[mutter/wip/carlosg/xwayland-startup-side-channel: 2/3] tests: Ensure MetaX11Display is initialized before running tests



commit e584a4090178992a932d236ca10ccecd8372daf7
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Nov 18 23:12:19 2019 +0100

    tests: Ensure MetaX11Display is initialized before running tests
    
    It might not be available right on initialization time if X11 is started
    asynchronously. As this is a requirement for our tests, ensure it is there
    before proceeding with the test.

 src/tests/test-runner.c | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/src/tests/test-runner.c b/src/tests/test-runner.c
index 7560c957e..d09d0abe6 100644
--- a/src/tests/test-runner.c
+++ b/src/tests/test-runner.c
@@ -61,11 +61,20 @@ test_case_alarm_filter (MetaX11Display        *x11_display,
   return FALSE;
 }
 
+static void
+wait_for_x11_display (MetaDisplay *display)
+{
+  while (!display->x11_display)
+    g_main_context_iteration (NULL, TRUE);
+}
+
 static TestCase *
 test_case_new (void)
 {
   TestCase *test = g_new0 (TestCase, 1);
 
+  wait_for_x11_display (meta_get_display ());
+
   meta_x11_display_set_alarm_filter (meta_get_display ()->x11_display,
                                      test_case_alarm_filter, test);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]