testsuite: Skip focus tests when necessary
authorMatthias Clasen <mclasen@redhat.com>
Sun, 16 Apr 2023 18:58:26 +0000 (20:58 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 21 Apr 2023 07:27:08 +0000 (09:27 +0200)
If our window does not get focus, we can't reliably
test things that depend on widgets being focused.

testsuite/gtk/test-focus-chain.c

index 0ab28caee91a5a864cff2577a7f1eec15f5b1a83..63484ee1a572742c4351b982fad3c2ae70866ae2 100644 (file)
@@ -214,7 +214,11 @@ load_ui_file (GFile *ui_file,
   if (keep_running)
     g_source_remove (timeout_handle_id);
 
-  g_assert (gtk_window_is_active (GTK_WINDOW (window)));
+  if (!gtk_window_is_active (GTK_WINDOW (window)))
+    {
+      g_print ("Skipping focus tests because window did not get focus. Headless display?");
+      exit (77);
+    }
 
   if (ext)
     {