diff options
author | Yuntaek Rim <yuntaek.rim@myscript.com> | 2018-01-17 22:59:43 +0200 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2018-08-16 08:44:47 +0000 |
commit | 00408414e38dd69186b7b39b3879a057079b6bb6 (patch) | |
tree | dfee460b2172b8c5fb7de098fa62174ff9be2a6e /tests/auto/inputpanel/data/tst_inputpanel.qml | |
parent | 61385be34a2d4b09fd77f780295adb37d931a88d (diff) |
Allow InputMethod to process pre-edit click
We already have InputMethod::reselect, but it is
limited to case where the current pre-edit is
discarded and new range is made active.
However, if an input method wants to move the
cursor within pre-edit, it is not possible with
the current implementation.
This change adds the new API for the InputMethod
which allows to handle pre-edit click before
reselect happens. If the input method handles
the event, reselect will not be done.
This change also improves the cursor handling
within pre-edit text. Previously if the cursor
attribute was added to pre-edit text and the
input was committed, the cursor would jump to
position after pre-edit text. This is now taken
into account when committing text and cursor
location will be preserved.
Change-Id: I0a32f75eb4e454c86dd8d4f4016ac02fc1bc6c60
Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto/inputpanel/data/tst_inputpanel.qml')
-rw-r--r-- | tests/auto/inputpanel/data/tst_inputpanel.qml | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/auto/inputpanel/data/tst_inputpanel.qml b/tests/auto/inputpanel/data/tst_inputpanel.qml index b72eba68..9ced9a66 100644 --- a/tests/auto/inputpanel/data/tst_inputpanel.qml +++ b/tests/auto/inputpanel/data/tst_inputpanel.qml @@ -1104,6 +1104,10 @@ Rectangle { { initLocale: "ja_JP", initInputMode: "Hiragana", inputSequence: ["n","i","h","o","n","g","o"], outputText: "" }, // Latin only { initLocale: "ja_JP", initInputMethodHints: Qt.ImhLatinOnly, inputSequence: "hello", outputText: "Hello" }, + // Cursor test: 1. Enter hiragana input sequence and move cursor in the middle of input. + // 2. Change input mode to Katakana. + // 3. The input sequence should be committed leaving the cursor in the middle. + { initLocale: "ja_JP", initInputMode: "Hiragana", inputSequence: ["n","i","h","o","n","g","o",Qt.Key_Left,Qt.Key_Left,Qt.Key_Left,Qt.Key_Mode_switch], outputText: "\u306B\u307B\u3093\u3054", expectedCursorPosition: 2 }, ] } @@ -1116,6 +1120,9 @@ Rectangle { waitForRendering(inputPanel) compare(textInput.text, data.outputText) + + if (data.hasOwnProperty("expectedCursorPosition")) + compare(textInput.cursorPosition, data.expectedCursorPosition) } function test_baseKeyNoModifier() { |