diff options
author | Matthias Clasen <mclasen@redhat.com> | 2023-05-11 22:23:01 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2023-05-11 22:24:10 -0400 |
commit | ba64e5588db74e5a82295d8cd27bbdc6c9ebbe3b (patch) | |
tree | 19929afff6cda2e5792d3347f21abc7d521560b4 | |
parent | fcdcdb7e7883768e45bd778f057d876bc2215fe5 (diff) | |
download | gtk+-ba64e5588db74e5a82295d8cd27bbdc6c9ebbe3b.tar.gz |
Add a little wait to focus tests
I don't know exactly why, but this seems
to help the tests not fail on X11.
-rw-r--r-- | testsuite/gtk/test-focus-chain.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/testsuite/gtk/test-focus-chain.c b/testsuite/gtk/test-focus-chain.c index 63484ee1a5..c89e276126 100644 --- a/testsuite/gtk/test-focus-chain.c +++ b/testsuite/gtk/test-focus-chain.c @@ -67,6 +67,26 @@ check_focus_states (GtkWidget *focus_widget) } } +static gboolean +quit_iteration_loop (gpointer user_data) +{ + gboolean *keep_running = user_data; + + *keep_running = FALSE; + + return G_SOURCE_REMOVE; +} + +static void +wait (guint millis) +{ + gboolean keep_running = TRUE; + + g_timeout_add (millis, quit_iteration_loop, &keep_running); + while (keep_running) + g_main_context_iteration (NULL, TRUE); +} + static char * generate_focus_chain (GtkWidget *window, GtkDirectionType dir) @@ -125,6 +145,7 @@ generate_focus_chain (GtkWidget *window, } g_string_append_printf (output, "%s\n", name); + wait (100); count++; if (!first) @@ -171,16 +192,6 @@ get_dir_for_file (const char *path) } static gboolean -quit_iteration_loop (gpointer user_data) -{ - gboolean *keep_running = user_data; - - *keep_running = FALSE; - - return G_SOURCE_REMOVE; -} - -static gboolean load_ui_file (GFile *ui_file, GFile *ref_file, const char *ext) |