From ef9ec43469c114f90174772a796813367b081a3a Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 20 Oct 2020 22:44:24 -0400 Subject: [PATCH] a11y: Add some more tests --- testsuite/a11y/button.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/testsuite/a11y/button.c b/testsuite/a11y/button.c index f78207fb31..a5e44280a4 100644 --- a/testsuite/a11y/button.c +++ b/testsuite/a11y/button.c @@ -25,6 +25,24 @@ button_label (void) g_object_unref (button); } +/* Check that we set up a labelled_by relationship between a button + * and its label. + */ +static void +button_relation (void) +{ + GtkWidget *button = gtk_button_new_with_mnemonic ("_Hello"); + GList *list; + + g_object_ref_sink (button); + + list = g_list_append (NULL, gtk_widget_get_first_child (button)); + gtk_test_accessible_assert_relation (GTK_ACCESSIBLE (button), GTK_ACCESSIBLE_RELATION_LABELLED_BY, list); + g_list_free (list); + + g_object_unref (button); +} + static void linkbutton_role (void) { @@ -54,6 +72,7 @@ main (int argc, char *argv[]) g_test_add_func ("/a11y/button/role", button_role); g_test_add_func ("/a11y/button/label", button_label); + g_test_add_func ("/a11y/button/relation", button_relation); g_test_add_func ("/a11y/linkbutton/role", linkbutton_role); g_test_add_func ("/a11y/linkbutton/label", linkbutton_label);