Commit eee0f854 authored by Julian Helfferich's avatar Julian Helfferich Committed by Julian Helfferich
Browse files

Set up Unit Test framework

The necessary infrastructure has been put in place to write unit tests
using the QTest framework. I have followed the corresponding guideline:

https://community.kde.org/Guidelines_and_HOWTOs/UnitTests

and referred to the setup of Okular unit tests, where the guidelines were
not clear.
parent 2bdd7805
......@@ -14,7 +14,7 @@ set (KF5_MIN_VERSION "5.68.0")
find_package(ECM ${KF5_MIN_VERSION} REQUIRED CONFIG)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} )
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Widgets Svg Network)
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Test Widgets Svg Network)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
Config
ConfigWidgets
......@@ -35,6 +35,7 @@ include(KDEInstallDirs)
include(KDECompilerSettings NO_POLICY_SCOPE)
include(KDECMakeSettings)
include(ECMAddAppIcon)
include(ECMAddTests)
include(ECMQtDeclareLoggingCategory)
include(ECMSetupVersion)
......@@ -49,6 +50,9 @@ add_subdirectory(themes)
add_subdirectory(sounds)
add_subdirectory(doc)
if(BUILD_TESTING)
add_subdirectory(autotests)
endif()
########### next target ###############
......
enable_testing()
include_directories(AFTER "${CMAKE_CURRENT_SOURCE_DIR}/..")
ecm_add_test(
basic.cpp
TEST_NAME basic
LINK_LIBRARIES Qt5::Test
NAME_PREFIX "basic-"
)
#include <QTest>
class testBasic : public QObject
{
Q_OBJECT
private slots:
void testAlwaysSuccessful();
};
void testBasic::testAlwaysSuccessful()
{
QVERIFY( true );
}
QTEST_MAIN(testBasic)
#include "basic.moc"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment