Make builder template factories use a subscope

This commit is contained in:
James Westman 2023-04-28 20:42:46 -05:00
parent a2eaaa26fe
commit 9dcd06de51
6 changed files with 46 additions and 0 deletions

View file

@ -0,0 +1,9 @@
using Gtk 4.0;
BuilderListItemFactory {
template {
child: label;
}
}
Label label {}

View file

@ -0,0 +1 @@
5,12,5,Could not find object with ID label

View file

@ -0,0 +1,9 @@
using Gtk 4.0;
Gtk.BuilderListItemFactory {
template {
child: Gtk.Label label {};
}
}
Gtk.Label label {}

15
tests/samples/subscope.ui Normal file
View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk" version="4.0"/>
<object class="GtkBuilderListItemFactory">
<property name="bytes"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GtkListItem">
<property name="child">
<object class="GtkLabel" id="label"></object>
</property>
</template>
</interface>]]></property>
</object>
<object class="GtkLabel" id="label"></object>
</interface>

View file

@ -184,6 +184,7 @@ class TestSamples(unittest.TestCase):
self.assert_sample("string_list")
self.assert_sample("strings")
self.assert_sample("style")
self.assert_sample("subscope")
self.assert_sample(
"template", skip_run=True
) # The template class doesn't exist
@ -258,6 +259,7 @@ class TestSamples(unittest.TestCase):
self.assert_sample_error("size_group_obj_dne")
self.assert_sample_error("strv")
self.assert_sample_error("styles_in_non_widget")
self.assert_sample_error("subscope")
self.assert_sample_error("two_templates")
self.assert_sample_error("uint")
self.assert_sample_error("using_invalid_namespace")