1 | #include <gtk/gtk.h> |
2 | |
3 | static void |
4 | check_button_role (void) |
5 | { |
6 | GtkWidget *button = gtk_check_button_new (); |
7 | g_object_ref_sink (button); |
8 | |
9 | gtk_test_accessible_assert_role (button, GTK_ACCESSIBLE_ROLE_CHECKBOX); |
10 | |
11 | g_object_unref (object: button); |
12 | } |
13 | |
14 | static void |
15 | check_button_checked (void) |
16 | { |
17 | GtkWidget *button = gtk_check_button_new (); |
18 | g_object_ref_sink (button); |
19 | |
20 | gtk_test_accessible_assert_state (button, GTK_ACCESSIBLE_STATE_CHECKED, GTK_ACCESSIBLE_TRISTATE_FALSE); |
21 | |
22 | gtk_check_button_set_active (GTK_CHECK_BUTTON (button), TRUE); |
23 | |
24 | gtk_test_accessible_assert_state (button, GTK_ACCESSIBLE_STATE_CHECKED, GTK_ACCESSIBLE_TRISTATE_TRUE); |
25 | |
26 | gtk_check_button_set_inconsistent (GTK_CHECK_BUTTON (button), TRUE); |
27 | |
28 | gtk_test_accessible_assert_state (button, GTK_ACCESSIBLE_STATE_CHECKED, GTK_ACCESSIBLE_TRISTATE_MIXED); |
29 | |
30 | g_object_unref (object: button); |
31 | } |
32 | |
33 | static void |
34 | check_button_label (void) |
35 | { |
36 | GtkWidget *button = gtk_check_button_new_with_label (label: "Hello" ); |
37 | g_object_ref_sink (button); |
38 | |
39 | gtk_test_accessible_assert_property (button, GTK_ACCESSIBLE_PROPERTY_LABEL, "Hello" ); |
40 | |
41 | g_object_unref (object: button); |
42 | } |
43 | |
44 | int |
45 | main (int argc, char *argv[]) |
46 | { |
47 | gtk_test_init (argcp: &argc, argvp: &argv, NULL); |
48 | |
49 | g_test_add_func (testpath: "/a11y/checkbutton/role" , test_func: check_button_role); |
50 | g_test_add_func (testpath: "/a11y/checkbutton/checked" , test_func: check_button_checked); |
51 | g_test_add_func (testpath: "/a11y/checkbutton/label" , test_func: check_button_label); |
52 | |
53 | return g_test_run (); |
54 | } |
55 | |