Add accessibility properties

This commit is contained in:
James Westman 2021-11-12 00:26:23 -06:00
parent d511b3f1e3
commit b776163cd7
No known key found for this signature in database
GPG key ID: CE2DBA0ADB654EA6
20 changed files with 324 additions and 13 deletions

View file

@ -0,0 +1,7 @@
using Gtk 4.0;
Widget {
accessibility {
not_a_prop: "Hello, world!";
}
}

View file

@ -0,0 +1 @@
5,5,10,'not_a_prop' is not an accessibility property, relation, or state

View file

@ -0,0 +1,7 @@
using Gtk 4.0;
Widget {
accessibility {
labelled_by: not_an_object;
}
}

View file

@ -0,0 +1 @@
5,18,13,Could not find object with ID not_an_object

View file

@ -0,0 +1,7 @@
using Gtk 4.0;
Widget {
accessibility {
orientation: 1;
}
}

View file

@ -0,0 +1 @@
5,18,1,Cannot convert 1 to Gtk.Orientation

View file

@ -0,0 +1,3 @@
using Gtk 4.0;
NotARealWidget {}

View file

@ -0,0 +1,10 @@
using Gtk 4.0;
Gtk.Widget {
accessibility {
label: _("Hello, world!");
labelled_by: my_label;
checked: true;
}
}
Gtk.Label my_label {}

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk" version="4.0"/>
<object class="GtkWidget">
<accessibility>
<property name="label" translatable="true">Hello, world!</property>
<relation name="labelled_by">my_label</relation>
<state name="checked">true</state>
</accessibility>
</object>
<object class="GtkLabel" id="my_label"></object>
</interface>

View file

@ -86,9 +86,13 @@ class TestSamples(unittest.TestCase):
diff = difflib.unified_diff(expected.splitlines(), actual.splitlines())
print("\n".join(diff))
raise AssertionError()
else:
# Expected a compiler error but there wasn't one
raise AssertionError()
def test_samples(self):
self.assert_sample("accessibility")
self.assert_sample("binding")
self.assert_sample("child_type")
self.assert_sample("flags")
@ -106,6 +110,9 @@ class TestSamples(unittest.TestCase):
def test_sample_errors(self):
self.assert_sample_error("a11y_prop_dne")
self.assert_sample_error("a11y_prop_obj_dne")
self.assert_sample_error("a11y_prop_type")
self.assert_sample_error("class_assign")
self.assert_sample_error("class_dne")
self.assert_sample_error("duplicate_obj_id")