From afd01a7341df6ab5629469d9b55ab4f1b195cff0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kari=20Hautam=C3=A4ki?= Date: Mon, 20 Apr 2015 15:05:59 +0300 Subject: 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 --- tests/auto/quick/qquicktext/tst_qquicktext.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tests/auto/quick/qquicktext/tst_qquicktext.cpp') 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 object(component.create()); + + QQuickText *text = qobject_cast(object.data()); + QVERIFY(text); + + QCOMPARE(text->contentWidth(), 0.0); + + QQuickText *reference = text->findChild("elidedRef"); + QVERIFY(reference); + + text->setWidth(10); + QCOMPARE(text->contentWidth(), reference->contentWidth()); +} + QTEST_MAIN(tst_qquicktext) #include "tst_qquicktext.moc" -- cgit v1.2.3