Validate object types

This commit is contained in:
James Westman 2021-11-05 00:44:33 -05:00
parent a0ba59af77
commit d89f2356b4
No known key found for this signature in database
GPG key ID: CE2DBA0ADB654EA6
11 changed files with 126 additions and 33 deletions

View file

@ -0,0 +1,6 @@
using Gtk 4.0;
Box box {}
Label {
label: box;
}

View file

@ -0,0 +1 @@
5,10,3,Cannot assign Gtk.Box to string

View file

@ -0,0 +1,5 @@
using Gtk 4.0;
Scale {
adjustment: Label {};
}

View file

@ -0,0 +1 @@
4,3,21,Cannot assign Gtk.Label to Gtk.Adjustment

View file

@ -0,0 +1,5 @@
using Gtk 4.0;
Label {
label: my_label;
}

View file

@ -0,0 +1 @@
4,10,8,Could not find object with ID my_label

View file

@ -0,0 +1,7 @@
using Gtk 4.0;
Scale {
adjustment: adj;
}
Adjustment adj {}

8
tests/samples/id_prop.ui Normal file
View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk" version="4.0"/>
<object class="GtkScale">
<property name="adjustment">adj</property>
</object>
<object class="GtkAdjustment" id="adj"></object>
</interface>

View file

@ -92,6 +92,7 @@ class TestSamples(unittest.TestCase):
self.assert_sample("binding")
self.assert_sample("child_type")
self.assert_sample("flags")
self.assert_sample("id_prop")
self.assert_sample("layout")
self.assert_sample("menu")
self.assert_sample("object_prop")
@ -105,12 +106,15 @@ class TestSamples(unittest.TestCase):
def test_sample_errors(self):
self.assert_sample_error("class_assign")
self.assert_sample_error("class_dne")
self.assert_sample_error("duplicate_obj_id")
self.assert_sample_error("enum_member_dne")
self.assert_sample_error("invalid_bool")
self.assert_sample_error("ns_not_imported")
self.assert_sample_error("not_a_class")
self.assert_sample_error("object_dne")
self.assert_sample_error("obj_prop_type")
self.assert_sample_error("property_dne")
self.assert_sample_error("signal_dne")
self.assert_sample_error("two_templates")