projects/guix·blob python-team · refs

67 lines · 1.9 KiB

1From 8fb3557bce1fdf9e2c4146e89b43753688d64455 Mon Sep 17 00:00:00 2001
2From: Alessandro Astone <[email protected]>
3Date: Mon, 23 Mar 2026 15:48:20 +0100
4Subject: [PATCH] testsuite/a11y: Fixup treeview test after focus policy
5 changes
6
7Since commit
8 fbc28541f0 ("a11y: Don't send focus-related events for unfocused treeview")
9the window must have focus in order for the treeview to have focus and emit
10the signal we want to test for.
11
12Part-of: <https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/9716>
13---
14 testsuite/a11y/tree-relationships.c | 26 +++++++++++++++++++++++---
15 1 file changed, 23 insertions(+), 3 deletions(-)
16
17diff --git a/testsuite/a11y/tree-relationships.c b/testsuite/a11y/tree-relationships.c
18index 34f45b690a5..a1cc1f38288 100644
19--- a/testsuite/a11y/tree-relationships.c
20+++ b/testsuite/a11y/tree-relationships.c
21@@ -223,6 +223,24 @@ process_pending_idles ()
22 g_main_loop_run (loop);
23 }
24
25+static void
26+on_window_focus (GObject *obj,
27+ GParamSpec *pspec,
28+ gpointer data)
29+{
30+ GMainLoop *loop = data;
31+ g_main_loop_quit (loop);
32+}
33+
34+
35+static void
36+wait_window_focus (GtkWidget *window)
37+{
38+ GMainLoop *loop = g_main_loop_new (NULL, FALSE);
39+ g_signal_connect (window, "notify::is-active", G_CALLBACK (on_window_focus), loop);
40+ g_main_loop_run (loop);
41+}
42+
43 static void
44 test_a11y_tree_focus (void)
45 {
46@@ -243,13 +261,15 @@ test_a11y_tree_focus (void)
47 window = builder_get_toplevel (builder);
48 g_assert (window);
49
50- populate_tree (builder);
51+ gtk_widget_show (window);
52+ gtk_window_present (GTK_WINDOW (window));
53+ wait_window_focus (window);
54
55+ populate_tree (builder);
56 tv = (GtkTreeView *)gtk_builder_get_object (builder, "treeview1");
57 gtk_tree_view_expand_all (tv);
58
59- gtk_widget_show (window);
60-
61+ gtk_widget_grab_focus (GTK_WIDGET (tv));
62 gtk_tree_view_get_cursor (tv, &path, &focus_column);
63 gtk_tree_path_down (path);
64 data.count = 0;
65--
66GitLab
67