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
This commit is contained in:
@@ -121,7 +121,15 @@ gtk_accessible_attribute_set_add (GtkAccessibleAttributeSet *self,
|
||||
if (value != NULL)
|
||||
{
|
||||
if (gtk_accessible_value_equal (value, self->attribute_values[attribute]))
|
||||
return FALSE;
|
||||
{
|
||||
if (!_gtk_bitmask_get (self->attributes_set, attribute))
|
||||
{
|
||||
self->attributes_set = _gtk_bitmask_set (self->attributes_set, attribute, TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -29,6 +29,7 @@ tests = [
|
||||
{ 'name': 'switch' },
|
||||
{ 'name': 'textview' },
|
||||
{ 'name': 'togglebutton' },
|
||||
{ 'name': 'value' },
|
||||
{ 'name': 'window' },
|
||||
]
|
||||
|
||||
|
||||
32
testsuite/a11y/value.c
Normal file
32
testsuite/a11y/value.c
Normal file
@@ -0,0 +1,32 @@
|
||||
#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 ();
|
||||
}
|
||||
Reference in New Issue
Block a user