reftests: Add test for the overflow methods

Reference is using labels again
This commit is contained in:
Benjamin Otte 2022-06-10 01:09:49 +02:00
parent 7c034cc283
commit bf5edc6b7c
4 changed files with 82 additions and 4 deletions

View File

@ -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;

View File

@ -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>

View File

@ -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="text-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="text-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="text-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="text-overflow">ellipsize-end</property>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@ -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',