summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorJoona Petrell <joona.t.petrell@nokia.com>2011-03-04 03:26:12 (GMT)
committerJoona Petrell <joona.t.petrell@nokia.com>2011-03-04 03:36:56 (GMT)
commit9f674617daf03026d78f8ce18328cbe6c31b689d (patch)
treeec41ebf4edba3bbedc6ae8e53ef8a24b7b8cc98a /tests/auto
parent94bf3f5acd1342687c55fc5d82077ca89d59b633 (diff)
downloadQt-9f674617daf03026d78f8ce18328cbe6c31b689d.zip
Qt-9f674617daf03026d78f8ce18328cbe6c31b689d.tar.gz
Qt-9f674617daf03026d78f8ce18328cbe6c31b689d.tar.bz2
Remove text alignment of empty QML editors following the layout direction
Task-number: QTBUG-15880 Reviewed-by: Martin Jones Removed implicit text alignment of empty text in QML editor following the application's default layout direction. Change was originally made few days ago in the commit 88253db8a7d7910e1393b1948fb3747117538c92. Aligning empty and neutral text to the right for RTL locales requires much more comprehensive changes to the Qt's internal text classes than initially thought. Change-Id: I93a26df259b87dff47d57423949270656746c9a7
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp10
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp12
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp12
3 files changed, 11 insertions, 23 deletions
diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
index 6c9998e..2aeb425 100644
--- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
+++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
@@ -547,15 +547,11 @@ void tst_qdeclarativetext::horizontalAlignment_RightToLeft()
QCOMPARE(text->hAlign(), QDeclarativeText::AlignLeft);
QVERIFY(textPrivate->layout.lineAt(0).x() < canvas->width()/2);
- // empty text should implicitly follow the layout direction
- QApplication::setLayoutDirection(Qt::RightToLeft);
+ // empty text is also implicitly left aligned
text->setText("");
- QCOMPARE(text->hAlign(), QDeclarativeText::AlignRight);
- text->setHAlign(QDeclarativeText::AlignLeft);
QCOMPARE(text->hAlign(), QDeclarativeText::AlignLeft);
-
- // set layout direction back to LTR to avoid affecting other autotests
- QApplication::setLayoutDirection(Qt::LeftToRight);
+ text->setHAlign(QDeclarativeText::AlignRight);
+ QCOMPARE(text->hAlign(), QDeclarativeText::AlignRight);
delete canvas;
}
diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
index 6d5750f..ff52167 100644
--- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
+++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
@@ -474,17 +474,13 @@ void tst_qdeclarativetextedit::hAlign_RightToLeft()
QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignLeft);
QVERIFY(textEdit->positionToRectangle(0).x() < canvas->width()/2);
- // empty text should implicitly follow the layout direction
- QApplication::setLayoutDirection(Qt::RightToLeft);
+ // empty text is also implicitly left aligned
textEdit->setText("");
- QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignRight);
- QVERIFY(textEdit->positionToRectangle(0).x() > canvas->width()/2);
- textEdit->setHAlign(QDeclarativeTextEdit::AlignLeft);
QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignLeft);
QVERIFY(textEdit->positionToRectangle(0).x() < canvas->width()/2);
-
- // set layout direction back to LTR to avoid affecting other autotests
- QApplication::setLayoutDirection(Qt::LeftToRight);
+ textEdit->setHAlign(QDeclarativeTextEdit::AlignRight);
+ QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignRight);
+ QVERIFY(textEdit->positionToRectangle(0).x() > canvas->width()/2);
delete canvas;
}
diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
index 72e8b11..666bbc8 100644
--- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
+++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
@@ -1078,17 +1078,13 @@ void tst_qdeclarativetextinput::horizontalAlignment_RightToLeft()
QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignLeft);
QVERIFY(-textInputPrivate->hscroll < canvas->width()/2);
- // empty text should implicitly follow the layout direction
- QApplication::setLayoutDirection(Qt::RightToLeft);
+ // empty text is also implicitly left aligned
textInput->setText("");
- QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignRight);
- QVERIFY(-textInputPrivate->hscroll > canvas->width()/2);
- textInput->setHAlign(QDeclarativeTextInput::AlignLeft);
QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignLeft);
QVERIFY(-textInputPrivate->hscroll < canvas->width()/2);
-
- // set layout direction back to LTR to avoid affecting other autotests
- QApplication::setLayoutDirection(Qt::LeftToRight);
+ textInput->setHAlign(QDeclarativeTextInput::AlignRight);
+ QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignRight);
+ QVERIFY(-textInputPrivate->hscroll > canvas->width()/2);
delete canvas;
}