[gtk/wip/otte/for-master: 3/3] reftests: Add reftest for last 2 issues




commit ccf9d2fcc2a1036ada1925322f28c1901ab86a37
Author: Benjamin Otte <otte redhat com>
Date:   Sat Nov 6 03:38:03 2021 +0100

    reftests: Add reftest for last 2 issues
    
    Use a label that is long enough to require wrapping and force it into a
    hardcoded width. Use a sentence where all the words have the same size
    to not get unwanted wrapping behavior.
    
    Also append a 2nd row to check that the first row gets the proper height
    allocated.
    
    Found by Marco Melorio.

 .../reftests/listview-with-wrapped-labels.ref.ui   | 50 ++++++++++++++++++
 testsuite/reftests/listview-with-wrapped-labels.ui | 59 ++++++++++++++++++++++
 testsuite/reftests/meson.build                     |  2 +
 3 files changed, 111 insertions(+)
---
diff --git a/testsuite/reftests/listview-with-wrapped-labels.ref.ui 
b/testsuite/reftests/listview-with-wrapped-labels.ref.ui
new file mode 100644
index 0000000000..cb2d150e79
--- /dev/null
+++ b/testsuite/reftests/listview-with-wrapped-labels.ref.ui
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <object class="GtkWindow" id="window1">
+    <property name="width_request">200</property>
+    <property name="height_request">400</property>
+    <property name="decorated">0</property>
+    <child>
+      <object class="GtkScrolledWindow">
+        <child>
+          <object class="GtkListView" id="listview">
+            <property name="factory">
+              <object class="GtkBuilderListItemFactory">
+                <property name="bytes"><![CDATA[
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <template class="GtkListItem">
+    <property name="child">
+      <object class="GtkLabel">
+        <property name="xalign">0</property>
+        <property name="wrap">1</property>
+        <binding name="label">
+          <lookup name="string" type="GtkStringObject">
+            <lookup name="item">GtkListItem</lookup>
+          </lookup>
+        </binding>
+      </object>
+    </property>
+  </template>
+</interface>
+                ]]></property>
+              </object>
+            </property>
+            <property name="model">
+              <object class="GtkNoSelection">
+                <property name="model">
+                  <object class="GtkStringList">
+                    <items>
+                      <item>Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo.</item>
+                      <item>Hello World!</item>
+                    </items>
+                  </object>
+                </property>
+              </object>
+            </property>
+          </object>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/testsuite/reftests/listview-with-wrapped-labels.ui 
b/testsuite/reftests/listview-with-wrapped-labels.ui
new file mode 100644
index 0000000000..4d4292149b
--- /dev/null
+++ b/testsuite/reftests/listview-with-wrapped-labels.ui
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <object class="GtkWindow" id="window1">
+    <property name="width_request">200</property>
+    <property name="height_request">400</property>
+    <property name="decorated">0</property>
+    <child>
+      <object class="GtkScrolledWindow">
+        <child>
+          <object class="GtkListView" id="listview">
+            <property name="factory">
+              <object class="GtkBuilderListItemFactory">
+                <property name="bytes"><![CDATA[
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <template class="GtkListItem">
+    <property name="child">
+      <object class="GtkBox">
+        <child>
+          <object class="GtkBox">
+            <property name="orientation">vertical</property>
+            <child>
+              <object class="GtkLabel">
+                <property name="xalign">0</property>
+                <property name="wrap">1</property>
+                <binding name="label">
+                  <lookup name="string" type="GtkStringObject">
+                    <lookup name="item">GtkListItem</lookup>
+                  </lookup>
+                </binding>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </property>
+  </template>
+</interface>
+                ]]></property>
+              </object>
+            </property>
+            <property name="model">
+              <object class="GtkNoSelection">
+                <property name="model">
+                  <object class="GtkStringList">
+                    <items>
+                      <item>Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo.</item>
+                      <item>Hello World!</item>
+                    </items>
+                  </object>
+                </property>
+              </object>
+            </property>
+          </object>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/testsuite/reftests/meson.build b/testsuite/reftests/meson.build
index 692a427438..7917c1d388 100644
--- a/testsuite/reftests/meson.build
+++ b/testsuite/reftests/meson.build
@@ -385,6 +385,8 @@ testdata = [
   'link-coloring.css',
   'link-coloring.ref.ui',
   'link-coloring.ui',
+  'listview-with-wrapped-labels.ref.ui',
+  'listview-with-wrapped-labels.ui',
   'marble.xpm',
   'messagedialog-secondarytext.ui',
   'messagedialog-secondarytext.ref.ui',


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