diff options
author | Kari Hautamäki <kari.hautamaki@theqtcompany.com> | 2015-04-20 15:05:59 +0300 |
---|---|---|
committer | Kari Hautamäki <kari.hautamaki@theqtcompany.com> | 2016-05-20 08:20:07 +0000 |
commit | afd01a7341df6ab5629469d9b55ab4f1b195cff0 (patch) | |
tree | bfb43518afb74f4297f14a6f47c025c9573b1212 /tests | |
parent | ad069828db14cbb9d657b482a802358924c6b947 (diff) |
Don't render when width is zero and elide is not None
Works now similarly as with very small text lengths (smaller than
elide characted length).
Change-Id: I0c4aafbcc50343bb0ec8b5f335045e1048a499fd
Task-number: QTBUG-34990
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/quick/qquicktext/data/ellipsisText.qml | 17 | ||||
-rw-r--r-- | tests/auto/quick/qquicktext/tst_qquicktext.cpp | 23 |
2 files changed, 40 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicktext/data/ellipsisText.qml b/tests/auto/quick/qquicktext/data/ellipsisText.qml new file mode 100644 index 0000000000..37faafcbf3 --- /dev/null +++ b/tests/auto/quick/qquicktext/data/ellipsisText.qml @@ -0,0 +1,17 @@ +import QtQuick 2.0 + +Text { + width: 0 + height: 10 + text: "Meaningless text" + elide: Text.ElideRight + + Text { + objectName: "elidedRef" + width: 10 + height: 10 + text: "Meaningless text" + elide: Text.ElideRight + } +} + diff --git a/tests/auto/quick/qquicktext/tst_qquicktext.cpp b/tests/auto/quick/qquicktext/tst_qquicktext.cpp index 46ec099501..d0fc36936a 100644 --- a/tests/auto/quick/qquicktext/tst_qquicktext.cpp +++ b/tests/auto/quick/qquicktext/tst_qquicktext.cpp @@ -147,6 +147,9 @@ private slots: void padding(); + void zeroWidthAndElidedDoesntRender(); + + private: QStringList standard; QStringList richText; @@ -4146,6 +4149,26 @@ void tst_qquicktext::padding() delete root; } +void tst_qquicktext::zeroWidthAndElidedDoesntRender() +{ + // Tests QTBUG-34990 + + QQmlComponent component(&engine, testFile("ellipsisText.qml")); + + QScopedPointer<QObject> object(component.create()); + + QQuickText *text = qobject_cast<QQuickText *>(object.data()); + QVERIFY(text); + + QCOMPARE(text->contentWidth(), 0.0); + + QQuickText *reference = text->findChild<QQuickText *>("elidedRef"); + QVERIFY(reference); + + text->setWidth(10); + QCOMPARE(text->contentWidth(), reference->contentWidth()); +} + QTEST_MAIN(tst_qquicktext) #include "tst_qquicktext.moc" |