diff options
author | Pekka Vuorela <pekka.ta.vuorela@nokia.com> | 2011-11-15 18:17:29 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-11-24 13:50:37 +0100 |
commit | 38276a3d5348423a222c0fc794a28ab361d97e78 (patch) | |
tree | 30b5d3898ef2f2d052e6f65a10235a6cea756bb4 /tests/auto/qtquick1/qdeclarativetextinput | |
parent | b7be92e8ad22481c79f87e3741f85609c2612be7 (diff) |
TextInput elements not to have tentative commit in inputMethodQuery
Tentative commit should not be part of surrounding text, it's already
a property of the input method.
Change-Id: I64aec9763fb20770b6729f7f59dcbe23cf5a6718
Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'tests/auto/qtquick1/qdeclarativetextinput')
-rw-r--r-- | tests/auto/qtquick1/qdeclarativetextinput/tst_qdeclarativetextinput.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/qtquick1/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/qtquick1/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index 38e01ebe47..c84de1260e 100644 --- a/tests/auto/qtquick1/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/qtquick1/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -1565,6 +1565,28 @@ void tst_qdeclarativetextinput::inputMethods() QCOMPARE(input->text(), QString("Our Goodbye world!")); QCOMPARE(input->cursorPosition(), 7); + // test that basic tentative commit gets to text property on preedit state + input->setText(""); + QList<QInputMethodEvent::Attribute> attributes; + QInputMethodEvent preeditEvent("test", attributes); + preeditEvent.setTentativeCommitString("test"); + QApplication::sendEvent(canvas, &preeditEvent); + QCOMPARE(input->text(), QString("test")); + + // tentative commit not allowed present in surrounding text + QInputMethodQueryEvent queryEvent(Qt::ImSurroundingText); + QApplication::sendEvent(canvas, &queryEvent); + QCOMPARE(queryEvent.value(Qt::ImSurroundingText).toString(), QString("")); + + // if text with tentative commit does not validate, not allowed to be part of text property + input->setText(""); // ensure input state is reset + QValidator *validator = new QIntValidator(0, 100); + input->setValidator(validator); + QApplication::sendEvent(canvas, &preeditEvent); + QCOMPARE(input->text(), QString("")); + input->setValidator(0); + delete validator; + delete canvas; } |