diff options
author | Andrew den Exter <andrew.den-exter@nokia.com> | 2011-03-02 07:30:53 (GMT) |
---|---|---|
committer | Andrew den Exter <andrew.den-exter@nokia.com> | 2011-03-03 00:39:11 (GMT) |
commit | 585ddb51909db49c51e9e8019d3b5d45c48a1a08 (patch) | |
tree | abee2f963f350d35f4700f645f6eb70e8c6b4e8c /tests | |
parent | 2123a7ff6a04aec331fada5e03aa99395a0de1db (diff) | |
download | Qt-585ddb51909db49c51e9e8019d3b5d45c48a1a08.zip Qt-585ddb51909db49c51e9e8019d3b5d45c48a1a08.tar.gz Qt-585ddb51909db49c51e9e8019d3b5d45c48a1a08.tar.bz2 |
Position the TextInput cursor correctly after IM text is commited.
If text is removed before the cursor position decrement not increment
the cursor by the by the difference.
Change-Id: If9558c88157cc884652af7aaf9bd5fad0ea822d8
Task-number: QTBUG-17863
Reviewed-by: Martin Jones
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index 0d228e2..24ce0e4 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -1174,6 +1174,24 @@ void tst_qdeclarativetextinput::inputMethods() QApplication::sendEvent(canvas, &event); QCOMPARE(input->text(), QString("My Hello world!")); + input->setCursorPosition(2); + event.setCommitString("Your", -2, 2); + QApplication::sendEvent(canvas, &event); + QCOMPARE(input->text(), QString("Your Hello world!")); + QCOMPARE(input->cursorPosition(), 4); + + input->setCursorPosition(7); + event.setCommitString("Goodbye", -2, 5); + QApplication::sendEvent(canvas, &event); + QCOMPARE(input->text(), QString("Your Goodbye world!")); + QCOMPARE(input->cursorPosition(), 12); + + input->setCursorPosition(8); + event.setCommitString("Our", -8, 4); + QApplication::sendEvent(canvas, &event); + QCOMPARE(input->text(), QString("Our Goodbye world!")); + QCOMPARE(input->cursorPosition(), 7); + delete canvas; } |