diff options
author | Andrew den Exter <andrew.den-exter@nokia.com> | 2012-04-17 17:28:50 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-17 11:06:15 +0200 |
commit | e624c2d9b0940f0abc24ef7685238299fec5c36e (patch) | |
tree | c711593f566af4112c3ae8836229ec575e5a85e7 /tests/auto/quick/qquicktext | |
parent | e5c04205903b7c413fe09be321fc4becf60a3c51 (diff) |
Don't crash when calculating the implicit width of truncated lines.
Remember to call beginLayout() on the QTextLayout before creating
lines or the layout data won't be allocated.
Change-Id: Ic344ca376fc25e38c50078135deb02dee3afc4f1
Reviewed-by: Chris Adams <christopher.adams@nokia.com>
Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
Diffstat (limited to 'tests/auto/quick/qquicktext')
-rw-r--r-- | tests/auto/quick/qquicktext/tst_qquicktext.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/auto/quick/qquicktext/tst_qquicktext.cpp b/tests/auto/quick/qquicktext/tst_qquicktext.cpp index 86de5014e0..7ef232b4d9 100644 --- a/tests/auto/quick/qquicktext/tst_qquicktext.cpp +++ b/tests/auto/quick/qquicktext/tst_qquicktext.cpp @@ -1582,18 +1582,20 @@ void tst_qquicktext::implicitSize() QFETCH(QString, wrap); QFETCH(QString, elide); QString componentStr = "import QtQuick 2.0\nText { " + "property real iWidth: implicitWidth; " "text: \"" + text + "\"; " "width: " + width + "; " "textFormat: " + format + "; " "wrapMode: " + wrap + "; " "elide: " + elide + "; " - "maximumLineCount: 1 }"; + "maximumLineCount: 2 }"; QQmlComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); QVERIFY(textObject->width() < textObject->implicitWidth()); QVERIFY(textObject->height() == textObject->implicitHeight()); + QCOMPARE(textObject->property("iWidth").toReal(), textObject->implicitWidth()); textObject->resetWidth(); QVERIFY(textObject->width() == textObject->implicitWidth()); |