[gtk/wip/otte/inscription: 3/3] reftests: Add test for the overflow methods
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/inscription: 3/3] reftests: Add test for the overflow methods
- Date: Thu, 9 Jun 2022 23:11:52 +0000 (UTC)
commit 39a74380708efa18a2bb9df86b628d23e5ea5221
Author: Benjamin Otte <otte redhat com>
Date: Fri Jun 10 01:09:49 2022 +0200
reftests: Add test for the overflow methods
Reference is using labels again
gtk/gtkinscription.c | 8 ++---
testsuite/reftests/inscription-overflow.ref.ui | 41 ++++++++++++++++++++++++++
testsuite/reftests/inscription-overflow.ui | 35 ++++++++++++++++++++++
testsuite/reftests/meson.build | 2 ++
4 files changed, 82 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkinscription.c b/gtk/gtkinscription.c
index 164b29256b..488f602607 100644
--- a/gtk/gtkinscription.c
+++ b/gtk/gtkinscription.c
@@ -367,8 +367,8 @@ gtk_inscription_measure (GtkWidget *widget,
static void
gtk_inscription_get_layout_location (GtkInscription *self,
- int *x_out,
- int *y_out)
+ float *x_out,
+ float *y_out)
{
GtkWidget *widget = GTK_WIDGET (self);
const int widget_width = gtk_widget_get_width (widget);
@@ -376,7 +376,7 @@ gtk_inscription_get_layout_location (GtkInscription *self,
PangoRectangle logical;
float xalign;
int baseline;
- int x, y;
+ float x, y;
g_assert (x_out);
g_assert (y_out);
@@ -451,7 +451,7 @@ gtk_inscription_snapshot (GtkWidget *widget,
{
GtkInscription *self = GTK_INSCRIPTION (widget);
GtkStyleContext *context;
- int lx, ly;
+ float lx, ly;
if (!self->text || (*self->text == '\0'))
return;
diff --git a/testsuite/reftests/inscription-overflow.ref.ui b/testsuite/reftests/inscription-overflow.ref.ui
new file mode 100644
index 0000000000..e9b131b1d5
--- /dev/null
+++ b/testsuite/reftests/inscription-overflow.ref.ui
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <object class="GtkWindow">
+ <property name="default-width">200</property>
+ <child>
+ <object class="GtkBox">
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkOverlay">
+ <child>
+ <object class="GtkLabel" />
+ </child>
+ <child type="overlay">
+ <object class="GtkLabel">
+ <property name="label" translatable="yes">Lorem ipsum dolor sit amet, consetetur sadipscing
elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
voluptua.</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="label" translatable="yes">Lorem ipsum dolor sit amet, consetetur sadipscing
elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
voluptua.</property>
+ <property name="ellipsize">start</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="label" translatable="yes">Lorem ipsum dolor sit amet, consetetur sadipscing
elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
voluptua.</property>
+ <property name="ellipsize">middle</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="label" translatable="yes">Lorem ipsum dolor sit amet, consetetur sadipscing
elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
voluptua.</property>
+ <property name="ellipsize">end</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
diff --git a/testsuite/reftests/inscription-overflow.ui b/testsuite/reftests/inscription-overflow.ui
new file mode 100644
index 0000000000..b4ed99a28c
--- /dev/null
+++ b/testsuite/reftests/inscription-overflow.ui
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <object class="GtkWindow">
+ <property name="default-width">200</property>
+ <child>
+ <object class="GtkBox">
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkInscription">
+ <property name="text" translatable="yes">Lorem ipsum dolor sit amet, consetetur sadipscing
elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
voluptua.</property>
+ <property name="overflow">clip</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkInscription">
+ <property name="text" translatable="yes">Lorem ipsum dolor sit amet, consetetur sadipscing
elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
voluptua.</property>
+ <property name="overflow">ellipsize-start</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkInscription">
+ <property name="text" translatable="yes">Lorem ipsum dolor sit amet, consetetur sadipscing
elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
voluptua.</property>
+ <property name="overflow">ellipsize-middle</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkInscription">
+ <property name="text" translatable="yes">Lorem ipsum dolor sit amet, consetetur sadipscing
elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
voluptua.</property>
+ <property name="overflow">ellipsize-end</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
diff --git a/testsuite/reftests/meson.build b/testsuite/reftests/meson.build
index 3001d0e127..7c03cb7062 100644
--- a/testsuite/reftests/meson.build
+++ b/testsuite/reftests/meson.build
@@ -369,6 +369,8 @@ testdata = [
'image-load-from-file.ui',
'inscription-markup.ref.ui',
'inscription-markup.ui',
+ 'inscription-overflow.ref.ui',
+ 'inscription-overflow.ui',
'label-attribute-preference.css',
'label-attribute-preference.ref.ui',
'label-attribute-preference.ui',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]