Merge pull request #1133 from Scrumplex/refactor-tests
Move tests to a separate folder, to fix issues and improve maintenance
This commit is contained in:
commit
30abb65368
@ -67,7 +67,7 @@ find_package(ECM REQUIRED NO_MODULE)
|
|||||||
set(CMAKE_MODULE_PATH "${ECM_MODULE_PATH};${CMAKE_MODULE_PATH}")
|
set(CMAKE_MODULE_PATH "${ECM_MODULE_PATH};${CMAKE_MODULE_PATH}")
|
||||||
include(CTest)
|
include(CTest)
|
||||||
include(ECMAddTests)
|
include(ECMAddTests)
|
||||||
if (BUILD_TESTING)
|
if(BUILD_TESTING)
|
||||||
enable_testing()
|
enable_testing()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -321,5 +321,8 @@ add_subdirectory(libraries/murmur2) # Hash for usage with the CurseForge API
|
|||||||
|
|
||||||
add_subdirectory(buildconfig)
|
add_subdirectory(buildconfig)
|
||||||
|
|
||||||
|
if(BUILD_TESTING)
|
||||||
|
add_subdirectory(tests)
|
||||||
|
endif()
|
||||||
# NOTE: this must always be last to appease the CMake deity of quirky install command evaluation order.
|
# NOTE: this must always be last to appease the CMake deity of quirky install command evaluation order.
|
||||||
add_subdirectory(launcher)
|
add_subdirectory(launcher)
|
||||||
|
@ -88,12 +88,6 @@ set(CORE_SOURCES
|
|||||||
MMCTime.cpp
|
MMCTime.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
ecm_add_test(FileSystem_test.cpp LINK_LIBRARIES Launcher_logic Qt${QT_VERSION_MAJOR}::Test
|
|
||||||
TEST_NAME FileSystem) # TODO: needs testdata
|
|
||||||
|
|
||||||
ecm_add_test(GZip_test.cpp LINK_LIBRARIES Launcher_logic Qt${QT_VERSION_MAJOR}::Test
|
|
||||||
TEST_NAME GZip)
|
|
||||||
|
|
||||||
set(PATHMATCHER_SOURCES
|
set(PATHMATCHER_SOURCES
|
||||||
# Path matchers
|
# Path matchers
|
||||||
pathmatcher/FSTreeMatcher.h
|
pathmatcher/FSTreeMatcher.h
|
||||||
@ -355,46 +349,6 @@ set(MINECRAFT_SOURCES
|
|||||||
mojang/PackageManifest.cpp
|
mojang/PackageManifest.cpp
|
||||||
minecraft/Agent.h)
|
minecraft/Agent.h)
|
||||||
|
|
||||||
ecm_add_test(minecraft/GradleSpecifier_test.cpp LINK_LIBRARIES Launcher_logic Qt${QT_VERSION_MAJOR}::Test
|
|
||||||
TEST_NAME GradleSpecifier)
|
|
||||||
|
|
||||||
if(BUILD_TESTING)
|
|
||||||
add_executable(PackageManifest
|
|
||||||
mojang/PackageManifest_test.cpp
|
|
||||||
)
|
|
||||||
target_link_libraries(PackageManifest
|
|
||||||
Launcher_logic
|
|
||||||
Qt${QT_VERSION_MAJOR}::Test
|
|
||||||
)
|
|
||||||
target_include_directories(PackageManifest
|
|
||||||
PRIVATE ../cmake/UnitTest/
|
|
||||||
)
|
|
||||||
add_test(
|
|
||||||
NAME PackageManifest
|
|
||||||
COMMAND PackageManifest
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# TODO: needs minecraft/testdata
|
|
||||||
ecm_add_test(minecraft/MojangVersionFormat_test.cpp LINK_LIBRARIES Launcher_logic Qt${QT_VERSION_MAJOR}::Test
|
|
||||||
TEST_NAME MojangVersionFormat)
|
|
||||||
|
|
||||||
ecm_add_test(minecraft/Library_test.cpp LINK_LIBRARIES Launcher_logic Qt${QT_VERSION_MAJOR}::Test
|
|
||||||
TEST_NAME Library)
|
|
||||||
|
|
||||||
# FIXME: shares data with FileSystem test
|
|
||||||
# TODO: needs testdata
|
|
||||||
ecm_add_test(minecraft/mod/ResourceFolderModel_test.cpp LINK_LIBRARIES Launcher_logic Qt${QT_VERSION_MAJOR}::Test
|
|
||||||
TEST_NAME ResourceFolderModel)
|
|
||||||
|
|
||||||
ecm_add_test(minecraft/mod/ResourcePackParse_test.cpp
|
|
||||||
LINK_LIBRARIES Launcher_logic Qt${QT_VERSION_MAJOR}::Test
|
|
||||||
TEST_NAME ResourcePackParse)
|
|
||||||
|
|
||||||
ecm_add_test(minecraft/ParseUtils_test.cpp LINK_LIBRARIES Launcher_logic Qt${QT_VERSION_MAJOR}::Test
|
|
||||||
TEST_NAME ParseUtils)
|
|
||||||
|
|
||||||
# the screenshots feature
|
# the screenshots feature
|
||||||
set(SCREENSHOTS_SOURCES
|
set(SCREENSHOTS_SOURCES
|
||||||
screenshots/Screenshot.h
|
screenshots/Screenshot.h
|
||||||
@ -416,9 +370,6 @@ set(TASKS_SOURCES
|
|||||||
tasks/MultipleOptionsTask.cpp
|
tasks/MultipleOptionsTask.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
ecm_add_test(tasks/Task_test.cpp LINK_LIBRARIES Launcher_logic Qt${QT_VERSION_MAJOR}::Test
|
|
||||||
TEST_NAME Task)
|
|
||||||
|
|
||||||
set(SETTINGS_SOURCES
|
set(SETTINGS_SOURCES
|
||||||
# Settings
|
# Settings
|
||||||
settings/INIFile.cpp
|
settings/INIFile.cpp
|
||||||
@ -435,9 +386,6 @@ set(SETTINGS_SOURCES
|
|||||||
settings/SettingsObject.h
|
settings/SettingsObject.h
|
||||||
)
|
)
|
||||||
|
|
||||||
ecm_add_test(settings/INIFile_test.cpp LINK_LIBRARIES Launcher_logic Qt${QT_VERSION_MAJOR}::Test
|
|
||||||
TEST_NAME INIFile)
|
|
||||||
|
|
||||||
set(JAVA_SOURCES
|
set(JAVA_SOURCES
|
||||||
java/JavaChecker.h
|
java/JavaChecker.h
|
||||||
java/JavaChecker.cpp
|
java/JavaChecker.cpp
|
||||||
@ -453,9 +401,6 @@ set(JAVA_SOURCES
|
|||||||
java/JavaVersion.cpp
|
java/JavaVersion.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
ecm_add_test(java/JavaVersion_test.cpp LINK_LIBRARIES Launcher_logic Qt${QT_VERSION_MAJOR}::Test
|
|
||||||
TEST_NAME JavaVersion)
|
|
||||||
|
|
||||||
set(TRANSLATIONS_SOURCES
|
set(TRANSLATIONS_SOURCES
|
||||||
translations/TranslationsModel.h
|
translations/TranslationsModel.h
|
||||||
translations/TranslationsModel.cpp
|
translations/TranslationsModel.cpp
|
||||||
@ -558,9 +503,6 @@ set(PACKWIZ_SOURCES
|
|||||||
modplatform/packwiz/Packwiz.cpp
|
modplatform/packwiz/Packwiz.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
# TODO: needs modplatform/packwiz/testdata
|
|
||||||
ecm_add_test(modplatform/packwiz/Packwiz_test.cpp LINK_LIBRARIES Launcher_logic Qt${QT_VERSION_MAJOR}::Test
|
|
||||||
TEST_NAME Packwiz)
|
|
||||||
|
|
||||||
set(TECHNIC_SOURCES
|
set(TECHNIC_SOURCES
|
||||||
modplatform/technic/SingleZipPackInstallTask.h
|
modplatform/technic/SingleZipPackInstallTask.h
|
||||||
@ -584,9 +526,6 @@ set(ATLAUNCHER_SOURCES
|
|||||||
modplatform/atlauncher/ATLShareCode.h
|
modplatform/atlauncher/ATLShareCode.h
|
||||||
)
|
)
|
||||||
|
|
||||||
ecm_add_test(meta/Index_test.cpp LINK_LIBRARIES Launcher_logic Qt${QT_VERSION_MAJOR}::Test
|
|
||||||
TEST_NAME Index)
|
|
||||||
|
|
||||||
################################ COMPILE ################################
|
################################ COMPILE ################################
|
||||||
|
|
||||||
# we need zlib
|
# we need zlib
|
||||||
@ -1005,6 +944,7 @@ endif()
|
|||||||
|
|
||||||
# Add executable
|
# Add executable
|
||||||
add_library(Launcher_logic STATIC ${LOGIC_SOURCES} ${LAUNCHER_SOURCES} ${LAUNCHER_UI} ${LAUNCHER_RESOURCES})
|
add_library(Launcher_logic STATIC ${LOGIC_SOURCES} ${LAUNCHER_SOURCES} ${LAUNCHER_UI} ${LAUNCHER_RESOURCES})
|
||||||
|
target_include_directories(Launcher_logic PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
target_link_libraries(Launcher_logic
|
target_link_libraries(Launcher_logic
|
||||||
systeminfo
|
systeminfo
|
||||||
Launcher_classparser
|
Launcher_classparser
|
||||||
|
43
tests/CMakeLists.txt
Normal file
43
tests/CMakeLists.txt
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
project(tests)
|
||||||
|
|
||||||
|
ecm_add_test(FileSystem_test.cpp LINK_LIBRARIES Launcher_logic Qt${QT_VERSION_MAJOR}::Test
|
||||||
|
TEST_NAME FileSystem)
|
||||||
|
|
||||||
|
ecm_add_test(GZip_test.cpp LINK_LIBRARIES Launcher_logic Qt${QT_VERSION_MAJOR}::Test
|
||||||
|
TEST_NAME GZip)
|
||||||
|
|
||||||
|
ecm_add_test(GradleSpecifier_test.cpp LINK_LIBRARIES Launcher_logic Qt${QT_VERSION_MAJOR}::Test
|
||||||
|
TEST_NAME GradleSpecifier)
|
||||||
|
|
||||||
|
ecm_add_test(PackageManifest_test.cpp LINK_LIBRARIES Launcher_logic Qt${QT_VERSION_MAJOR}::Test
|
||||||
|
TEST_NAME PackageManifest)
|
||||||
|
|
||||||
|
ecm_add_test(MojangVersionFormat_test.cpp LINK_LIBRARIES Launcher_logic Qt${QT_VERSION_MAJOR}::Test
|
||||||
|
TEST_NAME MojangVersionFormat)
|
||||||
|
|
||||||
|
ecm_add_test(Library_test.cpp LINK_LIBRARIES Launcher_logic Qt${QT_VERSION_MAJOR}::Test
|
||||||
|
TEST_NAME Library)
|
||||||
|
|
||||||
|
ecm_add_test(ResourceFolderModel_test.cpp LINK_LIBRARIES Launcher_logic Qt${QT_VERSION_MAJOR}::Test
|
||||||
|
TEST_NAME ResourceFolderModel)
|
||||||
|
|
||||||
|
ecm_add_test(ResourcePackParse_test.cpp LINK_LIBRARIES Launcher_logic Qt${QT_VERSION_MAJOR}::Test
|
||||||
|
TEST_NAME ResourcePackParse)
|
||||||
|
|
||||||
|
ecm_add_test(ParseUtils_test.cpp LINK_LIBRARIES Launcher_logic Qt${QT_VERSION_MAJOR}::Test
|
||||||
|
TEST_NAME ParseUtils)
|
||||||
|
|
||||||
|
ecm_add_test(Task_test.cpp LINK_LIBRARIES Launcher_logic Qt${QT_VERSION_MAJOR}::Test
|
||||||
|
TEST_NAME Task)
|
||||||
|
|
||||||
|
ecm_add_test(INIFile_test.cpp LINK_LIBRARIES Launcher_logic Qt${QT_VERSION_MAJOR}::Test
|
||||||
|
TEST_NAME INIFile)
|
||||||
|
|
||||||
|
ecm_add_test(JavaVersion_test.cpp LINK_LIBRARIES Launcher_logic Qt${QT_VERSION_MAJOR}::Test
|
||||||
|
TEST_NAME JavaVersion)
|
||||||
|
|
||||||
|
ecm_add_test(Packwiz_test.cpp LINK_LIBRARIES Launcher_logic Qt${QT_VERSION_MAJOR}::Test
|
||||||
|
TEST_NAME Packwiz)
|
||||||
|
|
||||||
|
ecm_add_test(Index_test.cpp LINK_LIBRARIES Launcher_logic Qt${QT_VERSION_MAJOR}::Test
|
||||||
|
TEST_NAME Index)
|
@ -2,7 +2,7 @@
|
|||||||
#include <QTemporaryDir>
|
#include <QTemporaryDir>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
|
|
||||||
#include "FileSystem.h"
|
#include <FileSystem.h>
|
||||||
|
|
||||||
class FileSystemTest : public QObject
|
class FileSystemTest : public QObject
|
||||||
{
|
{
|
||||||
@ -80,7 +80,7 @@ slots:
|
|||||||
|
|
||||||
void test_copy()
|
void test_copy()
|
||||||
{
|
{
|
||||||
QString folder = QFINDTESTDATA("testdata/test_folder");
|
QString folder = QFINDTESTDATA("testdata/FileSystem/test_folder");
|
||||||
auto f = [&folder]()
|
auto f = [&folder]()
|
||||||
{
|
{
|
||||||
QTemporaryDir tempDir;
|
QTemporaryDir tempDir;
|
@ -1,6 +1,6 @@
|
|||||||
#include <QTest>
|
#include <QTest>
|
||||||
|
|
||||||
#include "GZip.h"
|
#include <GZip.h>
|
||||||
#include <random>
|
#include <random>
|
||||||
|
|
||||||
void fib(int &prev, int &cur)
|
void fib(int &prev, int &cur)
|
@ -1,6 +1,6 @@
|
|||||||
#include <QTest>
|
#include <QTest>
|
||||||
|
|
||||||
#include "minecraft/GradleSpecifier.h"
|
#include <minecraft/GradleSpecifier.h>
|
||||||
|
|
||||||
class GradleSpecifierTest : public QObject
|
class GradleSpecifierTest : public QObject
|
||||||
{
|
{
|
@ -1,6 +1,6 @@
|
|||||||
#include <QTest>
|
#include <QTest>
|
||||||
|
|
||||||
#include "settings/INIFile.h"
|
#include <settings/INIFile.h>
|
||||||
|
|
||||||
class IniFileTest : public QObject
|
class IniFileTest : public QObject
|
||||||
{
|
{
|
@ -1,7 +1,7 @@
|
|||||||
#include <QTest>
|
#include <QTest>
|
||||||
|
|
||||||
#include "meta/Index.h"
|
#include <meta/Index.h>
|
||||||
#include "meta/VersionList.h"
|
#include <meta/VersionList.h>
|
||||||
|
|
||||||
class IndexTest : public QObject
|
class IndexTest : public QObject
|
||||||
{
|
{
|
@ -1,6 +1,6 @@
|
|||||||
#include <QTest>
|
#include <QTest>
|
||||||
|
|
||||||
#include "java/JavaVersion.h"
|
#include <java/JavaVersion.h>
|
||||||
|
|
||||||
class JavaVersionTest : public QObject
|
class JavaVersionTest : public QObject
|
||||||
{
|
{
|
@ -1,10 +1,10 @@
|
|||||||
#include <QTest>
|
#include <QTest>
|
||||||
|
|
||||||
#include "minecraft/MojangVersionFormat.h"
|
#include <minecraft/MojangVersionFormat.h>
|
||||||
#include "minecraft/OneSixVersionFormat.h"
|
#include <minecraft/OneSixVersionFormat.h>
|
||||||
#include "minecraft/Library.h"
|
#include <minecraft/Library.h>
|
||||||
#include "net/HttpMetaCache.h"
|
#include <net/HttpMetaCache.h>
|
||||||
#include "FileSystem.h"
|
#include <FileSystem.h>
|
||||||
|
|
||||||
class LibraryTest : public QObject
|
class LibraryTest : public QObject
|
||||||
{
|
{
|
||||||
@ -30,7 +30,7 @@ slots:
|
|||||||
{
|
{
|
||||||
cache.reset(new HttpMetaCache());
|
cache.reset(new HttpMetaCache());
|
||||||
cache->addBase("libraries", QDir("libraries").absolutePath());
|
cache->addBase("libraries", QDir("libraries").absolutePath());
|
||||||
dataDir = QDir(QFINDTESTDATA("testdata")).absolutePath();
|
dataDir = QDir(QFINDTESTDATA("testdata/Library")).absolutePath();
|
||||||
}
|
}
|
||||||
void test_legacy()
|
void test_legacy()
|
||||||
{
|
{
|
||||||
@ -72,14 +72,14 @@ slots:
|
|||||||
QCOMPARE(test.isNative(), false);
|
QCOMPARE(test.isNative(), false);
|
||||||
QStringList failedFiles;
|
QStringList failedFiles;
|
||||||
test.setHint("local");
|
test.setHint("local");
|
||||||
auto downloads = test.getDownloads(currentSystem, cache.get(), failedFiles, QFINDTESTDATA("testdata"));
|
auto downloads = test.getDownloads(currentSystem, cache.get(), failedFiles, QFINDTESTDATA("testdata/Library"));
|
||||||
QCOMPARE(downloads.size(), 0);
|
QCOMPARE(downloads.size(), 0);
|
||||||
qDebug() << failedFiles;
|
qDebug() << failedFiles;
|
||||||
QCOMPARE(failedFiles.size(), 0);
|
QCOMPARE(failedFiles.size(), 0);
|
||||||
|
|
||||||
QStringList jar, native, native32, native64;
|
QStringList jar, native, native32, native64;
|
||||||
test.getApplicableFiles(currentSystem, jar, native, native32, native64, QFINDTESTDATA("testdata"));
|
test.getApplicableFiles(currentSystem, jar, native, native32, native64, QFINDTESTDATA("testdata/Library"));
|
||||||
QCOMPARE(jar, {QFileInfo(QFINDTESTDATA("testdata/codecwav-20101023.jar")).absoluteFilePath()});
|
QCOMPARE(jar, {QFileInfo(QFINDTESTDATA("testdata/Library/codecwav-20101023.jar")).absoluteFilePath()});
|
||||||
QCOMPARE(native, {});
|
QCOMPARE(native, {});
|
||||||
QCOMPARE(native32, {});
|
QCOMPARE(native32, {});
|
||||||
QCOMPARE(native64, {});
|
QCOMPARE(native64, {});
|
||||||
@ -165,20 +165,20 @@ slots:
|
|||||||
test.setRepositoryURL("file://foo/bar");
|
test.setRepositoryURL("file://foo/bar");
|
||||||
{
|
{
|
||||||
QStringList jar, native, native32, native64;
|
QStringList jar, native, native32, native64;
|
||||||
test.getApplicableFiles(Os_Linux, jar, native, native32, native64, QFINDTESTDATA("testdata"));
|
test.getApplicableFiles(Os_Linux, jar, native, native32, native64, QFINDTESTDATA("testdata/Library"));
|
||||||
QCOMPARE(jar, {});
|
QCOMPARE(jar, {});
|
||||||
QCOMPARE(native, {});
|
QCOMPARE(native, {});
|
||||||
QCOMPARE(native32, {QFileInfo(QFINDTESTDATA("testdata/testname-testversion-linux-32.jar")).absoluteFilePath()});
|
QCOMPARE(native32, {QFileInfo(QFINDTESTDATA("testdata/Library/testname-testversion-linux-32.jar")).absoluteFilePath()});
|
||||||
QCOMPARE(native64, {QFileInfo(QFINDTESTDATA("testdata") + "/testname-testversion-linux-64.jar").absoluteFilePath()});
|
QCOMPARE(native64, {QFileInfo(QFINDTESTDATA("testdata/Library") + "/testname-testversion-linux-64.jar").absoluteFilePath()});
|
||||||
QStringList failedFiles;
|
QStringList failedFiles;
|
||||||
auto dls = test.getDownloads(Os_Linux, cache.get(), failedFiles, QFINDTESTDATA("testdata"));
|
auto dls = test.getDownloads(Os_Linux, cache.get(), failedFiles, QFINDTESTDATA("testdata/Library"));
|
||||||
QCOMPARE(dls.size(), 0);
|
QCOMPARE(dls.size(), 0);
|
||||||
QCOMPARE(failedFiles, {QFileInfo(QFINDTESTDATA("testdata") + "/testname-testversion-linux-64.jar").absoluteFilePath()});
|
QCOMPARE(failedFiles, {QFileInfo(QFINDTESTDATA("testdata/Library") + "/testname-testversion-linux-64.jar").absoluteFilePath()});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void test_onenine()
|
void test_onenine()
|
||||||
{
|
{
|
||||||
auto test = readMojangJson(QFINDTESTDATA("testdata/lib-simple.json"));
|
auto test = readMojangJson(QFINDTESTDATA("testdata/Library/lib-simple.json"));
|
||||||
{
|
{
|
||||||
QStringList jar, native, native32, native64;
|
QStringList jar, native, native32, native64;
|
||||||
test->getApplicableFiles(Os_OSX, jar, native, native32, native64, QString());
|
test->getApplicableFiles(Os_OSX, jar, native, native32, native64, QString());
|
||||||
@ -197,41 +197,41 @@ slots:
|
|||||||
test->setHint("local");
|
test->setHint("local");
|
||||||
{
|
{
|
||||||
QStringList jar, native, native32, native64;
|
QStringList jar, native, native32, native64;
|
||||||
test->getApplicableFiles(Os_OSX, jar, native, native32, native64, QFINDTESTDATA("testdata"));
|
test->getApplicableFiles(Os_OSX, jar, native, native32, native64, QFINDTESTDATA("testdata/Library"));
|
||||||
QCOMPARE(jar, {QFileInfo(QFINDTESTDATA("testdata/codecwav-20101023.jar")).absoluteFilePath()});
|
QCOMPARE(jar, {QFileInfo(QFINDTESTDATA("testdata/Library/codecwav-20101023.jar")).absoluteFilePath()});
|
||||||
QCOMPARE(native, {});
|
QCOMPARE(native, {});
|
||||||
QCOMPARE(native32, {});
|
QCOMPARE(native32, {});
|
||||||
QCOMPARE(native64, {});
|
QCOMPARE(native64, {});
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
QStringList failedFiles;
|
QStringList failedFiles;
|
||||||
auto dls = test->getDownloads(Os_Linux, cache.get(), failedFiles, QFINDTESTDATA("testdata"));
|
auto dls = test->getDownloads(Os_Linux, cache.get(), failedFiles, QFINDTESTDATA("testdata/Library"));
|
||||||
QCOMPARE(dls.size(), 0);
|
QCOMPARE(dls.size(), 0);
|
||||||
QCOMPARE(failedFiles, {});
|
QCOMPARE(failedFiles, {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void test_onenine_local_override()
|
void test_onenine_local_override()
|
||||||
{
|
{
|
||||||
auto test = readMojangJson(QFINDTESTDATA("testdata/lib-simple.json"));
|
auto test = readMojangJson(QFINDTESTDATA("testdata/Library/lib-simple.json"));
|
||||||
test->setHint("local");
|
test->setHint("local");
|
||||||
{
|
{
|
||||||
QStringList jar, native, native32, native64;
|
QStringList jar, native, native32, native64;
|
||||||
test->getApplicableFiles(Os_OSX, jar, native, native32, native64, QFINDTESTDATA("testdata"));
|
test->getApplicableFiles(Os_OSX, jar, native, native32, native64, QFINDTESTDATA("testdata/Library"));
|
||||||
QCOMPARE(jar, {QFileInfo(QFINDTESTDATA("testdata/codecwav-20101023.jar")).absoluteFilePath()});
|
QCOMPARE(jar, {QFileInfo(QFINDTESTDATA("testdata/Library/codecwav-20101023.jar")).absoluteFilePath()});
|
||||||
QCOMPARE(native, {});
|
QCOMPARE(native, {});
|
||||||
QCOMPARE(native32, {});
|
QCOMPARE(native32, {});
|
||||||
QCOMPARE(native64, {});
|
QCOMPARE(native64, {});
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
QStringList failedFiles;
|
QStringList failedFiles;
|
||||||
auto dls = test->getDownloads(Os_Linux, cache.get(), failedFiles, QFINDTESTDATA("testdata"));
|
auto dls = test->getDownloads(Os_Linux, cache.get(), failedFiles, QFINDTESTDATA("testdata/Library"));
|
||||||
QCOMPARE(dls.size(), 0);
|
QCOMPARE(dls.size(), 0);
|
||||||
QCOMPARE(failedFiles, {});
|
QCOMPARE(failedFiles, {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void test_onenine_native()
|
void test_onenine_native()
|
||||||
{
|
{
|
||||||
auto test = readMojangJson(QFINDTESTDATA("testdata/lib-native.json"));
|
auto test = readMojangJson(QFINDTESTDATA("testdata/Library/lib-native.json"));
|
||||||
QStringList jar, native, native32, native64;
|
QStringList jar, native, native32, native64;
|
||||||
test->getApplicableFiles(Os_OSX, jar, native, native32, native64, QString());
|
test->getApplicableFiles(Os_OSX, jar, native, native32, native64, QString());
|
||||||
QCOMPARE(jar, QStringList());
|
QCOMPARE(jar, QStringList());
|
||||||
@ -246,7 +246,7 @@ slots:
|
|||||||
}
|
}
|
||||||
void test_onenine_native_arch()
|
void test_onenine_native_arch()
|
||||||
{
|
{
|
||||||
auto test = readMojangJson(QFINDTESTDATA("testdata/lib-native-arch.json"));
|
auto test = readMojangJson(QFINDTESTDATA("testdata/Library/lib-native-arch.json"));
|
||||||
QStringList jar, native, native32, native64;
|
QStringList jar, native, native32, native64;
|
||||||
test->getApplicableFiles(Os_Windows, jar, native, native32, native64, QString());
|
test->getApplicableFiles(Os_Windows, jar, native, native32, native64, QString());
|
||||||
QCOMPARE(jar, {});
|
QCOMPARE(jar, {});
|
@ -1,7 +1,7 @@
|
|||||||
#include <QTest>
|
#include <QTest>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
#include "minecraft/MojangVersionFormat.h"
|
#include <minecraft/MojangVersionFormat.h>
|
||||||
|
|
||||||
class MojangVersionFormatTest : public QObject
|
class MojangVersionFormatTest : public QObject
|
||||||
{
|
{
|
||||||
@ -29,7 +29,7 @@ private
|
|||||||
slots:
|
slots:
|
||||||
void test_Through_Simple()
|
void test_Through_Simple()
|
||||||
{
|
{
|
||||||
QJsonDocument doc = readJson(QFINDTESTDATA("testdata/1.9-simple.json"));
|
QJsonDocument doc = readJson(QFINDTESTDATA("testdata/MojangVersionFormat/1.9-simple.json"));
|
||||||
auto vfile = MojangVersionFormat::versionFileFromJson(doc, "1.9-simple.json");
|
auto vfile = MojangVersionFormat::versionFileFromJson(doc, "1.9-simple.json");
|
||||||
auto doc2 = MojangVersionFormat::versionFileToJson(vfile);
|
auto doc2 = MojangVersionFormat::versionFileToJson(vfile);
|
||||||
writeJson("1.9-simple-passthorugh.json", doc2);
|
writeJson("1.9-simple-passthorugh.json", doc2);
|
||||||
@ -39,7 +39,7 @@ slots:
|
|||||||
|
|
||||||
void test_Through()
|
void test_Through()
|
||||||
{
|
{
|
||||||
QJsonDocument doc = readJson(QFINDTESTDATA("testdata/1.9.json"));
|
QJsonDocument doc = readJson(QFINDTESTDATA("testdata/MojangVersionFormat/1.9.json"));
|
||||||
auto vfile = MojangVersionFormat::versionFileFromJson(doc, "1.9.json");
|
auto vfile = MojangVersionFormat::versionFileFromJson(doc, "1.9.json");
|
||||||
auto doc2 = MojangVersionFormat::versionFileToJson(vfile);
|
auto doc2 = MojangVersionFormat::versionFileToJson(vfile);
|
||||||
writeJson("1.9-passthorugh.json", doc2);
|
writeJson("1.9-passthorugh.json", doc2);
|
@ -1,7 +1,7 @@
|
|||||||
#include <QTest>
|
#include <QTest>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
#include "mojang/PackageManifest.h"
|
#include <mojang/PackageManifest.h>
|
||||||
|
|
||||||
using namespace mojang_files;
|
using namespace mojang_files;
|
||||||
|
|
||||||
@ -82,14 +82,14 @@ void PackageManifestTest::test_parse()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PackageManifestTest::test_parse_file() {
|
void PackageManifestTest::test_parse_file() {
|
||||||
auto path = QFINDTESTDATA("testdata/1.8.0_202-x64.json");
|
auto path = QFINDTESTDATA("testdata/PackageManifest/1.8.0_202-x64.json");
|
||||||
auto manifest = Package::fromManifestFile(path);
|
auto manifest = Package::fromManifestFile(path);
|
||||||
QVERIFY(manifest.valid == true);
|
QVERIFY(manifest.valid == true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PackageManifestTest::test_inspect() {
|
void PackageManifestTest::test_inspect() {
|
||||||
auto path = QFINDTESTDATA("testdata/inspect_win/");
|
auto path = QFINDTESTDATA("testdata/PackageManifest/inspect_win/");
|
||||||
auto manifest = Package::fromInspectedFolder(path);
|
auto manifest = Package::fromInspectedFolder(path);
|
||||||
QVERIFY(manifest.valid == true);
|
QVERIFY(manifest.valid == true);
|
||||||
QVERIFY(manifest.files.size() == 2);
|
QVERIFY(manifest.files.size() == 2);
|
||||||
@ -112,7 +112,7 @@ void PackageManifestTest::test_inspect() {
|
|||||||
|
|
||||||
#ifndef Q_OS_WIN32
|
#ifndef Q_OS_WIN32
|
||||||
void PackageManifestTest::test_inspect_symlinks() {
|
void PackageManifestTest::test_inspect_symlinks() {
|
||||||
auto path = QFINDTESTDATA("testdata/inspect/");
|
auto path = QFINDTESTDATA("testdata/PackageManifest/inspect/");
|
||||||
auto manifest = Package::fromInspectedFolder(path);
|
auto manifest = Package::fromInspectedFolder(path);
|
||||||
QVERIFY(manifest.valid == true);
|
QVERIFY(manifest.valid == true);
|
||||||
QVERIFY(manifest.files.size() == 1);
|
QVERIFY(manifest.files.size() == 1);
|
@ -20,7 +20,7 @@
|
|||||||
#include <QTemporaryDir>
|
#include <QTemporaryDir>
|
||||||
#include <QTest>
|
#include <QTest>
|
||||||
|
|
||||||
#include "Packwiz.h"
|
#include <modplatform/packwiz/Packwiz.h>
|
||||||
|
|
||||||
class PackwizTest : public QObject {
|
class PackwizTest : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -29,7 +29,7 @@ class PackwizTest : public QObject {
|
|||||||
// Files taken from https://github.com/packwiz/packwiz-example-pack
|
// Files taken from https://github.com/packwiz/packwiz-example-pack
|
||||||
void loadFromFile_Modrinth()
|
void loadFromFile_Modrinth()
|
||||||
{
|
{
|
||||||
QString source = QFINDTESTDATA("testdata");
|
QString source = QFINDTESTDATA("testdata/Packwiz");
|
||||||
|
|
||||||
QDir index_dir(source);
|
QDir index_dir(source);
|
||||||
QString slug_mod("borderless-mining");
|
QString slug_mod("borderless-mining");
|
||||||
@ -55,7 +55,7 @@ class PackwizTest : public QObject {
|
|||||||
|
|
||||||
void loadFromFile_Curseforge()
|
void loadFromFile_Curseforge()
|
||||||
{
|
{
|
||||||
QString source = QFINDTESTDATA("testdata");
|
QString source = QFINDTESTDATA("testdata/Packwiz");
|
||||||
|
|
||||||
QDir index_dir(source);
|
QDir index_dir(source);
|
||||||
QString name_mod("screenshot-to-clipboard-fabric.pw.toml");
|
QString name_mod("screenshot-to-clipboard-fabric.pw.toml");
|
@ -1,6 +1,6 @@
|
|||||||
#include <QTest>
|
#include <QTest>
|
||||||
|
|
||||||
#include "minecraft/ParseUtils.h"
|
#include <minecraft/ParseUtils.h>
|
||||||
|
|
||||||
class ParseUtilsTest : public QObject
|
class ParseUtilsTest : public QObject
|
||||||
{
|
{
|
@ -37,10 +37,10 @@
|
|||||||
#include <QTemporaryDir>
|
#include <QTemporaryDir>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
#include "FileSystem.h"
|
#include <FileSystem.h>
|
||||||
|
|
||||||
#include "minecraft/mod/ModFolderModel.h"
|
#include <minecraft/mod/ModFolderModel.h>
|
||||||
#include "minecraft/mod/ResourceFolderModel.h"
|
#include <minecraft/mod/ResourceFolderModel.h>
|
||||||
|
|
||||||
#define EXEC_UPDATE_TASK(EXEC, VERIFY) \
|
#define EXEC_UPDATE_TASK(EXEC, VERIFY) \
|
||||||
QEventLoop loop; \
|
QEventLoop loop; \
|
||||||
@ -70,7 +70,7 @@ slots:
|
|||||||
void test_1178()
|
void test_1178()
|
||||||
{
|
{
|
||||||
// source
|
// source
|
||||||
QString source = QFINDTESTDATA("testdata/test_folder");
|
QString source = QFINDTESTDATA("testdata/ResourceFolderModel/test_folder");
|
||||||
|
|
||||||
// sanity check
|
// sanity check
|
||||||
QVERIFY(!source.endsWith('/'));
|
QVERIFY(!source.endsWith('/'));
|
||||||
@ -135,7 +135,7 @@ slots:
|
|||||||
|
|
||||||
void test_addFromWatch()
|
void test_addFromWatch()
|
||||||
{
|
{
|
||||||
QString source = QFINDTESTDATA("testdata");
|
QString source = QFINDTESTDATA("testdata/ResourceFolderModel");
|
||||||
|
|
||||||
ModFolderModel model(source);
|
ModFolderModel model(source);
|
||||||
|
|
||||||
@ -154,8 +154,8 @@ slots:
|
|||||||
|
|
||||||
void test_removeResource()
|
void test_removeResource()
|
||||||
{
|
{
|
||||||
QString folder_resource = QFINDTESTDATA("testdata/test_folder");
|
QString folder_resource = QFINDTESTDATA("testdata/ResourceFolderModel/test_folder");
|
||||||
QString file_mod = QFINDTESTDATA("testdata/supercoolmod.jar");
|
QString file_mod = QFINDTESTDATA("testdata/ResourceFolderModel/supercoolmod.jar");
|
||||||
|
|
||||||
QTemporaryDir tmp;
|
QTemporaryDir tmp;
|
||||||
|
|
||||||
@ -206,8 +206,8 @@ slots:
|
|||||||
|
|
||||||
void test_enable_disable()
|
void test_enable_disable()
|
||||||
{
|
{
|
||||||
QString folder_resource = QFINDTESTDATA("testdata/test_folder");
|
QString folder_resource = QFINDTESTDATA("testdata/ResourceFolderModel/test_folder");
|
||||||
QString file_mod = QFINDTESTDATA("testdata/supercoolmod.jar");
|
QString file_mod = QFINDTESTDATA("testdata/ResourceFolderModel/supercoolmod.jar");
|
||||||
|
|
||||||
QTemporaryDir tmp;
|
QTemporaryDir tmp;
|
||||||
ResourceFolderModel model(tmp.path());
|
ResourceFolderModel model(tmp.path());
|
@ -19,10 +19,10 @@
|
|||||||
#include <QTest>
|
#include <QTest>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
#include "FileSystem.h"
|
#include <FileSystem.h>
|
||||||
|
|
||||||
#include "ResourcePack.h"
|
#include <minecraft/mod/ResourcePack.h>
|
||||||
#include "tasks/LocalResourcePackParseTask.h"
|
#include <minecraft/mod/tasks/LocalResourcePackParseTask.h>
|
||||||
|
|
||||||
class ResourcePackParseTest : public QObject {
|
class ResourcePackParseTest : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -30,7 +30,7 @@ class ResourcePackParseTest : public QObject {
|
|||||||
private slots:
|
private slots:
|
||||||
void test_parseZIP()
|
void test_parseZIP()
|
||||||
{
|
{
|
||||||
QString source = QFINDTESTDATA("testdata");
|
QString source = QFINDTESTDATA("testdata/ResourcePackParse");
|
||||||
|
|
||||||
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) };
|
||||||
@ -43,7 +43,7 @@ class ResourcePackParseTest : public QObject {
|
|||||||
|
|
||||||
void test_parseFolder()
|
void test_parseFolder()
|
||||||
{
|
{
|
||||||
QString source = QFINDTESTDATA("testdata");
|
QString source = QFINDTESTDATA("testdata/ResourcePackParse");
|
||||||
|
|
||||||
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) };
|
||||||
@ -56,7 +56,7 @@ class ResourcePackParseTest : public QObject {
|
|||||||
|
|
||||||
void test_parseFolder2()
|
void test_parseFolder2()
|
||||||
{
|
{
|
||||||
QString source = QFINDTESTDATA("testdata");
|
QString source = QFINDTESTDATA("testdata/ResourcePackParse");
|
||||||
|
|
||||||
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) };
|
@ -1,9 +1,9 @@
|
|||||||
#include <QTest>
|
#include <QTest>
|
||||||
|
|
||||||
#include "ConcurrentTask.h"
|
#include <tasks/ConcurrentTask.h>
|
||||||
#include "MultipleOptionsTask.h"
|
#include <tasks/MultipleOptionsTask.h>
|
||||||
#include "SequentialTask.h"
|
#include <tasks/SequentialTask.h>
|
||||||
#include "Task.h"
|
#include <tasks/Task.h>
|
||||||
|
|
||||||
/* Does nothing. Only used for testing. */
|
/* Does nothing. Only used for testing. */
|
||||||
class BasicTask : public Task {
|
class BasicTask : public Task {
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
#include <QTest>
|
#include <QTest>
|
||||||
|
|
||||||
#include "TestUtil.h"
|
#include <TestUtil.h>
|
||||||
#include <Version.h>
|
#include <Version.h>
|
||||||
|
|
||||||
class ModUtilsTest : public QObject
|
class ModUtilsTest : public QObject
|
1
tests/testdata/Library
vendored
Symbolic link
1
tests/testdata/Library
vendored
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
MojangVersionFormat/
|
1
tests/testdata/ResourceFolderModel
vendored
Symbolic link
1
tests/testdata/ResourceFolderModel
vendored
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
ResourcePackParse
|
Loading…
Reference in New Issue
Block a user