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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
|
set(UNITY_SRC ../plugins/unityshell/src)
#
# Data
#
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/data/ubuntuone-installer.desktop
${CMAKE_BINARY_DIR}/tests/data/ubuntuone-installer.desktop)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/data/ubuntu-software-center.desktop
${CMAKE_BINARY_DIR}/tests/data/ubuntu-software-center.desktop)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/data/update-manager.desktop
${CMAKE_BINARY_DIR}/tests/data/update-manager.desktop)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/data/bzr-handle-patch.desktop
${CMAKE_BINARY_DIR}/tests/data/bzr-handle-patch.desktop)
#
# Unit tests
#
find_package (PkgConfig)
set (TEST_DEPS "${UNITY_PLUGIN_DEPS};unity>=4.99.0")
pkg_check_modules (TEST_UNIT_DEPS REQUIRED ${TEST_DEPS})
set (TESTDATADIR "${CMAKE_CURRENT_SOURCE_DIR}/data")
set (CFLAGS
${TEST_UNIT_DEPS_CFLAGS}
${TEST_UNIT_DEPS_CFLAGS_OTHER}
${MAINTAINER_CFLAGS}
"-g"
"-DTESTDATADIR=\"${TESTDATADIR}\""
"-DGETTEXT_PACKAGE=\"unity\""
"-DINDICATORDIR=\"${CMAKE_BINARY_DIR}/tests\""
"-DINDICATORICONDIR=\"${CMAKE_BINARY_DIR}/tests\""
"-I${CMAKE_CURRENT_BINARY_DIR}"
)
add_definitions (${CFLAGS})
set (LIBS ${TEST_UNIT_DEPS_LIBRARIES} "-lunity-core-${UNITY_API_VERSION} -lcompiz_core -lm")
link_libraries (${LIBS})
set (LIB_PATHS ${TEST_UNIT_DEPS_LIBRARY_DIRS})
link_directories (${CMAKE_BINARY_DIR}/UnityCore ${LIB_PATHS})
include_directories (. .. ../services ../UnityCore ${UNITY_SRC} ${CMAKE_BINARY_DIR})
include_directories (${CMAKE_SOURCE_DIR}/plugins/unity-mt-grab-handles/src)
include_directories (${CMAKE_SOURCE_DIR}/dash)
include_directories (${CMAKE_SOURCE_DIR}/launcher)
include_directories (${CMAKE_SOURCE_DIR}/panel)
include_directories (${CMAKE_SOURCE_DIR}/hud)
include_directories (${CMAKE_SOURCE_DIR}/shortcuts)
include_directories (${CMAKE_SOURCE_DIR}/unity-shared)
# We can't have convenience libs so we need to rebuild with what we need
# Please keep actual test files alphabetically at top and then files
# from ../${UNITY_SRC} or ../../services in alphabetically after that
find_program(GLIB_GENMARSHAL glib-genmarshal)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/panel-marshal.c
COMMAND ${GLIB_GENMARSHAL} ARGS ../services/panel-marshal.list --body --prefix=panel_marshal > ${CMAKE_CURRENT_BINARY_DIR}/panel-marshal.c
COMMAND ${GLIB_GENMARSHAL} ARGS ../services/panel-marshal.list --header --prefix=panel_marshal > ${CMAKE_CURRENT_BINARY_DIR}/panel-marshal.h
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ../services/panel-marshal.list
COMMENT "Generating marshallers for panel-service")
add_executable (test-unit
unit/TestMain.cpp
unit/TestQuicklistMenuitems.cpp
unit/TestPanelService.cpp
unit/TestUBus.cpp
unit/TestStaticCairoText.cpp
${CMAKE_SOURCE_DIR}/launcher/CairoBaseWindow.cpp
${CMAKE_SOURCE_DIR}/unity-shared/Introspectable.cpp
${CMAKE_SOURCE_DIR}/launcher/QuicklistMenuItem.cpp
${CMAKE_SOURCE_DIR}/launcher/QuicklistMenuItemCheckmark.cpp
${CMAKE_SOURCE_DIR}/launcher/QuicklistMenuItemLabel.cpp
${CMAKE_SOURCE_DIR}/launcher/QuicklistMenuItemRadio.cpp
${CMAKE_SOURCE_DIR}/launcher/QuicklistMenuItemSeparator.cpp
${CMAKE_SOURCE_DIR}/launcher/QuicklistView.cpp
${CMAKE_SOURCE_DIR}/unity-shared/StaticCairoText.cpp
../services/panel-service.c
${CMAKE_CURRENT_BINARY_DIR}/panel-marshal.c
${CMAKE_SOURCE_DIR}/unity-shared/ubus-server.cpp
)
target_link_libraries (test-unit ${LIBS})
add_dependencies (test-unit unity-core-${UNITY_API_VERSION})
add_subdirectory (test-input-remover)
add_subdirectory (test-minimize-window-handler)
add_subdirectory (test-get-transients)
#
# GTest tests
#
find_program(GLIB_GENMARSHAL glib-genmarshal)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test_glib_signals_utils_marshal.cpp
COMMAND ${GLIB_GENMARSHAL} ARGS test_glib_signals_utils_marshal.list --body --prefix=test_signals > ${CMAKE_CURRENT_BINARY_DIR}/test_glib_signals_utils_marshal.cpp
COMMAND ${GLIB_GENMARSHAL} ARGS test_glib_signals_utils_marshal.list --header --prefix=test_signals > ${CMAKE_CURRENT_BINARY_DIR}/test_glib_signals_utils_marshal.h
COMMAND sed ARGS -i "s/glib-object/test_glib_signals_utils_marshal/" ${CMAKE_CURRENT_BINARY_DIR}/test_glib_signals_utils_marshal.cpp
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS test_glib_signals_utils_marshal.list
COMMENT "Generating marshallers")
enable_testing()
# :(
find_library (GMOCK_LIB gmock)
find_library (GMOCK_MAIN_LIB gmock_main)
find_path(GTEST_SRC_DIR gtest.cc PATHS /usr/src/gtest/src)
if (GTEST_SRC_DIR AND
GMOCK_LIB AND
GMOCK_MAIN_LIB)
# The service that provides DBus services to test against
add_executable(test-gtest-service
test_service_gdbus_wrapper.c
test_service_gdbus_wrapper.h
test_service_hud.c
test_service_hud.h
test_service_lens.c
test_service_lens.h
test_service_main.c
test_service_model.c
test_service_model.h)
target_link_libraries(test-gtest-service ${LIBS})
add_dependencies (test-gtest-service unity-core-${UNITY_API_VERSION} gtest)
# The actual test executable (xless) - do not put anything that requires X in here
add_executable(test-gtest-xless
test_animator.cpp
test_launcher_model.cpp
test_glib_object.cpp
test_glib_object_utils.cpp
test_glib_object_utils.h
test_glib_signals.cpp
test_glib_signals_utils.cpp
test_glib_signals_utils.h
test_glib_source.cpp
test_glib_variant.cpp
test_desktop_utilities.cpp
${CMAKE_CURRENT_BINARY_DIR}/test_glib_signals_utils_marshal.cpp
test_indicator.cpp
test_indicator_appmenu.cpp
test_indicator_entry.cpp
test_indicators.cpp
test_favorite_store_gsettings.cpp
test_favorite_store_private.cpp
test_home_lens.cpp
test_launcher_entry_remote.cpp
test_shortcut_model.cpp
test_shortcut_private.cpp
test_introspection.cpp
test_main_xless.cpp
test_grabhandle.cpp
test_unityshell_private.cpp
test_showdesktop_handler.cpp
test_hud_private.cpp
test_shell_paint_schedule.cpp
${CMAKE_SOURCE_DIR}/launcher/AbstractLauncherIcon.cpp
${CMAKE_SOURCE_DIR}/unity-shared/Animator.cpp
${UNITY_SRC}/DebugDBusInterface.cpp
${UNITY_SRC}/XPathQueryPart.cpp
${CMAKE_SOURCE_DIR}/launcher/FavoriteStore.cpp
${CMAKE_SOURCE_DIR}/launcher/FavoriteStoreGSettings.cpp
${CMAKE_SOURCE_DIR}/unity-shared/IconTextureSource.cpp
${CMAKE_SOURCE_DIR}/launcher/LauncherModel.cpp
${CMAKE_SOURCE_DIR}/launcher/LauncherEntryRemote.cpp
${CMAKE_SOURCE_DIR}/launcher/FavoriteStorePrivate.cpp
${CMAKE_SOURCE_DIR}/shortcuts/ShortcutModel.cpp
${CMAKE_SOURCE_DIR}/shortcuts/ShortcutHintPrivate.cpp
${CMAKE_SOURCE_DIR}/unity-shared/ShellPaintSchedule.cpp
${CMAKE_SOURCE_DIR}/unity-shared/Introspectable.cpp
${CMAKE_SOURCE_DIR}/unity-shared/TextureCache.cpp
${CMAKE_SOURCE_DIR}/unity-shared/Timer.cpp
${UNITY_SRC}/UnityshellPrivate.cpp
${CMAKE_SOURCE_DIR}/unity-shared/WindowManager.cpp
${UNITY_SRC}/UnityShowdesktopHandler.cpp
${CMAKE_SOURCE_DIR}/plugins/unity-mt-grab-handles/src/unity-mt-grab-handle.cpp
${CMAKE_SOURCE_DIR}/plugins/unity-mt-grab-handles/src/unity-mt-grab-handle-group.cpp
${CMAKE_SOURCE_DIR}/plugins/unity-mt-grab-handles/src/unity-mt-grab-handle-impl-factory.cpp
${CMAKE_SOURCE_DIR}/plugins/unity-mt-grab-handles/src/unity-mt-grab-handle-layout.cpp
${CMAKE_SOURCE_DIR}/plugins/unity-mt-grab-handles/src/unity-mt-texture.cpp
${CMAKE_SOURCE_DIR}/hud/HudPrivate.cpp
)
target_link_libraries(test-gtest-xless gtest ${GMOCK_LIB} ${GMOCK_MAIN_LIB} ${LIBS})
add_test(UnityGTestXless test-gtest-xless)
add_dependencies(test-gtest-xless unity-core-${UNITY_API_VERSION} gtest)
# tests that require dbus, must not require X
add_executable(test-gtest-dbus
test_categories.cpp
test_filesystem_lenses.cpp
test_filter.cpp
test_gdbus_proxy.cpp
test_hud.cpp
test_lens.cpp
test_main_dbus.cpp
test_model.cpp
test_utils.h
test_ratings_filter.cpp
test_results.cpp
)
target_link_libraries(test-gtest-dbus gtest ${LIBS})
add_test(UnityGTestDBus test-gtest-dbus)
add_dependencies(test-gtest-dbus unity-core-${UNITY_API_VERSION} test-gtest-service gtest)
# Tests that require X
add_executable(test-gtest
test_bamflaunchericon.cpp
test_hud_button.cpp
test_hud_controller.cpp
test_dashview_impl.cpp
test_texture_cache.cpp
test_main.cpp
test_lensview_impl.cpp
test_icon_loader.cpp
test_hud_view.cpp
test_resultviewgrid.cpp
test_single_monitor_launcher_icon.cpp
test_switcher_controller.cpp
test_switcher_model.cpp
${CMAKE_SOURCE_DIR}/dash/AbstractPlacesGroup.cpp
${CMAKE_SOURCE_DIR}/dash/DashViewPrivate.cpp
${CMAKE_SOURCE_DIR}/dash/LensViewPrivate.cpp
${CMAKE_SOURCE_DIR}/dash/ResultRenderer.cpp
${CMAKE_SOURCE_DIR}/dash/ResultView.cpp
${CMAKE_SOURCE_DIR}/dash/ResultViewGrid.cpp
${CMAKE_SOURCE_DIR}/hud/HudAbstractView.cpp
${CMAKE_SOURCE_DIR}/hud/HudButton.cpp
${CMAKE_SOURCE_DIR}/hud/HudController.cpp
${CMAKE_SOURCE_DIR}/hud/HudIcon.cpp
${CMAKE_SOURCE_DIR}/hud/HudIconTextureSource.cpp
${CMAKE_SOURCE_DIR}/hud/HudPrivate.cpp
${CMAKE_SOURCE_DIR}/hud/HudView.cpp
${CMAKE_SOURCE_DIR}/launcher/AbstractLauncherIcon.cpp
${CMAKE_SOURCE_DIR}/launcher/BamfLauncherIcon.cpp
${CMAKE_SOURCE_DIR}/launcher/CairoBaseWindow.cpp
${CMAKE_SOURCE_DIR}/launcher/DNDCollectionWindow.cpp
${CMAKE_SOURCE_DIR}/launcher/Decaymulator.cpp
${CMAKE_SOURCE_DIR}/launcher/DndData.cpp
${CMAKE_SOURCE_DIR}/launcher/FavoriteStore.cpp
${CMAKE_SOURCE_DIR}/launcher/FavoriteStoreGSettings.cpp
${CMAKE_SOURCE_DIR}/launcher/FavoriteStorePrivate.cpp
${CMAKE_SOURCE_DIR}/launcher/GeisAdapter.cpp
${CMAKE_SOURCE_DIR}/launcher/Launcher.cpp
${CMAKE_SOURCE_DIR}/launcher/LauncherDragWindow.cpp
${CMAKE_SOURCE_DIR}/launcher/LauncherEntryRemote.cpp
${CMAKE_SOURCE_DIR}/launcher/LauncherHideMachine.cpp
${CMAKE_SOURCE_DIR}/launcher/LauncherHoverMachine.cpp
${CMAKE_SOURCE_DIR}/launcher/LauncherIcon.cpp
${CMAKE_SOURCE_DIR}/launcher/LauncherModel.cpp
${CMAKE_SOURCE_DIR}/launcher/LayoutSystem.cpp
${CMAKE_SOURCE_DIR}/launcher/PointerBarrier.cpp
${CMAKE_SOURCE_DIR}/launcher/QuicklistManager.cpp
${CMAKE_SOURCE_DIR}/launcher/QuicklistMenuItem.cpp
${CMAKE_SOURCE_DIR}/launcher/QuicklistMenuItemCheckmark.cpp
${CMAKE_SOURCE_DIR}/launcher/QuicklistMenuItemLabel.cpp
${CMAKE_SOURCE_DIR}/launcher/QuicklistMenuItemRadio.cpp
${CMAKE_SOURCE_DIR}/launcher/QuicklistMenuItemSeparator.cpp
${CMAKE_SOURCE_DIR}/launcher/QuicklistView.cpp
${CMAKE_SOURCE_DIR}/launcher/SimpleLauncherIcon.cpp
${CMAKE_SOURCE_DIR}/launcher/SingleMonitorLauncherIcon.cpp
${CMAKE_SOURCE_DIR}/launcher/SpacerLauncherIcon.cpp
${CMAKE_SOURCE_DIR}/launcher/SwitcherController.cpp
${CMAKE_SOURCE_DIR}/launcher/SwitcherModel.cpp
${CMAKE_SOURCE_DIR}/launcher/SwitcherView.cpp
${CMAKE_SOURCE_DIR}/launcher/Tooltip.cpp
${CMAKE_SOURCE_DIR}/unity-shared/Animator.cpp
${CMAKE_SOURCE_DIR}/unity-shared/BackgroundEffectHelper.cpp
${CMAKE_SOURCE_DIR}/unity-shared/DashStyle.cpp
${CMAKE_SOURCE_DIR}/unity-shared/IconLoader.cpp
${CMAKE_SOURCE_DIR}/unity-shared/IconRenderer.cpp
${CMAKE_SOURCE_DIR}/unity-shared/IconTexture.cpp
${CMAKE_SOURCE_DIR}/unity-shared/IconTextureSource.cpp
${CMAKE_SOURCE_DIR}/unity-shared/IMTextEntry.cpp
${CMAKE_SOURCE_DIR}/unity-shared/Introspectable.cpp
${CMAKE_SOURCE_DIR}/unity-shared/IntrospectableWrappers.cpp
${CMAKE_SOURCE_DIR}/unity-shared/JSONParser.cpp
${CMAKE_SOURCE_DIR}/unity-shared/OverlayRenderer.cpp
${CMAKE_SOURCE_DIR}/unity-shared/PanelStyle.cpp
${CMAKE_SOURCE_DIR}/unity-shared/SearchBar.cpp
${CMAKE_SOURCE_DIR}/unity-shared/SearchBarSpinner.cpp
${CMAKE_SOURCE_DIR}/unity-shared/StaticCairoText.cpp
${CMAKE_SOURCE_DIR}/unity-shared/TextureCache.cpp
${CMAKE_SOURCE_DIR}/unity-shared/Timer.cpp
${CMAKE_SOURCE_DIR}/unity-shared/UBusWrapper.cpp
${CMAKE_SOURCE_DIR}/unity-shared/UScreen.cpp
${CMAKE_SOURCE_DIR}/unity-shared/UnitySettings.cpp
${CMAKE_SOURCE_DIR}/unity-shared/UnityWindowStyle.cpp
${CMAKE_SOURCE_DIR}/unity-shared/UnityWindowView.cpp
${CMAKE_SOURCE_DIR}/unity-shared/WindowManager.cpp
${CMAKE_SOURCE_DIR}/unity-shared/ubus-server.cpp
)
target_link_libraries(test-gtest gtest gmock ${LIBS})
add_test(UnityGTest test-gtest)
add_dependencies(test-gtest unity-core-${UNITY_API_VERSION} gtest gmock)
endif (GTEST_SRC_DIR AND
GMOCK_LIB AND
GMOCK_MAIN_LIB)
add_subdirectory (test-gesture-engine)
#
# check target
#
set (TEST_RESULT_DIR ${CMAKE_BINARY_DIR}/tests)
set (TEST_RESULT_XML ${TEST_RESULT_DIR}/test-results.xml)
set (TEST_RESULT_HTML ${TEST_RESULT_DIR}/test-results.html)
set (GTEST_TEST_COMMAND ./test-gtest)
set (GTEST_TEST_COMMAND_XLESS ./test-gtest-xless)
set (GTEST_TEST_COMMAND_DBUS dbus-test-runner --task ./test-gtest-service --task ./test-gtest-dbus)
set (GTEST_TEST_COMMAND_GESTURE_ENGINE ./test-gesture-engine/test-gesture-engine)
set (TEST_COMMAND
gtester --verbose -k --g-fatal-warnings -o=${TEST_RESULT_XML} ./test-unit
&& ${GTEST_TEST_COMMAND}
&& ${GTEST_TEST_COMMAND_XLESS}
&& ${GTEST_TEST_COMMAND_GESTURE_ENGINE}
&& ${GTEST_TEST_COMMAND_DBUS}
)
set (TEST_COMMAND_HEADLESS
${GTEST_TEST_COMMAND_XLESS}
&& ${GTEST_TEST_COMMAND_GESTURE_ENGINE}
#&& ${GTEST_TEST_COMMAND_DBUS}
&& echo "Warning, DBus test cases are disabled!!")
if (GTEST_SRC_DIR)
add_custom_target (check COMMAND ${TEST_COMMAND} DEPENDS test-unit test-gtest test-gtest-xless test-gtest-dbus test-gesture-engine)
add_custom_target (check-headless COMMAND ${TEST_COMMAND_HEADLESS} DEPENDS test-gtest-xless test-gtest-dbus test-gesture-engine)
add_custom_target (check-report COMMAND ${TEST_UNIT_COMMAND} && gtester-report ${TEST_RESULT_XML} > ${TEST_RESULT_HTML})
add_custom_target (gcheck COMMAND ${DBUS_TEST_COMMAND} DEPENDS test-gtest test-gtest-xless)
else (GTEST_SRC_DIR)
add_custom_target (check COMMAND ${TEST_COMMAND} DEPENDS test-unit)
endif (GTEST_SRC_DIR)
# make target to allow devs to run "make autopilot" from build dir:
set (AUTOPILOTDIR "${CMAKE_CURRENT_SOURCE_DIR}/autopilot")
# Rules to install autopilot files and executable script:
install(CODE "execute_process(COMMAND python setup.py install --prefix ${CMAKE_INSTALL_PREFIX} WORKING_DIRECTORY ${AUTOPILOTDIR})")
add_custom_target (autopilot COMMAND cd ${AUTOPILOTDIR} && make check)
|