mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-09 10:20:07 +00:00
label: max-width-chars should be ignored sometimes
When a widget is neither wrappable nor ellipsizable, we cannot modify the label to fit into any size. So we cannot respect max-width-chars.
This commit is contained in:
parent
cce6a603a6
commit
81169d18c3
@ -1082,7 +1082,7 @@ get_static_size (GtkLabel *self,
|
||||
|
||||
get_default_widths (self, &minimum_default, &natural_default);
|
||||
|
||||
layout = gtk_label_get_measuring_layout (self, NULL, natural_default);
|
||||
layout = gtk_label_get_measuring_layout (self, NULL, self->ellipsize ? natural_default : -1);
|
||||
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
|
11
testsuite/reftests/label-small-max-width-chars.ref.ui
Normal file
11
testsuite/reftests/label-small-max-width-chars.ref.ui
Normal file
@ -0,0 +1,11 @@
|
||||
<?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">Hello World</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
12
testsuite/reftests/label-small-max-width-chars.ui
Normal file
12
testsuite/reftests/label-small-max-width-chars.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">Hello World</property>
|
||||
<property name="max-width-chars">2</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
@ -359,6 +359,8 @@ testdata = [
|
||||
'label-sizing.ui',
|
||||
'label-small-ellipsized.ref.ui',
|
||||
'label-small-ellipsized.ui',
|
||||
'label-small-max-width-chars.ref.ui',
|
||||
'label-small-max-width-chars.ui',
|
||||
'label-text-shadow-clipping.css',
|
||||
'label-text-shadow-clipping.ref.ui',
|
||||
'label-text-shadow-clipping.ui',
|
||||
|
Loading…
Reference in New Issue
Block a user