summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp')
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
index dbce1881..255625f7 100644
--- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
+++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
@@ -84,7 +84,7 @@ void sendPreeditText(const QString &text, int cursor)
attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, cursor,
text.length(), QVariant()));
QInputMethodEvent event(text, attributes);
- QApplication::sendEvent(qApp->inputMethod()->inputItem(), &event);
+ QApplication::sendEvent(qApp->focusObject(), &event);
}
@@ -2672,7 +2672,8 @@ void tst_qdeclarativetextinput::inputMethodComposing()
{
QInputMethodEvent inputEvent(text.mid(3), QList<QInputMethodEvent::Attribute>());
- QApplication::sendEvent(qApp->inputMethod()->inputItem(), &inputEvent);
+ if (qApp->focusObject())
+ QApplication::sendEvent(qApp->focusObject(), &inputEvent);
}
QCOMPARE(input.isInputMethodComposing(), true);
@@ -2680,7 +2681,8 @@ void tst_qdeclarativetextinput::inputMethodComposing()
{
QInputMethodEvent inputEvent(text.mid(12), QList<QInputMethodEvent::Attribute>());
- QApplication::sendEvent(qApp->inputMethod()->inputItem(), &inputEvent);
+ if (qApp->focusObject())
+ QApplication::sendEvent(qApp->focusObject(), &inputEvent);
}
QCOMPARE(input.isInputMethodComposing(), true);
@@ -2688,7 +2690,8 @@ void tst_qdeclarativetextinput::inputMethodComposing()
{
QInputMethodEvent inputEvent;
- QApplication::sendEvent(qApp->inputMethod()->inputItem(), &inputEvent);
+ if (qApp->focusObject())
+ QApplication::sendEvent(qApp->focusObject(), &inputEvent);
}
QCOMPARE(input.isInputMethodComposing(), false);
QCOMPARE(spy.count(), 2);