fix: update parse tests

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
This commit is contained in:
Rachel Powers 2022-12-24 18:08:08 -07:00
parent a7c9b2f172
commit cfce54fe46
5 changed files with 14 additions and 8 deletions

View File

@ -116,7 +116,7 @@ bool processZIP(TexturePack& pack, ProcessingLevel level)
if (level == ProcessingLevel::BasicInfoOnly) { if (level == ProcessingLevel::BasicInfoOnly) {
zip.close(); zip.close();
return false; return true;
} }
if (zip.setCurrentFile("pack.png")) { if (zip.setCurrentFile("pack.png")) {

View File

@ -37,7 +37,7 @@ bool process(WorldSave& save, ProcessingLevel level = ProcessingLevel::Full);
bool processZIP(WorldSave& pack, ProcessingLevel level = ProcessingLevel::Full); bool processZIP(WorldSave& pack, ProcessingLevel level = ProcessingLevel::Full);
bool processFolder(WorldSave& pack, ProcessingLevel level = ProcessingLevel::Full); bool processFolder(WorldSave& pack, ProcessingLevel level = ProcessingLevel::Full);
bool validate(QFileInfo file); bool validate(QFileInfo file);
} // namespace WorldSaveUtils } // namespace WorldSaveUtils

View File

@ -35,10 +35,11 @@ class ResourcePackParseTest : public QObject {
QString zip_rp = FS::PathCombine(source, "test_resource_pack_idk.zip"); QString zip_rp = FS::PathCombine(source, "test_resource_pack_idk.zip");
ResourcePack pack { QFileInfo(zip_rp) }; ResourcePack pack { QFileInfo(zip_rp) };
ResourcePackUtils::processZIP(pack); bool valid = ResourcePackUtils::processZIP(pack, ResourcePackUtils::ProcessingLevel::BasicInfoOnly);
QVERIFY(pack.packFormat() == 3); QVERIFY(pack.packFormat() == 3);
QVERIFY(pack.description() == "um dois, feijão com arroz, três quatro, feijão no prato, cinco seis, café inglês, sete oito, comer biscoito, nove dez comer pastéis!!"); QVERIFY(pack.description() == "um dois, feijão com arroz, três quatro, feijão no prato, cinco seis, café inglês, sete oito, comer biscoito, nove dez comer pastéis!!");
QVERIFY(valid == true);
} }
void test_parseFolder() void test_parseFolder()
@ -48,10 +49,11 @@ class ResourcePackParseTest : public QObject {
QString folder_rp = FS::PathCombine(source, "test_folder"); QString folder_rp = FS::PathCombine(source, "test_folder");
ResourcePack pack { QFileInfo(folder_rp) }; ResourcePack pack { QFileInfo(folder_rp) };
ResourcePackUtils::processFolder(pack); bool valid = ResourcePackUtils::processFolder(pack, ResourcePackUtils::ProcessingLevel::BasicInfoOnly);
QVERIFY(pack.packFormat() == 1); QVERIFY(pack.packFormat() == 1);
QVERIFY(pack.description() == "Some resource pack maybe"); QVERIFY(pack.description() == "Some resource pack maybe");
QVERIFY(valid == true);
} }
void test_parseFolder2() void test_parseFolder2()
@ -61,10 +63,11 @@ class ResourcePackParseTest : public QObject {
QString folder_rp = FS::PathCombine(source, "another_test_folder"); QString folder_rp = FS::PathCombine(source, "another_test_folder");
ResourcePack pack { QFileInfo(folder_rp) }; ResourcePack pack { QFileInfo(folder_rp) };
ResourcePackUtils::process(pack); bool valid = ResourcePackUtils::process(pack, ResourcePackUtils::ProcessingLevel::BasicInfoOnly);
QVERIFY(pack.packFormat() == 6); QVERIFY(pack.packFormat() == 6);
QVERIFY(pack.description() == "o quartel pegou fogo, policia deu sinal, acode acode acode a bandeira nacional"); QVERIFY(pack.description() == "o quartel pegou fogo, policia deu sinal, acode acode acode a bandeira nacional");
QVERIFY(valid == false);
} }
}; };

View File

@ -36,9 +36,10 @@ class TexturePackParseTest : public QObject {
QString zip_rp = FS::PathCombine(source, "test_texture_pack_idk.zip"); QString zip_rp = FS::PathCombine(source, "test_texture_pack_idk.zip");
TexturePack pack { QFileInfo(zip_rp) }; TexturePack pack { QFileInfo(zip_rp) };
TexturePackUtils::processZIP(pack); bool valid = TexturePackUtils::processZIP(pack);
QVERIFY(pack.description() == "joe biden, wake up"); QVERIFY(pack.description() == "joe biden, wake up");
QVERIFY(valid == true);
} }
void test_parseFolder() void test_parseFolder()
@ -48,9 +49,10 @@ class TexturePackParseTest : public QObject {
QString folder_rp = FS::PathCombine(source, "test_texturefolder"); QString folder_rp = FS::PathCombine(source, "test_texturefolder");
TexturePack pack { QFileInfo(folder_rp) }; TexturePack pack { QFileInfo(folder_rp) };
TexturePackUtils::processFolder(pack); bool valid = TexturePackUtils::processFolder(pack, TexturePackUtils::ProcessingLevel::BasicInfoOnly);
QVERIFY(pack.description() == "Some texture pack surely"); QVERIFY(pack.description() == "Some texture pack surely");
QVERIFY(valid == true);
} }
void test_parseFolder2() void test_parseFolder2()
@ -60,9 +62,10 @@ class TexturePackParseTest : public QObject {
QString folder_rp = FS::PathCombine(source, "another_test_texturefolder"); QString folder_rp = FS::PathCombine(source, "another_test_texturefolder");
TexturePack pack { QFileInfo(folder_rp) }; TexturePack pack { QFileInfo(folder_rp) };
TexturePackUtils::process(pack); bool valid = TexturePackUtils::process(pack, TexturePackUtils::ProcessingLevel::BasicInfoOnly);
QVERIFY(pack.description() == "quieres\nfor real"); QVERIFY(pack.description() == "quieres\nfor real");
QVERIFY(valid == true);
} }
}; };