Add a little wait to focus tests

I don't know exactly why, but this seems
to help the tests not fail on X11.
This commit is contained in:
Matthias Clasen 2023-05-11 22:23:01 -04:00
parent fcdcdb7e78
commit ba64e5588d

View File

@ -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)
@ -170,16 +191,6 @@ get_dir_for_file (const char *path)
return 0;
}
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,