diff --git a/testsuite/a11y/meson.build b/testsuite/a11y/meson.build index e3250c3709..0b672a3e4e 100644 --- a/testsuite/a11y/meson.build +++ b/testsuite/a11y/meson.build @@ -17,6 +17,7 @@ tests = [ { 'name': 'progressbar' }, { 'name': 'scrollbar' }, { 'name': 'separator' }, + { 'name': 'spinbutton' }, { 'name': 'switch' }, { 'name': 'window' }, ] diff --git a/testsuite/a11y/spinbutton.c b/testsuite/a11y/spinbutton.c new file mode 100644 index 0000000000..bab37eb5c5 --- /dev/null +++ b/testsuite/a11y/spinbutton.c @@ -0,0 +1,42 @@ +#include + +static void +spinbutton_role (void) +{ + GtkWidget *widget = gtk_spin_button_new_with_range (0, 100, 1); + g_object_ref_sink (widget); + + gtk_test_accessible_assert_role (widget, GTK_ACCESSIBLE_ROLE_SPIN_BUTTON); + + g_object_unref (widget); +} + +static void +spinbutton_properties (void) +{ + GtkWidget *widget = gtk_spin_button_new_with_range (0, 100, 1); + g_object_ref_sink (widget); + + gtk_test_accessible_assert_property (widget, GTK_ACCESSIBLE_PROPERTY_VALUE_MAX, 100.); + gtk_test_accessible_assert_property (widget, GTK_ACCESSIBLE_PROPERTY_VALUE_MIN, 0.); + gtk_test_accessible_assert_property (widget, GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, 0.); + + gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), 50.); + + gtk_test_accessible_assert_property (widget, GTK_ACCESSIBLE_PROPERTY_VALUE_MAX, 100.); + gtk_test_accessible_assert_property (widget, GTK_ACCESSIBLE_PROPERTY_VALUE_MIN, 0.); + gtk_test_accessible_assert_property (widget, GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, 50.0); + + g_object_unref (widget); +} + +int +main (int argc, char *argv[]) +{ + gtk_test_init (&argc, &argv, NULL); + + g_test_add_func ("/a11y/spinbutton/role", spinbutton_role); + g_test_add_func ("/a11y/spinbutton/properties", spinbutton_properties); + + return g_test_run (); +}