From: Alessandro Astone Date: Mon, 23 Mar 2026 15:48:20 +0100 Subject: 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. Forwarded: https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/9716 Applied-upstream: 3.24.53, commit:159b9b5f53cb896f02831a26844af2f893ffe670 --- 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 34f45b6..a1cc1f3 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;