Merge lp:~3v1n0/unity/tests-split-and-cleanup into lp:unity

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Andrea Azzarone
Approved revision: no longer in the source branch.
Merged at revision: 4255
Proposed branch: lp:~3v1n0/unity/tests-split-and-cleanup
Merge into: lp:unity
Prerequisite: lp:~azzar1/unity/fix-gcc7
Diff against target: 1179 lines (+577/-356)
13 files modified
tests/CMakeLists.txt (+441/-291)
tests/MockCategories.h (+24/-14)
tests/MockResults.h (+32/-7)
tests/test-gestures/CMakeLists.txt (+3/-1)
tests/test_bamf_application.cpp (+25/-0)
tests/test_gnome_session_manager.cpp (+1/-1)
tests/test_icon_loader.cpp (+32/-32)
tests/test_launcher_controller.cpp (+1/-1)
tests/test_previews_application.cpp (+1/-1)
tests/test_previews_music_payment.cpp (+1/-1)
tests/test_previews_payment.cpp (+1/-0)
tests/test_showdesktop_handler.cpp (+13/-5)
tests/test_thumbnail_generator.cpp (+2/-2)
To merge this branch: bzr merge lp:~3v1n0/unity/tests-split-and-cleanup
Reviewer Review Type Date Requested Status
Andrea Azzarone (community) Approve
Review via email: mp+330839@code.launchpad.net

Commit message

Tests: split unit tests in single binaries, enable unstable tests

Use CMake foo, for getting the best for running tests in single mode
and generating smart targets for them

To post a comment you must log in.
Revision history for this message
Andrea Azzarone (azzar1) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/CMakeLists.txt'
2--- tests/CMakeLists.txt 2017-04-10 12:00:06 +0000
3+++ tests/CMakeLists.txt 2017-09-25 16:01:26 +0000
4@@ -76,9 +76,115 @@
5
6 enable_testing()
7
8+set (UNITY_TEST_XLESS_BINARIES "")
9+set (UNITY_TEST_XLESS_TARGETS "")
10+
11+set (UNITY_TEST_BINARIES "")
12+set (UNITY_TEST_TARGETS "")
13+set (UNITY_TEST_TARGETS_HEADLESS "")
14+
15+set (UNITY_TEST_SLOW_BINARIES "")
16+set (UNITY_TEST_SLOW_TARGETS "")
17+set (UNITY_TEST_SLOW_TARGETS_HEADLESS "")
18+
19+set (UNITY_TEST_DBUS_BINARIES "")
20+set (UNITY_TEST_DBUS_TARGETS "")
21+
22+set (DUMMY_XORG_TEST_RUNNER ${CMAKE_CURRENT_SOURCE_DIR}/dummy-xorg-test-runner.sh)
23+find_program (DBUS_RUN_SESSION dbus-run-session)
24+
25+function (to_camel_case input output)
26+ string (REGEX MATCHALL "(^|[-_])([^-_]+)" matches ${input})
27+
28+ foreach (match ${matches})
29+ string (REGEX REPLACE "^[-_]" "" match ${match})
30+ string (SUBSTRING ${match} 0 1 head)
31+ string (SUBSTRING ${match} 1 -1 tail)
32+ string (TOUPPER ${head} head)
33+ string (TOLOWER ${tail} tail)
34+ string (CONCAT camel ${camel} ${head} ${tail})
35+ endforeach ()
36+
37+ set (${output} ${camel} PARENT_SCOPE)
38+endfunction ()
39+
40+function (ensure_screaming_case input output)
41+ set (screaming)
42+ string (REPLACE "-" "_" screaming ${input})
43+ string (TOUPPER ${screaming} screaming)
44+
45+ set (${output} ${screaming} PARENT_SCOPE)
46+endfunction ()
47+
48+function (add_gtest basename)
49+ set (options HAS_HEADLESS_TARGET HAS_CUSTOM_RUN_TARGETS)
50+ set (oneValueArgs NAMESPACE)
51+ set (multiValueArgs LIBS EXTRA_SOURCES)
52+ cmake_parse_arguments (ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
53+
54+ set (test_binary test-${basename})
55+ string (REPLACE "-" "_" test_source ${test_binary})
56+
57+ to_camel_case (${ARGS_NAMESPACE} namespace_camel)
58+ to_camel_case (${basename} basename_camel)
59+ ensure_screaming_case (${ARGS_NAMESPACE} VAR_PREFIX)
60+
61+ add_executable (${test_binary} ${test_source}.cpp ${ARGS_EXTRA_SOURCES})
62+ target_link_libraries (${test_binary} ${ARGS_LIBS})
63+
64+ add_test ("${namespace_camel}${basename_camel}" ${test_binary})
65+ set (${VAR_PREFIX}_BINARIES ${${VAR_PREFIX}_BINARIES} ${test_binary} PARENT_SCOPE)
66+
67+ if (NOT ${ARGS_HAS_CUSTOM_RUN_TARGETS})
68+ set (run_target run-${test_binary})
69+ set (test_result ${CMAKE_CURRENT_BINARY_DIR}/${test_binary}.xml)
70+ add_custom_target (${run_target}
71+ COMMAND ./${test_binary} --gtest_output=xml:${test_result}
72+ DEPENDS ${test_binary})
73+ add_custom_target (clean-${test_binary}-result COMMAND rm -f ${test_result})
74+ set (${VAR_PREFIX}_TARGETS ${${VAR_PREFIX}_TARGETS} ${run_target} PARENT_SCOPE)
75+
76+ if (${ARGS_HAS_HEADLESS_TARGET})
77+ set (run_target run-${test_binary}-headless)
78+ set (test_result ${CMAKE_CURRENT_BINARY_DIR}/${test_binary}-headless.xml)
79+ add_custom_target (${run_target}
80+ COMMAND env NUX_FALLBACK_TEXTURE=TRUE
81+ ${DUMMY_XORG_TEST_RUNNER}
82+ ${DBUS_RUN_SESSION}
83+ ./${test_binary} --gtest_output=xml:${test_result}
84+ DEPENDS ${test_binary})
85+ add_custom_target (clean-${test_binary}-headless-result COMMAND rm -f ${test_result})
86+ set (${VAR_PREFIX}_TARGETS_HEADLESS ${${VAR_PREFIX}_TARGETS_HEADLESS} ${run_target} PARENT_SCOPE)
87+ endif (${ARGS_HAS_HEADLESS_TARGET})
88+ endif (NOT ${ARGS_HAS_CUSTOM_RUN_TARGETS})
89+
90+ # add_custom_command (OUTPUT ${test_result} COMMAND
91+ # ./${test_binary} --gtest_output=xml:${test_result})
92+ # set (GTEST_RESULTS ${GTEST_RESULTS} ${test_result} PARENT_SCOPE)
93+
94+ # add_custom_command (OUTPUT ${test_result}
95+ # COMMAND env NUX_FALLBACK_TEXTURE=TRUE ${DUMMY_XORG_TEST_RUNNER}
96+ # ./${test_binary} --gtest_output=xml:${test_result})
97+ # set (GTEST_RESULTS_HEADLESS ${GTEST_RESULTS_HEADLESS} ${test_result} PARENT_SCOPE)
98+endfunction ()
99+
100 if (GMOCK_LIB AND
101 GMOCK_MAIN_LIB)
102
103+ add_library (test-main-libs STATIC
104+ test_main.cpp
105+ logger_helper.cpp
106+ )
107+ # Build plain C files separately so they don't try to include the
108+ # C++ pch.
109+ add_library (test-libs-c STATIC
110+ bamf-mock-application.c
111+ bamf-mock-window.c
112+ gmockmount.c
113+ gmockvolume.c
114+ ${CMAKE_SOURCE_DIR}/services/panel-service.c
115+ )
116+
117 # MockWindowManager
118 add_library (unity_mock_window_manager STATIC
119 MockWindowManager.cpp)
120@@ -105,266 +211,290 @@
121 unity-shared
122 ${LIBS})
123
124-# gtest-slow, start moving things over that are slow running tests
125- set (GTEST_SLOW_SOURCES
126- test_main.cpp
127- logger_helper.cpp
128- mock-application.cpp
129- test_switcher_controller_slow.cpp
130- test_switcher_controller_class.cpp
131- test_tooltip_manager.cpp
132- )
133-
134- set (GTEST_SLOW_LIBS
135- gtest
136- gmock
137- launcher-lib
138- switcher-lib
139- unity-shared
140- unity-shared-standalone
141- )
142-
143- add_executable(test-gtest-slow ${GTEST_SLOW_SOURCES})
144- target_link_libraries(test-gtest-slow ${GTEST_SLOW_LIBS})
145- add_test(UnityGTestSlow test-gtest-slow)
146-
147-# The actual test executable (xless) - do not put anything that requires X in here
148- set (GTEST_XLESS_SOURCES
149- test_main_xless.cpp
150- mock-application.cpp
151- test_action_handle.cpp
152- test_abstract_interface_generator.cpp
153- test_animation_utils.cpp
154- test_connection_manager.cpp
155- test_delta_tracker.cpp
156- test_em_converter.cpp
157- test_glib_dbus_object.cpp
158- test_glib_cancellable.cpp
159- test_glib_object.cpp
160- test_glib_object_utils.cpp
161- test_glib_object_utils.h
162- test_glib_signals.cpp
163- test_glib_signals_utils.cpp
164- test_glib_signals_utils.h
165- test_glib_source.cpp
166- test_glib_variant.cpp
167- test_grabhandle.cpp
168- test_gsettings_scopes.cpp
169- test_desktop_utilities.cpp
170- test_desktop_application_subject.cpp
171- test_indicator.cpp
172- test_indicator_appmenu.cpp
173- test_indicator_entry.cpp
174- test_indicators.cpp
175- test_introspection_data.cpp
176- test_favorite_store.cpp
177- test_favorite_store_gsettings.cpp
178- test_favorite_store_private.cpp
179- test_launcher_entry_remote.cpp
180- test_launcher_options.cpp
181- test_layout_system.cpp
182- test_model_iterator.cpp
183- test_previews.cpp
184- test_raw_pixel.cpp
185- test_scope_data.cpp
186- test_time_util.cpp
187- test_ubus.cpp
188- test_unityshell_private.cpp
189- test_volume_imp.cpp
190- ${UNITY_SRC}/UnityshellPrivate.cpp
191- ${CMAKE_SOURCE_DIR}/plugins/unity-mt-grab-handles/src/unity-mt-grab-handle.cpp
192- ${CMAKE_SOURCE_DIR}/plugins/unity-mt-grab-handles/src/unity-mt-grab-handle-group.cpp
193- ${CMAKE_SOURCE_DIR}/plugins/unity-mt-grab-handles/src/unity-mt-grab-handle-impl-factory.cpp
194- ${CMAKE_SOURCE_DIR}/plugins/unity-mt-grab-handles/src/unity-mt-grab-handle-layout.cpp
195- ${CMAKE_SOURCE_DIR}/plugins/unity-mt-grab-handles/src/unity-mt-texture.cpp
196- )
197-
198- set (GTEST_XLESS_LIBS
199- gtest
200- test-libs-c
201- unity-shared
202- unity-shared-standalone
203- launcher-lib
204- switcher-lib
205- ${GMOCK_LIB}
206- ${GMOCK_MAIN_LIB}
207- ${LIBS}
208- )
209+ # The actual test executable (xless) - do not put anything that requires X in here
210+
211+ add_library (test-main-xless-libs STATIC
212+ test_main_xless.cpp
213+ logger_helper.cpp
214+ )
215+
216+ function (add_unity_test_xless basename)
217+ set (VAR_PREFIX "UNITY_TEST_XLESS")
218+ set (UNITY_TEST_XLESS_LIBS
219+ gtest
220+ test-main-xless-libs
221+ test-libs-c
222+ unity-shared
223+ unity-shared-standalone
224+ launcher-lib
225+ switcher-lib
226+ ${GMOCK_LIB}
227+ ${GMOCK_MAIN_LIB}
228+ ${LIBS}
229+ )
230+
231+ if (ENABLE_X_SUPPORT)
232+ set (UNITY_TEST_XLESS_LIBS
233+ ${UNITY_TEST_XLESS_LIBS}
234+ shortcuts-lib
235+ hud-lib
236+ )
237+ endif ()
238+
239+ add_gtest (${basename} NAMESPACE ${VAR_PREFIX} LIBS "${${VAR_PREFIX}_LIBS}" ${ARGN})
240+
241+ set (${VAR_PREFIX}_BINARIES ${${VAR_PREFIX}_BINARIES} PARENT_SCOPE)
242+ set (${VAR_PREFIX}_TARGETS ${${VAR_PREFIX}_TARGETS} PARENT_SCOPE)
243+ endfunction ()
244+
245+ add_unity_test_xless (abstract-interface-generator)
246+ add_unity_test_xless (action-handle)
247+ add_unity_test_xless (animation-utils)
248+ add_unity_test_xless (connection-manager)
249+ add_unity_test_xless (delta-tracker)
250+ add_unity_test_xless (desktop-application-subject)
251+ add_unity_test_xless (desktop-utilities)
252+ add_unity_test_xless (em-converter)
253+ add_unity_test_xless (favorite-store)
254+ add_unity_test_xless (favorite-store-gsettings)
255+ add_unity_test_xless (favorite-store-private)
256+ add_unity_test_xless (glib-cancellable)
257+ add_unity_test_xless (glib-dbus-object)
258+ add_unity_test_xless (glib-object EXTRA_SOURCES test_glib_object_utils.cpp)
259+ add_unity_test_xless (glib-signals EXTRA_SOURCES test_glib_signals_utils.cpp)
260+ add_unity_test_xless (glib-source)
261+ add_unity_test_xless (glib-variant)
262+ add_unity_test_xless (grabhandle
263+ EXTRA_SOURCES
264+ ${CMAKE_SOURCE_DIR}/plugins/unity-mt-grab-handles/src/unity-mt-grab-handle.cpp
265+ ${CMAKE_SOURCE_DIR}/plugins/unity-mt-grab-handles/src/unity-mt-grab-handle-group.cpp
266+ ${CMAKE_SOURCE_DIR}/plugins/unity-mt-grab-handles/src/unity-mt-grab-handle-impl-factory.cpp
267+ ${CMAKE_SOURCE_DIR}/plugins/unity-mt-grab-handles/src/unity-mt-grab-handle-layout.cpp
268+ ${CMAKE_SOURCE_DIR}/plugins/unity-mt-grab-handles/src/unity-mt-texture.cpp)
269+ add_unity_test_xless (gsettings-scopes)
270+ add_unity_test_xless (indicator)
271+ add_unity_test_xless (indicator-appmenu)
272+ add_unity_test_xless (indicator-entry)
273+ add_unity_test_xless (indicators)
274+ add_unity_test_xless (introspection-data)
275+ add_unity_test_xless (launcher-entry-remote)
276+ add_unity_test_xless (launcher-options)
277+ add_unity_test_xless (layout-system)
278+ add_unity_test_xless (model-iterator)
279+ add_unity_test_xless (previews)
280+ add_unity_test_xless (raw-pixel)
281+ add_unity_test_xless (scope-data)
282+ add_unity_test_xless (time-util)
283+ add_unity_test_xless (ubus)
284+ add_unity_test_xless (unityshell-private EXTRA_SOURCES ${UNITY_SRC}/UnityshellPrivate.cpp)
285+ add_unity_test_xless (volume-imp)
286
287 if (ENABLE_X_SUPPORT)
288- set (GTEST_XLESS_SOURCES
289- ${GTEST_XLESS_SOURCES}
290- test_hud_private.cpp
291- test_pointer_barrier.cpp
292- test_shortcut_model.cpp
293- test_shortcut_private.cpp
294- ${LAUNCHER_SOURCES}
295- )
296- set (GTEST_XLESS_LIBS
297- ${GTEST_XLESS_LIBS}
298- shortcuts-lib
299- hud-lib
300- )
301+ add_unity_test_xless (hud-private)
302+ add_unity_test_xless (pointer-barrier)
303+ add_unity_test_xless (shortcut-model)
304+ add_unity_test_xless (shortcut-private)
305 endif ()
306
307- add_executable(test-gtest-xless ${GTEST_XLESS_SOURCES})
308- target_link_libraries(test-gtest-xless ${GTEST_XLESS_LIBS})
309- add_test(UnityGTestXless test-gtest-xless)
310-
311-# tests that require dbus, must not require X
312- add_executable(test-gtest-dbus
313- test_categories.cpp
314- test_dbus_indicators.cpp
315- test_filter.cpp
316- test_glib_dbus_proxy.cpp
317- test_hud.cpp
318- test_main_dbus.cpp
319- test_model.cpp
320- test_utils.h
321- test_ratings_filter.cpp
322- test_results.cpp
323- test_scope.cpp
324- test_scope_filter.cpp
325- #test_scope_proxy.cpp
326- test_tracks.cpp
327- )
328- target_link_libraries(test-gtest-dbus gtest unity-shared ${LIBS})
329- add_test(UnityGTestDBus test-gtest-dbus)
330- add_dependencies(test-gtest-dbus unity-core-${UNITY_API_VERSION} unity-shared test-gtest-service gtest)
331-
332+ # tests that require dbus, must not require X
333+ add_library (test-main-dbus-libs STATIC
334+ test_main_dbus.cpp
335+ logger_helper.cpp
336+ )
337+
338+ function (add_unity_test_dbus basename)
339+ set (VAR_PREFIX "UNITY_TEST_DBUS")
340+ set (UNITY_TEST_DBUS_LIBS gtest unity-shared test-main-dbus-libs ${LIBS})
341+
342+ set (test_binary test-${basename})
343+ add_custom_target (run-${test_binary}
344+ COMMAND dbus-test-runner --max-wait=300 --task
345+ ./test-gtest-service --task-name test-service
346+ --task=./${test_binary} --task-name=${test_binary}
347+ --wait-for=com.canonical.Unity.Test
348+ --parameter=--gtest_output=xml:./${test_binary}.xml
349+ DEPENDS ${test_binary} test-gtest-service)
350+ add_custom_target (clean-${test_binary}-result COMMAND rm -f ${test_result})
351+ set (${VAR_PREFIX}_TARGETS ${${VAR_PREFIX}_TARGETS} run-${test_binary})
352+
353+ add_gtest (${basename} NAMESPACE ${VAR_PREFIX} LIBS "${${VAR_PREFIX}_LIBS}" HAS_CUSTOM_RUN_TARGETS ${ARGN})
354+
355+ set (${VAR_PREFIX}_BINARIES ${${VAR_PREFIX}_BINARIES} PARENT_SCOPE)
356+ set (${VAR_PREFIX}_TARGETS ${${VAR_PREFIX}_TARGETS} PARENT_SCOPE)
357+ endfunction ()
358+
359+ # test-gtest-dbus
360+ add_unity_test_dbus (categories)
361+ add_unity_test_dbus (dbus-indicators)
362+ add_unity_test_dbus (filter)
363+ add_unity_test_dbus (glib-dbus-proxy)
364+ add_unity_test_dbus (hud)
365+ add_unity_test_dbus (main-dbus)
366+ add_unity_test_dbus (model)
367+ add_unity_test_dbus (ratings-filter)
368+ add_unity_test_dbus (results)
369+ add_unity_test_dbus (scope)
370+ add_unity_test_dbus (scope-filter)
371+ add_unity_test_dbus (scope-proxy)
372+ add_unity_test_dbus (tracks)
373+
374+ # Tests that require X
375 if (ENABLE_X_SUPPORT)
376-# Tests that require X
377- add_executable(test-gtest
378- mock-application.cpp
379- mock_results.cpp
380- logger_helper.cpp
381- test_main.cpp
382- test_action_link.cpp
383- test_application_launcher_icon.cpp
384- test_bamf_application.cpp
385- test_bfb_launcher_icon.cpp
386- test_decorations_input_mixer.cpp
387- test_decorations_widgets.cpp
388- test_dashview.cpp
389- test_dashview_impl.cpp
390- test_dash_controller.cpp
391- test_desktop_launcher_icon.cpp
392- test_device_launcher_section.cpp
393- test_error_preview.cpp
394- test_edge_barrier_controller.cpp
395- test_expo_launcher_icon.cpp
396- test_file_manager_launcher_icon.cpp
397- test_filter_widgets.cpp
398- test_glib_dbus_server.cpp
399- test_gnome_session_manager.cpp
400- test_gtk_icon_info.cpp
401- test_hud_button.cpp
402- test_hud_controller.cpp
403- test_hud_launcher_icon.cpp
404- test_hud_view.cpp
405- test_icon_loader.cpp
406- test_im_text_entry.cpp
407- test_keyboard_util.cpp
408- test_launcher.cpp
409- test_launcher_controller.cpp
410- test_launcher_drag_window.cpp
411- test_launcher_hide_machine.cpp
412- test_launcher_hover_machine.cpp
413- test_launcher_icon.cpp
414- test_launcher_minimize_speed.cpp
415- test_launcher_model.cpp
416- test_launcher_tooltip.cpp
417- test_lockscreen_controller.cpp
418- test_panel_controller.cpp
419- test_panel_indicators_view.cpp
420- test_panel_indicator_entry_dropdown_view.cpp
421- test_panel_menu_view.cpp
422- test_panel_service.cpp
423- test_panel_style.cpp
424- test_panel_tray.cpp
425- test_panel_view.cpp
426- test_places_group.cpp
427- test_preview_player.cpp
428- test_previews_application.cpp
429- test_previews_generic.cpp
430- test_previews_movie.cpp
431- test_previews_music.cpp
432- test_previews_music_payment.cpp
433- test_previews_payment.cpp
434- test_previews_social.cpp
435- test_quicklist_manager.cpp
436- test_quicklist_menu_item.cpp
437- test_quicklist_view.cpp
438- test_result_renderer.cpp
439- test_resultviewgrid.cpp
440- test_scope_bar.cpp
441- test_scope_view.cpp
442- test_screensaver_dbus_manager.cpp
443- test_searchbar.cpp
444- test_session_button.cpp
445- test_session_controller.cpp
446- test_session_view.cpp
447- test_shortcut_controller.cpp
448- test_shortcut_modeller_compiz.cpp
449- test_shortcut_view.cpp
450- test_single_monitor_launcher_icon.cpp
451- test_showdesktop_handler.cpp
452- test_software_center_launcher_icon.cpp
453- test_spread_filter.cpp
454- test_static_cairo_text.cpp
455- test_switcher_controller.cpp
456- test_switcher_controller_class.cpp
457- test_switcher_model.cpp
458- test_switcher_view.cpp
459- test_systemd_wrapper.cpp
460- test_tabiterator.cpp
461- test_texture_cache.cpp
462- test_text_input.cpp
463- test_thumbnail_generator.cpp
464- test_trash_launcher_icon.cpp
465- test_unity_settings.cpp
466- test_unity_window_style.cpp
467- test_unity_window_view.cpp
468- test_upstart_wrapper.cpp
469- test_user_authenticator_pam.cpp
470- test_volume_launcher_icon.cpp
471- test_window_buttons.cpp
472- test_xdnd_manager_imp.cpp
473- test_xdnd_start_stop_notifier_imp.cpp
474- ${UNITY_SRC}/UnityShowdesktopHandler.cpp
475- ${CMAKE_SOURCE_DIR}/plugins/unityshell/src/WindowMinimizeSpeedController.cpp
476- ${CMAKE_SOURCE_DIR}/services/panel-service.c
477- )
478-
479- # Build plain C files separately so they don't try to include the
480- # C++ pch.
481- add_library(test-libs-c STATIC
482- bamf-mock-application.c
483- bamf-mock-window.c
484- gmockmount.c
485- gmockvolume.c
486- )
487-
488- target_link_libraries(test-gtest
489- ${LIBS}
490- test-libs-c
491- gtest
492- gmock
493- dash-lib
494- decorations-lib
495- hud-lib
496- launcher-lib
497- lockscreen-lib
498- panel-lib
499- pam
500- previews-lib
501- shortcuts-lib
502- shutdown-lib
503- switcher-lib
504- unity-shared
505- unity-shared-bamf
506- unity-shared-standalone)
507- add_test(UnityGTest test-gtest)
508+
509+ function (add_unity_test basename #[[extra_sources]])
510+ set (VAR_PREFIX UNITY_TEST)
511+ set (UNITY_TEST_LIBS
512+ test-main-libs
513+ test-libs-c
514+ ${LIBS}
515+ gtest
516+ gmock
517+ dash-lib
518+ decorations-lib
519+ hud-lib
520+ launcher-lib
521+ lockscreen-lib
522+ panel-lib
523+ pam
524+ previews-lib
525+ shortcuts-lib
526+ shutdown-lib
527+ switcher-lib
528+ unity-shared
529+ unity-shared-bamf
530+ unity-shared-standalone)
531+
532+ add_gtest (${basename} NAMESPACE ${VAR_PREFIX} LIBS "${${VAR_PREFIX}_LIBS}" HAS_HEADLESS_TARGET ${ARGN})
533+
534+ set (${VAR_PREFIX}_BINARIES ${${VAR_PREFIX}_BINARIES} PARENT_SCOPE)
535+ set (${VAR_PREFIX}_TARGETS ${${VAR_PREFIX}_TARGETS} PARENT_SCOPE)
536+ set (${VAR_PREFIX}_TARGETS_HEADLESS ${${VAR_PREFIX}_TARGETS_HEADLESS} PARENT_SCOPE)
537+ endfunction ()
538+
539+ add_unity_test (action-link)
540+ add_unity_test (application-launcher-icon EXTRA_SOURCES mock-application.cpp)
541+ add_unity_test (bamf-application EXTRA_SOURCES mock-application.cpp)
542+ add_unity_test (bfb-launcher-icon)
543+ add_unity_test (decorations-input-mixer)
544+ add_unity_test (decorations-widgets)
545+ add_unity_test (dashview)
546+ add_unity_test (dashview-impl)
547+ add_unity_test (dash-controller)
548+ add_unity_test (desktop-launcher-icon)
549+ add_unity_test (device-launcher-section)
550+ add_unity_test (error-preview)
551+ add_unity_test (edge-barrier-controller)
552+ add_unity_test (expo-launcher-icon)
553+ add_unity_test (file-manager-launcher-icon)
554+ add_unity_test (filter-widgets)
555+ add_unity_test (glib-dbus-server)
556+ add_unity_test (gnome-session-manager)
557+ add_unity_test (gtk-icon-info)
558+ add_unity_test (hud-button)
559+ add_unity_test (hud-controller)
560+ add_unity_test (hud-launcher-icon)
561+ add_unity_test (hud-view)
562+ add_unity_test (icon-loader)
563+ add_unity_test (im-text-entry)
564+ add_unity_test (keyboard-util)
565+ add_unity_test (launcher EXTRA_SOURCES mock-application.cpp)
566+ add_unity_test (launcher-controller EXTRA_SOURCES mock-application.cpp)
567+ add_unity_test (launcher-drag-window)
568+ add_unity_test (launcher-hide-machine)
569+ add_unity_test (launcher-hover-machine)
570+ add_unity_test (launcher-icon)
571+ add_unity_test (launcher-minimize-speed
572+ EXTRA_SOURCES
573+ ${CMAKE_SOURCE_DIR}/plugins/unityshell/src/WindowMinimizeSpeedController.cpp)
574+ add_unity_test (launcher-model)
575+ add_unity_test (launcher-tooltip)
576+ add_unity_test (lockscreen-controller)
577+ add_unity_test (panel-controller)
578+ add_unity_test (panel-indicators-view)
579+ add_unity_test (panel-indicator-entry-dropdown-view)
580+ add_unity_test (panel-menu-view)
581+ add_unity_test (panel-service)
582+ add_unity_test (panel-style)
583+ add_unity_test (panel-tray)
584+ add_unity_test (panel-view)
585+ add_unity_test (places-group)
586+ add_unity_test (preview-player)
587+ add_unity_test (previews-application)
588+ add_unity_test (previews-generic)
589+ add_unity_test (previews-movie)
590+ add_unity_test (previews-music)
591+ add_unity_test (previews-music-payment)
592+ add_unity_test (previews-payment)
593+ add_unity_test (previews-social)
594+ add_unity_test (quicklist-manager)
595+ add_unity_test (quicklist-menu-item)
596+ add_unity_test (quicklist-view)
597+ add_unity_test (result-renderer)
598+ add_unity_test (resultviewgrid)
599+ add_unity_test (scope-bar)
600+ add_unity_test (scope-view)
601+ add_unity_test (screensaver-dbus-manager)
602+ add_unity_test (searchbar)
603+ add_unity_test (session-button)
604+ add_unity_test (session-controller)
605+ add_unity_test (session-view)
606+ add_unity_test (shortcut-controller)
607+ add_unity_test (shortcut-modeller-compiz)
608+ add_unity_test (shortcut-view)
609+ add_unity_test (single-monitor-launcher-icon)
610+ add_unity_test (showdesktop-handler
611+ EXTRA_SOURCES ${UNITY_SRC}/UnityShowdesktopHandler.cpp)
612+ add_unity_test (software-center-launcher-icon EXTRA_SOURCES mock-application.cpp)
613+ add_unity_test (spread-filter)
614+ add_unity_test (static-cairo-text)
615+ add_unity_test (switcher-controller
616+ EXTRA_SOURCES test_switcher_controller_class.cpp)
617+ add_unity_test (switcher-model)
618+ add_unity_test (switcher-view)
619+ add_unity_test (systemd-wrapper)
620+ add_unity_test (tabiterator)
621+ add_unity_test (texture-cache)
622+ add_unity_test (text-input)
623+ add_unity_test (thumbnail-generator)
624+ add_unity_test (trash-launcher-icon EXTRA_SOURCES mock-application.cpp)
625+ add_unity_test (unity-settings)
626+ add_unity_test (unity-window-style)
627+ add_unity_test (unity-window-view)
628+ add_unity_test (upstart-wrapper)
629+ add_unity_test (user-authenticator-pam)
630+ add_unity_test (volume-launcher-icon)
631+ add_unity_test (window-buttons)
632+ add_unity_test (xdnd-manager-imp)
633+ add_unity_test (xdnd-start-stop-notifier-imp)
634+
635+ #
636+ # Slow tests
637+ #
638+ function (add_unity_test_slow basename)
639+ set (VAR_PREFIX "UNITY_TEST_SLOW")
640+ set (UNITY_TEST_SLOW_LIBS
641+ test-main-libs
642+ gtest
643+ gmock
644+ launcher-lib
645+ switcher-lib
646+ unity-shared
647+ unity-shared-standalone
648+ )
649+
650+ add_gtest (${basename} NAMESPACE ${VAR_PREFIX} LIBS "${${VAR_PREFIX}_LIBS}" HAS_HEADLESS_TARGET ${ARGN})
651+
652+ set (${VAR_PREFIX}_BINARIES ${${VAR_PREFIX}_BINARIES} PARENT_SCOPE)
653+ set (${VAR_PREFIX}_TARGETS ${${VAR_PREFIX}_TARGETS} PARENT_SCOPE)
654+ set (${VAR_PREFIX}_TARGETS_HEADLESS ${${VAR_PREFIX}_TARGETS_HEADLESS} PARENT_SCOPE)
655+ endfunction ()
656+
657+ add_unity_test_slow (switcher-controller-slow
658+ EXTRA_SOURCES
659+ test_switcher_controller_class.cpp
660+ mock-application.cpp)
661+ add_unity_test_slow (tooltip-manager)
662+
663 endif (ENABLE_X_SUPPORT)
664 endif (GMOCK_LIB AND
665 GMOCK_MAIN_LIB)
666@@ -376,49 +506,69 @@
667 #
668 # check target
669 #
670-set (TEST_RESULT_DIR ${CMAKE_BINARY_DIR}/tests)
671-set (TEST_RESULT_XML ${TEST_RESULT_DIR}/test-results.xml)
672-set (TEST_RESULT_HTML ${TEST_RESULT_DIR}/test-results.html)
673-set (DUMMY_XORG_TEST_RUNNER ${CMAKE_CURRENT_SOURCE_DIR}/dummy-xorg-test-runner.sh)
674-if (ENABLE_X_SUPPORT)
675- set (GTEST_TEST_COMMAND ./test-gtest --gtest_output=xml:./test-gtest.xml)
676- set (GTEST_TEST_COMMAND_GESTURES ./test-gestures/test-gestures --gtest_output=xml:./test-gestures.xml)
677-endif (ENABLE_X_SUPPORT)
678-set (GTEST_TEST_COMMAND_XLESS ./test-gtest-xless --gtest_output=xml:./test-gtest-xless.xml)
679-set (GTEST_TEST_COMMAND_SLOW ./test-gtest-slow --gtest_output=xml:./test-gtest-slow.xml)
680-set (GTEST_TEST_COMMAND_DBUS dbus-test-runner --max-wait=300 --task ./test-gtest-service --task-name test-service --task=./test-gtest-dbus --task-name=test-gtest-dbus --wait-for=com.canonical.Unity.Test --parameter=--gtest_output=xml:./test-gtest-dbus.xml --parameter=--gtest_filter=-TestCategoriesChanging*)
681-
682-set (TEST_COMMAND_XLESS
683- ${GTEST_TEST_COMMAND_XLESS}
684- && ${GTEST_TEST_COMMAND_GESTURES}
685- && ${GTEST_TEST_COMMAND_DBUS})
686-
687-set (TEST_COMMAND
688- ${GTEST_TEST_COMMAND}
689- && ${GTEST_TEST_COMMAND_SLOW}
690- && ${TEST_COMMAND_XLESS})
691-
692-set (TEST_COMMAND_HEADLESS
693- export NUX_FALLBACK_TEXTURE=TRUE
694- && ${DUMMY_XORG_TEST_RUNNER} ${GTEST_TEST_COMMAND}
695- && ${DUMMY_XORG_TEST_RUNNER} ${GTEST_TEST_COMMAND_SLOW}
696- && ${TEST_COMMAND_XLESS})
697-
698 if (GMOCK_SOURCE_DIR)
699+ add_custom_target (tests-xless DEPENDS ${UNITY_TEST_XLESS_BINARIES})
700+ add_custom_target (test-gtest-xless DEPENDS tests-xless)
701+ add_custom_target (check-xless DEPENDS ${UNITY_TEST_XLESS_TARGETS})
702+
703+ add_custom_target (tests-dbus DEPENDS ${UNITY_TEST_DBUS_BINARIES})
704+ add_custom_target (test-gtest-dbus DEPENDS tests-dbus)
705+ add_custom_target (check-dbus DEPENDS ${UNITY_TEST_DBUS_TARGETS})
706+
707+ add_custom_target (clean-tests-results COMMAND rm -f ${CMAKE_CURRENT_BINARY_DIR}/test-*.xml)
708+
709 if (ENABLE_X_SUPPORT)
710- add_custom_target (check COMMAND ${TEST_COMMAND} DEPENDS test-gtest test-gtest-slow test-gtest-xless test-gtest-dbus test-gestures)
711- add_custom_target (check-headless COMMAND ${TEST_COMMAND_HEADLESS} DEPENDS test-gtest test-gtest-slow test-gtest-xless test-gtest-dbus test-gestures)
712- add_custom_target (gcheck COMMAND ${DBUS_TEST_COMMAND} DEPENDS test-gtest test-gtest-xless)
713+ add_custom_target (test-gtest DEPENDS ${UNITY_TEST_BINARIES})
714+ add_custom_target (check-gtest DEPENDS ${UNITY_TEST_TARGETS})
715+ add_custom_target (check-gtest-headless DEPENDS ${UNITY_TEST_TARGETS_HEADLESS})
716+
717+ add_custom_target (test-gtest-slow DEPENDS ${UNITY_TEST_SLOW_BINARIES})
718+ add_custom_target (check-gtest-slow DEPENDS ${UNITY_TEST_SLOW_TARGETS})
719+ add_custom_target (check-gtest-slow-headless DEPENDS ${UNITY_TEST_SLOW_TARGETS_HEADLESS})
720+
721+ add_custom_target (tests DEPENDS
722+ test-gtest
723+ test-gtest-slow
724+ test-gtest-xless
725+ test-gtest-dbus
726+ test-gestures
727+ )
728+
729+ add_custom_target (check DEPENDS
730+ check-xless
731+ check-gestures
732+ check-gtest
733+ check-gtest-slow
734+ check-dbus
735+ )
736+
737+ add_custom_target (check-headless DEPENDS
738+ check-xless
739+ check-gestures
740+ check-gtest-headless
741+ check-gtest-slow-headless
742+ check-dbus
743+ )
744+
745+ add_custom_target (gcheck DEPENDS check)
746 else ()
747- add_custom_target (check COMMAND ${TEST_COMMAND} DEPENDS test-gtest-xless test-gtest-dbus)
748- add_custom_target (check-headless COMMAND ${TEST_COMMAND_XLESS} DEPENDS test-gtest-xless test-gtest-dbus)
749- add_custom_target (gcheck COMMAND ${DBUS_TEST_COMMAND} DEPENDS test-gtest-xless)
750+ add_custom_target (tests DEPENDS
751+ test-gtest-xless
752+ test-gtest-dbus
753+ )
754+
755+ add_custom_target (check DEPENDS
756+ check-xless
757+ check-dbus)
758+
759+ add_custom_target (check-headless DEPENDS check)
760+ add_custom_target (gcheck DEPENDS check)
761 endif ()
762- add_custom_target (check-report COMMAND ${TEST_UNIT_COMMAND} && gtester-report ${TEST_RESULT_XML} > ${TEST_RESULT_HTML})
763+
764 endif (GMOCK_SOURCE_DIR)
765+
766 # make target to allow devs to run "make autopilot" from build dir:
767 set (AUTOPILOTDIR "${CMAKE_CURRENT_SOURCE_DIR}/autopilot")
768 # Rules to install autopilot files and executable script:
769 install(CODE "execute_process(COMMAND python2.7 setup.py install --prefix ${CMAKE_INSTALL_PREFIX} WORKING_DIRECTORY ${AUTOPILOTDIR})")
770 add_custom_target (autopilot COMMAND cd ${AUTOPILOTDIR} && make check)
771-
772
773=== modified file 'tests/MockCategories.h'
774--- tests/MockCategories.h 2013-07-09 06:14:21 +0000
775+++ tests/MockCategories.h 2017-09-25 16:01:26 +0000
776@@ -28,29 +28,39 @@
777 namespace dash
778 {
779
780-struct MockCategories : public Categories
781+Category generate_mock_category(size_t index)
782+{
783+ Category mock_category(nullptr, nullptr, nullptr);
784+ mock_category.id.SetGetterFunction([index] { return "mock-cat"+std::to_string(index); });
785+ mock_category.name.SetGetterFunction([index] { return "MockCategory "+std::to_string(index); });
786+ mock_category.icon_hint.SetGetterFunction([index] { return "mock-category-icon-"+std::to_string(index); });
787+ mock_category.renderer_name.SetGetterFunction([] { return "grid"; });
788+ mock_category.index.SetGetterFunction([index] { return index; });
789+ return mock_category;
790+}
791+
792+struct MockCategories : Categories
793 {
794 MockCategories(unsigned count_)
795 : Categories(LOCAL)
796 {
797 count.SetGetterFunction([count_] { return count_; });
798 }
799+
800+ const Category RowAtIndex(std::size_t index) const override
801+ {
802+ return generate_mock_category(index);
803+ }
804 };
805
806 // Template specialization for Category in tests
807 template<>
808 const Category Model<Category>::RowAtIndex(std::size_t index) const
809 {
810- Category mock_category(nullptr, nullptr, nullptr);
811- mock_category.id.SetGetterFunction([index] { return "cat"+std::to_string(index); });
812- mock_category.name.SetGetterFunction([index] { return "Category "+std::to_string(index); });
813- mock_category.icon_hint.SetGetterFunction([] { return "cmake"; });
814- mock_category.renderer_name.SetGetterFunction([] { return "grid"; });
815- mock_category.index.SetGetterFunction([index] { return index; });
816- return mock_category;
817-}
818-
819-}
820-}
821-
822-#endif // _UNITY_MOCK_CATEGORIES_H
823\ No newline at end of file
824+ return generate_mock_category(index);
825+}
826+
827+}
828+}
829+
830+#endif // _UNITY_MOCK_CATEGORIES_H
831
832=== modified file 'tests/MockResults.h'
833--- tests/MockResults.h 2013-07-09 17:25:50 +0000
834+++ tests/MockResults.h 2017-09-25 16:01:26 +0000
835@@ -26,19 +26,44 @@
836 namespace unity {
837 namespace dash {
838
839-struct MockResults : public Results
840+struct MockResult : Result
841+{
842+ MockResult(std::size_t index)
843+ : Result(nullptr, nullptr, nullptr)
844+ {
845+ uri.SetGetterFunction([index] { return "proto://result-" + std::to_string(index); });
846+ icon_hint.SetGetterFunction([index] { return "icon-result-" + std::to_string(index); });
847+ category_index.SetGetterFunction([index] { return 0; });
848+ result_type.SetGetterFunction([index] { return 0; });
849+ mimetype.SetGetterFunction([index] { return "mime-type-" + std::to_string(index); });
850+ name.SetGetterFunction([index] { return "MockResult " + std::to_string(index); });
851+ comment.SetGetterFunction([index] { return "Just a pointless result " + std::to_string(index); });
852+ dnd_uri.SetGetterFunction([index] { return "dnd://mock-result" + std::to_string(index); });
853+ hints.SetGetterFunction([index] { return glib::HintsMap(); });
854+ }
855+};
856+
857+struct MockResults : Results
858 {
859 MockResults(unsigned int count_)
860 : Results(LOCAL)
861 {
862 count.SetGetterFunction([count_] { return count_; });
863 }
864+
865+ const Result RowAtIndex(std::size_t index) const override
866+ {
867+ return MockResult(index);
868+ }
869 };
870
871 // Template specialization for Result in tests
872-template<> const Result Model<Result>::RowAtIndex(std::size_t index) const;
873-
874-}
875-}
876-
877-#endif
878\ No newline at end of file
879+template<> const Result Model<Result>::RowAtIndex(std::size_t index) const
880+{
881+ return MockResult(index);
882+}
883+
884+}
885+}
886+
887+#endif
888
889=== modified file 'tests/test-gestures/CMakeLists.txt'
890--- tests/test-gestures/CMakeLists.txt 2016-11-29 16:54:18 +0000
891+++ tests/test-gestures/CMakeLists.txt 2017-09-25 16:01:26 +0000
892@@ -75,5 +75,7 @@
893 add_test(UnityGTestGestures test-gestures)
894 add_dependencies(test-gestures gtest unity-core-${UNITY_API_VERSION})
895
896- add_custom_target (check-gestures COMMAND ./test-gestures DEPENDS test-gestures)
897+ add_custom_target (check-gestures COMMAND
898+ ./test-gestures --gtest_output=xml:${CMAKE_CURRENT_BINARY_DIR}/../test-gestures.xml
899+ DEPENDS test-gestures)
900 endif (GMOCK_SOURCE_DIR)
901
902=== modified file 'tests/test_bamf_application.cpp'
903--- tests/test_bamf_application.cpp 2016-11-29 14:43:12 +0000
904+++ tests/test_bamf_application.cpp 2017-09-25 16:01:26 +0000
905@@ -28,6 +28,31 @@
906
907 #include <UnityCore/GLibWrapper.h>
908
909+namespace unity
910+{
911+
912+bool operator==(ApplicationPtr const& lhs, ApplicationPtr const& rhs)
913+{
914+ return (lhs.get() == rhs.get() || (lhs && rhs && *lhs == *rhs));
915+}
916+
917+bool operator!=(ApplicationPtr const& lhs, ApplicationPtr const& rhs)
918+{
919+ return !(lhs == rhs);
920+}
921+
922+bool operator==(ApplicationWindowPtr const& lhs, ApplicationWindowPtr const& rhs)
923+{
924+ return (lhs.get() == rhs.get() || (lhs && rhs && *lhs == *rhs));
925+}
926+
927+bool operator!=(ApplicationWindowPtr const& lhs, ApplicationWindowPtr const& rhs)
928+{
929+ return !(lhs == rhs);
930+}
931+
932+}
933+
934 namespace {
935
936 unity::StandaloneWindow::Ptr AddFakeWindowToWM(Window xid, bool mapped)
937
938=== modified file 'tests/test_gnome_session_manager.cpp'
939--- tests/test_gnome_session_manager.cpp 2016-11-29 14:43:12 +0000
940+++ tests/test_gnome_session_manager.cpp 2017-09-25 16:01:26 +0000
941@@ -1139,7 +1139,7 @@
942 EXPECT_TRUE(unlock_emitted);
943 }
944
945-TEST_F(TestGnomeSessionManager, UNSTABLE_TEST(NoLockWhenLockingDisabled))
946+TEST_F(TestGnomeSessionManager, NoLockWhenLockingDisabled)
947 {
948 bool lock_emitted = false;
949 bool screensaver_emitted = false;
950
951=== modified file 'tests/test_icon_loader.cpp'
952--- tests/test_icon_loader.cpp 2015-10-16 08:46:28 +0000
953+++ tests/test_icon_loader.cpp 2017-09-25 16:01:26 +0000
954@@ -104,7 +104,7 @@
955 EXPECT_EQ(&icon_loader, &IconLoader::GetDefault());
956 }
957
958-TEST_F(TestIconLoader, UNSTABLE_TEST(TestGetOneIcon))
959+TEST_F(TestIconLoader, UNSTABLE_TEST (TestGetOneIcon))
960 {
961 LoadResult load_result;
962
963@@ -118,35 +118,35 @@
964 EXPECT_TRUE(IsValidPixbuf(load_result.pixbuf));
965 }
966
967-TEST_F(TestIconLoader, UNSTABLE_TEST(TestGetAnnotatedIcon))
968-{
969- LoadResult load_result;
970-
971- auto handle = icon_loader.LoadFromGIconString(". UnityProtocolAnnotatedIcon %7B'base-icon':%20%3C'cmake'%3E,%20'ribbon':%20%3C'foo'%3E%7D", -1, 48, sigc::mem_fun(load_result,
972- &LoadResult::IconLoaded));
973- handles_.push_back(handle);
974-
975- Utils::WaitPendingEvents(WAIT_TIMEOUT);
976- Utils::WaitUntilMSec(load_result.got_callback, WAIT_TIMEOUT);
977- EXPECT_TRUE(load_result.got_callback);
978- EXPECT_TRUE(IsValidPixbuf(load_result.pixbuf));
979-}
980-
981-TEST_F(TestIconLoader, UNSTABLE_TEST(TestGetColorizedIcon))
982-{
983- LoadResult load_result;
984-
985- auto handle = icon_loader.LoadFromGIconString(". UnityProtocolAnnotatedIcon %7B'base-icon':%20%3C'cmake'%3E,%20'colorize-value':%20%3Cuint32%204278190335%3E%7D", -1, 48, sigc::mem_fun(load_result,
986- &LoadResult::IconLoaded));
987- handles_.push_back(handle);
988-
989- Utils::WaitPendingEvents(WAIT_TIMEOUT);
990- Utils::WaitUntilMSec(load_result.got_callback, WAIT_TIMEOUT);
991- EXPECT_TRUE(load_result.got_callback);
992- EXPECT_TRUE(IsValidPixbuf(load_result.pixbuf));
993-}
994-
995-TEST_F(TestIconLoader, UNSTABLE_TEST(TestGetOneIconManyTimes))
996+TEST_F(TestIconLoader, TestGetAnnotatedIcon)
997+{
998+ LoadResult load_result;
999+
1000+ auto handle = icon_loader.LoadFromGIconString(". UnityProtocolAnnotatedIcon %7B'base-icon':%20%3C'python'%3E,%20'ribbon':%20%3C'foo'%3E%7D", -1, 48, sigc::mem_fun(load_result,
1001+ &LoadResult::IconLoaded));
1002+ handles_.push_back(handle);
1003+
1004+ Utils::WaitPendingEvents(WAIT_TIMEOUT);
1005+ Utils::WaitUntilMSec(load_result.got_callback, WAIT_TIMEOUT);
1006+ EXPECT_TRUE(load_result.got_callback);
1007+ EXPECT_TRUE(IsValidPixbuf(load_result.pixbuf));
1008+}
1009+
1010+TEST_F(TestIconLoader, TestGetColorizedIcon)
1011+{
1012+ LoadResult load_result;
1013+
1014+ auto handle = icon_loader.LoadFromGIconString(". UnityProtocolAnnotatedIcon %7B'base-icon':%20%3C'python'%3E,%20'colorize-value':%20%3Cuint32%204278190335%3E%7D", -1, 48, sigc::mem_fun(load_result,
1015+ &LoadResult::IconLoaded));
1016+ handles_.push_back(handle);
1017+
1018+ Utils::WaitPendingEvents(WAIT_TIMEOUT);
1019+ Utils::WaitUntilMSec(load_result.got_callback, WAIT_TIMEOUT);
1020+ EXPECT_TRUE(load_result.got_callback);
1021+ EXPECT_TRUE(IsValidPixbuf(load_result.pixbuf));
1022+}
1023+
1024+TEST_F(TestIconLoader, TestGetOneIconManyTimes)
1025 {
1026 std::vector<LoadResult> results;
1027 std::vector<IconLoader::Handle> handles;
1028@@ -176,7 +176,7 @@
1029 CheckResults(results);
1030 }
1031
1032-TEST_F(TestIconLoader, UNSTABLE_TEST(TestGetManyIcons))
1033+TEST_F(TestIconLoader, UNSTABLE_TEST (TestGetManyIcons))
1034 {
1035 std::vector<LoadResult> results;
1036 int i = 0;
1037@@ -198,7 +198,7 @@
1038 CheckResults(results);
1039 }
1040
1041-TEST_F(TestIconLoader, UNSTABLE_TEST(TestCancelSome))
1042+TEST_F(TestIconLoader, UNSTABLE_TEST (TestCancelSome))
1043 {
1044 std::vector<LoadResult> results;
1045 std::vector<IconLoader::Handle> handles;
1046
1047=== modified file 'tests/test_launcher_controller.cpp'
1048--- tests/test_launcher_controller.cpp 2016-11-29 14:43:12 +0000
1049+++ tests/test_launcher_controller.cpp 2017-09-25 16:01:26 +0000
1050@@ -1719,7 +1719,7 @@
1051 EXPECT_TRUE(lc.Impl()->expo_icon_->IsVisible());
1052 }
1053
1054-TEST_F(TestLauncherController, UpdateSelectionChanged)
1055+TEST_F(TestLauncherController, UNSTABLE_TEST(UpdateSelectionChanged))
1056 {
1057 UBusManager manager;
1058 std::string last_selection_change;
1059
1060=== modified file 'tests/test_previews_application.cpp'
1061--- tests/test_previews_application.cpp 2016-11-29 14:43:12 +0000
1062+++ tests/test_previews_application.cpp 2017-09-25 16:01:26 +0000
1063@@ -98,7 +98,7 @@
1064 nux::ObjectPtr<nux::BaseWindow> parent_window_;
1065 dash::Preview::Ptr preview_model_;
1066
1067- previews::Style panel_style;
1068+ previews::Style previews_style;
1069 dash::Style dash_style;
1070 ThumbnailGenerator thumbnail_generator;
1071 };
1072
1073=== modified file 'tests/test_previews_music_payment.cpp'
1074--- tests/test_previews_music_payment.cpp 2014-07-30 13:27:18 +0000
1075+++ tests/test_previews_music_payment.cpp 2017-09-25 16:01:26 +0000
1076@@ -125,8 +125,8 @@
1077 UnityProtocolPreviewPaymentType preview_type;
1078
1079 // needed for styles
1080+ previews::Style previews_style;
1081 dash::Style dash_style;
1082-
1083 };
1084
1085 TEST_F(TestMusicPaymentPreview, TestContentLoading)
1086
1087=== modified file 'tests/test_previews_payment.cpp'
1088--- tests/test_previews_payment.cpp 2014-07-11 03:02:01 +0000
1089+++ tests/test_previews_payment.cpp 2017-09-25 16:01:26 +0000
1090@@ -145,6 +145,7 @@
1091 dash::Preview::Ptr preview_model;
1092
1093 // needed for styles
1094+ previews::Style previews_style;
1095 dash::Style dash_style;
1096 };
1097
1098
1099=== modified file 'tests/test_showdesktop_handler.cpp'
1100--- tests/test_showdesktop_handler.cpp 2015-09-30 20:59:26 +0000
1101+++ tests/test_showdesktop_handler.cpp 2017-09-25 16:01:26 +0000
1102@@ -13,6 +13,11 @@
1103
1104 compiz::WindowInputRemoverInterface::~WindowInputRemoverInterface () {}
1105
1106+namespace
1107+{
1108+const float MAX_FLOAT_DISTANCE = 0.001f;
1109+}
1110+
1111 class MockWindowInputRemover :
1112 public compiz::WindowInputRemoverInterface
1113 {
1114@@ -405,9 +410,10 @@
1115 EXPECT_EQ (ShowdesktopHandler::animating_windows.size (), 1);
1116 }
1117
1118-TEST_F(UnityShowdesktopHandlerTest, UNSTABLE_TEST(TestAnimationOpacity))
1119+TEST_F(UnityShowdesktopHandlerTest, TestAnimationOpacity)
1120 {
1121 MockUnityShowdesktopHandlerWindow mMockWindow;
1122+ using namespace testing;
1123
1124 EXPECT_CALL (mMockWindow, GetInputRemover ()).WillOnce (Invoke (UnityShowdesktopHandlerTest::getLock <MockWindowInputRemoverTestFadeOutFadeIn>));
1125 ShowdesktopHandler mMockHandler (static_cast <ShowdesktopHandlerWindowInterface *> (&mMockWindow), static_cast <compiz::WindowInputRemoverLockAcquireInterface *> (&mMockWindow));
1126@@ -431,12 +437,13 @@
1127
1128 mMockHandler.Animate (1);
1129
1130- if (i == 300)
1131+ if (i == ShowdesktopHandler::fade_time)
1132 EXPECT_EQ (opacity, std::numeric_limits <unsigned short>::max ());
1133 else
1134 {
1135 float rem = opacity - std::numeric_limits <unsigned short>::max () * (1.0f - i / static_cast <float> (ShowdesktopHandler::fade_time));
1136- EXPECT_TRUE (rem <= 1.0f && rem >= -1.0f);
1137+ EXPECT_THAT(rem, AllOf(AnyOf(FloatNear(1.0f, MAX_FLOAT_DISTANCE), Lt(1.0f)),
1138+ AnyOf(FloatNear(-1.0f, MAX_FLOAT_DISTANCE), Gt(-1.0f))));
1139 }
1140 }
1141
1142@@ -449,12 +456,13 @@
1143
1144 mMockHandler.Animate (1);
1145
1146- if (i == 300)
1147+ if (i == ShowdesktopHandler::fade_time)
1148 EXPECT_EQ (opacity, std::numeric_limits <unsigned short>::max ());
1149 else
1150 {
1151 float rem = opacity - std::numeric_limits <unsigned short>::max () * (i / static_cast <float> (ShowdesktopHandler::fade_time));
1152- EXPECT_TRUE (rem <= 1.0f && rem >= -1.0f);
1153+ EXPECT_THAT(rem, AllOf(AnyOf(FloatNear(1.0f, MAX_FLOAT_DISTANCE), Lt(1.0f)),
1154+ AnyOf(FloatNear(-1.0f, MAX_FLOAT_DISTANCE), Gt(-1.0f))));
1155 }
1156 }
1157
1158
1159=== modified file 'tests/test_thumbnail_generator.cpp'
1160--- tests/test_thumbnail_generator.cpp 2017-04-25 17:58:05 +0000
1161+++ tests/test_thumbnail_generator.cpp 2017-09-25 16:01:26 +0000
1162@@ -107,7 +107,7 @@
1163 thumb->ready.connect(sigc::mem_fun(load_result, &LoadResult::ThumbnailReady));
1164 thumb->error.connect(sigc::mem_fun(load_result, &LoadResult::ThumbnailFailed));
1165
1166- Utils::WaitUntilMSec(load_result.got_callback);
1167+ Utils::WaitUntilMSec(load_result.got_callback, 1500);
1168
1169 EXPECT_TRUE(load_result.succeeded);
1170 glib::Object<GIcon> icon(g_icon_new_for_string(load_result.return_string.c_str(), NULL));
1171@@ -164,7 +164,7 @@
1172 thumb->ready.connect(sigc::mem_fun(load_result, &LoadResult::ThumbnailReady));
1173 thumb->error.connect(sigc::mem_fun(load_result, &LoadResult::ThumbnailFailed));
1174
1175- Utils::WaitUntilMSec(load_result.got_callback);
1176+ Utils::WaitUntilMSec(load_result.got_callback, 1500);
1177
1178 EXPECT_TRUE(load_result.succeeded);
1179 glib::Object<GIcon> icon(g_icon_new_for_string(load_result.return_string.c_str(), NULL));