diff options
author | Martin Jones <martin.jones@nokia.com> | 2011-04-21 04:15:38 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2011-04-21 05:20:55 (GMT) |
commit | 6e5a642c9484536fc173714f560f739944368cf5 (patch) | |
tree | 140001aeada569e4c6cb71d65ecebb35c3f9498e /tests/auto/declarative/qdeclarativetext | |
parent | 92062a9af1dea35b9bdd781ee087755168ac1e77 (diff) | |
download | Qt-6e5a642c9484536fc173714f560f739944368cf5.zip Qt-6e5a642c9484536fc173714f560f739944368cf5.tar.gz Qt-6e5a642c9484536fc173714f560f739944368cf5.tar.bz2 |
Elide has unexpected effect on Text's implicitWidth
The elided string was used to calculate the implicitWidth rather than
the full string.
Change-Id: I51b8800b47d4e32f4d5eef07c71df10e2df905b7
Task-number: QTBUG-18627
Reviewed-by: Michael Brasser
Diffstat (limited to 'tests/auto/declarative/qdeclarativetext')
-rw-r--r-- | tests/auto/declarative/qdeclarativetext/data/elideimplicitwidth.qml | 7 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativetext/data/elideimplicitwidth.qml b/tests/auto/declarative/qdeclarativetext/data/elideimplicitwidth.qml new file mode 100644 index 0000000..60ae15c --- /dev/null +++ b/tests/auto/declarative/qdeclarativetext/data/elideimplicitwidth.qml @@ -0,0 +1,7 @@ +import QtQuick 1.1 + +Text { + text: "Hello World" + elide: Text.ElideRight + width: 30 +} diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp index ca6e87a..82b6f73 100644 --- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp +++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp @@ -390,6 +390,13 @@ void tst_qdeclarativetext::elide() QCOMPARE(textObject->width(), 100.); } } + + // QTBUG-18627 + QUrl qmlfile = QUrl::fromLocalFile(SRCDIR "/data/elideimplicitwidth.qml"); + QDeclarativeComponent textComponent(&engine, qmlfile); + QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(textComponent.create()); + QVERIFY(item != 0); + QVERIFY(item->implicitWidth() > item->width()); } void tst_qdeclarativetext::textFormat() |