Fix TextInput inputMethods test.
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>
This commit is contained in:
parent
28102d1935
commit
3226ae7f0f
|
@ -1497,25 +1497,24 @@ void tst_qquicktextinput::inputMethods()
|
||||||
// test that input method event is committed
|
// test that input method event is committed
|
||||||
QInputMethodEvent event;
|
QInputMethodEvent event;
|
||||||
event.setCommitString( "My ", -12, 0);
|
event.setCommitString( "My ", -12, 0);
|
||||||
QGuiApplication::sendEvent(&canvas, &event);
|
QGuiApplication::sendEvent(qGuiApp->inputPanel()->inputItem(), &event);
|
||||||
QEXPECT_FAIL("", QTBUG_21691_MESSAGE, Abort);
|
|
||||||
QCOMPARE(input->text(), QString("My Hello world!"));
|
QCOMPARE(input->text(), QString("My Hello world!"));
|
||||||
|
|
||||||
input->setCursorPosition(2);
|
input->setCursorPosition(2);
|
||||||
event.setCommitString("Your", -2, 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->text(), QString("Your Hello world!"));
|
||||||
QCOMPARE(input->cursorPosition(), 4);
|
QCOMPARE(input->cursorPosition(), 4);
|
||||||
|
|
||||||
input->setCursorPosition(7);
|
input->setCursorPosition(7);
|
||||||
event.setCommitString("Goodbye", -2, 5);
|
event.setCommitString("Goodbye", -2, 5);
|
||||||
QGuiApplication::sendEvent(&canvas, &event);
|
QGuiApplication::sendEvent(qGuiApp->inputPanel()->inputItem(), &event);
|
||||||
QCOMPARE(input->text(), QString("Your Goodbye world!"));
|
QCOMPARE(input->text(), QString("Your Goodbye world!"));
|
||||||
QCOMPARE(input->cursorPosition(), 12);
|
QCOMPARE(input->cursorPosition(), 12);
|
||||||
|
|
||||||
input->setCursorPosition(8);
|
input->setCursorPosition(8);
|
||||||
event.setCommitString("Our", -8, 4);
|
event.setCommitString("Our", -8, 4);
|
||||||
QGuiApplication::sendEvent(&canvas, &event);
|
QGuiApplication::sendEvent(qGuiApp->inputPanel()->inputItem(), &event);
|
||||||
QCOMPARE(input->text(), QString("Our Goodbye world!"));
|
QCOMPARE(input->text(), QString("Our Goodbye world!"));
|
||||||
QCOMPARE(input->cursorPosition(), 7);
|
QCOMPARE(input->cursorPosition(), 7);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue