qt5base-lts/tests/auto/gui/text/qglyphrun
Eskil Abrahamsen Blomfeldt 3e238113f8 Accept error margin in QGlyphRun/QStaticText test for decorations
When calculating the width of a text for drawing decorations on top,
we use the effective advance of the whole text after it has been
through the shaper.

However, in the case of QStaticText and QGlyphRun, there is shortcut:
Since we only have the glyph indexes and position of each glyph,
we use the position + advance of the right-most glyph to find the
right-most edge of the decoration. For this, however, we use the
advance of the glyph *out of context* of the rest of the string,
because the whole idea is to avoid doing the shaping of the string
with every draw call. In some rare cases, the advance of the
right-most character, in the context of the string, is different
from the advance of the standalone glyph.

Now, one way of fixing this would be to store the width of the
text in QStaticText and QGlyphRun, but since it is a very rare
artifact which is barely visible, I have opted to just work around
it in the test instead, the workaround being to force integer
metrics so that we don't get the small 0.2 pixel error.

Task-number: QTBUG-55217
Change-Id: I8d16d52f2ef27275cabb7d3865aeeaa31617ba3d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-02-02 15:10:41 +00:00
..
qglyphrun.pro QtGui: Remove Windows CE. 2016-03-30 17:35:41 +00:00
testdata.qrc QStyleSheetStyle: Don't interfere with QFontDialog 2014-10-24 16:59:26 +02:00
tst_qglyphrun.cpp Accept error margin in QGlyphRun/QStaticText test for decorations 2017-02-02 15:10:41 +00:00