[gtk/testcase-for-libhandy] reftests: Add a test demonstrating unfortunate headerbar behavior



commit 519b6c542cfcfbda205d6aecdd950f194457388f
Author: Benjamin Otte <otte redhat com>
Date:   Fri Apr 12 22:29:11 2019 +0200

    reftests: Add a test demonstrating unfortunate headerbar behavior
    
    When centering a widget with a size between minimum and natural size,
    the headerbar will always expand it as much as possible instead of
    keeping it centered.

 testsuite/reftests/headerbar-centering.ref.ui | 42 +++++++++++++++++++++++++++
 testsuite/reftests/headerbar-centering.ui     | 36 +++++++++++++++++++++++
 testsuite/reftests/meson.build                |  2 ++
 3 files changed, 80 insertions(+)
---
diff --git a/testsuite/reftests/headerbar-centering.ref.ui b/testsuite/reftests/headerbar-centering.ref.ui
new file mode 100644
index 0000000000..b45209518a
--- /dev/null
+++ b/testsuite/reftests/headerbar-centering.ref.ui
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <object class="GtkWindow">
+    <property name="type">popup</property>
+    <property name="default-width">400</property>
+    <child>
+      <object class="GtkHeaderBar">
+        <property name="title" translatable="yes">Join Chat Room</property>
+        <child type="start">
+          <object class="GtkButton">
+            <property name="label" translatable="yes">Hello World</property>
+            <property name="opacity">0</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkButton" id="back_button">
+            <property name="visible">0</property>
+            <property name="can_focus">1</property>
+            <property name="valign">center</property>
+            <style>
+              <class name="image-button"/>
+            </style>
+            <child>
+              <object class="GtkImage" id="back_icon"/>
+            </child>
+          </object>
+        </child>
+        <child type="title">
+          <object class="GtkLabel">
+            <property name="label" translatable="yes">This is a very long label that should be centered in 
the headerbar but unfortunately the headerbar scres this up and gives it all the available space instead and 
there's nothing we can do about it and now we're sad developers.</property>
+            <property name="ellipsize">end</property>
+          </object>
+        </child>
+        <child type="end">
+          <object class="GtkButton">
+            <property name="label" translatable="yes">Hello World</property>
+          </object>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/testsuite/reftests/headerbar-centering.ui b/testsuite/reftests/headerbar-centering.ui
new file mode 100644
index 0000000000..4ab7e2987d
--- /dev/null
+++ b/testsuite/reftests/headerbar-centering.ui
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <object class="GtkWindow">
+    <property name="type">popup</property>
+    <property name="default-width">400</property>
+    <child>
+      <object class="GtkHeaderBar">
+        <property name="title" translatable="yes">Join Chat Room</property>
+        <child>
+          <object class="GtkButton" id="back_button">
+            <property name="visible">0</property>
+            <property name="can_focus">1</property>
+            <property name="valign">center</property>
+            <style>
+              <class name="image-button"/>
+            </style>
+            <child>
+              <object class="GtkImage" id="back_icon"/>
+            </child>
+          </object>
+        </child>
+        <child type="title">
+          <object class="GtkLabel">
+            <property name="label" translatable="yes">This is a very long label that should be centered in 
the headerbar but unfortunately the headerbar scres this up and gives it all the available space instead and 
there's nothing we can do about it and now we're sad developers.</property>
+            <property name="ellipsize">end</property>
+          </object>
+        </child>
+        <child type="end">
+          <object class="GtkButton">
+            <property name="label" translatable="yes">Hello World</property>
+          </object>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/testsuite/reftests/meson.build b/testsuite/reftests/meson.build
index 3bafca4fad..ca9010b768 100644
--- a/testsuite/reftests/meson.build
+++ b/testsuite/reftests/meson.build
@@ -225,6 +225,8 @@ testdata = [
   'gtk-icontheme-sizing.css',
   'gtk-icontheme-sizing.ref.ui',
   'gtk-icontheme-sizing.ui',
+  'headerbar-centering.ui',
+  'headerbar-centering.ref.ui',
   'icon-effect-missing.css',
   'icon-effect-missing.ref.ui',
   'icon-effect-missing.ui',


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