From 9249768db5f5b09d67e81370da828e3cb99cc3df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sat, 31 Jan 2015 19:21:47 +0100 Subject: NOISSUE Make tests no longer use the MultiMC object They do not require the application part anymore --- tests/CMakeLists.txt | 7 ++++--- tests/TestUtil.h | 22 ---------------------- tests/tst_DownloadUpdateTask.cpp | 2 +- tests/tst_UpdateChecker.cpp | 5 +++-- tests/tst_gradlespecifier.cpp | 6 +++--- tests/tst_inifile.cpp | 4 ++-- tests/tst_pathutils.cpp | 2 +- tests/tst_userutils.cpp | 2 +- 8 files changed, 15 insertions(+), 35 deletions(-) (limited to 'tests') diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 7afb3f80..2f6b1a63 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,5 +1,5 @@ # run the unit tests with `make test` -find_package(Qt5 COMPONENTS Test Core Network Widgets) +find_package(Qt5 COMPONENTS Test Core Network) include_directories(${MMC_SRC}) @@ -13,7 +13,7 @@ macro(add_unit_test name) endif() endforeach() add_executable(tst_${name} ${srcs}) - qt5_use_modules(tst_${name} Test Core Network Widgets) + qt5_use_modules(tst_${name} Test Core Network) target_link_libraries(tst_${name} MultiMC_common) list(APPEND MultiMC_TESTS tst_${name}) add_test(NAME ${name} COMMAND tst_${name}) @@ -30,7 +30,7 @@ add_unit_test(UpdateChecker tst_UpdateChecker.cpp) add_unit_test(DownloadUpdateTask tst_DownloadUpdateTask.cpp) # Tests END # - + set(COVERAGE_SOURCE_DIRS ${MMC_SRC}/logic/* ${MMC_SRC}/logic/auth/* @@ -88,6 +88,7 @@ if(MultiMC_CODE_COVERAGE) endif(MultiMC_CODE_COVERAGE) set(MultiMC_TEST_DATA_PATH "${CMAKE_CURRENT_BINARY_DIR}/data") +message("${CMAKE_CURRENT_BINARY_DIR}/data") if(UNIX) # on unix we get the third / from the filename set(MultiMC_TEST_DATA_PATH "file://${MultiMC_TEST_DATA_PATH}") diff --git a/tests/TestUtil.h b/tests/TestUtil.h index 87a910d9..5b0741b8 100644 --- a/tests/TestUtil.h +++ b/tests/TestUtil.h @@ -5,8 +5,6 @@ #include #include -#include "MultiMC.h" - #include "test_config.h" class TestsInternal @@ -27,23 +25,3 @@ public: #define MULTIMC_GET_TEST_FILE(file) TestsInternal::readFile(QFINDTESTDATA(file)) #define MULTIMC_GET_TEST_FILE_UTF8(file) TestsInternal::readFileUtf8(QFINDTESTDATA(file)) -#ifdef Q_OS_LINUX -#define _MMC_EXTRA_ARGV , "-platform", "offscreen" -#define _MMC_EXTRA_ARGC 2 -#else -#define _MMC_EXTRA_ARGV -#define _MMC_EXTRA_ARGC 0 -#endif - - - -#define QTEST_GUILESS_MAIN_MULTIMC(TestObject) \ -int main(int argc, char *argv[]) \ -{ \ - const char *argv_[] = { argv[0] _MMC_EXTRA_ARGV }; \ - int argc_ = 1 + _MMC_EXTRA_ARGC; \ - MultiMC app(argc_, const_cast(argv_), true); \ - app.setAttribute(Qt::AA_Use96Dpi, true); \ - TestObject tc; \ - return QTest::qExec(&tc, argc, argv); \ -} diff --git a/tests/tst_DownloadUpdateTask.cpp b/tests/tst_DownloadUpdateTask.cpp index 8d8905b5..88c4d3d8 100644 --- a/tests/tst_DownloadUpdateTask.cpp +++ b/tests/tst_DownloadUpdateTask.cpp @@ -268,6 +268,6 @@ slots: } }; -QTEST_GUILESS_MAIN_MULTIMC(DownloadUpdateTaskTest) +QTEST_GUILESS_MAIN(DownloadUpdateTaskTest) #include "tst_DownloadUpdateTask.moc" diff --git a/tests/tst_UpdateChecker.cpp b/tests/tst_UpdateChecker.cpp index 49a4a6a3..75c5dcdd 100644 --- a/tests/tst_UpdateChecker.cpp +++ b/tests/tst_UpdateChecker.cpp @@ -140,7 +140,8 @@ slots: checker.updateChanList(false); QVERIFY(channelListLoadedSpy.wait()); - checker.m_channels[0].url = QUrl::fromLocalFile(QDir::current().absoluteFilePath("tests/data/")).toString(); + qDebug() << "CWD:" << QDir::current().absolutePath(); + checker.m_channels[0].url = findTestDataUrl("tests/data/"); checker.checkForUpdate(channel, false); @@ -151,6 +152,6 @@ slots: } }; -QTEST_GUILESS_MAIN_MULTIMC(UpdateCheckerTest) +QTEST_GUILESS_MAIN(UpdateCheckerTest) #include "tst_UpdateChecker.moc" diff --git a/tests/tst_gradlespecifier.cpp b/tests/tst_gradlespecifier.cpp index 69dd54f7..56c29b85 100644 --- a/tests/tst_gradlespecifier.cpp +++ b/tests/tst_gradlespecifier.cpp @@ -32,7 +32,7 @@ slots: QFETCH(QString, through); QString converted = GradleSpecifier(through); - + QCOMPARE(converted, through); } @@ -50,7 +50,7 @@ slots: QFETCH(QString, expected); QString converted = GradleSpecifier(spec).toPath(); - + QCOMPARE(converted, expected); } void test_Negative_data() @@ -72,6 +72,6 @@ slots: } }; -QTEST_GUILESS_MAIN_MULTIMC(GradleSpecifierTest) +QTEST_GUILESS_MAIN(GradleSpecifierTest) #include "tst_gradlespecifier.moc" diff --git a/tests/tst_inifile.cpp b/tests/tst_inifile.cpp index 93930ae9..6bec32f5 100644 --- a/tests/tst_inifile.cpp +++ b/tests/tst_inifile.cpp @@ -33,11 +33,11 @@ slots: QString there = INIFile::escape(through); QString back = INIFile::unescape(there); - + QCOMPARE(back, through); } }; -QTEST_GUILESS_MAIN_MULTIMC(IniFileTest) +QTEST_GUILESS_MAIN(IniFileTest) #include "tst_inifile.moc" diff --git a/tests/tst_pathutils.cpp b/tests/tst_pathutils.cpp index a1310d00..eed5b560 100644 --- a/tests/tst_pathutils.cpp +++ b/tests/tst_pathutils.cpp @@ -69,6 +69,6 @@ slots: } }; -QTEST_GUILESS_MAIN_MULTIMC(PathUtilsTest) +QTEST_GUILESS_MAIN(PathUtilsTest) #include "tst_pathutils.moc" diff --git a/tests/tst_userutils.cpp b/tests/tst_userutils.cpp index 3bc980c0..893e064e 100644 --- a/tests/tst_userutils.cpp +++ b/tests/tst_userutils.cpp @@ -66,6 +66,6 @@ slots: }; -QTEST_GUILESS_MAIN_MULTIMC(UserUtilsTest) +QTEST_GUILESS_MAIN(UserUtilsTest) #include "tst_userutils.moc" -- cgit v1.2.3