expressions: Validate lookup expressions

This commit is contained in:
James Westman 2022-04-30 15:20:05 -05:00
parent cc1d2ab78f
commit 76a482affb
No known key found for this signature in database
GPG key ID: CE2DBA0ADB654EA6
8 changed files with 50 additions and 9 deletions

View file

@ -0,0 +1,9 @@
using Gtk 4.0;
Box {
Label label {
visible: bind label.parent.something;
margin-start: bind label.margin-start.other;
label: bind nothing.parent.label;
}
}

View file

@ -0,0 +1,3 @@
5,32,9,Gtk.Widget does not have a property called something
6,43,5,Type int does not have properties
7,17,7,Could not find object with ID 'nothing'

View file

@ -10,7 +10,7 @@
<binding name="visible-child">
<lookup name="parent" type="GtkButton">
<closure function="my_closure" type="GtkButton">
<lookup name="parent">
<lookup name="parent" type="GtkBox">
<constant>box</constant>
</lookup>
</closure>

View file

@ -5,5 +5,5 @@ Overlay {
}
Label {
label: bind ((Label) label.parent.child).label;
label: bind ((Label) ((Overlay) label.parent).child).label;
}

View file

@ -9,8 +9,8 @@
<object class="GtkLabel">
<binding name="label">
<lookup name="label" type="GtkLabel">
<lookup name="child">
<lookup name="parent">
<lookup name="child" type="GtkOverlay">
<lookup name="parent" type="GtkLabel">
<constant>label</constant>
</lookup>
</lookup>

View file

@ -8,7 +8,7 @@
</object>
<object class="GtkBoolFilter">
<property name="expression">
<lookup name="invert">
<lookup name="invert" type="GtkBoolFilter">
<constant>filter</constant>
</lookup>
</property>

View file

@ -187,6 +187,7 @@ class TestSamples(unittest.TestCase):
self.assert_sample_error("duplicates")
self.assert_sample_error("empty")
self.assert_sample_error("enum_member_dne")
self.assert_sample_error("expr_lookup_prop")
self.assert_sample_error("filters_in_non_file_filter")
self.assert_sample_error("gtk_3")
self.assert_sample_error("gtk_exact_version")