Fix TextInput inputMethods test.
authorAndrew den Exter <andrew.den-exter@nokia.com>
Wed, 9 Nov 2011 01:33:12 +0000 (11:33 +1000)
committerQt by Nokia <qt-info@nokia.com>
Wed, 9 Nov 2011 08:55:01 +0000 (09:55 +0100)
Input method events should go to the input panels input item not the
canvas.

Change-Id: I2792b8d51585c028c3ba1a109b3dea16bea18f61
Reviewed-by: Martin Jones <martin.jones@nokia.com>

tests/auto/declarative/qquicktextinput/tst_qquicktextinput.cpp

index 7e38148..3067952 100644 (file)
@@ -1497,25 +1497,24 @@ void tst_qquicktextinput::inputMethods()
     // test that input method event is committed
     QInputMethodEvent event;
     event.setCommitString( "My ", -12, 0);
-    QGuiApplication::sendEvent(&canvas, &event);
-    QEXPECT_FAIL("", QTBUG_21691_MESSAGE, Abort);
+    QGuiApplication::sendEvent(qGuiApp->inputPanel()->inputItem(), &event);
     QCOMPARE(input->text(), QString("My Hello world!"));
 
     input->setCursorPosition(2);
     event.setCommitString("Your", -2, 2);
-    QGuiApplication::sendEvent(&canvas, &event);
+    QGuiApplication::sendEvent(qGuiApp->inputPanel()->inputItem(), &event);
     QCOMPARE(input->text(), QString("Your Hello world!"));
     QCOMPARE(input->cursorPosition(), 4);
 
     input->setCursorPosition(7);
     event.setCommitString("Goodbye", -2, 5);
-    QGuiApplication::sendEvent(&canvas, &event);
+    QGuiApplication::sendEvent(qGuiApp->inputPanel()->inputItem(), &event);
     QCOMPARE(input->text(), QString("Your Goodbye world!"));
     QCOMPARE(input->cursorPosition(), 12);
 
     input->setCursorPosition(8);
     event.setCommitString("Our", -8, 4);
-    QGuiApplication::sendEvent(&canvas, &event);
+    QGuiApplication::sendEvent(qGuiApp->inputPanel()->inputItem(), &event);
     QCOMPARE(input->text(), QString("Our Goodbye world!"));
     QCOMPARE(input->cursorPosition(), 7);
 }