From: Joona Petrell Date: Wed, 28 Sep 2011 14:47:19 +0000 (+0300) Subject: Fix TextInput and TextEdit inputMethodComposing autotests X-Git-Tag: qt-v5.0.0-alpha1~1535 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dc2935cbb0852c23804d894bef0e2a56b343b089;p=profile%2Fivi%2Fqtdeclarative.git Fix TextInput and TextEdit inputMethodComposing autotests In old QInputContext architecture events were send to focus widget, which delivered the events to the text editor items. In Qt5, input methods send events directly to the editor object using QInputPanel::inputItem(). Task-number: QTBUG-21691 Change-Id: Ia219f0cc7caaeafc32f5d7674a6ab377e773d4fa Reviewed-on: http://codereview.qt-project.org/5741 Reviewed-by: Qt Sanity Bot Reviewed-by: Andrew den Exter Reviewed-by: Lars Knoll --- diff --git a/tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp b/tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp index 3e92c35..ffb8188 100644 --- a/tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp +++ b/tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp @@ -2404,21 +2404,21 @@ void tst_qsgtextedit::inputMethodComposing() { QInputMethodEvent event(text.mid(3), QList()); - QGuiApplication::sendEvent(&view, &event); + QGuiApplication::sendEvent(edit, &event); } - QEXPECT_FAIL("", "QTBUG-21690", Abort); + QCOMPARE(edit->isInputMethodComposing(), true); QCOMPARE(spy.count(), 1); { QInputMethodEvent event(text.mid(12), QList()); - QGuiApplication::sendEvent(&view, &event); + QGuiApplication::sendEvent(edit, &event); } QCOMPARE(spy.count(), 1); { QInputMethodEvent event; - QGuiApplication::sendEvent(&view, &event); + QGuiApplication::sendEvent(edit, &event); } QCOMPARE(edit->isInputMethodComposing(), false); QCOMPARE(spy.count(), 2); diff --git a/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp b/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp index 5f9771a..35e0e91 100644 --- a/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp +++ b/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp @@ -2562,21 +2562,20 @@ void tst_qsgtextinput::inputMethodComposing() QCOMPARE(input->isInputMethodComposing(), false); { QInputMethodEvent event(text.mid(3), QList()); - QGuiApplication::sendEvent(&view, &event); + QGuiApplication::sendEvent(input, &event); } - QEXPECT_FAIL("", QTBUG_21691_MESSAGE, Abort); QCOMPARE(input->isInputMethodComposing(), true); QCOMPARE(spy.count(), 1); { QInputMethodEvent event(text.mid(12), QList()); - QGuiApplication::sendEvent(&view, &event); + QGuiApplication::sendEvent(input, &event); } QCOMPARE(spy.count(), 1); { QInputMethodEvent event; - QGuiApplication::sendEvent(&view, &event); + QGuiApplication::sendEvent(input, &event); } QCOMPARE(input->isInputMethodComposing(), false); QCOMPARE(spy.count(), 2);