mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-06 16:19:07 -04:00
Add accessibility properties
This commit is contained in:
parent
d511b3f1e3
commit
b776163cd7
20 changed files with 324 additions and 13 deletions
7
tests/sample_errors/a11y_prop_dne.blp
Normal file
7
tests/sample_errors/a11y_prop_dne.blp
Normal file
|
@ -0,0 +1,7 @@
|
|||
using Gtk 4.0;
|
||||
|
||||
Widget {
|
||||
accessibility {
|
||||
not_a_prop: "Hello, world!";
|
||||
}
|
||||
}
|
1
tests/sample_errors/a11y_prop_dne.err
Normal file
1
tests/sample_errors/a11y_prop_dne.err
Normal file
|
@ -0,0 +1 @@
|
|||
5,5,10,'not_a_prop' is not an accessibility property, relation, or state
|
7
tests/sample_errors/a11y_prop_obj_dne.blp
Normal file
7
tests/sample_errors/a11y_prop_obj_dne.blp
Normal file
|
@ -0,0 +1,7 @@
|
|||
using Gtk 4.0;
|
||||
|
||||
Widget {
|
||||
accessibility {
|
||||
labelled_by: not_an_object;
|
||||
}
|
||||
}
|
1
tests/sample_errors/a11y_prop_obj_dne.err
Normal file
1
tests/sample_errors/a11y_prop_obj_dne.err
Normal file
|
@ -0,0 +1 @@
|
|||
5,18,13,Could not find object with ID not_an_object
|
7
tests/sample_errors/a11y_prop_type.blp
Normal file
7
tests/sample_errors/a11y_prop_type.blp
Normal file
|
@ -0,0 +1,7 @@
|
|||
using Gtk 4.0;
|
||||
|
||||
Widget {
|
||||
accessibility {
|
||||
orientation: 1;
|
||||
}
|
||||
}
|
1
tests/sample_errors/a11y_prop_type.err
Normal file
1
tests/sample_errors/a11y_prop_type.err
Normal file
|
@ -0,0 +1 @@
|
|||
5,18,1,Cannot convert 1 to Gtk.Orientation
|
3
tests/sample_errors/obj_class_dne.blp
Normal file
3
tests/sample_errors/obj_class_dne.blp
Normal file
|
@ -0,0 +1,3 @@
|
|||
using Gtk 4.0;
|
||||
|
||||
NotARealWidget {}
|
10
tests/samples/accessibility.blp
Normal file
10
tests/samples/accessibility.blp
Normal 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 {}
|
12
tests/samples/accessibility.ui
Normal file
12
tests/samples/accessibility.ui
Normal 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>
|
|
@ -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")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue