aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicktext
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@live.com>2015-02-02 11:23:31 -0600
committerMichael Brasser <michael.brasser@live.com>2015-02-03 14:46:57 +0000
commit3b2e59130bf264ec63bf51b2049989f697d91ca1 (patch)
tree0e58a0762a92982d6e3204328e3b287b8cf8203f /tests/auto/quick/qquicktext
parent81b876b7177cf0d55b7c009342e501bfa900175c (diff)
Fix Text wrapping when growing from 0 width.
The fix for QTBUG-30896 caused a regression in the test case. Now check both width and implicit width validity before resetting widthExceeded. Change-Id: I4aba2aad299746906cfe20e288fa60cfe2acc64f Reviewed-by: Andrew den Exter <andrew.den.exter@qinetic.com.au>
Diffstat (limited to 'tests/auto/quick/qquicktext')
-rw-r--r--tests/auto/quick/qquicktext/data/growFromZeroWidth.qml8
-rw-r--r--tests/auto/quick/qquicktext/tst_qquicktext.cpp19
2 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicktext/data/growFromZeroWidth.qml b/tests/auto/quick/qquicktext/data/growFromZeroWidth.qml
new file mode 100644
index 0000000000..a264191e45
--- /dev/null
+++ b/tests/auto/quick/qquicktext/data/growFromZeroWidth.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+Text {
+ width: 0
+ wrapMode: Text.Wrap
+ horizontalAlignment: Text.AlignHCenter
+ text: "AA\nBBBBBBB\nCCCCCCCCCCCCCCCC"
+}
diff --git a/tests/auto/quick/qquicktext/tst_qquicktext.cpp b/tests/auto/quick/qquicktext/tst_qquicktext.cpp
index 2e5212d5d8..7453268f63 100644
--- a/tests/auto/quick/qquicktext/tst_qquicktext.cpp
+++ b/tests/auto/quick/qquicktext/tst_qquicktext.cpp
@@ -148,6 +148,8 @@ private slots:
void hover();
+ void growFromZeroWidth();
+
private:
QStringList standard;
QStringList richText;
@@ -3881,6 +3883,23 @@ void tst_qquicktext::hover()
QVERIFY(mouseArea->property("wasHovered").toBool());
}
+void tst_qquicktext::growFromZeroWidth()
+{
+ QQmlComponent component(&engine, testFile("growFromZeroWidth.qml"));
+
+ QScopedPointer<QObject> object(component.create());
+
+ QQuickText *text = qobject_cast<QQuickText *>(object.data());
+ QVERIFY(text);
+
+ QCOMPARE(text->lineCount(), 3);
+
+ text->setWidth(80);
+
+ // the new width should force our contents to wrap
+ QVERIFY(text->lineCount() > 3);
+}
+
QTEST_MAIN(tst_qquicktext)
#include "tst_qquicktext.moc"