diff options
| author | Marco Trevisan (TreviƱo) <mail@3v1n0.net> | 2017-09-25 16:03:32 +0000 |
|---|---|---|
| committer | Bileto Bot <ci-train-bot@canonical.com> | 2017-09-25 16:03:32 +0000 |
| commit | 294d975a32132d153aba0d6b33018d33cb4b27f6 (patch) | |
| tree | 34c83d606dc120fc1e14ac45594b0b7a31fd2a50 | |
| parent | 48c8ba20c3900f1455a0304099e7bad0ac7c2d17 (diff) | |
| parent | 823252e09794e5764aa6742beae8ca34abae40f2 (diff) | |
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 Approved by: Andrea Azzarone (bzr r4255)
| -rw-r--r-- | tests/CMakeLists.txt | 722 | ||||
| -rw-r--r-- | tests/MockCategories.h | 28 | ||||
| -rw-r--r-- | tests/MockResults.h | 31 | ||||
| -rw-r--r-- | tests/test-gestures/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | tests/test_bamf_application.cpp | 25 | ||||
| -rw-r--r-- | tests/test_gnome_session_manager.cpp | 2 | ||||
| -rw-r--r-- | tests/test_icon_loader.cpp | 16 | ||||
| -rw-r--r-- | tests/test_launcher_controller.cpp | 2 | ||||
| -rw-r--r-- | tests/test_previews_application.cpp | 2 | ||||
| -rw-r--r-- | tests/test_previews_music_payment.cpp | 2 | ||||
| -rw-r--r-- | tests/test_previews_payment.cpp | 1 | ||||
| -rw-r--r-- | tests/test_showdesktop_handler.cpp | 18 | ||||
| -rw-r--r-- | tests/test_thumbnail_generator.cpp | 4 |
13 files changed, 539 insertions, 318 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index c6ebb8f6e..58a8b1089 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -76,9 +76,115 @@ add_subdirectory (test-get-transients) enable_testing() +set (UNITY_TEST_XLESS_BINARIES "") +set (UNITY_TEST_XLESS_TARGETS "") + +set (UNITY_TEST_BINARIES "") +set (UNITY_TEST_TARGETS "") +set (UNITY_TEST_TARGETS_HEADLESS "") + +set (UNITY_TEST_SLOW_BINARIES "") +set (UNITY_TEST_SLOW_TARGETS "") +set (UNITY_TEST_SLOW_TARGETS_HEADLESS "") + +set (UNITY_TEST_DBUS_BINARIES "") +set (UNITY_TEST_DBUS_TARGETS "") + +set (DUMMY_XORG_TEST_RUNNER ${CMAKE_CURRENT_SOURCE_DIR}/dummy-xorg-test-runner.sh) +find_program (DBUS_RUN_SESSION dbus-run-session) + +function (to_camel_case input output) + string (REGEX MATCHALL "(^|[-_])([^-_]+)" matches ${input}) + + foreach (match ${matches}) + string (REGEX REPLACE "^[-_]" "" match ${match}) + string (SUBSTRING ${match} 0 1 head) + string (SUBSTRING ${match} 1 -1 tail) + string (TOUPPER ${head} head) + string (TOLOWER ${tail} tail) + string (CONCAT camel ${camel} ${head} ${tail}) + endforeach () + + set (${output} ${camel} PARENT_SCOPE) +endfunction () + +function (ensure_screaming_case input output) + set (screaming) + string (REPLACE "-" "_" screaming ${input}) + string (TOUPPER ${screaming} screaming) + + set (${output} ${screaming} PARENT_SCOPE) +endfunction () + +function (add_gtest basename) + set (options HAS_HEADLESS_TARGET HAS_CUSTOM_RUN_TARGETS) + set (oneValueArgs NAMESPACE) + set (multiValueArgs LIBS EXTRA_SOURCES) + cmake_parse_arguments (ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + set (test_binary test-${basename}) + string (REPLACE "-" "_" test_source ${test_binary}) + + to_camel_case (${ARGS_NAMESPACE} namespace_camel) + to_camel_case (${basename} basename_camel) + ensure_screaming_case (${ARGS_NAMESPACE} VAR_PREFIX) + + add_executable (${test_binary} ${test_source}.cpp ${ARGS_EXTRA_SOURCES}) + target_link_libraries (${test_binary} ${ARGS_LIBS}) + + add_test ("${namespace_camel}${basename_camel}" ${test_binary}) + set (${VAR_PREFIX}_BINARIES ${${VAR_PREFIX}_BINARIES} ${test_binary} PARENT_SCOPE) + + if (NOT ${ARGS_HAS_CUSTOM_RUN_TARGETS}) + set (run_target run-${test_binary}) + set (test_result ${CMAKE_CURRENT_BINARY_DIR}/${test_binary}.xml) + add_custom_target (${run_target} + COMMAND ./${test_binary} --gtest_output=xml:${test_result} + DEPENDS ${test_binary}) + add_custom_target (clean-${test_binary}-result COMMAND rm -f ${test_result}) + set (${VAR_PREFIX}_TARGETS ${${VAR_PREFIX}_TARGETS} ${run_target} PARENT_SCOPE) + + if (${ARGS_HAS_HEADLESS_TARGET}) + set (run_target run-${test_binary}-headless) + set (test_result ${CMAKE_CURRENT_BINARY_DIR}/${test_binary}-headless.xml) + add_custom_target (${run_target} + COMMAND env NUX_FALLBACK_TEXTURE=TRUE + ${DUMMY_XORG_TEST_RUNNER} + ${DBUS_RUN_SESSION} + ./${test_binary} --gtest_output=xml:${test_result} + DEPENDS ${test_binary}) + add_custom_target (clean-${test_binary}-headless-result COMMAND rm -f ${test_result}) + set (${VAR_PREFIX}_TARGETS_HEADLESS ${${VAR_PREFIX}_TARGETS_HEADLESS} ${run_target} PARENT_SCOPE) + endif (${ARGS_HAS_HEADLESS_TARGET}) + endif (NOT ${ARGS_HAS_CUSTOM_RUN_TARGETS}) + + # add_custom_command (OUTPUT ${test_result} COMMAND + # ./${test_binary} --gtest_output=xml:${test_result}) + # set (GTEST_RESULTS ${GTEST_RESULTS} ${test_result} PARENT_SCOPE) + + # add_custom_command (OUTPUT ${test_result} + # COMMAND env NUX_FALLBACK_TEXTURE=TRUE ${DUMMY_XORG_TEST_RUNNER} + # ./${test_binary} --gtest_output=xml:${test_result}) + # set (GTEST_RESULTS_HEADLESS ${GTEST_RESULTS_HEADLESS} ${test_result} PARENT_SCOPE) +endfunction () + if (GMOCK_LIB AND GMOCK_MAIN_LIB) + add_library (test-main-libs STATIC + test_main.cpp + logger_helper.cpp + ) + # Build plain C files separately so they don't try to include the + # C++ pch. + add_library (test-libs-c STATIC + bamf-mock-application.c + bamf-mock-window.c + gmockmount.c + gmockvolume.c + ${CMAKE_SOURCE_DIR}/services/panel-service.c + ) + # MockWindowManager add_library (unity_mock_window_manager STATIC MockWindowManager.cpp) @@ -105,266 +211,290 @@ if (GMOCK_LIB AND unity-shared ${LIBS}) -# gtest-slow, start moving things over that are slow running tests - set (GTEST_SLOW_SOURCES - test_main.cpp - logger_helper.cpp - mock-application.cpp - test_switcher_controller_slow.cpp - test_switcher_controller_class.cpp - test_tooltip_manager.cpp - ) + # The actual test executable (xless) - do not put anything that requires X in here - set (GTEST_SLOW_LIBS - gtest - gmock - launcher-lib - switcher-lib - unity-shared - unity-shared-standalone - ) + add_library (test-main-xless-libs STATIC + test_main_xless.cpp + logger_helper.cpp + ) - add_executable(test-gtest-slow ${GTEST_SLOW_SOURCES}) - target_link_libraries(test-gtest-slow ${GTEST_SLOW_LIBS}) - add_test(UnityGTestSlow test-gtest-slow) - -# The actual test executable (xless) - do not put anything that requires X in here - set (GTEST_XLESS_SOURCES - test_main_xless.cpp - mock-application.cpp - test_action_handle.cpp - test_abstract_interface_generator.cpp - test_animation_utils.cpp - test_connection_manager.cpp - test_delta_tracker.cpp - test_em_converter.cpp - test_glib_dbus_object.cpp - test_glib_cancellable.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_grabhandle.cpp - test_gsettings_scopes.cpp - test_desktop_utilities.cpp - test_desktop_application_subject.cpp - test_indicator.cpp - test_indicator_appmenu.cpp - test_indicator_entry.cpp - test_indicators.cpp - test_introspection_data.cpp - test_favorite_store.cpp - test_favorite_store_gsettings.cpp - test_favorite_store_private.cpp - test_launcher_entry_remote.cpp - test_launcher_options.cpp - test_layout_system.cpp - test_model_iterator.cpp - test_previews.cpp - test_raw_pixel.cpp - test_scope_data.cpp - test_time_util.cpp - test_ubus.cpp - test_unityshell_private.cpp - test_volume_imp.cpp - ${UNITY_SRC}/UnityshellPrivate.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 - ) - - set (GTEST_XLESS_LIBS - gtest - test-libs-c - unity-shared - unity-shared-standalone - launcher-lib - switcher-lib - ${GMOCK_LIB} - ${GMOCK_MAIN_LIB} - ${LIBS} - ) + function (add_unity_test_xless basename) + set (VAR_PREFIX "UNITY_TEST_XLESS") + set (UNITY_TEST_XLESS_LIBS + gtest + test-main-xless-libs + test-libs-c + unity-shared + unity-shared-standalone + launcher-lib + switcher-lib + ${GMOCK_LIB} + ${GMOCK_MAIN_LIB} + ${LIBS} + ) + + if (ENABLE_X_SUPPORT) + set (UNITY_TEST_XLESS_LIBS + ${UNITY_TEST_XLESS_LIBS} + shortcuts-lib + hud-lib + ) + endif () + + add_gtest (${basename} NAMESPACE ${VAR_PREFIX} LIBS "${${VAR_PREFIX}_LIBS}" ${ARGN}) + + set (${VAR_PREFIX}_BINARIES ${${VAR_PREFIX}_BINARIES} PARENT_SCOPE) + set (${VAR_PREFIX}_TARGETS ${${VAR_PREFIX}_TARGETS} PARENT_SCOPE) + endfunction () + + add_unity_test_xless (abstract-interface-generator) + add_unity_test_xless (action-handle) + add_unity_test_xless (animation-utils) + add_unity_test_xless (connection-manager) + add_unity_test_xless (delta-tracker) + add_unity_test_xless (desktop-application-subject) + add_unity_test_xless (desktop-utilities) + add_unity_test_xless (em-converter) + add_unity_test_xless (favorite-store) + add_unity_test_xless (favorite-store-gsettings) + add_unity_test_xless (favorite-store-private) + add_unity_test_xless (glib-cancellable) + add_unity_test_xless (glib-dbus-object) + add_unity_test_xless (glib-object EXTRA_SOURCES test_glib_object_utils.cpp) + add_unity_test_xless (glib-signals EXTRA_SOURCES test_glib_signals_utils.cpp) + add_unity_test_xless (glib-source) + add_unity_test_xless (glib-variant) + add_unity_test_xless (grabhandle + EXTRA_SOURCES + ${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) + add_unity_test_xless (gsettings-scopes) + add_unity_test_xless (indicator) + add_unity_test_xless (indicator-appmenu) + add_unity_test_xless (indicator-entry) + add_unity_test_xless (indicators) + add_unity_test_xless (introspection-data) + add_unity_test_xless (launcher-entry-remote) + add_unity_test_xless (launcher-options) + add_unity_test_xless (layout-system) + add_unity_test_xless (model-iterator) + add_unity_test_xless (previews) + add_unity_test_xless (raw-pixel) + add_unity_test_xless (scope-data) + add_unity_test_xless (time-util) + add_unity_test_xless (ubus) + add_unity_test_xless (unityshell-private EXTRA_SOURCES ${UNITY_SRC}/UnityshellPrivate.cpp) + add_unity_test_xless (volume-imp) if (ENABLE_X_SUPPORT) - set (GTEST_XLESS_SOURCES - ${GTEST_XLESS_SOURCES} - test_hud_private.cpp - test_pointer_barrier.cpp - test_shortcut_model.cpp - test_shortcut_private.cpp - ${LAUNCHER_SOURCES} - ) - set (GTEST_XLESS_LIBS - ${GTEST_XLESS_LIBS} - shortcuts-lib - hud-lib - ) + add_unity_test_xless (hud-private) + add_unity_test_xless (pointer-barrier) + add_unity_test_xless (shortcut-model) + add_unity_test_xless (shortcut-private) endif () - add_executable(test-gtest-xless ${GTEST_XLESS_SOURCES}) - target_link_libraries(test-gtest-xless ${GTEST_XLESS_LIBS}) - add_test(UnityGTestXless test-gtest-xless) - -# tests that require dbus, must not require X - add_executable(test-gtest-dbus - test_categories.cpp - test_dbus_indicators.cpp - test_filter.cpp - test_glib_dbus_proxy.cpp - test_hud.cpp - test_main_dbus.cpp - test_model.cpp - test_utils.h - test_ratings_filter.cpp - test_results.cpp - test_scope.cpp - test_scope_filter.cpp - #test_scope_proxy.cpp - test_tracks.cpp - ) - target_link_libraries(test-gtest-dbus gtest unity-shared ${LIBS}) - add_test(UnityGTestDBus test-gtest-dbus) - add_dependencies(test-gtest-dbus unity-core-${UNITY_API_VERSION} unity-shared test-gtest-service gtest) + # tests that require dbus, must not require X + add_library (test-main-dbus-libs STATIC + test_main_dbus.cpp + logger_helper.cpp + ) + function (add_unity_test_dbus basename) + set (VAR_PREFIX "UNITY_TEST_DBUS") + set (UNITY_TEST_DBUS_LIBS gtest unity-shared test-main-dbus-libs ${LIBS}) + + set (test_binary test-${basename}) + add_custom_target (run-${test_binary} + COMMAND dbus-test-runner --max-wait=300 --task + ./test-gtest-service --task-name test-service + --task=./${test_binary} --task-name=${test_binary} + --wait-for=com.canonical.Unity.Test + --parameter=--gtest_output=xml:./${test_binary}.xml + DEPENDS ${test_binary} test-gtest-service) + add_custom_target (clean-${test_binary}-result COMMAND rm -f ${test_result}) + set (${VAR_PREFIX}_TARGETS ${${VAR_PREFIX}_TARGETS} run-${test_binary}) + + add_gtest (${basename} NAMESPACE ${VAR_PREFIX} LIBS "${${VAR_PREFIX}_LIBS}" HAS_CUSTOM_RUN_TARGETS ${ARGN}) + + set (${VAR_PREFIX}_BINARIES ${${VAR_PREFIX}_BINARIES} PARENT_SCOPE) + set (${VAR_PREFIX}_TARGETS ${${VAR_PREFIX}_TARGETS} PARENT_SCOPE) + endfunction () + + # test-gtest-dbus + add_unity_test_dbus (categories) + add_unity_test_dbus (dbus-indicators) + add_unity_test_dbus (filter) + add_unity_test_dbus (glib-dbus-proxy) + add_unity_test_dbus (hud) + add_unity_test_dbus (main-dbus) + add_unity_test_dbus (model) + add_unity_test_dbus (ratings-filter) + add_unity_test_dbus (results) + add_unity_test_dbus (scope) + add_unity_test_dbus (scope-filter) + add_unity_test_dbus (scope-proxy) + add_unity_test_dbus (tracks) + + # Tests that require X if (ENABLE_X_SUPPORT) -# Tests that require X - add_executable(test-gtest - mock-application.cpp - mock_results.cpp - logger_helper.cpp - test_main.cpp - test_action_link.cpp - test_application_launcher_icon.cpp - test_bamf_application.cpp - test_bfb_launcher_icon.cpp - test_decorations_input_mixer.cpp - test_decorations_widgets.cpp - test_dashview.cpp - test_dashview_impl.cpp - test_dash_controller.cpp - test_desktop_launcher_icon.cpp - test_device_launcher_section.cpp - test_error_preview.cpp - test_edge_barrier_controller.cpp - test_expo_launcher_icon.cpp - test_file_manager_launcher_icon.cpp - test_filter_widgets.cpp - test_glib_dbus_server.cpp - test_gnome_session_manager.cpp - test_gtk_icon_info.cpp - test_hud_button.cpp - test_hud_controller.cpp - test_hud_launcher_icon.cpp - test_hud_view.cpp - test_icon_loader.cpp - test_im_text_entry.cpp - test_keyboard_util.cpp - test_launcher.cpp - test_launcher_controller.cpp - test_launcher_drag_window.cpp - test_launcher_hide_machine.cpp - test_launcher_hover_machine.cpp - test_launcher_icon.cpp - test_launcher_minimize_speed.cpp - test_launcher_model.cpp - test_launcher_tooltip.cpp - test_lockscreen_controller.cpp - test_panel_controller.cpp - test_panel_indicators_view.cpp - test_panel_indicator_entry_dropdown_view.cpp - test_panel_menu_view.cpp - test_panel_service.cpp - test_panel_style.cpp - test_panel_tray.cpp - test_panel_view.cpp - test_places_group.cpp - test_preview_player.cpp - test_previews_application.cpp - test_previews_generic.cpp - test_previews_movie.cpp - test_previews_music.cpp - test_previews_music_payment.cpp - test_previews_payment.cpp - test_previews_social.cpp - test_quicklist_manager.cpp - test_quicklist_menu_item.cpp - test_quicklist_view.cpp - test_result_renderer.cpp - test_resultviewgrid.cpp - test_scope_bar.cpp - test_scope_view.cpp - test_screensaver_dbus_manager.cpp - test_searchbar.cpp - test_session_button.cpp - test_session_controller.cpp - test_session_view.cpp - test_shortcut_controller.cpp - test_shortcut_modeller_compiz.cpp - test_shortcut_view.cpp - test_single_monitor_launcher_icon.cpp - test_showdesktop_handler.cpp - test_software_center_launcher_icon.cpp - test_spread_filter.cpp - test_static_cairo_text.cpp - test_switcher_controller.cpp - test_switcher_controller_class.cpp - test_switcher_model.cpp - test_switcher_view.cpp - test_systemd_wrapper.cpp - test_tabiterator.cpp - test_texture_cache.cpp - test_text_input.cpp - test_thumbnail_generator.cpp - test_trash_launcher_icon.cpp - test_unity_settings.cpp - test_unity_window_style.cpp - test_unity_window_view.cpp - test_upstart_wrapper.cpp - test_user_authenticator_pam.cpp - test_volume_launcher_icon.cpp - test_window_buttons.cpp - test_xdnd_manager_imp.cpp - test_xdnd_start_stop_notifier_imp.cpp - ${UNITY_SRC}/UnityShowdesktopHandler.cpp - ${CMAKE_SOURCE_DIR}/plugins/unityshell/src/WindowMinimizeSpeedController.cpp - ${CMAKE_SOURCE_DIR}/services/panel-service.c - ) - # Build plain C files separately so they don't try to include the - # C++ pch. - add_library(test-libs-c STATIC - bamf-mock-application.c - bamf-mock-window.c - gmockmount.c - gmockvolume.c - ) + function (add_unity_test basename #[[extra_sources]]) + set (VAR_PREFIX UNITY_TEST) + set (UNITY_TEST_LIBS + test-main-libs + test-libs-c + ${LIBS} + gtest + gmock + dash-lib + decorations-lib + hud-lib + launcher-lib + lockscreen-lib + panel-lib + pam + previews-lib + shortcuts-lib + shutdown-lib + switcher-lib + unity-shared + unity-shared-bamf + unity-shared-standalone) + + add_gtest (${basename} NAMESPACE ${VAR_PREFIX} LIBS "${${VAR_PREFIX}_LIBS}" HAS_HEADLESS_TARGET ${ARGN}) + + set (${VAR_PREFIX}_BINARIES ${${VAR_PREFIX}_BINARIES} PARENT_SCOPE) + set (${VAR_PREFIX}_TARGETS ${${VAR_PREFIX}_TARGETS} PARENT_SCOPE) + set (${VAR_PREFIX}_TARGETS_HEADLESS ${${VAR_PREFIX}_TARGETS_HEADLESS} PARENT_SCOPE) + endfunction () + + add_unity_test (action-link) + add_unity_test (application-launcher-icon EXTRA_SOURCES mock-application.cpp) + add_unity_test (bamf-application EXTRA_SOURCES mock-application.cpp) + add_unity_test (bfb-launcher-icon) + add_unity_test (decorations-input-mixer) + add_unity_test (decorations-widgets) + add_unity_test (dashview) + add_unity_test (dashview-impl) + add_unity_test (dash-controller) + add_unity_test (desktop-launcher-icon) + add_unity_test (device-launcher-section) + add_unity_test (error-preview) + add_unity_test (edge-barrier-controller) + add_unity_test (expo-launcher-icon) + add_unity_test (file-manager-launcher-icon) + add_unity_test (filter-widgets) + add_unity_test (glib-dbus-server) + add_unity_test (gnome-session-manager) + add_unity_test (gtk-icon-info) + add_unity_test (hud-button) + add_unity_test (hud-controller) + add_unity_test (hud-launcher-icon) + add_unity_test (hud-view) + add_unity_test (icon-loader) + add_unity_test (im-text-entry) + add_unity_test (keyboard-util) + add_unity_test (launcher EXTRA_SOURCES mock-application.cpp) + add_unity_test (launcher-controller EXTRA_SOURCES mock-application.cpp) + add_unity_test (launcher-drag-window) + add_unity_test (launcher-hide-machine) + add_unity_test (launcher-hover-machine) + add_unity_test (launcher-icon) + add_unity_test (launcher-minimize-speed + EXTRA_SOURCES + ${CMAKE_SOURCE_DIR}/plugins/unityshell/src/WindowMinimizeSpeedController.cpp) + add_unity_test (launcher-model) + add_unity_test (launcher-tooltip) + add_unity_test (lockscreen-controller) + add_unity_test (panel-controller) + add_unity_test (panel-indicators-view) + add_unity_test (panel-indicator-entry-dropdown-view) + add_unity_test (panel-menu-view) + add_unity_test (panel-service) + add_unity_test (panel-style) + add_unity_test (panel-tray) + add_unity_test (panel-view) + add_unity_test (places-group) + add_unity_test (preview-player) + add_unity_test (previews-application) + add_unity_test (previews-generic) + add_unity_test (previews-movie) + add_unity_test (previews-music) + add_unity_test (previews-music-payment) + add_unity_test (previews-payment) + add_unity_test (previews-social) + add_unity_test (quicklist-manager) + add_unity_test (quicklist-menu-item) + add_unity_test (quicklist-view) + add_unity_test (result-renderer) + add_unity_test (resultviewgrid) + add_unity_test (scope-bar) + add_unity_test (scope-view) + add_unity_test (screensaver-dbus-manager) + add_unity_test (searchbar) + add_unity_test (session-button) + add_unity_test (session-controller) + add_unity_test (session-view) + add_unity_test (shortcut-controller) + add_unity_test (shortcut-modeller-compiz) + add_unity_test (shortcut-view) + add_unity_test (single-monitor-launcher-icon) + add_unity_test (showdesktop-handler + EXTRA_SOURCES ${UNITY_SRC}/UnityShowdesktopHandler.cpp) + add_unity_test (software-center-launcher-icon EXTRA_SOURCES mock-application.cpp) + add_unity_test (spread-filter) + add_unity_test (static-cairo-text) + add_unity_test (switcher-controller + EXTRA_SOURCES test_switcher_controller_class.cpp) + add_unity_test (switcher-model) + add_unity_test (switcher-view) + add_unity_test (systemd-wrapper) + add_unity_test (tabiterator) + add_unity_test (texture-cache) + add_unity_test (text-input) + add_unity_test (thumbnail-generator) + add_unity_test (trash-launcher-icon EXTRA_SOURCES mock-application.cpp) + add_unity_test (unity-settings) + add_unity_test (unity-window-style) + add_unity_test (unity-window-view) + add_unity_test (upstart-wrapper) + add_unity_test (user-authenticator-pam) + add_unity_test (volume-launcher-icon) + add_unity_test (window-buttons) + add_unity_test (xdnd-manager-imp) + add_unity_test (xdnd-start-stop-notifier-imp) + + # + # Slow tests + # + function (add_unity_test_slow basename) + set (VAR_PREFIX "UNITY_TEST_SLOW") + set (UNITY_TEST_SLOW_LIBS + test-main-libs + gtest + gmock + launcher-lib + switcher-lib + unity-shared + unity-shared-standalone + ) + + add_gtest (${basename} NAMESPACE ${VAR_PREFIX} LIBS "${${VAR_PREFIX}_LIBS}" HAS_HEADLESS_TARGET ${ARGN}) + + set (${VAR_PREFIX}_BINARIES ${${VAR_PREFIX}_BINARIES} PARENT_SCOPE) + set (${VAR_PREFIX}_TARGETS ${${VAR_PREFIX}_TARGETS} PARENT_SCOPE) + set (${VAR_PREFIX}_TARGETS_HEADLESS ${${VAR_PREFIX}_TARGETS_HEADLESS} PARENT_SCOPE) + endfunction () + + add_unity_test_slow (switcher-controller-slow + EXTRA_SOURCES + test_switcher_controller_class.cpp + mock-application.cpp) + add_unity_test_slow (tooltip-manager) - target_link_libraries(test-gtest - ${LIBS} - test-libs-c - gtest - gmock - dash-lib - decorations-lib - hud-lib - launcher-lib - lockscreen-lib - panel-lib - pam - previews-lib - shortcuts-lib - shutdown-lib - switcher-lib - unity-shared - unity-shared-bamf - unity-shared-standalone) - add_test(UnityGTest test-gtest) endif (ENABLE_X_SUPPORT) endif (GMOCK_LIB AND GMOCK_MAIN_LIB) @@ -376,49 +506,69 @@ endif() # # 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 (DUMMY_XORG_TEST_RUNNER ${CMAKE_CURRENT_SOURCE_DIR}/dummy-xorg-test-runner.sh) -if (ENABLE_X_SUPPORT) - set (GTEST_TEST_COMMAND ./test-gtest --gtest_output=xml:./test-gtest.xml) - set (GTEST_TEST_COMMAND_GESTURES ./test-gestures/test-gestures --gtest_output=xml:./test-gestures.xml) -endif (ENABLE_X_SUPPORT) -set (GTEST_TEST_COMMAND_XLESS ./test-gtest-xless --gtest_output=xml:./test-gtest-xless.xml) -set (GTEST_TEST_COMMAND_SLOW ./test-gtest-slow --gtest_output=xml:./test-gtest-slow.xml) -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*) - -set (TEST_COMMAND_XLESS - ${GTEST_TEST_COMMAND_XLESS} - && ${GTEST_TEST_COMMAND_GESTURES} - && ${GTEST_TEST_COMMAND_DBUS}) - -set (TEST_COMMAND - ${GTEST_TEST_COMMAND} - && ${GTEST_TEST_COMMAND_SLOW} - && ${TEST_COMMAND_XLESS}) - -set (TEST_COMMAND_HEADLESS - export NUX_FALLBACK_TEXTURE=TRUE - && ${DUMMY_XORG_TEST_RUNNER} ${GTEST_TEST_COMMAND} - && ${DUMMY_XORG_TEST_RUNNER} ${GTEST_TEST_COMMAND_SLOW} - && ${TEST_COMMAND_XLESS}) - if (GMOCK_SOURCE_DIR) + add_custom_target (tests-xless DEPENDS ${UNITY_TEST_XLESS_BINARIES}) + add_custom_target (test-gtest-xless DEPENDS tests-xless) + add_custom_target (check-xless DEPENDS ${UNITY_TEST_XLESS_TARGETS}) + + add_custom_target (tests-dbus DEPENDS ${UNITY_TEST_DBUS_BINARIES}) + add_custom_target (test-gtest-dbus DEPENDS tests-dbus) + add_custom_target (check-dbus DEPENDS ${UNITY_TEST_DBUS_TARGETS}) + + add_custom_target (clean-tests-results COMMAND rm -f ${CMAKE_CURRENT_BINARY_DIR}/test-*.xml) + if (ENABLE_X_SUPPORT) - add_custom_target (check COMMAND ${TEST_COMMAND} DEPENDS test-gtest test-gtest-slow test-gtest-xless test-gtest-dbus test-gestures) - add_custom_target (check-headless COMMAND ${TEST_COMMAND_HEADLESS} DEPENDS test-gtest test-gtest-slow test-gtest-xless test-gtest-dbus test-gestures) - add_custom_target (gcheck COMMAND ${DBUS_TEST_COMMAND} DEPENDS test-gtest test-gtest-xless) + add_custom_target (test-gtest DEPENDS ${UNITY_TEST_BINARIES}) + add_custom_target (check-gtest DEPENDS ${UNITY_TEST_TARGETS}) + add_custom_target (check-gtest-headless DEPENDS ${UNITY_TEST_TARGETS_HEADLESS}) + + add_custom_target (test-gtest-slow DEPENDS ${UNITY_TEST_SLOW_BINARIES}) + add_custom_target (check-gtest-slow DEPENDS ${UNITY_TEST_SLOW_TARGETS}) + add_custom_target (check-gtest-slow-headless DEPENDS ${UNITY_TEST_SLOW_TARGETS_HEADLESS}) + + add_custom_target (tests DEPENDS + test-gtest + test-gtest-slow + test-gtest-xless + test-gtest-dbus + test-gestures + ) + + add_custom_target (check DEPENDS + check-xless + check-gestures + check-gtest + check-gtest-slow + check-dbus + ) + + add_custom_target (check-headless DEPENDS + check-xless + check-gestures + check-gtest-headless + check-gtest-slow-headless + check-dbus + ) + + add_custom_target (gcheck DEPENDS check) else () - add_custom_target (check COMMAND ${TEST_COMMAND} DEPENDS test-gtest-xless test-gtest-dbus) - add_custom_target (check-headless COMMAND ${TEST_COMMAND_XLESS} DEPENDS test-gtest-xless test-gtest-dbus) - add_custom_target (gcheck COMMAND ${DBUS_TEST_COMMAND} DEPENDS test-gtest-xless) + add_custom_target (tests DEPENDS + test-gtest-xless + test-gtest-dbus + ) + + add_custom_target (check DEPENDS + check-xless + check-dbus) + + add_custom_target (check-headless DEPENDS check) + add_custom_target (gcheck DEPENDS check) endif () - add_custom_target (check-report COMMAND ${TEST_UNIT_COMMAND} && gtester-report ${TEST_RESULT_XML} > ${TEST_RESULT_HTML}) + endif (GMOCK_SOURCE_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 python2.7 setup.py install --prefix ${CMAKE_INSTALL_PREFIX} WORKING_DIRECTORY ${AUTOPILOTDIR})") add_custom_target (autopilot COMMAND cd ${AUTOPILOTDIR} && make check) - diff --git a/tests/MockCategories.h b/tests/MockCategories.h index c7458623a..604022b9d 100644 --- a/tests/MockCategories.h +++ b/tests/MockCategories.h @@ -28,29 +28,39 @@ namespace unity namespace dash { -struct MockCategories : public Categories +Category generate_mock_category(size_t index) +{ + Category mock_category(nullptr, nullptr, nullptr); + mock_category.id.SetGetterFunction([index] { return "mock-cat"+std::to_string(index); }); + mock_category.name.SetGetterFunction([index] { return "MockCategory "+std::to_string(index); }); + mock_category.icon_hint.SetGetterFunction([index] { return "mock-category-icon-"+std::to_string(index); }); + mock_category.renderer_name.SetGetterFunction([] { return "grid"; }); + mock_category.index.SetGetterFunction([index] { return index; }); + return mock_category; +} + +struct MockCategories : Categories { MockCategories(unsigned count_) : Categories(LOCAL) { count.SetGetterFunction([count_] { return count_; }); } + + const Category RowAtIndex(std::size_t index) const override + { + return generate_mock_category(index); + } }; // Template specialization for Category in tests template<> const Category Model<Category>::RowAtIndex(std::size_t index) const { - Category mock_category(nullptr, nullptr, nullptr); - mock_category.id.SetGetterFunction([index] { return "cat"+std::to_string(index); }); - mock_category.name.SetGetterFunction([index] { return "Category "+std::to_string(index); }); - mock_category.icon_hint.SetGetterFunction([] { return "cmake"; }); - mock_category.renderer_name.SetGetterFunction([] { return "grid"; }); - mock_category.index.SetGetterFunction([index] { return index; }); - return mock_category; + return generate_mock_category(index); } } } -#endif // _UNITY_MOCK_CATEGORIES_H \ No newline at end of file +#endif // _UNITY_MOCK_CATEGORIES_H diff --git a/tests/MockResults.h b/tests/MockResults.h index 0eacdfaec..1bd20a6d8 100644 --- a/tests/MockResults.h +++ b/tests/MockResults.h @@ -26,19 +26,44 @@ namespace unity { namespace dash { -struct MockResults : public Results +struct MockResult : Result +{ + MockResult(std::size_t index) + : Result(nullptr, nullptr, nullptr) + { + uri.SetGetterFunction([index] { return "proto://result-" + std::to_string(index); }); + icon_hint.SetGetterFunction([index] { return "icon-result-" + std::to_string(index); }); + category_index.SetGetterFunction([index] { return 0; }); + result_type.SetGetterFunction([index] { return 0; }); + mimetype.SetGetterFunction([index] { return "mime-type-" + std::to_string(index); }); + name.SetGetterFunction([index] { return "MockResult " + std::to_string(index); }); + comment.SetGetterFunction([index] { return "Just a pointless result " + std::to_string(index); }); + dnd_uri.SetGetterFunction([index] { return "dnd://mock-result" + std::to_string(index); }); + hints.SetGetterFunction([index] { return glib::HintsMap(); }); + } +}; + +struct MockResults : Results { MockResults(unsigned int count_) : Results(LOCAL) { count.SetGetterFunction([count_] { return count_; }); } + + const Result RowAtIndex(std::size_t index) const override + { + return MockResult(index); + } }; // Template specialization for Result in tests -template<> const Result Model<Result>::RowAtIndex(std::size_t index) const; +template<> const Result Model<Result>::RowAtIndex(std::size_t index) const +{ + return MockResult(index); +} } } -#endif \ No newline at end of file +#endif diff --git a/tests/test-gestures/CMakeLists.txt b/tests/test-gestures/CMakeLists.txt index 193e0db18..a0e1a5517 100644 --- a/tests/test-gestures/CMakeLists.txt +++ b/tests/test-gestures/CMakeLists.txt @@ -75,5 +75,7 @@ if (GMOCK_SOURCE_DIR) add_test(UnityGTestGestures test-gestures) add_dependencies(test-gestures gtest unity-core-${UNITY_API_VERSION}) - add_custom_target (check-gestures COMMAND ./test-gestures DEPENDS test-gestures) + add_custom_target (check-gestures COMMAND + ./test-gestures --gtest_output=xml:${CMAKE_CURRENT_BINARY_DIR}/../test-gestures.xml + DEPENDS test-gestures) endif (GMOCK_SOURCE_DIR) diff --git a/tests/test_bamf_application.cpp b/tests/test_bamf_application.cpp index 9557af7e8..9e0812d2c 100644 --- a/tests/test_bamf_application.cpp +++ b/tests/test_bamf_application.cpp @@ -28,6 +28,31 @@ #include <UnityCore/GLibWrapper.h> +namespace unity +{ + +bool operator==(ApplicationPtr const& lhs, ApplicationPtr const& rhs) +{ + return (lhs.get() == rhs.get() || (lhs && rhs && *lhs == *rhs)); +} + +bool operator!=(ApplicationPtr const& lhs, ApplicationPtr const& rhs) +{ + return !(lhs == rhs); +} + +bool operator==(ApplicationWindowPtr const& lhs, ApplicationWindowPtr const& rhs) +{ + return (lhs.get() == rhs.get() || (lhs && rhs && *lhs == *rhs)); +} + +bool operator!=(ApplicationWindowPtr const& lhs, ApplicationWindowPtr const& rhs) +{ + return !(lhs == rhs); +} + +} + namespace { unity::StandaloneWindow::Ptr AddFakeWindowToWM(Window xid, bool mapped) diff --git a/tests/test_gnome_session_manager.cpp b/tests/test_gnome_session_manager.cpp index a5ba3eed4..d44dd0a20 100644 --- a/tests/test_gnome_session_manager.cpp +++ b/tests/test_gnome_session_manager.cpp @@ -1139,7 +1139,7 @@ TEST_F(TestGnomeSessionManager, LogindUnLock) EXPECT_TRUE(unlock_emitted); } -TEST_F(TestGnomeSessionManager, UNSTABLE_TEST(NoLockWhenLockingDisabled)) +TEST_F(TestGnomeSessionManager, NoLockWhenLockingDisabled) { bool lock_emitted = false; bool screensaver_emitted = false; diff --git a/tests/test_icon_loader.cpp b/tests/test_icon_loader.cpp index e6cfbfc08..852f88701 100644 --- a/tests/test_icon_loader.cpp +++ b/tests/test_icon_loader.cpp @@ -104,7 +104,7 @@ TEST_F(TestIconLoader, TestGetDefault) EXPECT_EQ(&icon_loader, &IconLoader::GetDefault()); } -TEST_F(TestIconLoader, UNSTABLE_TEST(TestGetOneIcon)) +TEST_F(TestIconLoader, UNSTABLE_TEST (TestGetOneIcon)) { LoadResult load_result; @@ -118,11 +118,11 @@ TEST_F(TestIconLoader, UNSTABLE_TEST(TestGetOneIcon)) EXPECT_TRUE(IsValidPixbuf(load_result.pixbuf)); } -TEST_F(TestIconLoader, UNSTABLE_TEST(TestGetAnnotatedIcon)) +TEST_F(TestIconLoader, TestGetAnnotatedIcon) { LoadResult load_result; - 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, + 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, &LoadResult::IconLoaded)); handles_.push_back(handle); @@ -132,11 +132,11 @@ TEST_F(TestIconLoader, UNSTABLE_TEST(TestGetAnnotatedIcon)) EXPECT_TRUE(IsValidPixbuf(load_result.pixbuf)); } -TEST_F(TestIconLoader, UNSTABLE_TEST(TestGetColorizedIcon)) +TEST_F(TestIconLoader, TestGetColorizedIcon) { LoadResult load_result; - 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, + 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, &LoadResult::IconLoaded)); handles_.push_back(handle); @@ -146,7 +146,7 @@ TEST_F(TestIconLoader, UNSTABLE_TEST(TestGetColorizedIcon)) EXPECT_TRUE(IsValidPixbuf(load_result.pixbuf)); } -TEST_F(TestIconLoader, UNSTABLE_TEST(TestGetOneIconManyTimes)) +TEST_F(TestIconLoader, TestGetOneIconManyTimes) { std::vector<LoadResult> results; std::vector<IconLoader::Handle> handles; @@ -176,7 +176,7 @@ TEST_F(TestIconLoader, UNSTABLE_TEST(TestGetOneIconManyTimes)) CheckResults(results); } -TEST_F(TestIconLoader, UNSTABLE_TEST(TestGetManyIcons)) +TEST_F(TestIconLoader, UNSTABLE_TEST (TestGetManyIcons)) { std::vector<LoadResult> results; int i = 0; @@ -198,7 +198,7 @@ TEST_F(TestIconLoader, UNSTABLE_TEST(TestGetManyIcons)) CheckResults(results); } -TEST_F(TestIconLoader, UNSTABLE_TEST(TestCancelSome)) +TEST_F(TestIconLoader, UNSTABLE_TEST (TestCancelSome)) { std::vector<LoadResult> results; std::vector<IconLoader::Handle> handles; diff --git a/tests/test_launcher_controller.cpp b/tests/test_launcher_controller.cpp index 3c99ca414..6a6df5c48 100644 --- a/tests/test_launcher_controller.cpp +++ b/tests/test_launcher_controller.cpp @@ -1719,7 +1719,7 @@ TEST_F(TestLauncherController, UpdateNumWorkspacesEnable) EXPECT_TRUE(lc.Impl()->expo_icon_->IsVisible()); } -TEST_F(TestLauncherController, UpdateSelectionChanged) +TEST_F(TestLauncherController, UNSTABLE_TEST(UpdateSelectionChanged)) { UBusManager manager; std::string last_selection_change; diff --git a/tests/test_previews_application.cpp b/tests/test_previews_application.cpp index b0b8fe1ba..77ea7cc20 100644 --- a/tests/test_previews_application.cpp +++ b/tests/test_previews_application.cpp @@ -98,7 +98,7 @@ public: nux::ObjectPtr<nux::BaseWindow> parent_window_; dash::Preview::Ptr preview_model_; - previews::Style panel_style; + previews::Style previews_style; dash::Style dash_style; ThumbnailGenerator thumbnail_generator; }; diff --git a/tests/test_previews_music_payment.cpp b/tests/test_previews_music_payment.cpp index 637b00c8d..daa6a3b47 100644 --- a/tests/test_previews_music_payment.cpp +++ b/tests/test_previews_music_payment.cpp @@ -125,8 +125,8 @@ class TestMusicPaymentPreview : public ::testing::Test UnityProtocolPreviewPaymentType preview_type; // needed for styles + previews::Style previews_style; dash::Style dash_style; - }; TEST_F(TestMusicPaymentPreview, TestContentLoading) diff --git a/tests/test_previews_payment.cpp b/tests/test_previews_payment.cpp index a395ce0aa..53f541743 100644 --- a/tests/test_previews_payment.cpp +++ b/tests/test_previews_payment.cpp @@ -145,6 +145,7 @@ class TestPaymentPreview : public ::testing::Test dash::Preview::Ptr preview_model; // needed for styles + previews::Style previews_style; dash::Style dash_style; }; diff --git a/tests/test_showdesktop_handler.cpp b/tests/test_showdesktop_handler.cpp index b7831754e..2bfa33d84 100644 --- a/tests/test_showdesktop_handler.cpp +++ b/tests/test_showdesktop_handler.cpp @@ -13,6 +13,11 @@ using ::testing::InSequence; compiz::WindowInputRemoverInterface::~WindowInputRemoverInterface () {} +namespace +{ +const float MAX_FLOAT_DISTANCE = 0.001f; +} + class MockWindowInputRemover : public compiz::WindowInputRemoverInterface { @@ -405,9 +410,10 @@ TEST_F(UnityShowdesktopHandlerTest, TestAnimationPostPaintActions) EXPECT_EQ (ShowdesktopHandler::animating_windows.size (), 1); } -TEST_F(UnityShowdesktopHandlerTest, UNSTABLE_TEST(TestAnimationOpacity)) +TEST_F(UnityShowdesktopHandlerTest, TestAnimationOpacity) { MockUnityShowdesktopHandlerWindow mMockWindow; + using namespace testing; EXPECT_CALL (mMockWindow, GetInputRemover ()).WillOnce (Invoke (UnityShowdesktopHandlerTest::getLock <MockWindowInputRemoverTestFadeOutFadeIn>)); ShowdesktopHandler mMockHandler (static_cast <ShowdesktopHandlerWindowInterface *> (&mMockWindow), static_cast <compiz::WindowInputRemoverLockAcquireInterface *> (&mMockWindow)); @@ -431,12 +437,13 @@ TEST_F(UnityShowdesktopHandlerTest, UNSTABLE_TEST(TestAnimationOpacity)) mMockHandler.Animate (1); - if (i == 300) + if (i == ShowdesktopHandler::fade_time) EXPECT_EQ (opacity, std::numeric_limits <unsigned short>::max ()); else { float rem = opacity - std::numeric_limits <unsigned short>::max () * (1.0f - i / static_cast <float> (ShowdesktopHandler::fade_time)); - EXPECT_TRUE (rem <= 1.0f && rem >= -1.0f); + EXPECT_THAT(rem, AllOf(AnyOf(FloatNear(1.0f, MAX_FLOAT_DISTANCE), Lt(1.0f)), + AnyOf(FloatNear(-1.0f, MAX_FLOAT_DISTANCE), Gt(-1.0f)))); } } @@ -449,12 +456,13 @@ TEST_F(UnityShowdesktopHandlerTest, UNSTABLE_TEST(TestAnimationOpacity)) mMockHandler.Animate (1); - if (i == 300) + if (i == ShowdesktopHandler::fade_time) EXPECT_EQ (opacity, std::numeric_limits <unsigned short>::max ()); else { float rem = opacity - std::numeric_limits <unsigned short>::max () * (i / static_cast <float> (ShowdesktopHandler::fade_time)); - EXPECT_TRUE (rem <= 1.0f && rem >= -1.0f); + EXPECT_THAT(rem, AllOf(AnyOf(FloatNear(1.0f, MAX_FLOAT_DISTANCE), Lt(1.0f)), + AnyOf(FloatNear(-1.0f, MAX_FLOAT_DISTANCE), Gt(-1.0f)))); } } diff --git a/tests/test_thumbnail_generator.cpp b/tests/test_thumbnail_generator.cpp index f6fdb04ba..d101c1b7b 100644 --- a/tests/test_thumbnail_generator.cpp +++ b/tests/test_thumbnail_generator.cpp @@ -107,7 +107,7 @@ TEST(TestThumbnailGenerator, TestGetOneFileThumbnail) thumb->ready.connect(sigc::mem_fun(load_result, &LoadResult::ThumbnailReady)); thumb->error.connect(sigc::mem_fun(load_result, &LoadResult::ThumbnailFailed)); - Utils::WaitUntilMSec(load_result.got_callback); + Utils::WaitUntilMSec(load_result.got_callback, 1500); EXPECT_TRUE(load_result.succeeded); glib::Object<GIcon> icon(g_icon_new_for_string(load_result.return_string.c_str(), NULL)); @@ -164,7 +164,7 @@ TEST(TestThumbnailGenerator, TestGetOneGIcon) thumb->ready.connect(sigc::mem_fun(load_result, &LoadResult::ThumbnailReady)); thumb->error.connect(sigc::mem_fun(load_result, &LoadResult::ThumbnailFailed)); - Utils::WaitUntilMSec(load_result.got_callback); + Utils::WaitUntilMSec(load_result.got_callback, 1500); EXPECT_TRUE(load_result.succeeded); glib::Object<GIcon> icon(g_icon_new_for_string(load_result.return_string.c_str(), NULL)); |
