From aad6f74db6a08ca23a9b4ee7f261a051d230bef7 Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Sun, 4 Sep 2022 15:05:11 +0200 Subject: [PATCH] fix: tests Signed-off-by: Sefa Eyeoglu --- tests/CMakeLists.txt | 2 +- tests/ResourceFolderModel_test.cpp | 1 - .../mod => tests}/TexturePackParse_test.cpp | 10 +++++----- .../another_test_texturefolder/pack.txt | Bin .../TexturePackParse}/test_texture_pack_idk.zip | Bin .../assets/minecraft/textures/blah.txt | Bin .../TexturePackParse}/test_texturefolder/pack.txt | Bin 7 files changed, 6 insertions(+), 7 deletions(-) rename {launcher/minecraft/mod => tests}/TexturePackParse_test.cpp (85%) rename {launcher/minecraft/mod/testdata => tests/testdata/TexturePackParse}/another_test_texturefolder/pack.txt (100%) rename {launcher/minecraft/mod/testdata => tests/testdata/TexturePackParse}/test_texture_pack_idk.zip (100%) rename {launcher/minecraft/mod/testdata => tests/testdata/TexturePackParse}/test_texturefolder/assets/minecraft/textures/blah.txt (100%) rename {launcher/minecraft/mod/testdata => tests/testdata/TexturePackParse}/test_texturefolder/pack.txt (100%) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 9c86c221..630f1200 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -24,7 +24,7 @@ ecm_add_test(ResourceFolderModel_test.cpp LINK_LIBRARIES Launcher_logic Qt${QT_V ecm_add_test(ResourcePackParse_test.cpp LINK_LIBRARIES Launcher_logic Qt${QT_VERSION_MAJOR}::Test TEST_NAME ResourcePackParse) -ecm_add_test(minecraft/mod/TexturePackParse_test.cpp LINK_LIBRARIES Launcher_logic Qt${QT_VERSION_MAJOR}::Test +ecm_add_test(TexturePackParse_test.cpp LINK_LIBRARIES Launcher_logic Qt${QT_VERSION_MAJOR}::Test TEST_NAME TexturePackParse) ecm_add_test(ParseUtils_test.cpp LINK_LIBRARIES Launcher_logic Qt${QT_VERSION_MAJOR}::Test diff --git a/tests/ResourceFolderModel_test.cpp b/tests/ResourceFolderModel_test.cpp index 3f0f3ba1..e38b8e93 100644 --- a/tests/ResourceFolderModel_test.cpp +++ b/tests/ResourceFolderModel_test.cpp @@ -146,7 +146,6 @@ slots: for (auto mod : model.allMods()) qDebug() << mod->name(); - // FIXME: It considers every file in the directory as a mod, but we should probably filter that out somehow. QCOMPARE(model.size(), 4); model.stopWatching(); diff --git a/launcher/minecraft/mod/TexturePackParse_test.cpp b/tests/TexturePackParse_test.cpp similarity index 85% rename from launcher/minecraft/mod/TexturePackParse_test.cpp rename to tests/TexturePackParse_test.cpp index 207c2c87..3e9eaf23 100644 --- a/launcher/minecraft/mod/TexturePackParse_test.cpp +++ b/tests/TexturePackParse_test.cpp @@ -21,8 +21,8 @@ #include "FileSystem.h" -#include "TexturePack.h" -#include "tasks/LocalTexturePackParseTask.h" +#include "minecraft/mod/TexturePack.h" +#include "minecraft/mod/tasks/LocalTexturePackParseTask.h" class TexturePackParseTest : public QObject { Q_OBJECT @@ -30,7 +30,7 @@ class TexturePackParseTest : public QObject { private slots: void test_parseZIP() { - QString source = QFINDTESTDATA("testdata"); + QString source = QFINDTESTDATA("testdata/TexturePackParse"); QString zip_rp = FS::PathCombine(source, "test_texture_pack_idk.zip"); TexturePack pack { QFileInfo(zip_rp) }; @@ -42,7 +42,7 @@ class TexturePackParseTest : public QObject { void test_parseFolder() { - QString source = QFINDTESTDATA("testdata"); + QString source = QFINDTESTDATA("testdata/TexturePackParse"); QString folder_rp = FS::PathCombine(source, "test_texturefolder"); TexturePack pack { QFileInfo(folder_rp) }; @@ -54,7 +54,7 @@ class TexturePackParseTest : public QObject { void test_parseFolder2() { - QString source = QFINDTESTDATA("testdata"); + QString source = QFINDTESTDATA("testdata/TexturePackParse"); QString folder_rp = FS::PathCombine(source, "another_test_texturefolder"); TexturePack pack { QFileInfo(folder_rp) }; diff --git a/launcher/minecraft/mod/testdata/another_test_texturefolder/pack.txt b/tests/testdata/TexturePackParse/another_test_texturefolder/pack.txt similarity index 100% rename from launcher/minecraft/mod/testdata/another_test_texturefolder/pack.txt rename to tests/testdata/TexturePackParse/another_test_texturefolder/pack.txt diff --git a/launcher/minecraft/mod/testdata/test_texture_pack_idk.zip b/tests/testdata/TexturePackParse/test_texture_pack_idk.zip similarity index 100% rename from launcher/minecraft/mod/testdata/test_texture_pack_idk.zip rename to tests/testdata/TexturePackParse/test_texture_pack_idk.zip diff --git a/launcher/minecraft/mod/testdata/test_texturefolder/assets/minecraft/textures/blah.txt b/tests/testdata/TexturePackParse/test_texturefolder/assets/minecraft/textures/blah.txt similarity index 100% rename from launcher/minecraft/mod/testdata/test_texturefolder/assets/minecraft/textures/blah.txt rename to tests/testdata/TexturePackParse/test_texturefolder/assets/minecraft/textures/blah.txt diff --git a/launcher/minecraft/mod/testdata/test_texturefolder/pack.txt b/tests/testdata/TexturePackParse/test_texturefolder/pack.txt similarity index 100% rename from launcher/minecraft/mod/testdata/test_texturefolder/pack.txt rename to tests/testdata/TexturePackParse/test_texturefolder/pack.txt