blob: 3d1dc9a9715614760af4abc40eed8228bac54b1e (
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
macro(declare_test testname)
add_executable(${testname} ${testname}.cpp)
target_link_libraries(${testname}
qmenumodel
dbusmenuscript
${GLIB_LDFLAGS}
${GIO_LDFLAGS}
Qt5::Core
Qt5::DBus
Qt5::Widgets
Qt5::Test
Qt5::Qml
Qt5::Quick
)
if(TEST_XML_OUTPUT)
set(TEST_ARGS -p -xunitxml -p -o -p test_${testname}.xml)
else()
set(TEST_ARGS "")
endif()
add_test(${testname}
${DBUS_RUNNER}
--task ${CMAKE_CURRENT_BINARY_DIR}/${testname} ${TEST_ARGS} --task-name Client
--task ${CMAKE_CURRENT_SOURCE_DIR}/script_${testname}.py --task-name Server
--ignore-return)
set_tests_properties(${testname} PROPERTIES
TIMEOUT ${CTEST_TESTING_TIMEOUT}
ENVIRONMENT "PYTHONPATH=${TEST_PYTHONPATH};QT_QPA_PLATFORM=minimal")
set(TESTS ${TESTS} ${testname})
endmacro(declare_test testname)
macro(declare_simple_test testname)
add_executable(${testname} ${testname}.cpp)
target_link_libraries(${testname}
qmenumodel
${GLIB_LDFLAGS}
${GIO_LDFLAGS}
Qt5::Core
Qt5::Test
)
add_test(${testname}
${CMAKE_CURRENT_BINARY_DIR}/${testname})
set_tests_properties(${testname} PROPERTIES
TIMEOUT ${CTEST_TESTING_TIMEOUT})
endmacro(declare_simple_test testname)
include_directories(${src_SOURCE_DIR}
${dbusmenuscript_SOURCE_DIR}
${GLIB_INCLUDE_DIRS}
)
add_definitions(-DTEST_SUITE)
set(TEST_PYTHONPATH ${dbusmenuscript_SOURCE_DIR})
if(NOT CTEST_TESTING_TIMEOUT)
set(CTEST_TESTING_TIMEOUT 60)
endif()
declare_test(servicetest)
declare_test(menuchangestest)
declare_test(modeltest)
declare_test(actiongrouptest)
declare_test(qmltest)
declare_test(convertertest)
declare_test(modelsignalstest)
declare_test(treetest)
declare_test(ayatanamenuactiontest)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/qmlfiles.h.in
${CMAKE_CURRENT_BINARY_DIR}/qmlfiles.h)
find_package(CoverageReport)
enable_coverage_report(
TARGETS
qmenumodel
FILTER
${CMAKE_SOURCE_DIR}/tests/*
${CMAKE_BINARY_DIR}/*
TESTS
${TESTS}
)
|