diff options
author | Martin Jones <martin.jones@nokia.com> | 2011-03-08 04:55:56 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2011-03-08 07:57:27 (GMT) |
commit | f47f01fd34d08f6152c9053c0d6928fc359aa0f9 (patch) | |
tree | 52ade58742556e5c843f34b869af7c6bcfdd7477 /tests | |
parent | 0b2983f9339f1003159f3a746491928f74b593ba (diff) | |
download | Qt-f47f01fd34d08f6152c9053c0d6928fc359aa0f9.zip Qt-f47f01fd34d08f6152c9053c0d6928fc359aa0f9.tar.gz Qt-f47f01fd34d08f6152c9053c0d6928fc359aa0f9.tar.bz2 |
Use the text layout bounds calculated by QLayout.
We used to calculate the size and position of the cache image
ourselves. Rather use the line positions and bounding rect calculated
by QLayout.
Change-Id: I601688ab7e310b0015a1994adf52b108f39504d8
Reviewed-by: Joona Petrell
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp index c854f86..9c12a90 100644 --- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp +++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp @@ -1156,12 +1156,14 @@ void tst_qdeclarativetext::lineHeight() QVERIFY(myText->lineHeightMode() == QDeclarativeText::ProportionalHeight); qreal h = myText->height(); + int lc = myText->lineCount(); + qreal lh = myText->height() / lc; myText->setLineHeight(1.5); - QVERIFY(myText->height() == h * 1.5); + QVERIFY(qAbs(myText->height() - (((lc-1) * lh * 1.5) + lh)) < 1.0); myText->setLineHeightMode(QDeclarativeText::FixedHeight); myText->setLineHeight(20); - QCOMPARE(myText->height(), myText->lineCount() * 20.0); + QCOMPARE(myText->height(), ((lc-1) * 20.0) + lh); myText->setText("Lorem ipsum sit <b>amet</b>, consectetur adipiscing elit. Integer felis nisl, varius in pretium nec, venenatis non erat. Proin lobortis interdum dictum."); myText->setLineHeightMode(QDeclarativeText::ProportionalHeight); |