diff options
author | flow <flowlnlnln@gmail.com> | 2022-09-12 12:57:55 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-12 12:57:55 -0300 |
commit | 30abb6536864e2d1b3b47eed19d64ee58a7bad2c (patch) | |
tree | ada66d7464bb870aaa3706c418939fa7c8c285c8 /launcher/minecraft/MojangVersionFormat_test.cpp | |
parent | 64a06b5ed664da5b4d3cd1850c0e3284be528f72 (diff) | |
parent | 4c7d3a103ca9cfd3af0b3acf2877561150c5ac60 (diff) | |
download | PrismLauncher-30abb6536864e2d1b3b47eed19d64ee58a7bad2c.tar.gz PrismLauncher-30abb6536864e2d1b3b47eed19d64ee58a7bad2c.tar.bz2 PrismLauncher-30abb6536864e2d1b3b47eed19d64ee58a7bad2c.zip |
Merge pull request #1133 from Scrumplex/refactor-tests
Move tests to a separate folder, to fix issues and improve maintenance
Diffstat (limited to 'launcher/minecraft/MojangVersionFormat_test.cpp')
-rw-r--r-- | launcher/minecraft/MojangVersionFormat_test.cpp | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/launcher/minecraft/MojangVersionFormat_test.cpp b/launcher/minecraft/MojangVersionFormat_test.cpp deleted file mode 100644 index 71df784b..00000000 --- a/launcher/minecraft/MojangVersionFormat_test.cpp +++ /dev/null @@ -1,53 +0,0 @@ -#include <QTest> -#include <QDebug> - -#include "minecraft/MojangVersionFormat.h" - -class MojangVersionFormatTest : public QObject -{ - Q_OBJECT - - static QJsonDocument readJson(const QString path) - { - QFile jsonFile(path); - jsonFile.open(QIODevice::ReadOnly); - auto data = jsonFile.readAll(); - jsonFile.close(); - return QJsonDocument::fromJson(data); - } - static void writeJson(const char *file, QJsonDocument doc) - { - QFile jsonFile(file); - jsonFile.open(QIODevice::WriteOnly | QIODevice::Text); - auto data = doc.toJson(QJsonDocument::Indented); - qDebug() << QString::fromUtf8(data); - jsonFile.write(data); - jsonFile.close(); - } - -private -slots: - void test_Through_Simple() - { - 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); - - QCOMPARE(doc.toJson(), doc2.toJson()); - } - - void test_Through() - { - 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); - QCOMPARE(doc.toJson(), doc2.toJson()); - } -}; - -QTEST_GUILESS_MAIN(MojangVersionFormatTest) - -#include "MojangVersionFormat_test.moc" - |