Port libplasma unit tests to ECM macros
This commit is contained in:
parent
1fa0ab960b
commit
cd7f92e648
@ -1,19 +1,25 @@
|
|||||||
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR})
|
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
|
include(ECMMarkAsTest)
|
||||||
|
|
||||||
include_directories ( ${karchive_SOURCE_DIR}/src
|
include_directories ( ${karchive_SOURCE_DIR}/src
|
||||||
${karchive_BINARY_DIR}/src
|
${karchive_BINARY_DIR}/src
|
||||||
)
|
)
|
||||||
|
|
||||||
find_package(KCoreAddons REQUIRED)
|
find_package(KCoreAddons REQUIRED)
|
||||||
|
|
||||||
|
# add_definitions( -DKDESRCDIR=${CMAKE_CURRENT_SOURCE_DIR} )
|
||||||
|
|
||||||
MACRO(PLASMA_UNIT_TESTS)
|
MACRO(PLASMA_UNIT_TESTS)
|
||||||
FOREACH(_testname ${ARGN})
|
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}
|
target_link_libraries(${_testname} ${QT_QTTEST_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY}
|
||||||
${KDE4_KIO_LIBS} ${KDE4_KDEUI_LIBS} plasma ${KArchive_LIBRARIES} ${KCoreAddons_LIBRARIES})
|
${KDE4_KIO_LIBS} ${KDE4_KDEUI_LIBS} plasma ${KArchive_LIBRARIES} ${KCoreAddons_LIBRARIES})
|
||||||
if(QT_QTOPENGL_FOUND)
|
if(QT_QTOPENGL_FOUND)
|
||||||
target_link_libraries(${_testname} ${QT_QTOPENGL_LIBRARY})
|
target_link_libraries(${_testname} ${QT_QTOPENGL_LIBRARY})
|
||||||
endif(QT_QTOPENGL_FOUND)
|
endif(QT_QTOPENGL_FOUND)
|
||||||
|
add_test(plasma-${_testname} ${_testname})
|
||||||
|
ecm_mark_as_test(${_testname})
|
||||||
ENDFOREACH(_testname)
|
ENDFOREACH(_testname)
|
||||||
ENDMACRO(PLASMA_UNIT_TESTS)
|
ENDMACRO(PLASMA_UNIT_TESTS)
|
||||||
|
|
||||||
@ -24,8 +30,11 @@ PLASMA_UNIT_TESTS(
|
|||||||
runnercontexttest
|
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} )
|
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)
|
if(QT_QTOPENGL_FOUND)
|
||||||
target_link_libraries(storagetest ${QT_QTOPENGL_LIBRARY})
|
target_link_libraries(storagetest ${QT_QTOPENGL_LIBRARY})
|
||||||
endif(QT_QTOPENGL_FOUND)
|
endif(QT_QTOPENGL_FOUND)
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
|
|
||||||
#include <kconfig.h>
|
#include <kconfig.h>
|
||||||
#include <kconfiggroup.h>
|
#include <kconfiggroup.h>
|
||||||
#include <kdebug.h>
|
|
||||||
#include <kconfigskeleton.h>
|
#include <kconfigskeleton.h>
|
||||||
|
|
||||||
#include "plasma/configloader.h"
|
#include "plasma/configloader.h"
|
||||||
@ -43,7 +42,7 @@ Q_DECLARE_METATYPE(QList<int>)
|
|||||||
void ConfigLoaderTest::init()
|
void ConfigLoaderTest::init()
|
||||||
{
|
{
|
||||||
QString fileName = TEST_NAME + QString::fromLatin1(".xml");
|
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);
|
cl = new Plasma::ConfigLoader(configFile->fileName(), configFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public:
|
|||||||
|
|
||||||
void PackageStructureTest::initTestCase()
|
void PackageStructureTest::initTestCase()
|
||||||
{
|
{
|
||||||
m_packagePath = QString::fromLatin1(KDESRCDIR) + "data/testpackage";
|
m_packagePath = QFINDTESTDATA("data/testpackage");
|
||||||
ps = Plasma::PluginLoader::self()->loadPackage("Plasma/Generic");
|
ps = Plasma::PluginLoader::self()->loadPackage("Plasma/Generic");
|
||||||
ps.setPath(m_packagePath);
|
ps.setPath(m_packagePath);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user