diff options
Diffstat (limited to 'tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp')
-rw-r--r-- | tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp | 20 |
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() |