diff options
author | J-P Nurmi <jpnurmi@digia.com> | 2014-07-25 15:49:36 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@digia.com> | 2014-08-08 00:25:55 +0200 |
commit | 29e2497a2c3d09470ad779dd1aadcefac2d4daaf (patch) | |
tree | ee33264d5ade53ff5832254004b6840ccef61f49 /tests/auto/quick/qquicktextinput | |
parent | ce5dff18b9a61707617080be7be0cd688996ad6f (diff) |
TextInput::displayText: include partial input from an input method
[ChangeLog][QtQuick][Important Behavior Changes] TextInput::displayText
now includes also partial input from an input method and thus matches with
the actual displayed text.
Task-number: QTBUG-40329
Change-Id: I407f464938c550d73eba1351283ec751aa293380
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Diffstat (limited to 'tests/auto/quick/qquicktextinput')
-rw-r--r-- | tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp index e5ef83ba32..c50923b32f 100644 --- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp +++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp @@ -2234,25 +2234,34 @@ void tst_qquicktextinput::inputMethods() QTRY_COMPARE(qGuiApp->focusObject(), input); QGuiApplication::sendEvent(input, &event); QCOMPARE(input->text(), QString("My Hello world!")); + QCOMPARE(input->displayText(), QString("My Hello world!")); input->setCursorPosition(2); event.setCommitString("Your", -2, 2); QGuiApplication::sendEvent(input, &event); QCOMPARE(input->text(), QString("Your Hello world!")); + QCOMPARE(input->displayText(), QString("Your Hello world!")); QCOMPARE(input->cursorPosition(), 4); input->setCursorPosition(7); event.setCommitString("Goodbye", -2, 5); QGuiApplication::sendEvent(input, &event); QCOMPARE(input->text(), QString("Your Goodbye world!")); + QCOMPARE(input->displayText(), QString("Your Goodbye world!")); QCOMPARE(input->cursorPosition(), 12); input->setCursorPosition(8); event.setCommitString("Our", -8, 4); QGuiApplication::sendEvent(input, &event); QCOMPARE(input->text(), QString("Our Goodbye world!")); + QCOMPARE(input->displayText(), QString("Our Goodbye world!")); QCOMPARE(input->cursorPosition(), 7); + QInputMethodEvent preeditEvent("PREEDIT", QList<QInputMethodEvent::Attribute>()); + QGuiApplication::sendEvent(input, &preeditEvent); + QCOMPARE(input->text(), QString("Our Goodbye world!")); + QCOMPARE(input->displayText(), QString("Our GooPREEDITdbye world!")); + // input should reset selection even if replacement parameters are out of bounds input->setText("text"); input->setCursorPosition(0); @@ -2260,6 +2269,8 @@ void tst_qquicktextinput::inputMethods() event.setCommitString("replacement", -input->text().length(), input->text().length()); QGuiApplication::sendEvent(input, &event); QCOMPARE(input->selectionStart(), input->selectionEnd()); + QCOMPARE(input->text(), QString("replacement")); + QCOMPARE(input->displayText(), QString("replacement")); QInputMethodQueryEvent enabledQueryEvent(Qt::ImEnabled); QGuiApplication::sendEvent(input, &enabledQueryEvent); |