gtk/testsuite/a11y/value.c
Matthias Clasen 32550fd6fc a11y: Remove an overzealous optimisation
The result of calling update_property needs
to be that the property is marked as set
afterward, even if the value we pass happens
to match the default value.

After this change, scrollbars have value-now
show up as zero in the accessiblity page of
the inspector, even when that matches the lower
bound.

Test included.

Fixes: #5886
2023-06-19 07:22:32 -04:00

33 lines
814 B
C

#include <gtk/gtk.h>
static void
value_set_unset (void)
{
GtkAdjustment *adjustment = gtk_adjustment_new (0, 0, 100, 1, 10, 10);
GtkWidget *scrollbar = gtk_scrollbar_new (GTK_ORIENTATION_HORIZONTAL, adjustment);
g_object_ref_sink (scrollbar);
gtk_test_accessible_assert_property (scrollbar, GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, 0.);
gtk_adjustment_set_value (adjustment, 10);
gtk_test_accessible_assert_property (scrollbar, GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, 10.);
gtk_adjustment_set_value (adjustment, 0);
gtk_test_accessible_assert_property (scrollbar, GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, 0.);
g_object_unref (scrollbar);
}
int
main (int argc, char *argv[])
{
gtk_test_init (&argc, &argv, NULL);
g_test_add_func ("/a11y/value/set-unset", value_set_unset);
return g_test_run ();
}