summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoona Petrell <joona.t.petrell@nokia.com>2011-03-08 04:33:29 (GMT)
committerJoona Petrell <joona.t.petrell@nokia.com>2011-03-08 06:58:11 (GMT)
commit54de06c6f3bd7ef74a10bfab9bff5416078edd6f (patch)
tree80e49e446f417138bae41750a0b179b4a0e5299c /tests
parentc783cbfe3839d7a4c0f75613d2a94e8cfb7a29d1 (diff)
downloadQt-54de06c6f3bd7ef74a10bfab9bff5416078edd6f.zip
Qt-54de06c6f3bd7ef74a10bfab9bff5416078edd6f.tar.gz
Qt-54de06c6f3bd7ef74a10bfab9bff5416078edd6f.tar.bz2
Base empty QML editor horizontal alignment on QApplication::keyboardInputDirection()
Task-number: QTBUG-15880 Reviewed-by: Martin Jones Change-Id: I240d53c8572fd3d1222b555e93812a3ee38e2558
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp6
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp11
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp11
3 files changed, 20 insertions, 8 deletions
diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
index 261dc51..c854f86 100644
--- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
+++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
@@ -576,9 +576,11 @@ void tst_qdeclarativetext::horizontalAlignment_RightToLeft()
QCOMPARE(text->hAlign(), QDeclarativeText::AlignLeft);
QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().left() < canvas->width()/2);
- // empty text is also implicitly left aligned
+ // empty text with implicit alignment follows the system locale-based
+ // keyboard input direction from QApplication::keyboardInputDirection
text->setText("");
- QCOMPARE(text->hAlign(), QDeclarativeText::AlignLeft);
+ QCOMPARE(text->hAlign(), QApplication::keyboardInputDirection() == Qt::LeftToRight ?
+ QDeclarativeText::AlignLeft : QDeclarativeText::AlignRight);
text->setHAlign(QDeclarativeText::AlignRight);
QCOMPARE(text->hAlign(), QDeclarativeText::AlignRight);
diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
index 7a0ca12..4d94dae 100644
--- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
+++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
@@ -500,10 +500,15 @@ void tst_qdeclarativetextedit::hAlign_RightToLeft()
QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignLeft);
QVERIFY(textEdit->positionToRectangle(0).x() < canvas->width()/2);
- // empty text is also implicitly left aligned
+ // empty text with implicit alignment follows the system locale-based
+ // keyboard input direction from QApplication::keyboardInputDirection
textEdit->setText("");
- QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignLeft);
- QVERIFY(textEdit->positionToRectangle(0).x() < canvas->width()/2);
+ QCOMPARE(textEdit->hAlign(), QApplication::keyboardInputDirection() == Qt::LeftToRight ?
+ QDeclarativeTextEdit::AlignLeft : QDeclarativeTextEdit::AlignRight);
+ if (QApplication::keyboardInputDirection() == Qt::LeftToRight)
+ QVERIFY(textEdit->positionToRectangle(0).x() < canvas->width()/2);
+ else
+ QVERIFY(textEdit->positionToRectangle(0).x() > canvas->width()/2);
textEdit->setHAlign(QDeclarativeTextEdit::AlignRight);
QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignRight);
QVERIFY(textEdit->positionToRectangle(0).x() > canvas->width()/2);
diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
index 5c8b59c..caada13 100644
--- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
+++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
@@ -1110,10 +1110,15 @@ void tst_qdeclarativetextinput::horizontalAlignment_RightToLeft()
QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignLeft);
QVERIFY(-textInputPrivate->hscroll < canvas->width()/2);
- // empty text is also implicitly left aligned
+ // empty text with implicit alignment follows the system locale-based
+ // keyboard input direction from QApplication::keyboardInputDirection
textInput->setText("");
- QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignLeft);
- QVERIFY(-textInputPrivate->hscroll < canvas->width()/2);
+ QCOMPARE(textInput->hAlign(), QApplication::keyboardInputDirection() == Qt::LeftToRight ?
+ QDeclarativeTextInput::AlignLeft : QDeclarativeTextInput::AlignRight);
+ if (QApplication::keyboardInputDirection() == Qt::LeftToRight)
+ QVERIFY(-textInputPrivate->hscroll < canvas->width()/2);
+ else
+ QVERIFY(-textInputPrivate->hscroll > canvas->width()/2);
textInput->setHAlign(QDeclarativeTextInput::AlignRight);
QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignRight);
QVERIFY(-textInputPrivate->hscroll > canvas->width()/2);