aboutsummaryrefslogtreecommitdiff
path: root/autotests/CMakeLists.txt
blob: 93745a993efe75e362ee4ca51d78dae337fa7783 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70

remove_definitions(-DQT_NO_CAST_FROM_ASCII)

include(ECMMarkAsTest)

find_package(Qt5Test ${QT_REQUIRED_VERSION} CONFIG QUIET)
find_package(Qt5Concurrent ${QT_REQUIRED_VERSION} CONFIG QUIET)

if(NOT Qt5Test_FOUND)
    message(STATUS "Qt5Test not found, autotests will not be built.")
    return()
endif()

if(NOT Qt5Concurrent_FOUND)
    message(STATUS "Qt5Concurrent not found, autotests will not be built.")
    return()
endif()

macro(KCONFIGCORE_UNIT_TESTS)
   foreach(_testname ${ARGN})
      add_executable(${_testname} ${_testname}.cpp) # TODO NOGUI
      add_test(kconfigcore-${_testname} ${_testname})
      target_link_libraries(${_testname} KF5::ConfigCore Qt5::Test Qt5::Concurrent)
      ecm_mark_as_test(${_testname})
   endforeach()
endmacro()

macro(KCONFIGGUI_UNIT_TESTS)
   foreach(_testname ${ARGN})
      add_executable(${_testname} ${_testname}.cpp)
      add_test(kconfiggui-${_testname} ${_testname})
      target_link_libraries(${_testname} KF5::ConfigGui Qt5::Test)
      ecm_mark_as_test(${_testname})
   endforeach()
endmacro()

kconfigcore_unit_tests(
   kconfignokdehometest
   kconfigtest
   kdesktopfiletest
   ksharedconfigtest
   test_kconf_update
)

target_include_directories(test_kconf_update PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../src/kconf_update)

# compile KEntryMap into the test since it's not exported
set(kentrymaptest_SRCS kentrymaptest.cpp ../src/core/kconfigdata.cpp)
add_executable(kentrymaptest ${kentrymaptest_SRCS})
add_test(kconfigcore-kentrymaptest kentrymaptest)
target_link_libraries(kentrymaptest KF5::ConfigCore Qt5::Test)
ecm_mark_as_test(kentrymaptest)

# compile KConfigUtils into the test since it's not exported
set(test_kconfigutils_SRCS test_kconfigutils ../src/kconf_update/kconfigutils.cpp)
add_executable(test_kconfigutils ${test_kconfigutils_SRCS})
add_test(kconfigcore-test_kconfigutils test_kconfigutils)
target_link_libraries(test_kconfigutils KF5::ConfigCore Qt5::Test)
target_include_directories(test_kconfigutils PRIVATE ../src/kconf_update)
ecm_mark_as_test(test_kconfigutils)

kconfiggui_unit_tests(
   kconfigguitest
   kconfigloadertest
   kconfigskeletontest
   kstandardshortcuttest
)

add_subdirectory(kconfig_compiler)