[mutter] tests/xwayland: Wait for clipboard to settle before killing Xwayland



commit 003ff46a98511e8bf34c81d24a1c74152987c86d
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Tue Jun 28 14:17:00 2022 +0200

    tests/xwayland: Wait for clipboard to settle before killing Xwayland
    
    The test aims to test that trying to fetch X11 clipboard content after
    Xwayland went away doesn't cause issues. What happens though is that
    sometimes the clipboard content doesn't have time to settle (i.e. fetch
    mime types etc) before Xwayland gets terminated, which causes flakyness.
    
    Fix this by waiting for the compositor side clipboard owners to finish
    setting up before continuing.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2484>

 src/tests/xwayland-tests.c | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/src/tests/xwayland-tests.c b/src/tests/xwayland-tests.c
index 9cdce37a37..bcd356b371 100644
--- a/src/tests/xwayland-tests.c
+++ b/src/tests/xwayland-tests.c
@@ -122,6 +122,8 @@ meta_test_xwayland_restart_selection (void)
                                      tests_alarm_filter,
                                      test_client);
 
+  g_assert_null (x11_display->selection.owners[META_SELECTION_CLIPBOARD]);
+
   test_client_do_check (test_client,
                         "create", window_name,
                         NULL);
@@ -130,6 +132,9 @@ meta_test_xwayland_restart_selection (void)
                         NULL);
   test_client_wait_check (test_client);
 
+  while (!x11_display->selection.owners[META_SELECTION_CLIPBOARD])
+    g_main_context_iteration (NULL, TRUE);
+
   g_test_expect_message ("libmutter", G_LOG_LEVEL_WARNING,
                          "*Connection to xwayland lost*");
   g_test_expect_message ("libmutter", G_LOG_LEVEL_WARNING,


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