forked from AuroraMiddleware/gtk
a11y: Add switch tests
Tests the fix in the previous commit.
This commit is contained in:
parent
2ef4be21c8
commit
d2c5e3f2b3
@ -16,6 +16,7 @@ tests = [
|
||||
{ 'name': 'dialog' },
|
||||
{ 'name': 'progressbar' },
|
||||
{ 'name': 'separator' },
|
||||
{ 'name': 'switch' },
|
||||
{ 'name': 'window' },
|
||||
]
|
||||
|
||||
|
38
testsuite/a11y/switch.c
Normal file
38
testsuite/a11y/switch.c
Normal file
@ -0,0 +1,38 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static void
|
||||
switch_role (void)
|
||||
{
|
||||
GtkWidget *widget = gtk_switch_new ();
|
||||
g_object_ref_sink (widget);
|
||||
|
||||
gtk_test_accessible_assert_role (widget, GTK_ACCESSIBLE_ROLE_SWITCH);
|
||||
|
||||
g_object_unref (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
switch_state (void)
|
||||
{
|
||||
GtkWidget *widget = gtk_switch_new ();
|
||||
g_object_ref_sink (widget);
|
||||
|
||||
gtk_test_accessible_assert_state (widget, GTK_ACCESSIBLE_STATE_CHECKED, FALSE);
|
||||
|
||||
gtk_switch_set_active (GTK_SWITCH (widget), TRUE);
|
||||
|
||||
gtk_test_accessible_assert_state (widget, GTK_ACCESSIBLE_STATE_CHECKED, TRUE);
|
||||
|
||||
g_object_unref (widget);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
gtk_test_init (&argc, &argv, NULL);
|
||||
|
||||
g_test_add_func ("/a11y/switch/role", switch_role);
|
||||
g_test_add_func ("/a11y/switch/state", switch_state);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
Loading…
Reference in New Issue
Block a user