mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Add Adw.Breakpoint custom syntax
This commit is contained in:
parent
aafebf0dfb
commit
8fcd08c835
12 changed files with 264 additions and 11 deletions
12
tests/sample_errors/adw_breakpoint.blp
Normal file
12
tests/sample_errors/adw_breakpoint.blp
Normal file
|
@ -0,0 +1,12 @@
|
|||
using Gtk 4.0;
|
||||
using Adw 1;
|
||||
|
||||
Label label {}
|
||||
|
||||
Adw.Breakpoint {
|
||||
setters {
|
||||
label.foo: "bar";
|
||||
not_an_object.visible: true;
|
||||
label.foo: "baz";
|
||||
}
|
||||
}
|
4
tests/sample_errors/adw_breakpoint.err
Normal file
4
tests/sample_errors/adw_breakpoint.err
Normal file
|
@ -0,0 +1,4 @@
|
|||
8,11,3,Class Gtk.Label does not have a property called foo
|
||||
9,5,13,Could not find object with ID not_an_object
|
||||
10,11,3,Class Gtk.Label does not have a property called foo
|
||||
10,5,17,Duplicate setter for label.foo
|
13
tests/samples/adw_breakpoint.blp
Normal file
13
tests/samples/adw_breakpoint.blp
Normal file
|
@ -0,0 +1,13 @@
|
|||
using Gtk 4.0;
|
||||
using Adw 1;
|
||||
|
||||
Gtk.Label label {}
|
||||
|
||||
Adw.Breakpoint {
|
||||
condition ("max-width: 600px")
|
||||
setters {
|
||||
label.label: _("Hello, world!");
|
||||
label.visible: false;
|
||||
label.extra-menu: null;
|
||||
}
|
||||
}
|
11
tests/samples/adw_breakpoint.ui
Normal file
11
tests/samples/adw_breakpoint.ui
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk" version="4.0"/>
|
||||
<object class="GtkLabel" id="label"></object>
|
||||
<object class="AdwBreakpoint">
|
||||
<condition>max-width: 600px</condition>
|
||||
<setter object="label" property="label" translatable="true">Hello, world!</setter>
|
||||
<setter object="label" property="visible">false</setter>
|
||||
<setter object="label" property="extra-menu"></setter>
|
||||
</object>
|
||||
</interface>
|
|
@ -143,6 +143,9 @@ class TestSamples(unittest.TestCase):
|
|||
raise AssertionError()
|
||||
|
||||
def test_samples(self):
|
||||
have_adw = False
|
||||
have_adw_1_4 = False
|
||||
|
||||
try:
|
||||
import gi
|
||||
|
||||
|
@ -151,11 +154,15 @@ class TestSamples(unittest.TestCase):
|
|||
|
||||
have_adw = True
|
||||
Adw.init()
|
||||
if Adw.MINOR_VERSION >= 4:
|
||||
have_adw_1_4 = True
|
||||
except:
|
||||
have_adw = False
|
||||
pass
|
||||
|
||||
self.assert_sample("accessibility")
|
||||
self.assert_sample("action_widgets")
|
||||
if have_adw_1_4:
|
||||
self.assert_sample("adw_breakpoint")
|
||||
self.assert_sample("child_type")
|
||||
self.assert_sample("combo_box_text")
|
||||
self.assert_sample("comments")
|
||||
|
@ -208,6 +215,22 @@ class TestSamples(unittest.TestCase):
|
|||
self.assert_sample("using")
|
||||
|
||||
def test_sample_errors(self):
|
||||
have_adw = False
|
||||
have_adw_1_4 = False
|
||||
|
||||
try:
|
||||
import gi
|
||||
|
||||
gi.require_version("Adw", "1")
|
||||
from gi.repository import Adw
|
||||
|
||||
have_adw = True
|
||||
Adw.init()
|
||||
if Adw.MINOR_VERSION >= 4:
|
||||
have_adw_1_4 = True
|
||||
except:
|
||||
pass
|
||||
|
||||
self.assert_sample_error("a11y_in_non_widget")
|
||||
self.assert_sample_error("a11y_prop_dne")
|
||||
self.assert_sample_error("a11y_prop_obj_dne")
|
||||
|
@ -219,6 +242,8 @@ class TestSamples(unittest.TestCase):
|
|||
self.assert_sample_error("action_widget_in_invalid_container")
|
||||
self.assert_sample_error("action_widget_response_dne")
|
||||
self.assert_sample_error("action_widget_negative_response")
|
||||
if have_adw_1_4:
|
||||
self.assert_sample_error("adw_breakpoint")
|
||||
self.assert_sample_error("bitfield_member_dne")
|
||||
self.assert_sample_error("children")
|
||||
self.assert_sample_error("class_assign")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue