mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-08 09:40:10 +00:00
a11y: Add spinbutton tests
Tests the fix in the previous commit.
This commit is contained in:
parent
9458c1cc47
commit
6e494b93ce
@ -17,6 +17,7 @@ tests = [
|
||||
{ 'name': 'progressbar' },
|
||||
{ 'name': 'scrollbar' },
|
||||
{ 'name': 'separator' },
|
||||
{ 'name': 'spinbutton' },
|
||||
{ 'name': 'switch' },
|
||||
{ 'name': 'window' },
|
||||
]
|
||||
|
42
testsuite/a11y/spinbutton.c
Normal file
42
testsuite/a11y/spinbutton.c
Normal file
@ -0,0 +1,42 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
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 ();
|
||||
}
|
Loading…
Reference in New Issue
Block a user