diff options
author | Wang Chuan <ouchuanm@outlook.com> | 2020-01-05 09:34:28 +0800 |
---|---|---|
committer | Wang Chuan <ouchuanm@outlook.com> | 2020-01-16 15:00:39 +0800 |
commit | 7b4275b541808a5c26b2524b3bde2b1f9bc56fc1 (patch) | |
tree | 06fab0f0bcbb294e55caff918d21aaa755ab26b1 /tests/auto/quick/qquicktext/tst_qquicktext.cpp | |
parent | 43e3c21a0bad9141b6c35cc4ee4a58b4d824462a (diff) |
QQuickTextNodeEngine: reduce redundant rendering of glyphs
The glyphs between two text blocks that have different text format
will be rendered twice, and in this case the rich text will be display
incorrectly.(e.g., the first text block is a superscript and the
second is a normal text)
Fixes this by reduce the redundant rendering of glyphs between two
differently formatted text blocks
Fixes: QTBUG-80759
Change-Id: I51ca3f7df1ad368d28df9beb6124a87bf50f0e01
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'tests/auto/quick/qquicktext/tst_qquicktext.cpp')
-rw-r--r-- | tests/auto/quick/qquicktext/tst_qquicktext.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicktext/tst_qquicktext.cpp b/tests/auto/quick/qquicktext/tst_qquicktext.cpp index 06ce730091..a64c9372da 100644 --- a/tests/auto/quick/qquicktext/tst_qquicktext.cpp +++ b/tests/auto/quick/qquicktext/tst_qquicktext.cpp @@ -168,6 +168,8 @@ private slots: void transparentBackground(); + void displaySuperscriptedTag(); + private: QStringList standard; QStringList richText; @@ -4507,6 +4509,32 @@ void tst_qquicktext::transparentBackground() QCOMPARE(color.blue(), 255); QCOMPARE(color.green(), 255); } + +void tst_qquicktext::displaySuperscriptedTag() +{ + if ((QGuiApplication::platformName() == QLatin1String("offscreen")) + || (QGuiApplication::platformName() == QLatin1String("minimal"))) + QSKIP("Skipping due to grabToImage not functional on offscreen/minimimal platforms"); + + QScopedPointer<QQuickView> window(new QQuickView); + window->setSource(testFileUrl("displaySuperscriptedTag.qml")); + QTRY_COMPARE(window->status(), QQuickView::Ready); + + window->show(); + QVERIFY(QTest::qWaitForWindowExposed(window.data())); + + QQuickText *text = window->findChild<QQuickText *>("text"); + QVERIFY(text); + + QImage img = window->grabWindow(); + QCOMPARE(img.isNull(), false); + + QColor color = img.pixelColor(1, static_cast<int>(text->contentHeight()) / 4 * 3); + QCOMPARE(color.red(), 255); + QCOMPARE(color.blue(), 255); + QCOMPARE(color.green(), 255); +} + QTEST_MAIN(tst_qquicktext) #include "tst_qquicktext.moc" |