diff --git a/src/tests/monitor-unit-tests.c b/src/tests/monitor-unit-tests.c index 2340438d0..ad0cdda62 100644 --- a/src/tests/monitor-unit-tests.c +++ b/src/tests/monitor-unit-tests.c @@ -343,6 +343,8 @@ create_monitor_test_clients (void) { GError *error = NULL; + test_wait_for_x11_display (); + meta_x11_display_set_alarm_filter (meta_get_display ()->x11_display, monitor_tests_alarm_filter, NULL); diff --git a/src/tests/test-runner.c b/src/tests/test-runner.c index 7560c957e..950556233 100644 --- a/src/tests/test-runner.c +++ b/src/tests/test-runner.c @@ -66,6 +66,8 @@ test_case_new (void) { TestCase *test = g_new0 (TestCase, 1); + test_wait_for_x11_display (); + meta_x11_display_set_alarm_filter (meta_get_display ()->x11_display, test_case_alarm_filter, test); diff --git a/src/tests/test-utils.c b/src/tests/test-utils.c index bc4b97f92..cfade80c5 100644 --- a/src/tests/test-utils.c +++ b/src/tests/test-utils.c @@ -533,3 +533,17 @@ test_get_plugin_name (void) else return "libdefault"; } + +void +test_wait_for_x11_display (void) +{ + MetaDisplay *display; + + display = meta_get_display (); + g_assert_nonnull (display); + + while (!display->x11_display) + g_main_context_iteration (NULL, TRUE); + + g_assert_nonnull (display->x11_display); +} diff --git a/src/tests/test-utils.h b/src/tests/test-utils.h index 2f1a73116..1710b98e0 100644 --- a/src/tests/test-utils.h +++ b/src/tests/test-utils.h @@ -84,4 +84,6 @@ void test_client_destroy (TestClient *client); const char * test_get_plugin_name (void); +void test_wait_for_x11_display (void); + #endif /* TEST_UTILS_H */