Skip to content

Commit

Permalink
Added test for input method selection in TextInput
Browse files Browse the repository at this point in the history
Change-Id: I4438625f9bb82e53bbdf173c9148f587984d7f81
Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>
  • Loading branch information
Pekka Vuorela authored and Qt by Nokia committed Nov 24, 2011
1 parent 2e03531 commit 6680be4
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/auto/declarative/qquicktextinput/tst_qquicktextinput.cpp
Expand Up @@ -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;
}

Expand Down

0 comments on commit 6680be4

Please sign in to comment.