[gnome-builder] libide/tweaks: add another test using subpage factory



commit 21c7bf99888dc5e77ed0ad92cfb453e37d30242c
Author: Christian Hergert <chergert redhat com>
Date:   Sun Jul 31 05:33:44 2022 -0700

    libide/tweaks: add another test using subpage factory
    
    This shows an example of modifying the subpage that will be generated
    from the factory using the GListModel items.

 src/libide/tweaks/tests/meson.build        |  1 +
 src/libide/tweaks/tests/test2/0.ui         | 26 ++++++++++++++++++++++++++
 src/libide/tweaks/tests/test2/1.ui         | 25 +++++++++++++++++++++++++
 src/libide/tweaks/tests/test2/expected.xml | 11 +++++++++++
 4 files changed, 63 insertions(+)
---
diff --git a/src/libide/tweaks/tests/meson.build b/src/libide/tweaks/tests/meson.build
index a99012f74..cefb8b5b2 100644
--- a/src/libide/tweaks/tests/meson.build
+++ b/src/libide/tweaks/tests/meson.build
@@ -5,6 +5,7 @@ test_tweaks = executable('test-tweaks', 'test-tweaks.c',
 test_tweaks_runs = [
   # name    subdir   reference       input files
   ['test1', 'test1', 'expected.xml', ['0.ui', '1.ui', '2.ui']],
+  ['test2', 'test2', 'expected.xml', ['0.ui', '1.ui']],
 ]
 
 foreach test_tweaks_run: test_tweaks_runs
diff --git a/src/libide/tweaks/tests/test2/0.ui b/src/libide/tweaks/tests/test2/0.ui
new file mode 100644
index 000000000..516a9b69f
--- /dev/null
+++ b/src/libide/tweaks/tests/test2/0.ui
@@ -0,0 +1,26 @@
+<interface>
+  <template class="IdeTweaks">
+    <child>
+      <object class="IdeTweaksSection" id="programming_section">
+        <child>
+          <object class="IdeTweaksPage" id="languages_page">
+            <child>
+              <object class="IdeTweaksSubpageFactory" id="language_subpage_factory">
+                <property name="model">GtkSourceLanguages</property>
+                <child>
+                  <object class="IdeTweaksSubpage" id="language_subpage">
+                    <child>
+                      <object class="IdeTweaksGroup" id="language_general_group">
+                        <property name="title" translatable="yes">General</property>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
+  </template>
+</interface>
diff --git a/src/libide/tweaks/tests/test2/1.ui b/src/libide/tweaks/tests/test2/1.ui
new file mode 100644
index 000000000..046f3f6f0
--- /dev/null
+++ b/src/libide/tweaks/tests/test2/1.ui
@@ -0,0 +1,25 @@
+<interface>
+  <template class="IdeTweaks">
+    <child internal-child="programming_section">
+      <object class="IdeTweaksSection">
+        <child internal-child="languages_page">
+          <object class="IdeTweaksPage">
+            <child internal-child="language_subpage_factory">
+              <object class="IdeTweaksSubpageFactory">
+                <child internal-child="language_subpage">
+                  <object class="IdeTweaksSubpage">
+                    <child internal-child="language_general_group">
+                      <object class="IdeTweaksGroup">
+                        <property name="sort-key">test-key</property>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
+  </template>
+</interface>
diff --git a/src/libide/tweaks/tests/test2/expected.xml b/src/libide/tweaks/tests/test2/expected.xml
new file mode 100644
index 000000000..2cbba4cbe
--- /dev/null
+++ b/src/libide/tweaks/tests/test2/expected.xml
@@ -0,0 +1,11 @@
+<IdeTweaks id="IdeTweaks" id="IdeTweaks" sort-key="">
+  <IdeTweaksSection id="programming_section" id="programming_section" sort-key="">
+    <IdeTweaksPage id="languages_page" id="languages_page" sort-key="" icon-name="" title="">
+      <IdeTweaksSubpageFactory id="language_subpage_factory" id="language_subpage_factory" sort-key="" 
model="GListStore<GtkSourceLanguage>">
+        <IdeTweaksSubpage id="language_subpage" id="language_subpage" sort-key="" title="">
+          <IdeTweaksGroup id="language_general_group" id="language_general_group" sort-key="test-key" 
title="General"/>
+        </IdeTweaksSubpage>
+      </IdeTweaksSubpageFactory>
+    </IdeTweaksPage>
+  </IdeTweaksSection>
+</IdeTweaks>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]