mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Add more tests
This commit is contained in:
parent
08a74acb37
commit
a4b31f2cb0
24 changed files with 89 additions and 8 deletions
3
tests/sample_errors/class_dne.blp
Normal file
3
tests/sample_errors/class_dne.blp
Normal file
|
@ -0,0 +1,3 @@
|
|||
using Gtk 4.0;
|
||||
|
||||
template TestTemplate : Gtk.NotARealClass {}
|
1
tests/sample_errors/class_dne.err
Normal file
1
tests/sample_errors/class_dne.err
Normal file
|
@ -0,0 +1 @@
|
|||
3,25,17,Namespace Gtk does not contain a class called NotARealClass
|
5
tests/sample_errors/enum_member_dne.blp
Normal file
5
tests/sample_errors/enum_member_dne.blp
Normal file
|
@ -0,0 +1,5 @@
|
|||
using Gtk 4.0;
|
||||
|
||||
Box {
|
||||
orientation: diagonal;
|
||||
}
|
1
tests/sample_errors/enum_member_dne.err
Normal file
1
tests/sample_errors/enum_member_dne.err
Normal file
|
@ -0,0 +1 @@
|
|||
4,16,8,diagonal is not a member of Gtk.Orientation
|
5
tests/sample_errors/invalid_bool.blp
Normal file
5
tests/sample_errors/invalid_bool.blp
Normal file
|
@ -0,0 +1,5 @@
|
|||
using Gtk 4.0;
|
||||
|
||||
Label {
|
||||
visible: maybe;
|
||||
}
|
1
tests/sample_errors/invalid_bool.err
Normal file
1
tests/sample_errors/invalid_bool.err
Normal file
|
@ -0,0 +1 @@
|
|||
4,12,5,Expected 'true' or 'false' for boolean value
|
3
tests/sample_errors/not_a_class.blp
Normal file
3
tests/sample_errors/not_a_class.blp
Normal file
|
@ -0,0 +1,3 @@
|
|||
using Gtk 4.0;
|
||||
|
||||
template TestTemplate : Gtk.Orientable {}
|
1
tests/sample_errors/not_a_class.err
Normal file
1
tests/sample_errors/not_a_class.err
Normal file
|
@ -0,0 +1 @@
|
|||
3,25,14,Gtk.Orientable is not a class
|
3
tests/sample_errors/ns_not_imported.blp
Normal file
3
tests/sample_errors/ns_not_imported.blp
Normal file
|
@ -0,0 +1,3 @@
|
|||
using Gtk 4.0;
|
||||
|
||||
template TestTemplate : Adw.ApplicationWindow {}
|
1
tests/sample_errors/ns_not_imported.err
Normal file
1
tests/sample_errors/ns_not_imported.err
Normal file
|
@ -0,0 +1 @@
|
|||
3,25,21,Namespace Adw was not imported
|
5
tests/sample_errors/property_dne.blp
Normal file
5
tests/sample_errors/property_dne.blp
Normal file
|
@ -0,0 +1,5 @@
|
|||
using Gtk 4.0;
|
||||
|
||||
Label {
|
||||
not-a-real-property: "Hello, world!";
|
||||
}
|
1
tests/sample_errors/property_dne.err
Normal file
1
tests/sample_errors/property_dne.err
Normal file
|
@ -0,0 +1 @@
|
|||
4,3,19,Class Gtk.Label does not contain a property called not-a-real-property
|
5
tests/sample_errors/signal_dne.blp
Normal file
5
tests/sample_errors/signal_dne.blp
Normal file
|
@ -0,0 +1,5 @@
|
|||
using Gtk 4.0;
|
||||
|
||||
Button {
|
||||
eaten-by-velociraptors => on_eaten_by_velociraptors();
|
||||
}
|
1
tests/sample_errors/signal_dne.err
Normal file
1
tests/sample_errors/signal_dne.err
Normal file
|
@ -0,0 +1 @@
|
|||
4,3,22,Class Gtk.Button does not contain a signal called eaten-by-velociraptors
|
|
@ -1 +1 @@
|
|||
2,7,17,Namespace NotARealNamespace-2.0 could not be found
|
||||
2,7,21,Namespace NotARealNamespace-2.0 could not be found
|
||||
|
|
7
tests/samples/object_prop.blp
Normal file
7
tests/samples/object_prop.blp
Normal file
|
@ -0,0 +1,7 @@
|
|||
using Gtk 4.0;
|
||||
|
||||
template TestTemplate : Label {
|
||||
test-property: Button {
|
||||
label: "Hello, world!";
|
||||
};
|
||||
}
|
11
tests/samples/object_prop.ui
Normal file
11
tests/samples/object_prop.ui
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk" version="4.0"/>
|
||||
<template class="TestTemplate" parent="GtkLabel">
|
||||
<property name="test-property">
|
||||
<object class="GtkButton">
|
||||
<property name="label">Hello, world!</property>
|
||||
</object>
|
||||
</property>
|
||||
</template>
|
||||
</interface>
|
|
@ -1,3 +1,6 @@
|
|||
using Gtk 4.0;
|
||||
|
||||
template TestTemplate : ApplicationWindow {}
|
||||
template TestTemplate : ApplicationWindow {
|
||||
test-property: "Hello, world";
|
||||
test-signal => on_test_signal();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk" version="4.0"/>
|
||||
<template class="TestTemplate" parent="GtkApplicationWindow"></template>
|
||||
<template class="TestTemplate" parent="GtkApplicationWindow">
|
||||
<property name="test-property">Hello, world</property>
|
||||
<signal name="test-signal" handler="on_test_signal"/>
|
||||
</template>
|
||||
</interface>
|
||||
|
|
5
tests/samples/translated.blp
Normal file
5
tests/samples/translated.blp
Normal file
|
@ -0,0 +1,5 @@
|
|||
using Gtk 4.0;
|
||||
|
||||
Label {
|
||||
label: _("Hello, world!");
|
||||
}
|
7
tests/samples/translated.ui
Normal file
7
tests/samples/translated.ui
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk" version="4.0"/>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="true">Hello, world!</property>
|
||||
</object>
|
||||
</interface>
|
|
@ -94,15 +94,24 @@ class TestSamples(unittest.TestCase):
|
|||
self.assert_sample("flags")
|
||||
self.assert_sample("layout")
|
||||
self.assert_sample("menu")
|
||||
self.assert_sample("object_prop")
|
||||
self.assert_sample("property")
|
||||
self.assert_sample("signal")
|
||||
self.assert_sample("strings")
|
||||
self.assert_sample("style")
|
||||
self.assert_sample("template")
|
||||
self.assert_sample("translated")
|
||||
self.assert_sample("using")
|
||||
|
||||
|
||||
def test_sample_errors(self):
|
||||
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("property_dne")
|
||||
self.assert_sample_error("signal_dne")
|
||||
self.assert_sample_error("two_templates")
|
||||
self.assert_sample_error("using_invalid_namespace")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue