From cfce54fe46f7d3db39e50c4113cb9fc74d6719e2 Mon Sep 17 00:00:00 2001 From: Rachel Powers <508861+Ryex@users.noreply.github.com> Date: Sat, 24 Dec 2022 18:08:08 -0700 Subject: [PATCH] fix: update parse tests Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com> --- .../mod/tasks/LocalTexturePackParseTask.cpp | 2 +- .../mod/tasks/LocalWorldSaveParseTask.h | 2 +- tests/ResourcePackParse_test.cpp | 9 ++++++--- tests/TexturePackParse_test.cpp | 9 ++++++--- .../test_resource_pack_idk.zip | Bin 322 -> 804 bytes 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/launcher/minecraft/mod/tasks/LocalTexturePackParseTask.cpp b/launcher/minecraft/mod/tasks/LocalTexturePackParseTask.cpp index e4492f12..38f1d7c1 100644 --- a/launcher/minecraft/mod/tasks/LocalTexturePackParseTask.cpp +++ b/launcher/minecraft/mod/tasks/LocalTexturePackParseTask.cpp @@ -116,7 +116,7 @@ bool processZIP(TexturePack& pack, ProcessingLevel level) if (level == ProcessingLevel::BasicInfoOnly) { zip.close(); - return false; + return true; } if (zip.setCurrentFile("pack.png")) { diff --git a/launcher/minecraft/mod/tasks/LocalWorldSaveParseTask.h b/launcher/minecraft/mod/tasks/LocalWorldSaveParseTask.h index 44153735..aa5db0c2 100644 --- a/launcher/minecraft/mod/tasks/LocalWorldSaveParseTask.h +++ b/launcher/minecraft/mod/tasks/LocalWorldSaveParseTask.h @@ -37,7 +37,7 @@ bool process(WorldSave& save, ProcessingLevel level = ProcessingLevel::Full); bool processZIP(WorldSave& pack, ProcessingLevel level = ProcessingLevel::Full); bool processFolder(WorldSave& pack, ProcessingLevel level = ProcessingLevel::Full); -bool validate(QFileInfo file); +bool validate(QFileInfo file); } // namespace WorldSaveUtils diff --git a/tests/ResourcePackParse_test.cpp b/tests/ResourcePackParse_test.cpp index 568c3b63..4192da31 100644 --- a/tests/ResourcePackParse_test.cpp +++ b/tests/ResourcePackParse_test.cpp @@ -35,10 +35,11 @@ class ResourcePackParseTest : public QObject { QString zip_rp = FS::PathCombine(source, "test_resource_pack_idk.zip"); ResourcePack pack { QFileInfo(zip_rp) }; - ResourcePackUtils::processZIP(pack); + bool valid = ResourcePackUtils::processZIP(pack, ResourcePackUtils::ProcessingLevel::BasicInfoOnly); 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(valid == true); } void test_parseFolder() @@ -48,10 +49,11 @@ class ResourcePackParseTest : public QObject { QString folder_rp = FS::PathCombine(source, "test_folder"); ResourcePack pack { QFileInfo(folder_rp) }; - ResourcePackUtils::processFolder(pack); + bool valid = ResourcePackUtils::processFolder(pack, ResourcePackUtils::ProcessingLevel::BasicInfoOnly); QVERIFY(pack.packFormat() == 1); QVERIFY(pack.description() == "Some resource pack maybe"); + QVERIFY(valid == true); } void test_parseFolder2() @@ -61,10 +63,11 @@ class ResourcePackParseTest : public QObject { QString folder_rp = FS::PathCombine(source, "another_test_folder"); ResourcePack pack { QFileInfo(folder_rp) }; - ResourcePackUtils::process(pack); + bool valid = ResourcePackUtils::process(pack, ResourcePackUtils::ProcessingLevel::BasicInfoOnly); QVERIFY(pack.packFormat() == 6); QVERIFY(pack.description() == "o quartel pegou fogo, policia deu sinal, acode acode acode a bandeira nacional"); + QVERIFY(valid == false); } }; diff --git a/tests/TexturePackParse_test.cpp b/tests/TexturePackParse_test.cpp index 0771f79f..4ddc0a3a 100644 --- a/tests/TexturePackParse_test.cpp +++ b/tests/TexturePackParse_test.cpp @@ -36,9 +36,10 @@ class TexturePackParseTest : public QObject { QString zip_rp = FS::PathCombine(source, "test_texture_pack_idk.zip"); TexturePack pack { QFileInfo(zip_rp) }; - TexturePackUtils::processZIP(pack); + bool valid = TexturePackUtils::processZIP(pack); QVERIFY(pack.description() == "joe biden, wake up"); + QVERIFY(valid == true); } void test_parseFolder() @@ -48,9 +49,10 @@ class TexturePackParseTest : public QObject { QString folder_rp = FS::PathCombine(source, "test_texturefolder"); TexturePack pack { QFileInfo(folder_rp) }; - TexturePackUtils::processFolder(pack); + bool valid = TexturePackUtils::processFolder(pack, TexturePackUtils::ProcessingLevel::BasicInfoOnly); QVERIFY(pack.description() == "Some texture pack surely"); + QVERIFY(valid == true); } void test_parseFolder2() @@ -60,9 +62,10 @@ class TexturePackParseTest : public QObject { QString folder_rp = FS::PathCombine(source, "another_test_texturefolder"); TexturePack pack { QFileInfo(folder_rp) }; - TexturePackUtils::process(pack); + bool valid = TexturePackUtils::process(pack, TexturePackUtils::ProcessingLevel::BasicInfoOnly); QVERIFY(pack.description() == "quieres\nfor real"); + QVERIFY(valid == true); } }; diff --git a/tests/testdata/ResourcePackParse/test_resource_pack_idk.zip b/tests/testdata/ResourcePackParse/test_resource_pack_idk.zip index 52b91cdcfc6e2dbb0ecb76c5cb33d07b0184487d..b4e66a609436f535c4c95f6d2512114f9caa28eb 100644 GIT binary patch literal 804 zcmWIWW@Zs#U|`^2FfNk|z0d8=Jq^e^4aD3GG7JTY$=Q0j$+@W|iJ>8!49pvS`I14n zw1S&~k>w>b0|S_F?K9*%WWeK^uJx5K?^#Yx3|p&-E1M9zb!x`Z%o(Rliwu3bTfVga zpZ|Zl&GxhBQl77W#<2O9t_=I57hRk7#wN-iF@DxGMP!ztlfQ;oTf_8UN*_cH8eUFW zSWwG-$31+;zgCwCH$_$DCaX{QFt^(L3ai1~{9PNlycrH{bu~1Y6Yyu6ur1S<#9y+T zCI^X6S!ev~{^r~e`2e`rO!{Yp0)5251R{Wd9f%W)i&IOA^_dxPD-%R0%gxM7O)g4I zE5WNl3Y&(K)QXbQqEu9?t~rK_p@sDao53St%004mv B$V~tM delta 31 gcmZ3&c8F=h-N~C714UTb7=VBg2m^uiZ4ie60D+SQ!2kdN