Ticket #666 (new defect)
adjustSize() sometimes sets width to invalid values
|Reported by:||totycro@…||Owned by:||FIFE|
|Time remaining:||Time spent:|
The setup is as follows:
A Label with a min and max width, which are the same. It gets some wrapped text, on resizeToContent, ClickLabel::adjustSize is called (. Here, setWidth() is called with the result of mGuiFont->getAsImageMultiline(mWrappedText), which isFontBase::getAsImageMultiline . This calculates a width of the text, which i don't yet know what it is.
However this width is set, violating the min/max constraints (first bug). The text is then rewrapped using wrapText() in setWidth(). After that, the height is set, but with the value from the original image, which has been calculated with the old width. Sometimes the rewrapping requires a new line, which would increase the height, but still the old value is set without rechecking. Therefore the last wrapped part is hidden (second bug).
So the width should not be changed in the first place in this case, and if it would be set in other cases, the height should adapt accordingly, or, the image returned by getAsImageMultiline should be such that it's wide enough to fit the maximum line of the original render, such that it decreases the width only so far that the height can stay the same (no additional newlines are introduced).