1 | #include <gtk/gtk.h> |
2 | |
3 | static void |
4 | switch_role (void) |
5 | { |
6 | GtkWidget *widget = gtk_switch_new (); |
7 | g_object_ref_sink (widget); |
8 | |
9 | gtk_test_accessible_assert_role (widget, GTK_ACCESSIBLE_ROLE_SWITCH); |
10 | |
11 | g_object_unref (object: widget); |
12 | } |
13 | |
14 | static void |
15 | switch_state (void) |
16 | { |
17 | GtkWidget *widget = gtk_switch_new (); |
18 | g_object_ref_sink (widget); |
19 | |
20 | gtk_test_accessible_assert_state (widget, GTK_ACCESSIBLE_STATE_CHECKED, FALSE); |
21 | |
22 | gtk_switch_set_active (GTK_SWITCH (widget), TRUE); |
23 | |
24 | gtk_test_accessible_assert_state (widget, GTK_ACCESSIBLE_STATE_CHECKED, TRUE); |
25 | |
26 | g_object_unref (object: widget); |
27 | } |
28 | |
29 | int |
30 | main (int argc, char *argv[]) |
31 | { |
32 | gtk_test_init (argcp: &argc, argvp: &argv, NULL); |
33 | |
34 | g_test_add_func (testpath: "/a11y/switch/role" , test_func: switch_role); |
35 | g_test_add_func (testpath: "/a11y/switch/state" , test_func: switch_state); |
36 | |
37 | return g_test_run (); |
38 | } |
39 | |