From 8fb3557bce1fdf9e2c4146e89b43753688d64455 Mon Sep 17 00:00:00 2001 From: Alessandro Astone Date: Mon, 23 Mar 2026 15:48:20 +0100 Subject: [PATCH] testsuite/a11y: Fixup treeview test after focus policy changes Since commit fbc28541f0 ("a11y: Don't send focus-related events for unfocused treeview") the window must have focus in order for the treeview to have focus and emit the signal we want to test for. Part-of: --- testsuite/a11y/tree-relationships.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/testsuite/a11y/tree-relationships.c b/testsuite/a11y/tree-relationships.c index 34f45b690a5..a1cc1f38288 100644 --- a/testsuite/a11y/tree-relationships.c +++ b/testsuite/a11y/tree-relationships.c @@ -223,6 +223,24 @@ process_pending_idles () g_main_loop_run (loop); } +static void +on_window_focus (GObject *obj, + GParamSpec *pspec, + gpointer data) +{ + GMainLoop *loop = data; + g_main_loop_quit (loop); +} + + +static void +wait_window_focus (GtkWidget *window) +{ + GMainLoop *loop = g_main_loop_new (NULL, FALSE); + g_signal_connect (window, "notify::is-active", G_CALLBACK (on_window_focus), loop); + g_main_loop_run (loop); +} + static void test_a11y_tree_focus (void) { @@ -243,13 +261,15 @@ test_a11y_tree_focus (void) window = builder_get_toplevel (builder); g_assert (window); - populate_tree (builder); + gtk_widget_show (window); + gtk_window_present (GTK_WINDOW (window)); + wait_window_focus (window); + populate_tree (builder); tv = (GtkTreeView *)gtk_builder_get_object (builder, "treeview1"); gtk_tree_view_expand_all (tv); - gtk_widget_show (window); - + gtk_widget_grab_focus (GTK_WIDGET (tv)); gtk_tree_view_get_cursor (tv, &path, &focus_column); gtk_tree_path_down (path); data.count = 0; -- GitLab