From cc09f3d3bb8e6f273072c1b4727929bf7b0bad83 Mon Sep 17 00:00:00 2001 From: Tom Greig Date: Sun, 30 Mar 2025 10:27:11 +0100 Subject: [PATCH] Add tests for nested templates Basically just a copy of the list_factory test, but with an extra copy of the list factory inside it. --- tests/samples/list_factory_nested.blp | 17 +++++++++ tests/samples/list_factory_nested.ui | 44 +++++++++++++++++++++++ tests/samples/list_factory_nested_dec.blp | 18 ++++++++++ 3 files changed, 79 insertions(+) create mode 100644 tests/samples/list_factory_nested.blp create mode 100644 tests/samples/list_factory_nested.ui create mode 100644 tests/samples/list_factory_nested_dec.blp diff --git a/tests/samples/list_factory_nested.blp b/tests/samples/list_factory_nested.blp new file mode 100644 index 0000000..86a59b3 --- /dev/null +++ b/tests/samples/list_factory_nested.blp @@ -0,0 +1,17 @@ +using Gtk 4.0; + +Gtk.ListView { + factory: Gtk.BuilderListItemFactory list_item_factory { + template ListItem { + child: Gtk.ListView { + factory: Gtk.BuilderListItemFactory list_item_factory { + template ListItem { + child: Gtk.Label { + label: bind template.item as <$MyObject>.name; + }; + } + }; + }; + } + }; +} diff --git a/tests/samples/list_factory_nested.ui b/tests/samples/list_factory_nested.ui new file mode 100644 index 0000000..44cdb2b --- /dev/null +++ b/tests/samples/list_factory_nested.ui @@ -0,0 +1,44 @@ + + + + + + + + + + +]]> + + + + diff --git a/tests/samples/list_factory_nested_dec.blp b/tests/samples/list_factory_nested_dec.blp new file mode 100644 index 0000000..755491c --- /dev/null +++ b/tests/samples/list_factory_nested_dec.blp @@ -0,0 +1,18 @@ +using Gtk 4.0; + +ListView { + factory: BuilderListItemFactory list_item_factory { + template ListItem { + child: ListView { + factory: BuilderListItemFactory list_item_factory { + template ListItem { + child: Label { + label: bind template.item as <$MyObject>.name; + }; + } + }; + }; + } + }; +} +