aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJarkko Koivikko <jarkko.koivikko@code-q.fi>2021-08-05 10:21:07 +0300
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-08-23 14:53:23 +0000
commitec3c3e03732a94b34cd431dd7adc9dc999ab221d (patch)
tree5e59d0685b535dac133326d7e9188ee30e6b1668 /tests
parent87cbf885a9ecb8302c0285882c4724f4c5a20bcf (diff)
qquicktextinput: Clear pre-edit text after input method reset
The QPlatformInputContext::reset() function does not allow any further input method events to be called. Therefore, clearing the pre-edit text is the sole responsibility of the text input control. This change modifies the QQuickTextInputPrivate::resetInputMethod() function and calls QQuickTextInputPrivate::cancelPreedit() instead of QInputMethod::reset() directly. The cancelPreedit() function will send a QInputMethodEvent which clears the IM state (in addition of calling QInputMethod::reset() function). Also, rename the QQuickTextInputPrivate::resetInputMethod() function to cancelInput, since it does not call inputMethod()->reset() directly. Fixes: QTBUG-95461 Change-Id: I6ab3b9dbe71956af72656e2a25a05d79603b34ea Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Inho Lee <inho.lee@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi> (cherry picked from commit b2103e33f490c96d0068d211c6f2d5b540ca407e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
index 8d15b52462..9e78170ab6 100644
--- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
+++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
@@ -5893,6 +5893,7 @@ void tst_qquicktextinput::clear()
textInput->clear();
QVERIFY(textInput->text().isEmpty());
+ QVERIFY2(textInput->preeditText().isEmpty(), "Pre-edit text must be empty after clear");
QCOMPARE(spy.count(), 3);
@@ -5901,6 +5902,7 @@ void tst_qquicktextinput::clear()
QVERIFY(!textInput->canUndo());
QCOMPARE(spy.count(), 4);
QCOMPARE(textInput->text(), QString("I am Legend"));
+ QVERIFY2(textInput->preeditText().isEmpty(), "Pre-edit text must be empty after undo");
}
void tst_qquicktextinput::backspaceSurrogatePairs()