aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicktext
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2020-01-20 01:00:27 +0100
committerFabian Kosmale <fabian.kosmale@qt.io>2020-01-20 07:04:47 +0000
commitb9519d9630d9192cb49b97c7c9fe30d43ab1ee4a (patch)
tree512b32a0e2dea84a89a01e89a1b7868f3c1c8a37 /tests/auto/quick/qquicktext
parent0ced82a8cf8472a79b08db05d441caf778ac9131 (diff)
parente5f7c5f2712957d0e1753c629e4cce86a0e6bdbc (diff)
Merge remote-tracking branch 'origin/5.15' into dev
Conflicts: src/qml/qml/qqmlvaluetype.cpp tests/auto/qml/qml.pro Change-Id: I78f992f83212bb9fd5e09b64163f15f046185224
Diffstat (limited to 'tests/auto/quick/qquicktext')
-rw-r--r--tests/auto/quick/qquicktext/data/displaySuperscriptedTag.qml18
-rw-r--r--tests/auto/quick/qquicktext/tst_qquicktext.cpp28
2 files changed, 46 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicktext/data/displaySuperscriptedTag.qml b/tests/auto/quick/qquicktext/data/displaySuperscriptedTag.qml
new file mode 100644
index 0000000000..b0ed21a0c8
--- /dev/null
+++ b/tests/auto/quick/qquicktext/data/displaySuperscriptedTag.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 200
+ height: 200
+ color: "white"
+ Text {
+ objectName: "text"
+ textFormat: Text.RichText
+ anchors.fill: parent
+ color: "black"
+ // display a black rectangle at the top left of the text
+ text: "<span style=\"background-color:rgba(255,255,255,255);vertical-align:super;\">&#x2588;</span>This is a test"
+ verticalAlignment: Text.AlignTop
+ horizontalAlignment: Text.AlignLeft
+ font.pixelSize: 30
+ }
+}
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"