diff options
author | Pekka Vuorela <pekka.ta.vuorela@nokia.com> | 2011-12-13 15:47:51 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-12-20 12:40:31 +0100 |
commit | 0332e605f916ff67ce579172e857e457e8ea3e41 (patch) | |
tree | 6ea0ea3a6cf635169932e08b60fb72c7369f80a9 /tests/auto/qtquick2/qquicktextinput | |
parent | b899758264bc29ecc80e04d4fbbe1832f01a9a08 (diff) |
QQuickLineControl more robust on input method & selection state
Input method event having replacement information out of bounds
left the controller in selection state when it shouldn't be.
Also now more liberal on accepted events. We cannot detect if input
method is confused for replacement inside boundaries, but going beyond
the end is more likely to be meant to replace until the end than to
leave previous text in addition to the new one.
Change-Id: I485009ac682c11876b39f7e22d7dfb91a6d162fe
Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>
Diffstat (limited to 'tests/auto/qtquick2/qquicktextinput')
-rw-r--r-- | tests/auto/qtquick2/qquicktextinput/tst_qquicktextinput.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/auto/qtquick2/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/qtquick2/qquicktextinput/tst_qquicktextinput.cpp index 51ee89a18e..557634542b 100644 --- a/tests/auto/qtquick2/qquicktextinput/tst_qquicktextinput.cpp +++ b/tests/auto/qtquick2/qquicktextinput/tst_qquicktextinput.cpp @@ -1659,6 +1659,14 @@ void tst_qquicktextinput::inputMethods() QCOMPARE(input->text(), QString("")); input->setValidator(0); delete validator; + + // input should reset selection even if replacement parameters are out of bounds + input->setText("text"); + input->setCursorPosition(0); + input->moveCursorSelection(input->text().length()); + event.setCommitString("replacement", -input->text().length(), input->text().length()); + QGuiApplication::sendEvent(qGuiApp->inputPanel()->inputItem(), &event); + QCOMPARE(input->selectionStart(), input->selectionEnd()); } /* |