[gtk/wrap-label-fixup] Add tests for the new wrap behavior



commit fcd8abe0bf487b0468b7b4b878feb17c4d1fa0fe
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Apr 12 22:01:57 2022 -0400

    Add tests for the new wrap behavior

 testsuite/reftests/label-wrap1.ref.ui | 24 ++++++++++++++++++++++++
 testsuite/reftests/label-wrap1.ui     | 27 +++++++++++++++++++++++++++
 testsuite/reftests/label-wrap2.ref.ui | 19 +++++++++++++++++++
 testsuite/reftests/label-wrap2.ui     | 26 ++++++++++++++++++++++++++
 testsuite/reftests/label-wrap3.ref.ui | 22 ++++++++++++++++++++++
 testsuite/reftests/label-wrap3.ui     | 25 +++++++++++++++++++++++++
 testsuite/reftests/meson.build        |  3 +++
 7 files changed, 146 insertions(+)
---
diff --git a/testsuite/reftests/label-wrap1.ref.ui b/testsuite/reftests/label-wrap1.ref.ui
new file mode 100644
index 0000000000..ba2b7b62f0
--- /dev/null
+++ b/testsuite/reftests/label-wrap1.ref.ui
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <object class="GtkWindow">
+    <property name="default-width">10</property>
+    <!--- Set this:
+      1 to test min height
+      remove it to test nat height
+      200 to test oversize
+    -->
+    <property name="default-height">1</property>
+    <property name="decorated">0</property>
+    <child>
+      <object class="GtkLabel">
+        <!-- 4 words with ~same length, so we know it'll be broken into 4 line -->
+        <property name="label">Hello
+W…</property>
+        <!--- To limit the width to 1 word -->
+        <property name="wrap-mode">word</property>
+        <!-- These 2 influence if the lines property is used -->
+        <property name="wrap">1</property>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/testsuite/reftests/label-wrap1.ui b/testsuite/reftests/label-wrap1.ui
new file mode 100644
index 0000000000..e9b13febb2
--- /dev/null
+++ b/testsuite/reftests/label-wrap1.ui
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <object class="GtkWindow">
+    <property name="default-width">10</property>
+    <!--- Set this:
+      1 to test min height
+      remove it to test nat height
+      200 to test oversize
+    -->
+    <property name="default-height">1</property>
+    <property name="decorated">0</property>
+    <child>
+      <object class="GtkLabel">
+        <!-- 4 words with ~same length, so we know it'll be broken into 4 line -->
+        <property name="label">Hello World multi line</property>
+        <!--- To limit the width to 1 word -->
+        <property name="max-width-chars">2</property>
+        <property name="wrap-mode">word</property>
+        <!-- These 2 influence if the lines property is used -->
+        <property name="wrap">1</property>
+        <property name="ellipsize">end</property>
+        <!-- The actual test -->
+        <property name="lines">2</property>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/testsuite/reftests/label-wrap2.ref.ui b/testsuite/reftests/label-wrap2.ref.ui
new file mode 100644
index 0000000000..26c5c94dc6
--- /dev/null
+++ b/testsuite/reftests/label-wrap2.ref.ui
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <object class="GtkWindow">
+    <property name="default-width">10</property>
+    <!--- Set this:
+      1 to test min height
+      remove it to test nat height
+      200 to test oversize
+    -->
+    <property name="default-height">1</property>
+    <property name="decorated">0</property>
+    <child>
+      <object class="GtkLabel">
+        <!-- 4 words with ~same length, so we know it'll be broken into 4 line -->
+        <property name="label">…</property>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/testsuite/reftests/label-wrap2.ui b/testsuite/reftests/label-wrap2.ui
new file mode 100644
index 0000000000..501db0537b
--- /dev/null
+++ b/testsuite/reftests/label-wrap2.ui
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <object class="GtkWindow">
+    <property name="default-width">10</property>
+    <!--- Set this:
+      1 to test min height
+      remove it to test nat height
+      200 to test oversize
+    -->
+    <property name="default-height">1</property>
+    <property name="decorated">0</property>
+    <child>
+      <object class="GtkLabel">
+        <!-- 4 words with ~same length, so we know it'll be broken into 4 line -->
+        <property name="label">Hello World multi line</property>
+        <!--- To limit the width to 1 word -->
+        <property name="max-width-chars">2</property>
+        <property name="wrap-mode">word</property>
+        <!-- These 2 influence if the lines property is used -->
+        <property name="ellipsize">end</property>
+        <!-- The actual test -->
+        <property name="lines">2</property>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/testsuite/reftests/label-wrap3.ref.ui b/testsuite/reftests/label-wrap3.ref.ui
new file mode 100644
index 0000000000..f5cd7bf2ba
--- /dev/null
+++ b/testsuite/reftests/label-wrap3.ref.ui
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <object class="GtkWindow">
+    <property name="default-width">10</property>
+    <!--- Set this:
+      1 to test min height
+      remove it to test nat height
+      200 to test oversize
+    -->
+    <property name="default-height">1</property>
+    <property name="decorated">0</property>
+    <child>
+      <object class="GtkLabel">
+        <!-- 4 words with ~same length, so we know it'll be broken into 4 line -->
+        <property name="label">Hello
+World
+multi
+line</property>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/testsuite/reftests/label-wrap3.ui b/testsuite/reftests/label-wrap3.ui
new file mode 100644
index 0000000000..152e72f0bf
--- /dev/null
+++ b/testsuite/reftests/label-wrap3.ui
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <object class="GtkWindow">
+    <property name="default-width">10</property>
+    <!--- Set this:
+      1 to test min height
+      remove it to test nat height
+      200 to test oversize
+    -->
+    <property name="default-height">1</property>
+    <property name="decorated">0</property>
+    <child>
+      <object class="GtkLabel">
+        <!-- 4 words with ~same length, so we know it'll be broken into 4 line -->
+        <property name="label">Hello World multi line</property>
+        <!--- To limit the width to 1 word -->
+        <property name="max-width-chars">2</property>
+        <property name="wrap-mode">word</property>
+        <!-- These 2 influence if the lines property is used -->
+        <property name="wrap">1</property>
+        <property name="lines">2</property>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/testsuite/reftests/meson.build b/testsuite/reftests/meson.build
index 0b6d0fa84a..6d8a802ed2 100644
--- a/testsuite/reftests/meson.build
+++ b/testsuite/reftests/meson.build
@@ -416,6 +416,9 @@ testdata = [
   'label-wrap-word-char-natural-size.ui',
   'label-wrapped-huge-max-width-chars.ref.ui',
   'label-wrapped-huge-max-width-chars.ui',
+  'label-wrap1.ui',
+  'label-wrap2.ui',
+  'label-wrap3.ui',
   # this seems to make assumptions on text positioning
   # that are not valid with subpixel positioning
   #'label-wrap-justify.ref.ui',


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