diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-02-02 17:08:58 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-06-06 16:59:31 +0000 |
commit | b46cb00fc0e63dc0e58c6779b4e0f92e0cec70a7 (patch) | |
tree | bfe9f7b2e1659becb974ff051038562e909f7ad5 /tests/auto/gui/text/qstatictext/tst_qstatictext.cpp | |
parent | b72a9cbaaf7d49a1813c3b1926a68e05f47f350a (diff) |
Handle negative leading in layout
Adjust line positions to deal with negative leading which isn't included
in height of QTextLine.
Change-Id: Id7918968c0f9d7e65700b9e7a08fc5d761883f22
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'tests/auto/gui/text/qstatictext/tst_qstatictext.cpp')
-rw-r--r-- | tests/auto/gui/text/qstatictext/tst_qstatictext.cpp | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp b/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp index 83e9390d25..beaec04238 100644 --- a/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp +++ b/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp @@ -245,38 +245,33 @@ void tst_QStaticText::compareToDrawText() QPainter p(&imageDrawStaticPlainText); p.setFont(font); QStaticText text("Lorem ipsum dolor sit amet, consectetur adipiscing elit."); - text.setTextWidth(30), + text.setTextWidth(10), p.setClipRect(QRectF(11, 12, 30, 500)); text.setTextFormat(Qt::PlainText); p.drawStaticText(QPointF(11, 12), text); } -#if defined(DEBUG_SAVE_IMAGE) - imageDrawText.save("compareToDrawText_imageDrawText.png"); - imageDrawStaticPlainText.save("compareToDrawText_imageDrawStaticPlainText.png"); -#endif - - QVERIFY(imageDrawText.toImage() != m_whiteSquare); - QCOMPARE(imageDrawStaticPlainText, imageDrawText); - - // Rich text rendering does not take negative leading into account. -#if 0 QPixmap imageDrawStaticRichText(1000, 1000); imageDrawStaticRichText.fill(Qt::white); { QPainter p(&imageDrawStaticRichText); p.setFont(font); QStaticText text("Lorem ipsum dolor sit amet, consectetur adipiscing elit."); - text.setTextWidth(30), + text.setTextWidth(10), p.setClipRect(QRectF(11, 12, 30, 500)); text.setTextFormat(Qt::RichText); p.drawStaticText(QPointF(11, 12), text); } + #if defined(DEBUG_SAVE_IMAGE) - imageDrawStaticRichText.save("compareToDrawText_imageDrawStaticRichText.png"); + imageDrawText.save("compareToDrawText_imageDrawText.png"); + imageDrawStaticText.save("compareToDrawText_imageDrawStaticPlainText.png"); + imageDrawStaticText.save("compareToDrawText_imageDrawStaticRichText.png"); #endif + + QVERIFY(imageDrawText.toImage() != m_whiteSquare); + QCOMPARE(imageDrawStaticPlainText, imageDrawText); QCOMPARE(imageDrawStaticRichText, imageDrawText); -#endif } void tst_QStaticText::prepareToCorrectData() |