forked from AuroraMiddleware/gtk
label: Handle width-chars > text width
This was broken in wrapping labels. Testcase included.
This commit is contained in:
parent
bf40b89b53
commit
1e47b1c610
@ -1174,6 +1174,7 @@ get_width_for_height (GtkLabel *self,
|
||||
/* Minimum width is as many line breaks as possible */
|
||||
layout = gtk_label_get_measuring_layout (self, NULL, MAX (minimum_default, 0));
|
||||
pango_layout_get_size (layout, minimum_width, NULL);
|
||||
*minimum_width = MAX (*minimum_width, minimum_default);
|
||||
|
||||
/* Natural width is natural width - or as wide as possible */
|
||||
layout = gtk_label_get_measuring_layout (self, layout, natural_default);
|
||||
|
12
testsuite/reftests/label-wrap-width-chars.ref.ui
Normal file
12
testsuite/reftests/label-wrap-width-chars.ref.ui
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkWindow" id="window1">
|
||||
<property name="decorated">0</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label1">
|
||||
<property name="label" translatable="yes">Hello World</property>
|
||||
<property name="width-chars">20</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
13
testsuite/reftests/label-wrap-width-chars.ui
Normal file
13
testsuite/reftests/label-wrap-width-chars.ui
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkWindow" id="window1">
|
||||
<property name="decorated">0</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label1">
|
||||
<property name="label" translatable="yes">Hello World</property>
|
||||
<property name="wrap">1</property>
|
||||
<property name="width-chars">20</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
@ -369,6 +369,8 @@ testdata = [
|
||||
'label-text-shadow-changes-modify-clip.ui',
|
||||
'label-width-chars-dont-shrink.ref.ui',
|
||||
'label-width-chars-dont-shrink.ui',
|
||||
'label-wrap-width-chars.ref.ui',
|
||||
'label-wrap-width-chars.ui',
|
||||
'label-wrapped-huge-max-width-chars.ref.ui',
|
||||
'label-wrapped-huge-max-width-chars.ui',
|
||||
# this seems to make assumptions on text positioning
|
||||
|
Loading…
Reference in New Issue
Block a user