summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2015-01-31 19:21:47 +0100
committerPetr Mrázek <peterix@gmail.com>2015-04-02 11:30:38 +0200
commit9249768db5f5b09d67e81370da828e3cb99cc3df (patch)
tree3b915d591fe4cada33da7ebb8d9fd67df7d6a467 /tests
parent6f3aa65bd69f5155fa1ee56dee840e2e7e1d3c6f (diff)
downloadMultiMC-9249768db5f5b09d67e81370da828e3cb99cc3df.tar
MultiMC-9249768db5f5b09d67e81370da828e3cb99cc3df.tar.gz
MultiMC-9249768db5f5b09d67e81370da828e3cb99cc3df.tar.lz
MultiMC-9249768db5f5b09d67e81370da828e3cb99cc3df.tar.xz
MultiMC-9249768db5f5b09d67e81370da828e3cb99cc3df.zip
NOISSUE Make tests no longer use the MultiMC object
They do not require the application part anymore
Diffstat (limited to 'tests')
-rw-r--r--tests/CMakeLists.txt7
-rw-r--r--tests/TestUtil.h22
-rw-r--r--tests/tst_DownloadUpdateTask.cpp2
-rw-r--r--tests/tst_UpdateChecker.cpp5
-rw-r--r--tests/tst_gradlespecifier.cpp6
-rw-r--r--tests/tst_inifile.cpp4
-rw-r--r--tests/tst_pathutils.cpp2
-rw-r--r--tests/tst_userutils.cpp2
8 files changed, 15 insertions, 35 deletions
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 <QTest>
#include <QDir>
-#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<char**>(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"