1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
From: Alessandro Astone <alessandro.astone@canonical.com>
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;
|