aboutsummaryrefslogtreecommitdiff
path: root/launcher
diff options
context:
space:
mode:
Diffstat (limited to 'launcher')
-rw-r--r--launcher/CMakeLists.txt95
-rw-r--r--launcher/FileSystem.h5
-rw-r--r--launcher/FileSystem_test.cpp44
-rw-r--r--launcher/GZip_test.cpp1
-rw-r--r--launcher/java/JavaVersion_test.cpp1
-rw-r--r--launcher/meta/Index_test.cpp1
-rw-r--r--launcher/minecraft/GradleSpecifier_test.cpp1
-rw-r--r--launcher/minecraft/Library_test.cpp44
-rw-r--r--launcher/minecraft/MojangVersionFormat_test.cpp8
-rw-r--r--launcher/minecraft/ParseUtils_test.cpp2
-rw-r--r--launcher/minecraft/mod/ModFolderModel_test.cpp3
-rw-r--r--launcher/minecraft/mod/testdata/test_folder/assets/minecraft/textures/blah.txt1
-rw-r--r--launcher/minecraft/mod/testdata/test_folder/pack.mcmeta6
-rw-r--r--launcher/minecraft/mod/testdata/test_folder/pack.nfo1
-rw-r--r--launcher/modplatform/packwiz/Packwiz_test.cpp1
-rw-r--r--launcher/mojang/PackageManifest_test.cpp1
-rw-r--r--launcher/settings/INIFile_test.cpp1
-rw-r--r--launcher/tasks/Task_test.cpp1
-rw-r--r--launcher/updater/DownloadTask_test.cpp32
-rw-r--r--launcher/updater/UpdateChecker_test.cpp19
20 files changed, 94 insertions, 174 deletions
diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt
index b8db803b..e768ffaa 100644
--- a/launcher/CMakeLists.txt
+++ b/launcher/CMakeLists.txt
@@ -4,8 +4,6 @@ project(application)
######## Sources and headers ########
-include (UnitTest)
-
set(CORE_SOURCES
# LOGIC - Base classes and infrastructure
BaseInstaller.h
@@ -90,16 +88,11 @@ set(CORE_SOURCES
MMCTime.cpp
)
-add_unit_test(FileSystem
- SOURCES FileSystem_test.cpp
- LIBS Launcher_logic
- DATA testdata
- )
+ecm_add_test(FileSystem_test.cpp LINK_LIBRARIES Launcher_logic Qt5::Test
+ TEST_NAME FileSystem) # TODO: needs testdata
-add_unit_test(GZip
- SOURCES GZip_test.cpp
- LIBS Launcher_logic
- )
+ecm_add_test(GZip_test.cpp LINK_LIBRARIES Launcher_logic Qt5::Test
+ TEST_NAME GZip)
set(PATHMATCHER_SOURCES
# Path matchers
@@ -168,16 +161,10 @@ if (Launcher_UPDATER_BASE)
updater/DownloadTask.cpp
)
- add_unit_test(UpdateChecker
- SOURCES updater/UpdateChecker_test.cpp
- LIBS Launcher_logic
- DATA updater/testdata
- )
- add_unit_test(DownloadTask
- SOURCES updater/DownloadTask_test.cpp
- LIBS Launcher_logic
- DATA updater/testdata
- )
+ ecm_add_test(updater/UpdateChecker_test.cpp LINK_LIBRARIES Launcher_logic Qt5::Test
+ TEST_NAME UpdateChecker)
+ ecm_add_test(updater/DownloadTask_test.cpp LINK_LIBRARIES Launcher_logic Qt5::Test
+ TEST_NAME DownloadTask)
endif()
# Backend for the news bar... there's usually no news.
@@ -359,10 +346,8 @@ set(MINECRAFT_SOURCES
mojang/PackageManifest.cpp
minecraft/Agent.h)
-add_unit_test(GradleSpecifier
- SOURCES minecraft/GradleSpecifier_test.cpp
- LIBS Launcher_logic
- )
+ecm_add_test(minecraft/GradleSpecifier_test.cpp LINK_LIBRARIES Launcher_logic Qt5::Test
+ TEST_NAME GradleSpecifier)
if(BUILD_TESTING)
add_executable(PackageManifest
@@ -382,28 +367,20 @@ if(BUILD_TESTING)
)
endif()
-add_unit_test(MojangVersionFormat
- SOURCES minecraft/MojangVersionFormat_test.cpp
- LIBS Launcher_logic
- DATA minecraft/testdata
- )
+# TODO: needs minecraft/testdata
+ecm_add_test(minecraft/MojangVersionFormat_test.cpp LINK_LIBRARIES Launcher_logic Qt5::Test
+ TEST_NAME MojangVersionFormat)
-add_unit_test(Library
- SOURCES minecraft/Library_test.cpp
- LIBS Launcher_logic
- )
+ecm_add_test(minecraft/Library_test.cpp LINK_LIBRARIES Launcher_logic Qt5::Test
+ TEST_NAME Library)
# FIXME: shares data with FileSystem test
-add_unit_test(ModFolderModel
- SOURCES minecraft/mod/ModFolderModel_test.cpp
- DATA testdata
- LIBS Launcher_logic
- )
+# TODO: needs testdata
+ecm_add_test(minecraft/mod/ModFolderModel_test.cpp LINK_LIBRARIES Launcher_logic Qt5::Test
+ TEST_NAME ModFolderModel)
-add_unit_test(ParseUtils
- SOURCES minecraft/ParseUtils_test.cpp
- LIBS Launcher_logic
- )
+ecm_add_test(minecraft/ParseUtils_test.cpp LINK_LIBRARIES Launcher_logic Qt5::Test
+ TEST_NAME ParseUtils)
# the screenshots feature
set(SCREENSHOTS_SOURCES
@@ -422,10 +399,8 @@ set(TASKS_SOURCES
tasks/SequentialTask.cpp
)
-add_unit_test(Task
- SOURCES tasks/Task_test.cpp
- LIBS Launcher_logic
- )
+ecm_add_test(tasks/Task_test.cpp LINK_LIBRARIES Launcher_logic Qt5::Test
+ TEST_NAME Task)
set(SETTINGS_SOURCES
# Settings
@@ -443,10 +418,8 @@ set(SETTINGS_SOURCES
settings/SettingsObject.h
)
-add_unit_test(INIFile
- SOURCES settings/INIFile_test.cpp
- LIBS Launcher_logic
- )
+ecm_add_test(settings/INIFile_test.cpp LINK_LIBRARIES Launcher_logic Qt5::Test
+ TEST_NAME INIFile)
set(JAVA_SOURCES
java/JavaChecker.h
@@ -463,10 +436,8 @@ set(JAVA_SOURCES
java/JavaVersion.cpp
)
-add_unit_test(JavaVersion
- SOURCES java/JavaVersion_test.cpp
- LIBS Launcher_logic
- )
+ecm_add_test(java/JavaVersion_test.cpp LINK_LIBRARIES Launcher_logic Qt5::Test
+ TEST_NAME JavaVersion)
set(TRANSLATIONS_SOURCES
translations/TranslationsModel.h
@@ -558,11 +529,9 @@ set(PACKWIZ_SOURCES
modplatform/packwiz/Packwiz.cpp
)
-add_unit_test(Packwiz
- SOURCES modplatform/packwiz/Packwiz_test.cpp
- DATA modplatform/packwiz/testdata
- LIBS Launcher_logic
- )
+# TODO: needs modplatform/packwiz/testdata
+ecm_add_test(modplatform/packwiz/Packwiz_test.cpp LINK_LIBRARIES Launcher_logic Qt5::Test
+ TEST_NAME Packwiz)
set(TECHNIC_SOURCES
modplatform/technic/SingleZipPackInstallTask.h
@@ -586,10 +555,8 @@ set(ATLAUNCHER_SOURCES
modplatform/atlauncher/ATLShareCode.h
)
-add_unit_test(Index
- SOURCES meta/Index_test.cpp
- LIBS Launcher_logic
- )
+ecm_add_test(meta/Index_test.cpp LINK_LIBRARIES Launcher_logic Qt5::Test
+ TEST_NAME Index)
################################ COMPILE ################################
diff --git a/launcher/FileSystem.h b/launcher/FileSystem.h
index bc942ab3..31c7af70 100644
--- a/launcher/FileSystem.h
+++ b/launcher/FileSystem.h
@@ -120,11 +120,6 @@ bool checkProblemticPathJava(QDir folder);
// Get the Directory representing the User's Desktop
QString getDesktopDir();
-// Create a shortcut at *location*, pointing to *dest* called with the arguments *args*
-// call it *name* and assign it the icon *icon*
-// return true if operation succeeded
-bool createShortCut(QString location, QString dest, QStringList args, QString name, QString iconLocation);
-
// Overrides one folder with the contents of another, preserving items exclusive to the first folder
// Equivalent to doing QDir::rename, but allowing for overrides
bool overrideFolder(QString overwritten_path, QString override_path);
diff --git a/launcher/FileSystem_test.cpp b/launcher/FileSystem_test.cpp
index 90ddc499..99ae9269 100644
--- a/launcher/FileSystem_test.cpp
+++ b/launcher/FileSystem_test.cpp
@@ -1,7 +1,6 @@
#include <QTest>
#include <QTemporaryDir>
#include <QStandardPaths>
-#include "TestUtil.h"
#include "FileSystem.h"
@@ -81,7 +80,7 @@ slots:
void test_copy()
{
- QString folder = QFINDTESTDATA("data/test_folder");
+ QString folder = QFINDTESTDATA("testdata/test_folder");
auto f = [&folder]()
{
QTemporaryDir tempDir;
@@ -116,47 +115,6 @@ slots:
{
QCOMPARE(FS::getDesktopDir(), QStandardPaths::writableLocation(QStandardPaths::DesktopLocation));
}
-
-// this is only valid on linux
-// FIXME: implement on windows, OSX, then test.
-#if defined(Q_OS_LINUX)
- void test_createShortcut_data()
- {
- QTest::addColumn<QString>("location");
- QTest::addColumn<QString>("dest");
- QTest::addColumn<QStringList>("args");
- QTest::addColumn<QString>("name");
- QTest::addColumn<QString>("iconLocation");
- QTest::addColumn<QByteArray>("result");
-
- QTest::newRow("unix") << QDir::currentPath()
- << "asdfDest"
- << (QStringList() << "arg1" << "arg2")
- << "asdf"
- << QString()
- #if defined(Q_OS_LINUX)
- << GET_TEST_FILE("data/FileSystem-test_createShortcut-unix")
- #elif defined(Q_OS_WIN)
- << QByteArray()
- #endif
- ;
- }
-
- void test_createShortcut()
- {
- QFETCH(QString, location);
- QFETCH(QString, dest);
- QFETCH(QStringList, args);
- QFETCH(QString, name);
- QFETCH(QString, iconLocation);
- QFETCH(QByteArray, result);
-
- QVERIFY(FS::createShortCut(location, dest, args, name, iconLocation));
- QCOMPARE(QString::fromLocal8Bit(TestsInternal::readFile(location + QDir::separator() + name + ".desktop")), QString::fromLocal8Bit(result));
-
- //QDir().remove(location);
- }
-#endif
};
QTEST_GUILESS_MAIN(FileSystemTest)
diff --git a/launcher/GZip_test.cpp b/launcher/GZip_test.cpp
index 3f4d181c..73859fbc 100644
--- a/launcher/GZip_test.cpp
+++ b/launcher/GZip_test.cpp
@@ -1,5 +1,4 @@
#include <QTest>
-#include "TestUtil.h"
#include "GZip.h"
#include <random>
diff --git a/launcher/java/JavaVersion_test.cpp b/launcher/java/JavaVersion_test.cpp
index 10ae13a7..545947ef 100644
--- a/launcher/java/JavaVersion_test.cpp
+++ b/launcher/java/JavaVersion_test.cpp
@@ -1,5 +1,4 @@
#include <QTest>
-#include "TestUtil.h"
#include "java/JavaVersion.h"
diff --git a/launcher/meta/Index_test.cpp b/launcher/meta/Index_test.cpp
index 5d3ddc50..261858c4 100644
--- a/launcher/meta/Index_test.cpp
+++ b/launcher/meta/Index_test.cpp
@@ -1,5 +1,4 @@
#include <QTest>
-#include "TestUtil.h"
#include "meta/Index.h"
#include "meta/VersionList.h"
diff --git a/launcher/minecraft/GradleSpecifier_test.cpp b/launcher/minecraft/GradleSpecifier_test.cpp
index 0900c9d8..a062dfac 100644
--- a/launcher/minecraft/GradleSpecifier_test.cpp
+++ b/launcher/minecraft/GradleSpecifier_test.cpp
@@ -1,5 +1,4 @@
#include <QTest>
-#include "TestUtil.h"
#include "minecraft/GradleSpecifier.h"
diff --git a/launcher/minecraft/Library_test.cpp b/launcher/minecraft/Library_test.cpp
index 47531ad6..834dd558 100644
--- a/launcher/minecraft/Library_test.cpp
+++ b/launcher/minecraft/Library_test.cpp
@@ -1,5 +1,4 @@
#include <QTest>
-#include "TestUtil.h"
#include "minecraft/MojangVersionFormat.h"
#include "minecraft/OneSixVersionFormat.h"
@@ -11,15 +10,14 @@ class LibraryTest : public QObject
{
Q_OBJECT
private:
- LibraryPtr readMojangJson(const char *file)
+ LibraryPtr readMojangJson(const QString path)
{
- auto path = QFINDTESTDATA(file);
QFile jsonFile(path);
jsonFile.open(QIODevice::ReadOnly);
auto data = jsonFile.readAll();
jsonFile.close();
ProblemContainer problems;
- return MojangVersionFormat::libraryFromJson(problems, QJsonDocument::fromJson(data).object(), file);
+ return MojangVersionFormat::libraryFromJson(problems, QJsonDocument::fromJson(data).object(), path);
}
// get absolute path to expected storage, assuming default cache prefix
QStringList getStorage(QString relative)
@@ -32,7 +30,7 @@ slots:
{
cache.reset(new HttpMetaCache());
cache->addBase("libraries", QDir("libraries").absolutePath());
- dataDir = QDir("data").absolutePath();
+ dataDir = QDir(QFINDTESTDATA("testdata")).absolutePath();
}
void test_legacy()
{
@@ -74,14 +72,14 @@ slots:
QCOMPARE(test.isNative(), false);
QStringList failedFiles;
test.setHint("local");
- auto downloads = test.getDownloads(currentSystem, cache.get(), failedFiles, QString("data"));
+ auto downloads = test.getDownloads(currentSystem, cache.get(), failedFiles, QFINDTESTDATA("testdata"));
QCOMPARE(downloads.size(), 0);
qDebug() << failedFiles;
QCOMPARE(failedFiles.size(), 0);
QStringList jar, native, native32, native64;
- test.getApplicableFiles(currentSystem, jar, native, native32, native64, QString("data"));
- QCOMPARE(jar, {QFileInfo("data/codecwav-20101023.jar").absoluteFilePath()});
+ test.getApplicableFiles(currentSystem, jar, native, native32, native64, QFINDTESTDATA("testdata"));
+ QCOMPARE(jar, {QFileInfo(QFINDTESTDATA("testdata/codecwav-20101023.jar")).absoluteFilePath()});
QCOMPARE(native, {});
QCOMPARE(native32, {});
QCOMPARE(native64, {});
@@ -167,20 +165,20 @@ slots:
test.setRepositoryURL("file://foo/bar");
{
QStringList jar, native, native32, native64;
- test.getApplicableFiles(Os_Linux, jar, native, native32, native64, QString("data"));
+ test.getApplicableFiles(Os_Linux, jar, native, native32, native64, QFINDTESTDATA("testdata"));
QCOMPARE(jar, {});
QCOMPARE(native, {});
- QCOMPARE(native32, {QFileInfo("data/testname-testversion-linux-32.jar").absoluteFilePath()});
- QCOMPARE(native64, {QFileInfo("data/testname-testversion-linux-64.jar").absoluteFilePath()});
+ QCOMPARE(native32, {QFileInfo(QFINDTESTDATA("testdata/testname-testversion-linux-32.jar")).absoluteFilePath()});
+ QCOMPARE(native64, {QFileInfo(QFINDTESTDATA("testdata") + "/testname-testversion-linux-64.jar").absoluteFilePath()});
QStringList failedFiles;
- auto dls = test.getDownloads(Os_Linux, cache.get(), failedFiles, QString("data"));
+ auto dls = test.getDownloads(Os_Linux, cache.get(), failedFiles, QFINDTESTDATA("testdata"));
QCOMPARE(dls.size(), 0);
- QCOMPARE(failedFiles, {"data/testname-testversion-linux-64.jar"});
+ QCOMPARE(failedFiles, {QFileInfo(QFINDTESTDATA("testdata") + "/testname-testversion-linux-64.jar").absoluteFilePath()});
}
}
void test_onenine()
{
- auto test = readMojangJson("data/lib-simple.json");
+ auto test = readMojangJson(QFINDTESTDATA("testdata/lib-simple.json"));
{
QStringList jar, native, native32, native64;
test->getApplicableFiles(Os_OSX, jar, native, native32, native64, QString());
@@ -199,41 +197,41 @@ slots:
test->setHint("local");
{
QStringList jar, native, native32, native64;
- test->getApplicableFiles(Os_OSX, jar, native, native32, native64, QString("data"));
- QCOMPARE(jar, {QFileInfo("data/codecwav-20101023.jar").absoluteFilePath()});
+ test->getApplicableFiles(Os_OSX, jar, native, native32, native64, QFINDTESTDATA("testdata"));
+ QCOMPARE(jar, {QFileInfo(QFINDTESTDATA("testdata/codecwav-20101023.jar")).absoluteFilePath()});
QCOMPARE(native, {});
QCOMPARE(native32, {});
QCOMPARE(native64, {});
}
{
QStringList failedFiles;
- auto dls = test->getDownloads(Os_Linux, cache.get(), failedFiles, QString("data"));
+ auto dls = test->getDownloads(Os_Linux, cache.get(), failedFiles, QFINDTESTDATA("testdata"));
QCOMPARE(dls.size(), 0);
QCOMPARE(failedFiles, {});
}
}
void test_onenine_local_override()
{
- auto test = readMojangJson("data/lib-simple.json");
+ auto test = readMojangJson(QFINDTESTDATA("testdata/lib-simple.json"));
test->setHint("local");
{
QStringList jar, native, native32, native64;
- test->getApplicableFiles(Os_OSX, jar, native, native32, native64, QString("data"));
- QCOMPARE(jar, {QFileInfo("data/codecwav-20101023.jar").absoluteFilePath()});
+ test->getApplicableFiles(Os_OSX, jar, native, native32, native64, QFINDTESTDATA("testdata"));
+ QCOMPARE(jar, {QFileInfo(QFINDTESTDATA("testdata/codecwav-20101023.jar")).absoluteFilePath()});
QCOMPARE(native, {});
QCOMPARE(native32, {});
QCOMPARE(native64, {});
}
{
QStringList failedFiles;
- auto dls = test->getDownloads(Os_Linux, cache.get(), failedFiles, QString("data"));
+ auto dls = test->getDownloads(Os_Linux, cache.get(), failedFiles, QFINDTESTDATA("testdata"));
QCOMPARE(dls.size(), 0);
QCOMPARE(failedFiles, {});
}
}
void test_onenine_native()
{
- auto test = readMojangJson("data/lib-native.json");
+ auto test = readMojangJson(QFINDTESTDATA("testdata/lib-native.json"));
QStringList jar, native, native32, native64;
test->getApplicableFiles(Os_OSX, jar, native, native32, native64, QString());
QCOMPARE(jar, QStringList());
@@ -248,7 +246,7 @@ slots:
}
void test_onenine_native_arch()
{
- auto test = readMojangJson("data/lib-native-arch.json");
+ auto test = readMojangJson(QFINDTESTDATA("testdata/lib-native-arch.json"));
QStringList jar, native, native32, native64;
test->getApplicableFiles(Os_Windows, jar, native, native32, native64, QString());
QCOMPARE(jar, {});
diff --git a/launcher/minecraft/MojangVersionFormat_test.cpp b/launcher/minecraft/MojangVersionFormat_test.cpp
index 9d095340..71df784b 100644
--- a/launcher/minecraft/MojangVersionFormat_test.cpp
+++ b/launcher/minecraft/MojangVersionFormat_test.cpp
@@ -1,6 +1,5 @@
#include <QTest>
#include <QDebug>
-#include "TestUtil.h"
#include "minecraft/MojangVersionFormat.h"
@@ -8,9 +7,8 @@ class MojangVersionFormatTest : public QObject
{
Q_OBJECT
- static QJsonDocument readJson(const char *file)
+ static QJsonDocument readJson(const QString path)
{
- auto path = QFINDTESTDATA(file);
QFile jsonFile(path);
jsonFile.open(QIODevice::ReadOnly);
auto data = jsonFile.readAll();
@@ -31,7 +29,7 @@ private
slots:
void test_Through_Simple()
{
- QJsonDocument doc = readJson("data/1.9-simple.json");
+ QJsonDocument doc = readJson(QFINDTESTDATA("testdata/1.9-simple.json"));
auto vfile = MojangVersionFormat::versionFileFromJson(doc, "1.9-simple.json");
auto doc2 = MojangVersionFormat::versionFileToJson(vfile);
writeJson("1.9-simple-passthorugh.json", doc2);
@@ -41,7 +39,7 @@ slots:
void test_Through()
{
- QJsonDocument doc = readJson("data/1.9.json");
+ QJsonDocument doc = readJson(QFINDTESTDATA("testdata/1.9.json"));
auto vfile = MojangVersionFormat::versionFileFromJson(doc, "1.9.json");
auto doc2 = MojangVersionFormat::versionFileToJson(vfile);
writeJson("1.9-passthorugh.json", doc2);
diff --git a/launcher/minecraft/ParseUtils_test.cpp b/launcher/minecraft/ParseUtils_test.cpp
index fcc137e5..7721a46d 100644
--- a/launcher/minecraft/ParseUtils_test.cpp
+++ b/launcher/minecraft/ParseUtils_test.cpp
@@ -1,5 +1,4 @@
#include <QTest>
-#include "TestUtil.h"
#include "minecraft/ParseUtils.h"
@@ -42,4 +41,3 @@ slots:
QTEST_GUILESS_MAIN(ParseUtilsTest)
#include "ParseUtils_test.moc"
-
diff --git a/launcher/minecraft/mod/ModFolderModel_test.cpp b/launcher/minecraft/mod/ModFolderModel_test.cpp
index 34a3b83a..b4d37ce5 100644
--- a/launcher/minecraft/mod/ModFolderModel_test.cpp
+++ b/launcher/minecraft/mod/ModFolderModel_test.cpp
@@ -35,7 +35,6 @@
#include <QTest>
#include <QTemporaryDir>
-#include "TestUtil.h"
#include "FileSystem.h"
#include "minecraft/mod/ModFolderModel.h"
@@ -50,7 +49,7 @@ slots:
void test_1178()
{
// source
- QString source = QFINDTESTDATA("data/test_folder");
+ QString source = QFINDTESTDATA("testdata/test_folder");
// sanity check
QVERIFY(!source.endsWith('/'));
diff --git a/launcher/minecraft/mod/testdata/test_folder/assets/minecraft/textures/blah.txt b/launcher/minecraft/mod/testdata/test_folder/assets/minecraft/textures/blah.txt
new file mode 100644
index 00000000..8d1c8b69
--- /dev/null
+++ b/launcher/minecraft/mod/testdata/test_folder/assets/minecraft/textures/blah.txt
@@ -0,0 +1 @@
+
diff --git a/launcher/minecraft/mod/testdata/test_folder/pack.mcmeta b/launcher/minecraft/mod/testdata/test_folder/pack.mcmeta
new file mode 100644
index 00000000..67ee0434
--- /dev/null
+++ b/launcher/minecraft/mod/testdata/test_folder/pack.mcmeta
@@ -0,0 +1,6 @@
+{
+ "pack": {
+ "pack_format": 1,
+ "description": "Some resource pack maybe"
+ }
+}
diff --git a/launcher/minecraft/mod/testdata/test_folder/pack.nfo b/launcher/minecraft/mod/testdata/test_folder/pack.nfo
new file mode 100644
index 00000000..8d1c8b69
--- /dev/null
+++ b/launcher/minecraft/mod/testdata/test_folder/pack.nfo
@@ -0,0 +1 @@
+
diff --git a/launcher/modplatform/packwiz/Packwiz_test.cpp b/launcher/modplatform/packwiz/Packwiz_test.cpp
index 3d47f9f7..d6251148 100644
--- a/launcher/modplatform/packwiz/Packwiz_test.cpp
+++ b/launcher/modplatform/packwiz/Packwiz_test.cpp
@@ -21,7 +21,6 @@
#include <QTest>
#include "Packwiz.h"
-#include "TestUtil.h"
class PackwizTest : public QObject {
Q_OBJECT
diff --git a/launcher/mojang/PackageManifest_test.cpp b/launcher/mojang/PackageManifest_test.cpp
index d4c55c5a..e8da4266 100644
--- a/launcher/mojang/PackageManifest_test.cpp
+++ b/launcher/mojang/PackageManifest_test.cpp
@@ -1,6 +1,5 @@
#include <QTest>
#include <QDebug>
-#include "TestUtil.h"
#include "mojang/PackageManifest.h"
diff --git a/launcher/settings/INIFile_test.cpp b/launcher/settings/INIFile_test.cpp
index 08c2155e..d23f9fdf 100644
--- a/launcher/settings/INIFile_test.cpp
+++ b/launcher/settings/INIFile_test.cpp
@@ -1,5 +1,4 @@
#include <QTest>
-#include "TestUtil.h"
#include "settings/INIFile.h"
diff --git a/launcher/tasks/Task_test.cpp b/launcher/tasks/Task_test.cpp
index 9b6cc2e5..ef153a6a 100644
--- a/launcher/tasks/Task_test.cpp
+++ b/launcher/tasks/Task_test.cpp
@@ -1,5 +1,4 @@
#include <QTest>
-#include "TestUtil.h"
#include "Task.h"
diff --git a/launcher/updater/DownloadTask_test.cpp b/launcher/updater/DownloadTask_test.cpp
index 8e823a63..deba2632 100644
--- a/launcher/updater/DownloadTask_test.cpp
+++ b/launcher/updater/DownloadTask_test.cpp
@@ -1,8 +1,6 @@
#include <QTest>
#include <QSignalSpy>
-#include "TestUtil.h"
-
#include "updater/GoUpdate.h"
#include "updater/DownloadTask.h"
#include "updater/UpdateChecker.h"
@@ -71,13 +69,23 @@ slots:
void test_parseVersionInfo_data()
{
+ QFile f1(QFINDTESTDATA("testdata/1.json"));
+ f1.open(QFile::ReadOnly);
+ QByteArray data1 = f1.readAll();
+ f1.close();
+
+ QFile f2(QFINDTESTDATA("testdata/2.json"));
+ f2.open(QFile::ReadOnly);
+ QByteArray data2 = f2.readAll();
+ f2.close();
+
QTest::addColumn<QByteArray>("data");
QTest::addColumn<VersionFileList>("list");
QTest::addColumn<QString>("error");
QTest::addColumn<bool>("ret");
QTest::newRow("one")
- << GET_TEST_FILE("data/1.json")
+ << data1
<< (VersionFileList()
<< VersionFileEntry{"fileOne",
493,
@@ -93,7 +101,7 @@ slots:
"f12df554b21e320be6471d7154130e70"})
<< QString() << true;
QTest::newRow("two")
- << GET_TEST_FILE("data/2.json")
+ << data2
<< (VersionFileList()
<< VersionFileEntry{"fileOne",
493,
@@ -133,42 +141,42 @@ slots:
QTest::newRow("test 1")
<< tempFolder << (VersionFileList()
<< VersionFileEntry{
- "data/fileOne", 493,
+ QFINDTESTDATA("testdata/fileOne"), 493,
FileSourceList()
<< FileSource(
"http", "http://host/path/fileOne-1"),
"9eb84090956c484e32cb6c08455a667b"}
<< VersionFileEntry{
- "data/fileTwo", 644,
+ QFINDTESTDATA("testdata/fileTwo"), 644,
FileSourceList()
<< FileSource(
"http", "http://host/path/fileTwo-1"),
"38f94f54fa3eb72b0ea836538c10b043"}
<< VersionFileEntry{
- "data/fileThree", 420,
+ QFINDTESTDATA("testdata/fileThree"), 420,
FileSourceList()
<< FileSource(
"http", "http://host/path/fileThree-1"),
"f12df554b21e320be6471d7154130e70"})
<< (VersionFileList()
<< VersionFileEntry{
- "data/fileOne", 493,
+ QFINDTESTDATA("testdata/fileOne"), 493,
FileSourceList()
<< FileSource("http",
"http://host/path/fileOne-2"),
"42915a71277c9016668cce7b82c6b577"}
<< VersionFileEntry{
- "data/fileTwo", 644,
+ QFINDTESTDATA("testdata/fileTwo"), 644,
FileSourceList()
<< FileSource("http",
"http://host/path/fileTwo-2"),
"38f94f54fa3eb72b0ea836538c10b043"})
<< (OperationList()
- << Operation::DeleteOp("data/fileThree")
+ << Operation::DeleteOp(QFINDTESTDATA("testdata/fileThree"))
<< Operation::CopyOp(
FS::PathCombine(tempFolder,
- QString("data/fileOne").replace("/", "_")),
- "data/fileOne", 493));
+ QFINDTESTDATA("data/fileOne").replace("/", "_")),
+ QFINDTESTDATA("data/fileOne"), 493));
}
void test_processFileLists()
{
diff --git a/launcher/updater/UpdateChecker_test.cpp b/launcher/updater/UpdateChecker_test.cpp
index ec55a40e..70e3381f 100644
--- a/launcher/updater/UpdateChecker_test.cpp
+++ b/launcher/updater/UpdateChecker_test.cpp
@@ -1,7 +1,6 @@
#include <QTest>
#include <QSignalSpy>
-#include "TestUtil.h"
#include "updater/UpdateChecker.h"
Q_DECLARE_METATYPE(UpdateChecker::ChannelListEntry)
@@ -50,36 +49,36 @@ slots:
QTest::newRow("garbage")
<< QString()
- << findTestDataUrl("data/garbageChannels.json")
+ << findTestDataUrl("testdata/garbageChannels.json")
<< false
<< false
<< QList<UpdateChecker::ChannelListEntry>();
QTest::newRow("errors")
<< QString()
- << findTestDataUrl("data/errorChannels.json")
+ << findTestDataUrl("testdata/errorChannels.json")
<< false
<< true
<< QList<UpdateChecker::ChannelListEntry>();
QTest::newRow("no channels")
<< QString()
- << findTestDataUrl("data/noChannels.json")
+ << findTestDataUrl("testdata/noChannels.json")
<< false
<< true
<< QList<UpdateChecker::ChannelListEntry>();
QTest::newRow("one channel")
<< QString("develop")
- << findTestDataUrl("data/oneChannel.json")
+ << findTestDataUrl("testdata/oneChannel.json")
<< true
<< true
<< (QList<UpdateChecker::ChannelListEntry>() << UpdateChecker::ChannelListEntry{"develop", "Develop", "The channel called \"develop\"", "http://example.org/stuff"});
QTest::newRow("several channels")
<< QString("develop")
- << findTestDataUrl("data/channels.json")
+ << findTestDataUrl("testdata/channels.json")
<< true
<< true
<< (QList<UpdateChecker::ChannelListEntry>()
- << UpdateChecker::ChannelListEntry{"develop", "Develop", "The channel called \"develop\"", findTestDataUrl("data")}
- << UpdateChecker::ChannelListEntry{"stable", "Stable", "It's stable at least", findTestDataUrl("data")}
+ << UpdateChecker::ChannelListEntry{"develop", "Develop", "The channel called \"develop\"", findTestDataUrl("testdata")}
+ << UpdateChecker::ChannelListEntry{"stable", "Stable", "It's stable at least", findTestDataUrl("testdata")}
<< UpdateChecker::ChannelListEntry{"42", "The Channel", "This is the channel that is going to answer all of your questions", "https://dent.me/tea"});
}
void tst_ChannelListParsing()
@@ -117,7 +116,7 @@ slots:
void tst_UpdateChecking()
{
QString channel = "develop";
- QString channelUrl = findTestDataUrl("data/channels.json");
+ QString channelUrl = findTestDataUrl("testdata/channels.json");
int currentBuild = 2;
shared_qobject_ptr<QNetworkAccessManager> nam = new QNetworkAccessManager();
@@ -132,7 +131,7 @@ slots:
QVERIFY(channelListLoadedSpy.wait());
qDebug() << "CWD:" << QDir::current().absolutePath();
- checker.m_channels[0].url = findTestDataUrl("data/");
+ checker.m_channels[0].url = findTestDataUrl("testdata/");
checker.checkForUpdate(channel, false);
QVERIFY(updateAvailableSpy.wait());