mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 19:00:08 +00:00
a11y: Add tests for mnemonics
We set up labelled-by accessible relations when a label is set as mnemonic widget. Verify that that happens as expected.
This commit is contained in:
parent
9a82aadca7
commit
cc35cc6c4e
43
testsuite/a11y/label.c
Normal file
43
testsuite/a11y/label.c
Normal file
@ -0,0 +1,43 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static void
|
||||
label_relations (void)
|
||||
{
|
||||
GtkWidget *label = gtk_label_new ("a");
|
||||
GtkWidget *label2 = gtk_label_new ("b");
|
||||
GtkWidget *entry = gtk_entry_new ();
|
||||
GList *list;
|
||||
|
||||
g_object_ref_sink (label);
|
||||
g_object_ref_sink (label2);
|
||||
g_object_ref_sink (entry);
|
||||
|
||||
gtk_test_accessible_assert_relation (GTK_ACCESSIBLE (entry), GTK_ACCESSIBLE_RELATION_LABELLED_BY, NULL);
|
||||
|
||||
gtk_widget_add_mnemonic_label (entry, label);
|
||||
|
||||
list = g_list_append (NULL, label);
|
||||
gtk_test_accessible_assert_relation (GTK_ACCESSIBLE (entry), GTK_ACCESSIBLE_RELATION_LABELLED_BY, list);
|
||||
g_list_free (list);
|
||||
|
||||
gtk_widget_add_mnemonic_label (entry, label2);
|
||||
|
||||
list = g_list_append (NULL, label);
|
||||
list = g_list_append (list, label2);
|
||||
gtk_test_accessible_assert_relation (GTK_ACCESSIBLE (entry), GTK_ACCESSIBLE_RELATION_LABELLED_BY, list);
|
||||
g_list_free (list);
|
||||
|
||||
g_object_unref (entry);
|
||||
g_object_unref (label);
|
||||
g_object_unref (label2);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
gtk_test_init (&argc, &argv, NULL);
|
||||
|
||||
g_test_add_func ("/a11y/label/relations", label_relations);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
@ -16,6 +16,7 @@ tests = [
|
||||
{ 'name': 'dialog' },
|
||||
{ 'name': 'entry' },
|
||||
{ 'name': 'image' },
|
||||
{ 'name': 'label' },
|
||||
{ 'name': 'progressbar' },
|
||||
{ 'name': 'scrollbar' },
|
||||
{ 'name': 'separator' },
|
||||
|
Loading…
Reference in New Issue
Block a user