mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
tests: add tests for action widget syntax
This commit is contained in:
parent
736681a841
commit
d9ef1d4df9
17 changed files with 120 additions and 0 deletions
8
tests/sample_errors/action_widget_float_response.blp
Normal file
8
tests/sample_errors/action_widget_float_response.blp
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
using Gtk 4.0;
|
||||||
|
|
||||||
|
Dialog {
|
||||||
|
[action response=17.9]
|
||||||
|
Button float_response_button {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
1
tests/sample_errors/action_widget_float_response.err
Normal file
1
tests/sample_errors/action_widget_float_response.err
Normal file
|
@ -0,0 +1 @@
|
||||||
|
4,22,4,Response type must be GtkResponseType member or integer, not float
|
8
tests/sample_errors/action_widget_have_no_id.blp
Normal file
8
tests/sample_errors/action_widget_have_no_id.blp
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
using Gtk 4.0;
|
||||||
|
|
||||||
|
Dialog {
|
||||||
|
[action response=cancel]
|
||||||
|
Button {
|
||||||
|
label: _("Cancel");
|
||||||
|
}
|
||||||
|
}
|
1
tests/sample_errors/action_widget_have_no_id.err
Normal file
1
tests/sample_errors/action_widget_have_no_id.err
Normal file
|
@ -0,0 +1 @@
|
||||||
|
4,13,15,Action widget must have ID
|
13
tests/sample_errors/action_widget_multiple_default.blp
Normal file
13
tests/sample_errors/action_widget_multiple_default.blp
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
using Gtk 4.0;
|
||||||
|
|
||||||
|
Dialog {
|
||||||
|
[action response=yes default]
|
||||||
|
Button yes_button {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[action response=no default]
|
||||||
|
Button no_button {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
1
tests/sample_errors/action_widget_multiple_default.err
Normal file
1
tests/sample_errors/action_widget_multiple_default.err
Normal file
|
@ -0,0 +1 @@
|
||||||
|
9,25,7,Default response is already set
|
8
tests/sample_errors/action_widget_negative_response.blp
Normal file
8
tests/sample_errors/action_widget_negative_response.blp
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
using Gtk 4.0;
|
||||||
|
|
||||||
|
Dialog {
|
||||||
|
[action response = -179]
|
||||||
|
Button numeric_response_button {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
1
tests/sample_errors/action_widget_negative_response.err
Normal file
1
tests/sample_errors/action_widget_negative_response.err
Normal file
|
@ -0,0 +1 @@
|
||||||
|
4,24,4,Numeric response type can't be negative
|
8
tests/sample_errors/action_widget_not_action.blp
Normal file
8
tests/sample_errors/action_widget_not_action.blp
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
using Gtk 4.0;
|
||||||
|
|
||||||
|
Dialog {
|
||||||
|
[some_type response=ok]
|
||||||
|
Button ok_button {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
1
tests/sample_errors/action_widget_not_action.err
Normal file
1
tests/sample_errors/action_widget_not_action.err
Normal file
|
@ -0,0 +1 @@
|
||||||
|
4,16,11,Only action widget can have response ID
|
8
tests/sample_errors/action_widget_not_in_dialog.blp
Normal file
8
tests/sample_errors/action_widget_not_in_dialog.blp
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
using Gtk 4.0;
|
||||||
|
|
||||||
|
Box {
|
||||||
|
[action response=ok]
|
||||||
|
Button ok_button {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
1
tests/sample_errors/action_widget_not_in_dialog.err
Normal file
1
tests/sample_errors/action_widget_not_in_dialog.err
Normal file
|
@ -0,0 +1 @@
|
||||||
|
4,13,11,Gtk.Box is not a Gtk.Dialog, so it doesn't have action widgets
|
8
tests/sample_errors/action_widget_response_dne.blp
Normal file
8
tests/sample_errors/action_widget_response_dne.blp
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
using Gtk 4.0;
|
||||||
|
|
||||||
|
Dialog {
|
||||||
|
[action response=hello-world]
|
||||||
|
Button hello_world_button {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
1
tests/sample_errors/action_widget_response_dne.err
Normal file
1
tests/sample_errors/action_widget_response_dne.err
Normal file
|
@ -0,0 +1 @@
|
||||||
|
4,22,11,Response type "hello-world" doesn't exist
|
18
tests/samples/action_widgets.blp
Normal file
18
tests/samples/action_widgets.blp
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
using Gtk 4.0;
|
||||||
|
|
||||||
|
Dialog {
|
||||||
|
[action response=cancel]
|
||||||
|
Button cancel_button {
|
||||||
|
label: _("Cancel");
|
||||||
|
}
|
||||||
|
|
||||||
|
[action reponse=9]
|
||||||
|
Button custom_response_button {
|
||||||
|
label: _("Reinstall Windows");
|
||||||
|
}
|
||||||
|
|
||||||
|
[action response=ok default]
|
||||||
|
Button ok_button {
|
||||||
|
label: _("Ok");
|
||||||
|
}
|
||||||
|
}
|
26
tests/samples/action_widgets.ui
Normal file
26
tests/samples/action_widgets.ui
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<interface>
|
||||||
|
<requires lib="gtk" version="4.0"/>
|
||||||
|
<object class="GtkDialog">
|
||||||
|
<child type="action">
|
||||||
|
<object class="GtkButton" id="cancel_button">
|
||||||
|
<property name="label" translatable="true">Cancel</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child type="action">
|
||||||
|
<object class="GtkButton" id="custom_response_button">
|
||||||
|
<property name="label" translatable="true">Reinstall Windows</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child type="action">
|
||||||
|
<object class="GtkButton" id="ok_button">
|
||||||
|
<property name="label" translatable="true">Ok</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<action-widgets>
|
||||||
|
<action-widget response="cancel">cancel_button</action-widget>
|
||||||
|
<action-widget response="9">custom_response_button</action-widget>
|
||||||
|
<action-widget response="ok" default="True">ok_button</action-widget>
|
||||||
|
</action-widgets>
|
||||||
|
</object>
|
||||||
|
</interface>
|
|
@ -115,6 +115,7 @@ class TestSamples(unittest.TestCase):
|
||||||
|
|
||||||
def test_samples(self):
|
def test_samples(self):
|
||||||
self.assert_sample("accessibility")
|
self.assert_sample("accessibility")
|
||||||
|
self.assert_sample("action_widgets")
|
||||||
self.assert_sample("binding")
|
self.assert_sample("binding")
|
||||||
self.assert_sample("child_type")
|
self.assert_sample("child_type")
|
||||||
self.assert_sample("combo_box_text")
|
self.assert_sample("combo_box_text")
|
||||||
|
@ -145,6 +146,13 @@ class TestSamples(unittest.TestCase):
|
||||||
self.assert_sample_error("a11y_prop_dne")
|
self.assert_sample_error("a11y_prop_dne")
|
||||||
self.assert_sample_error("a11y_prop_obj_dne")
|
self.assert_sample_error("a11y_prop_obj_dne")
|
||||||
self.assert_sample_error("a11y_prop_type")
|
self.assert_sample_error("a11y_prop_type")
|
||||||
|
self.assert_sample_error("action_widget_float_response")
|
||||||
|
self.assert_sample_error("action_widget_have_no_id")
|
||||||
|
self.assert_sample_error("action_widget_multiple_default")
|
||||||
|
self.assert_sample_error("action_widget_not_action")
|
||||||
|
self.assert_sample_error("action_widget_not_in_dialog")
|
||||||
|
self.assert_sample_error("action_widget_response_dne")
|
||||||
|
self.assert_sample_error("action_widget_negative_response")
|
||||||
self.assert_sample_error("class_assign")
|
self.assert_sample_error("class_assign")
|
||||||
self.assert_sample_error("class_dne")
|
self.assert_sample_error("class_dne")
|
||||||
self.assert_sample_error("consecutive_unexpected_tokens")
|
self.assert_sample_error("consecutive_unexpected_tokens")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue