From cd7f92e64802f9255516a95bac4199e3599a2900 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCgler?= Date: Wed, 19 Jun 2013 02:06:55 +0200 Subject: [PATCH] Port libplasma unit tests to ECM macros --- src/plasma/autotests/CMakeLists.txt | 15 ++++++++++++--- src/plasma/autotests/configloadertest.cpp | 3 +-- src/plasma/autotests/packagestructuretest.cpp | 2 +- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/plasma/autotests/CMakeLists.txt b/src/plasma/autotests/CMakeLists.txt index 9587da0aa..5cef58540 100644 --- a/src/plasma/autotests/CMakeLists.txt +++ b/src/plasma/autotests/CMakeLists.txt @@ -1,19 +1,25 @@ set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}) +include(ECMMarkAsTest) + include_directories ( ${karchive_SOURCE_DIR}/src ${karchive_BINARY_DIR}/src ) find_package(KCoreAddons REQUIRED) +# add_definitions( -DKDESRCDIR=${CMAKE_CURRENT_SOURCE_DIR} ) + MACRO(PLASMA_UNIT_TESTS) FOREACH(_testname ${ARGN}) - kde4_add_unit_test(${_testname} TESTNAME plasma-${_testname} ${_testname}.cpp) + add_executable(${_testname} ${_testname}.cpp) target_link_libraries(${_testname} ${QT_QTTEST_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY} ${KDE4_KIO_LIBS} ${KDE4_KDEUI_LIBS} plasma ${KArchive_LIBRARIES} ${KCoreAddons_LIBRARIES}) if(QT_QTOPENGL_FOUND) target_link_libraries(${_testname} ${QT_QTOPENGL_LIBRARY}) endif(QT_QTOPENGL_FOUND) + add_test(plasma-${_testname} ${_testname}) + ecm_mark_as_test(${_testname}) ENDFOREACH(_testname) ENDMACRO(PLASMA_UNIT_TESTS) @@ -24,10 +30,13 @@ PLASMA_UNIT_TESTS( runnercontexttest ) -kde4_add_unit_test(storagetest TESTNAME plasma-storage storagetest.cpp ../private/storage.cpp ../private/storagethread.cpp) +add_executable(storagetest storagetest.cpp ../private/storage.cpp ../private/storagethread.cpp) target_link_libraries(storagetest ${QT_QTTEST_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY} ${QT_QTSQL_LIBRARY} ${KDE4_KIO_LIBS} plasma ${KCoreAddons_LIBRARIES} ) +add_test(plasma-storagetest storagetest) +ecm_mark_as_test(plasma-storagetest) + if(QT_QTOPENGL_FOUND) - target_link_libraries(storagetest ${QT_QTOPENGL_LIBRARY}) + target_link_libraries(storagetest ${QT_QTOPENGL_LIBRARY}) endif(QT_QTOPENGL_FOUND) if(QCA2_FOUND) diff --git a/src/plasma/autotests/configloadertest.cpp b/src/plasma/autotests/configloadertest.cpp index 15cbe5195..46b8798bc 100644 --- a/src/plasma/autotests/configloadertest.cpp +++ b/src/plasma/autotests/configloadertest.cpp @@ -22,7 +22,6 @@ #include #include -#include #include #include "plasma/configloader.h" @@ -43,7 +42,7 @@ Q_DECLARE_METATYPE(QList) void ConfigLoaderTest::init() { QString fileName = TEST_NAME + QString::fromLatin1(".xml"); - configFile = new QFile(QString::fromLatin1(KDESRCDIR) + QString::fromLatin1("/") + fileName); + configFile = new QFile(QFINDTESTDATA(QString::fromLatin1("/") + fileName)); cl = new Plasma::ConfigLoader(configFile->fileName(), configFile); } diff --git a/src/plasma/autotests/packagestructuretest.cpp b/src/plasma/autotests/packagestructuretest.cpp index 4a4586bc5..508abdb52 100644 --- a/src/plasma/autotests/packagestructuretest.cpp +++ b/src/plasma/autotests/packagestructuretest.cpp @@ -45,7 +45,7 @@ public: void PackageStructureTest::initTestCase() { - m_packagePath = QString::fromLatin1(KDESRCDIR) + "data/testpackage"; + m_packagePath = QFINDTESTDATA("data/testpackage"); ps = Plasma::PluginLoader::self()->loadPackage("Plasma/Generic"); ps.setPath(m_packagePath); }