diff options
author | Joona Petrell <joona.t.petrell@nokia.com> | 2011-03-08 05:30:36 (GMT) |
---|---|---|
committer | Joona Petrell <joona.t.petrell@nokia.com> | 2011-03-08 07:03:31 (GMT) |
commit | 0b2983f9339f1003159f3a746491928f74b593ba (patch) | |
tree | f56f1e1eb1dab5c352ac454b1be4c1a406bc51ad /tests/auto | |
parent | 54de06c6f3bd7ef74a10bfab9bff5416078edd6f (diff) | |
download | Qt-0b2983f9339f1003159f3a746491928f74b593ba.zip Qt-0b2983f9339f1003159f3a746491928f74b593ba.tar.gz Qt-0b2983f9339f1003159f3a746491928f74b593ba.tar.bz2 |
Fix TextInput key navigation for RTL text
Task-number: QTBUG-15882
Reviewed-by: Martin Jones
Change-Id: I77c02de3bcd1a1d05dfcdd71327da45182050071
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index caada13..fc19c94 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -115,6 +115,7 @@ private slots: void cursorVisible(); void cursorRectangle(); void navigation(); + void navigation_RTL(); void copyAndPaste(); void canPasteEmpty(); void canPaste(); @@ -1435,6 +1436,45 @@ void tst_qdeclarativetextinput::navigation() delete canvas; } +void tst_qdeclarativetextinput::navigation_RTL() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/navigation.qml"); + canvas->show(); + canvas->setFocus(); + + QVERIFY(canvas->rootObject() != 0); + + QDeclarativeTextInput *input = qobject_cast<QDeclarativeTextInput *>(qvariant_cast<QObject *>(canvas->rootObject()->property("myInput"))); + + QVERIFY(input != 0); + const quint16 arabic_str[] = { 0x0638, 0x0643, 0x00646, 0x0647, 0x0633, 0x0638, 0x0643, 0x00646, 0x0647, 0x0633, 0x0647}; + input->setText(QString::fromUtf16(arabic_str, 11)); + + input->setCursorPosition(0); + QTRY_VERIFY(input->hasActiveFocus() == true); + + // move off + simulateKey(canvas, Qt::Key_Right); + QVERIFY(input->hasActiveFocus() == false); + + // move back + simulateKey(canvas, Qt::Key_Left); + QVERIFY(input->hasActiveFocus() == true); + + input->setCursorPosition(input->text().length()); + QVERIFY(input->hasActiveFocus() == true); + + // move off + simulateKey(canvas, Qt::Key_Left); + QVERIFY(input->hasActiveFocus() == false); + + // move back + simulateKey(canvas, Qt::Key_Right); + QVERIFY(input->hasActiveFocus() == true); + + delete canvas; +} + void tst_qdeclarativetextinput::copyAndPaste() { #ifndef QT_NO_CLIPBOARD |