aboutsummaryrefslogtreecommitdiff
path: root/tests/integration/CMakeLists.txt
blob: a21ce0e664a44d645ec778306008cd80a7c6f12c (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

if(LOMIRI_API_FOUND)
    pkg_check_modules(GMENUHARNESS REQUIRED libgmenuharness REQUIRED)
    include_directories(${GMENUHARNESS_INCLUDE_DIRS})
endif()

pkg_check_modules(QTDBUSTEST REQUIRED libqtdbustest-1 REQUIRED)
include_directories(${QTDBUSTEST_INCLUDE_DIRS})

pkg_check_modules(QTDBUSMOCK REQUIRED libqtdbusmock-1 REQUIRED)
include_directories(${QTDBUSMOCK_INCLUDE_DIRS})

find_package(Qt5Test REQUIRED)
include_directories(${Qt5Test_INCLUDE_DIRS})

find_package(Qt5DBus REQUIRED)
include_directories(${Qt5DBus_INCLUDE_DIRS})

include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${GMOCK_INCLUDE_DIRS})

include_directories("${CMAKE_SOURCE_DIR}/tests/dbus-types")
include_directories("${CMAKE_BINARY_DIR}/tests/dbus-types")

add_definitions(-DSOUND_SERVICE_BIN="${CMAKE_BINARY_DIR}/src/ayatana-indicator-sound-service"
                -DSTREAM_RESTORE_TABLE="${CMAKE_SOURCE_DIR}/tests/integration/touch-stream-restore.table"
                -DVOLUME_SET_BIN="${CMAKE_BINARY_DIR}/tests/integration/set-volume"
                -DACCOUNTS_SERVICE_BIN="${CMAKE_BINARY_DIR}/tests/service-mocks/accounts-mock/accounts-service-sound"
                -DMEDIA_PLAYER_MPRIS_BIN="${CMAKE_BINARY_DIR}/tests/service-mocks/media-player-mpris-mock/media-player-mpris-mock"
                -DMEDIA_PLAYER_MPRIS_UPDATE_BIN="${CMAKE_BINARY_DIR}/tests/service-mocks/media-player-mpris-mock/media-player-mpris-mock-update"
                -DTEST_SOUND="${CMAKE_SOURCE_DIR}/tests/integration/test-sound.wav"
                -DQT_NO_KEYWORDS=1
                -DXDG_DATA_DIRS="${XDG_DATA_DIRS}"
                -DXDG_CONFIG_HOME="${XDG_CONFIG_HOME}"
                -DXDG_RUNTIME_DIR="${XDG_RUNTIME_DIR}"
                -DTEST_HOME="${TEST_HOME}"
)

if(EXISTS "/usr/share/accountsservice/interfaces/com.lomiri.AccountsService.Sound.xml")
    add_definitions(-DHAS_LOMIRI_ACCTSERVICE_SOUND_SETTINGS)
endif()

set(GLIB_REQUIRED_VERSION 2.26)

pkg_check_modules(
  GLIB REQUIRED
  glib-2.0>=${GLIB_REQUIRED_VERSION}
  gio-2.0>=${GLIB_REQUIRED_VERSION}
)
include_directories(${GLIB_INCLUDE_DIRS})

set(
    INTEGRATION_TESTS_SRC
    indicator-sound-test-base.cpp
    test-indicator.cpp
    utils/dbus-pulse-volume.cpp
    main.cpp
)

add_executable(
    integration-tests
    ${INTEGRATION_TESTS_SRC}
)

add_dependencies(
    integration-tests
    test-home
)

qt5_use_modules(
    integration-tests
    Core
    DBus
    Test
)

target_link_options (integration-tests PRIVATE -no-pie)
target_link_libraries(
    integration-tests
    sound-indicator-dbus-interfaces
    ${QTDBUSMOCK_LDFLAGS}
    ${QTDBUSTEST_LDFLAGS}
    ${GMOCK_LIBRARIES}
    ${GMENUHARNESS_LDFLAGS}
    ${GLIB_LDFLAGS}
)

add_test(
    integration-tests
    integration-tests
)

set(
    SET-VOLUME-SRC
    utils/dbus-pulse-volume.cpp
    utils/set-volume.cpp
)

set(
    GET-VOLUME-SRC
    utils/dbus-pulse-volume.cpp
    utils/get-volume.cpp
)

add_executable(
    set-volume
    ${SET-VOLUME-SRC}
)

add_dependencies(
    set-volume
    test-home
)

add_executable(
    get-volume
    ${GET-VOLUME-SRC}
)

add_dependencies(
    get-volume
    test-home
)

qt5_use_modules(
    set-volume
    Core
    DBus
    Test
)

qt5_use_modules(
    get-volume
    Core
    DBus
    Test
)

target_link_libraries(
    get-volume
    sound-indicator-dbus-interfaces
)

target_link_libraries(
    set-volume
    sound-indicator-dbus-interfaces
)

# coverage reporting
set(COVERAGE_TEST_TARGETS
  ${COVERAGE_TEST_TARGETS}
  integration-tests
  PARENT_SCOPE
)