summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-08-23 18:33:50 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-08-23 18:33:50 (GMT)
commit5bf62d2f11d36b2bfc1b970f2cfff97c87caa770 (patch)
tree58c53746a101c75b7f47b7aad220fe8e3f4f2af3 /tests/auto
parent6c0c437962a2638cca162277b14a30dae4fed57b (diff)
parent1ee6ff9fab218a8fa02a3cad1614730eb716bf45 (diff)
downloadQt-5bf62d2f11d36b2bfc1b970f2cfff97c87caa770.zip
Qt-5bf62d2f11d36b2bfc1b970f2cfff97c87caa770.tar.gz
Qt-5bf62d2f11d36b2bfc1b970f2cfff97c87caa770.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: Doc: Fixing typo Fix left alignment of native RTL pre-edit text.
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/data/horizontalAlignment_RightToLeft.qml1
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp12
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/data/horizontalAlignment_RightToLeft.qml1
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp13
4 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativetextedit/data/horizontalAlignment_RightToLeft.qml b/tests/auto/declarative/qdeclarativetextedit/data/horizontalAlignment_RightToLeft.qml
index 43ea8d8..6e739bf 100644
--- a/tests/auto/declarative/qdeclarativetextedit/data/horizontalAlignment_RightToLeft.qml
+++ b/tests/auto/declarative/qdeclarativetextedit/data/horizontalAlignment_RightToLeft.qml
@@ -18,6 +18,7 @@ Rectangle {
objectName: "text"
anchors.fill: parent
text: top.text
+ focus: true
}
}
}
diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
index 5d6f2a2..5c7f36f 100644
--- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
+++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
@@ -454,6 +454,8 @@ void tst_qdeclarativetextedit::hAlign_RightToLeft()
QVERIFY(textEdit != 0);
canvas->show();
+ const QString rtlText = textEdit->text();
+
// implicit alignment should follow the reading direction of text
QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignRight);
QVERIFY(textEdit->positionToRectangle(0).x() > canvas->width()/2);
@@ -530,6 +532,16 @@ void tst_qdeclarativetextedit::hAlign_RightToLeft()
QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignLeft);
QVERIFY(textEdit->positionToRectangle(0).x() < canvas->width()/2);
+ QApplication::setActiveWindow(canvas);
+ QTest::qWaitForWindowShown(canvas);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(canvas));
+
+ textEdit->setText(QString());
+ { QInputMethodEvent ev(rtlText, QList<QInputMethodEvent::Attribute>()); QApplication::sendEvent(canvas, &ev); }
+ QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignRight);
+ { QInputMethodEvent ev("Hello world!", QList<QInputMethodEvent::Attribute>()); QApplication::sendEvent(canvas, &ev); }
+ QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignLeft);
+
#ifndef Q_OS_MAC // QTBUG-18040
// empty text with implicit alignment follows the system locale-based
// keyboard input direction from QApplication::keyboardInputDirection
diff --git a/tests/auto/declarative/qdeclarativetextinput/data/horizontalAlignment_RightToLeft.qml b/tests/auto/declarative/qdeclarativetextinput/data/horizontalAlignment_RightToLeft.qml
index b11535e..7f27bbe 100644
--- a/tests/auto/declarative/qdeclarativetextinput/data/horizontalAlignment_RightToLeft.qml
+++ b/tests/auto/declarative/qdeclarativetextinput/data/horizontalAlignment_RightToLeft.qml
@@ -18,6 +18,7 @@ Rectangle {
objectName: "text"
anchors.fill: parent
text: top.text
+ focus: true
}
}
}
diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
index 280f952..bb895bf 100644
--- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
+++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
@@ -1198,6 +1198,8 @@ void tst_qdeclarativetextinput::horizontalAlignment_RightToLeft()
QVERIFY(textInput != 0);
canvas->show();
+ const QString rtlText = textInput->text();
+
QDeclarativeTextInputPrivate *textInputPrivate = QDeclarativeTextInputPrivate::get(textInput);
QVERIFY(textInputPrivate != 0);
QVERIFY(-textInputPrivate->hscroll > canvas->width()/2);
@@ -1262,6 +1264,17 @@ void tst_qdeclarativetextinput::horizontalAlignment_RightToLeft()
QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignLeft);
QVERIFY(-textInputPrivate->hscroll < canvas->width()/2);
+ QApplication::setActiveWindow(canvas);
+ QTest::qWaitForWindowShown(canvas);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(canvas));
+
+ // If there is no committed text, the preedit text should determine the alignment.
+ textInput->setText(QString());
+ { QInputMethodEvent ev(rtlText, QList<QInputMethodEvent::Attribute>()); QApplication::sendEvent(canvas, &ev); }
+ QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignRight);
+ { QInputMethodEvent ev("Hello world!", QList<QInputMethodEvent::Attribute>()); QApplication::sendEvent(canvas, &ev); }
+ QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignLeft);
+
#ifndef Q_OS_MAC // QTBUG-18040
// empty text with implicit alignment follows the system locale-based
// keyboard input direction from QApplication::keyboardInputDirection