1 | #include <gtk/gtk.h> |
2 | |
3 | static void |
4 | label_role (void) |
5 | { |
6 | GtkWidget *label = gtk_label_new (str: "a" ); |
7 | |
8 | g_object_ref_sink (label); |
9 | |
10 | gtk_test_accessible_assert_role (GTK_ACCESSIBLE (label), GTK_ACCESSIBLE_ROLE_LABEL); |
11 | |
12 | g_object_unref (object: label); |
13 | } |
14 | |
15 | static void |
16 | label_relations (void) |
17 | { |
18 | GtkWidget *label = gtk_label_new (str: "a" ); |
19 | GtkWidget *label2 = gtk_label_new (str: "b" ); |
20 | GtkWidget *entry = gtk_entry_new (); |
21 | |
22 | g_object_ref_sink (label); |
23 | g_object_ref_sink (label2); |
24 | g_object_ref_sink (entry); |
25 | |
26 | gtk_test_accessible_assert_relation (GTK_ACCESSIBLE (entry), GTK_ACCESSIBLE_RELATION_LABELLED_BY, NULL); |
27 | |
28 | gtk_widget_add_mnemonic_label (widget: entry, label); |
29 | |
30 | gtk_test_accessible_assert_relation (GTK_ACCESSIBLE (entry), GTK_ACCESSIBLE_RELATION_LABELLED_BY, label, NULL); |
31 | |
32 | gtk_widget_add_mnemonic_label (widget: entry, label: label2); |
33 | |
34 | gtk_test_accessible_assert_relation (GTK_ACCESSIBLE (entry), GTK_ACCESSIBLE_RELATION_LABELLED_BY, label, label2, NULL); |
35 | |
36 | g_object_unref (object: entry); |
37 | g_object_unref (object: label); |
38 | g_object_unref (object: label2); |
39 | } |
40 | |
41 | static void |
42 | label_properties (void) |
43 | { |
44 | GtkWidget *label = gtk_label_new (str: "a" ); |
45 | |
46 | g_object_ref_sink (label); |
47 | |
48 | gtk_test_accessible_assert_property (label, GTK_ACCESSIBLE_PROPERTY_LABEL, "a" ); |
49 | |
50 | gtk_label_set_label (GTK_LABEL (label), str: "b" ); |
51 | |
52 | gtk_test_accessible_assert_property (label, GTK_ACCESSIBLE_PROPERTY_LABEL, "b" ); |
53 | |
54 | g_object_unref (object: label); |
55 | } |
56 | |
57 | int |
58 | main (int argc, char *argv[]) |
59 | { |
60 | gtk_test_init (argcp: &argc, argvp: &argv, NULL); |
61 | |
62 | g_test_add_func (testpath: "/a11y/label/role" , test_func: label_role); |
63 | g_test_add_func (testpath: "/a11y/label/relations" , test_func: label_relations); |
64 | g_test_add_func (testpath: "/a11y/label/properties" , test_func: label_properties); |
65 | |
66 | return g_test_run (); |
67 | } |
68 | |