diff options
author | Pekka Vuorela <pekka.ta.vuorela@nokia.com> | 2011-11-15 13:43:16 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-11-24 15:02:58 +0100 |
commit | 6680be45ee6d29300227e628dc54ff33c49a36cf (patch) | |
tree | 32fe654c308ed41e5c75a40050f6ba716a428871 /tests/auto/declarative/qquicktextinput | |
parent | 2e03531bfb27fe4072d9d33b3ae422bba1c8c09b (diff) |
Added test for input method selection in TextInput
Change-Id: I4438625f9bb82e53bbdf173c9148f587984d7f81
Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>
Diffstat (limited to 'tests/auto/declarative/qquicktextinput')
-rw-r--r-- | tests/auto/declarative/qquicktextinput/tst_qquicktextinput.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/declarative/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/declarative/qquicktextinput/tst_qquicktextinput.cpp index 147208ea5e..4b041dd415 100644 --- a/tests/auto/declarative/qquicktextinput/tst_qquicktextinput.cpp +++ b/tests/auto/declarative/qquicktextinput/tst_qquicktextinput.cpp @@ -562,6 +562,19 @@ void tst_qquicktextinput::selection() textinputObject->deselect(); QVERIFY(textinputObject->selectedText().isNull()); + // test input method selection + QSignalSpy selectionSpy(textinputObject, SIGNAL(selectedTextChanged())); + textinputObject->setFocus(true); + { + QList<QInputMethodEvent::Attribute> attributes; + attributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 12, 5, QVariant()); + QInputMethodEvent event("", attributes); + QApplication::sendEvent(textinputObject, &event); + } + QCOMPARE(selectionSpy.count(), 1); + QCOMPARE(textinputObject->selectionStart(), 12); + QCOMPARE(textinputObject->selectionEnd(), 17); + delete textinputObject; } |