Add compilation tests

Added a set of test inputs and expected outputs, for regression testing.
This commit is contained in:
James Westman 2021-10-31 23:29:07 -05:00
parent 53ad4ec69d
commit 5f0eef5f2e
No known key found for this signature in database
GPG key ID: CE2DBA0ADB654EA6
21 changed files with 241 additions and 9 deletions

View file

@ -0,0 +1,7 @@
using Gtk 4.0;
Box {
visible: bind box2.visible sync-create;
}
Box box2 {}

8
tests/samples/binding.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="GtkBox">
<property name="visible" bind-source="box2" bind-property="visible" bind-flags="sync-create"/>
</object>
<object class="GtkBox" id="box2"></object>
</interface>

View file

@ -0,0 +1,7 @@
using Gtk 4.0;
Window {
[titlebar]
HeaderBar {
}
}

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk" version="4.0"/>
<object class="GtkWindow">
<child type="titlebar">
<object class="GtkHeaderBar"></object>
</child>
</object>
</interface>

10
tests/samples/layout.blp Normal file
View file

@ -0,0 +1,10 @@
using Gtk 4.0;
Grid {
Label {
layout {
column: 0;
row: 1;
}
}
}

14
tests/samples/layout.ui Normal file
View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk" version="4.0"/>
<object class="GtkGrid">
<child>
<object class="GtkLabel">
<layout>
<property name="column">0</property>
<property name="row">1</property>
</layout>
</object>
</child>
</object>
</interface>

20
tests/samples/menu.blp Normal file
View file

@ -0,0 +1,20 @@
using Gtk 4.0;
menu {
label: _("menu label");
test-custom-attribute: 3.1415;
submenu {
section {
label: "test section";
}
item {
label: "test item";
}
item "test item shorthand 1";
item "test item shorthand 2" "app.test-action";
item "test item shorthand 3" "app.test-action" "test-symbolic";
}
}

28
tests/samples/menu.ui Normal file
View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk" version="4.0"/>
<menu>
<attribute name="label" translatable="yes">menu label</attribute>
<attribute name="test-custom-attribute">3.1415</attribute>
<submenu>
<section>
<attribute name="label">test section</attribute>
</section>
<item>
<attribute name="label">test item</attribute>
</item>
<item>
<attribute name="label">test item shorthand 1</attribute>
</item>
<item>
<attribute name="label">test item shorthand 2</attribute>
<attribute name="action">app.test-action</attribute>
</item>
<item>
<attribute name="label">test item shorthand 3</attribute>
<attribute name="action">app.test-action</attribute>
<attribute name="icon">test-symbolic</attribute>
</item>
</submenu>
</menu>
</interface>

View file

@ -0,0 +1,5 @@
using Gtk 4.0;
Box {
orientation: VERTICAL;
}

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk" version="4.0"/>
<object class="GtkBox">
<property name="orientation">VERTICAL</property>
</object>
</interface>

6
tests/samples/signal.blp Normal file
View file

@ -0,0 +1,6 @@
using Gtk 4.0;
Button {
clicked => on_button_clicked() swapped;
notify::visible => on_button_notify_visible();
}

8
tests/samples/signal.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="GtkButton">
<signal name="clicked" handler="on_button_clicked" swapped="true"/>
<signal name="notify::visible" handler="on_button_notify_visible"/>
</object>
</interface>

5
tests/samples/style.blp Normal file
View file

@ -0,0 +1,5 @@
using Gtk 4.0;
Label {
style "class-1", "class-2";
}

10
tests/samples/style.ui Normal file
View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk" version="4.0"/>
<object class="GtkLabel">
<style>
<class name="class-1"/>
<class name="class-2"/>
</style>
</object>
</interface>

View file

@ -0,0 +1,3 @@
using Gtk 4.0;
template TestTemplate : ApplicationWindow {}

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk" version="4.0"/>
<template class="TestTemplate" parent="GtkApplicationWindow"></template>
</interface>

4
tests/samples/using.blp Normal file
View file

@ -0,0 +1,4 @@
using Gtk 4.0;
using GObject 2.0;
GObject.Object {}

5
tests/samples/using.ui Normal file
View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk" version="4.0"/>
<object class="GObject"></object>
</interface>