summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativetext
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2011-03-04 04:33:30 (GMT)
committerMartin Jones <martin.jones@nokia.com>2011-03-04 07:00:44 (GMT)
commit7cdd849b50f0314d0eb227e1d0c92627f2be555b (patch)
tree7afd7de1664dad1db3898a749c9ea8eda1a53fbf /tests/auto/declarative/qdeclarativetext
parent9f674617daf03026d78f8ce18328cbe6c31b689d (diff)
downloadQt-7cdd849b50f0314d0eb227e1d0c92627f2be555b.zip
Qt-7cdd849b50f0314d0eb227e1d0c92627f2be555b.tar.gz
Qt-7cdd849b50f0314d0eb227e1d0c92627f2be555b.tar.bz2
Fix RTL multiline Text drawing
We handled horizontal alignment ourselves, but this neglected some RTL layouting issues (e.g. trailing spaces). Allow QTextLayout to do the aligning for us. Also fix eliding of multiline text for RTL language - in this case the eliding should be to the left. Change-Id: I487137b123ae66c1f5fc358a8d8a013049d05818 Reviewed-by: Joona Petrell
Diffstat (limited to 'tests/auto/declarative/qdeclarativetext')
-rw-r--r--tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
index 2aeb425..f27fc07 100644
--- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
+++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
@@ -520,32 +520,32 @@ void tst_qdeclarativetext::horizontalAlignment_RightToLeft()
// implicit alignment should follow the reading direction of RTL text
QCOMPARE(text->hAlign(), QDeclarativeText::AlignRight);
- QVERIFY(textPrivate->layout.lineAt(0).x() > canvas->width()/2);
+ QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().left() > canvas->width()/2);
// explicitly left aligned
text->setHAlign(QDeclarativeText::AlignLeft);
QCOMPARE(text->hAlign(), QDeclarativeText::AlignLeft);
- QVERIFY(textPrivate->layout.lineAt(0).x() < canvas->width()/2);
+ QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().left() < canvas->width()/2);
// explicitly right aligned
text->setHAlign(QDeclarativeText::AlignRight);
QCOMPARE(text->hAlign(), QDeclarativeText::AlignRight);
- QVERIFY(textPrivate->layout.lineAt(0).x() > canvas->width()/2);
+ QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().left() > canvas->width()/2);
// explicitly center aligned
text->setHAlign(QDeclarativeText::AlignHCenter);
QCOMPARE(text->hAlign(), QDeclarativeText::AlignHCenter);
- QVERIFY(textPrivate->layout.lineAt(0).x() < canvas->width()/2);
+ QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().left() < canvas->width()/2);
// reseted alignment should go back to following the text reading direction
text->resetHAlign();
QCOMPARE(text->hAlign(), QDeclarativeText::AlignRight);
- QVERIFY(textPrivate->layout.lineAt(0).x() > canvas->width()/2);
+ QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().left() > canvas->width()/2);
// English text should be implicitly left aligned
text->setText("Hello world!");
QCOMPARE(text->hAlign(), QDeclarativeText::AlignLeft);
- QVERIFY(textPrivate->layout.lineAt(0).x() < canvas->width()/2);
+ QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().left() < canvas->width()/2);
// empty text is also implicitly left aligned
text->setText("");