summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPekka Vuorela <pvuorela@iki.fi>2012-09-03 16:58:03 +0300
committerQt by Nokia <qt-info@nokia.com>2012-09-07 11:11:00 +0200
commitce16d49569367fabe2fe6c69bb53cad4a8dd795d (patch)
tree4cbd12179c1b34ea94c60882e858acb78fe20441 /tests
parentb310ea8c0e276bd5d5b29b8390355a7ffe2b509e (diff)
Avoid usage of deprecated QInputMethod::inputItem() in tests
Change-Id: Ie6e37ab23b1bef99d294fe8a0acd95429a37a527 Reviewed-by: Joona Petrell <joona.petrell@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp6
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp11
2 files changed, 11 insertions, 6 deletions
diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
index 17b74687..36bab0c7 100644
--- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
+++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
@@ -90,7 +90,8 @@ 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);
+ if (qApp->focusObject())
+ QApplication::sendEvent(qApp->focusObject(), &event);
}
@@ -2502,7 +2503,8 @@ void tst_qdeclarativetextedit::preeditMicroFocus()
sendPreeditText(preeditText, 0);
ic.clear();
QInputMethodEvent imEvent(preeditText, QList<QInputMethodEvent::Attribute>());
- QApplication::sendEvent(qApp->inputMethod()->inputItem(), &imEvent);
+ if (qApp->focusObject())
+ QApplication::sendEvent(qApp->focusObject(), &imEvent);
currentRect = edit.inputMethodQuery(Qt::ImMicroFocus).toRect();
QCOMPARE(currentRect, previousRect);
#if defined(Q_WS_X11)
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);