summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativetext
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-04-15 02:41:36 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-04-15 02:41:36 (GMT)
commit5645cd7d7a97edb248a67d094993900f1dba4be8 (patch)
treeb939a4e93eb1eabdff4c4c0d21d2f676d3dafb93 /tests/auto/declarative/qdeclarativetext
parent2d9bc3296168de084fab45a4008edab8c290c3ff (diff)
downloadQt-5645cd7d7a97edb248a67d094993900f1dba4be8.zip
Qt-5645cd7d7a97edb248a67d094993900f1dba4be8.tar.gz
Qt-5645cd7d7a97edb248a67d094993900f1dba4be8.tar.bz2
Make sure richtext wraps correctly with a fixed height set.
Diffstat (limited to 'tests/auto/declarative/qdeclarativetext')
-rw-r--r--tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
index 2d10756..6637415 100644
--- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
+++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
@@ -286,8 +286,28 @@ void tst_qdeclarativetext::wrap()
QVERIFY(textObject != 0);
QCOMPARE(textObject->width(), 30.);
QVERIFY(textObject->height() > textHeight);
+
+ qreal oldHeight = textObject->height();
+ textObject->setWidth(100);
+ QVERIFY(textObject->height() < oldHeight);
}
+ // richtext again with a fixed height
+ for (int i = 0; i < richText.size(); i++)
+ {
+ QString componentStr = "import Qt 4.7\nText { wrapMode: Text.WordWrap; width: 30; height: 50; text: \"" + richText.at(i) + "\" }";
+ QDeclarativeComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->width(), 30.);
+ QVERIFY(textObject->implicitHeight() > textHeight);
+
+ qreal oldHeight = textObject->implicitHeight();
+ textObject->setWidth(100);
+ QVERIFY(textObject->implicitHeight() < oldHeight);
+ }
}
void tst_qdeclarativetext::elide()