aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicktext
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-05-23 16:11:50 +0200
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2016-05-24 14:00:39 +0200
commit8ae479a8eac7b9ffeeba24e9e459e3e02ca20587 (patch)
treed6fdf18ddd2456835c598f40399348d247af6c97 /tests/auto/quick/qquicktext
parent1337e0d0827e86591e67a6dbaaeb3bd3f9ed733b (diff)
parent607320ca9fb2796a5f6f2578578fd314f7e8b99e (diff)
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts: src/qml/jsruntime/qv4engine_p.h src/qml/jsruntime/qv4runtime_p.h src/qml/qml/qqmldelayedcallqueue.cpp src/qml/qml/qqmlvaluetypewrapper.cpp src/qml/qml/qqmlvmemetaobject.cpp src/qml/qml/v8/qv8engine_p.h tests/auto/quick/qquicktext/tst_qquicktext.cpp Change-Id: I3f0608c7beb88088cbbef4d0db59920f56deaea9
Diffstat (limited to 'tests/auto/quick/qquicktext')
-rw-r--r--tests/auto/quick/qquicktext/data/ellipsisText.qml17
-rw-r--r--tests/auto/quick/qquicktext/tst_qquicktext.cpp22
2 files changed, 39 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 8b7d8c0711..6c0da40b8e 100644
--- a/tests/auto/quick/qquicktext/tst_qquicktext.cpp
+++ b/tests/auto/quick/qquicktext/tst_qquicktext.cpp
@@ -149,6 +149,8 @@ private slots:
void hintingPreference();
+ void zeroWidthAndElidedDoesntRender();
+
private:
QStringList standard;
QStringList richText;
@@ -4175,6 +4177,26 @@ void tst_qquicktext::hintingPreference()
}
+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"