summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPekka Vuorela <pekka.ta.vuorela@nokia.com>2012-02-03 10:07:51 +0200
committerQt by Nokia <qt-info@nokia.com>2012-02-10 09:54:58 +0100
commite761f5b906c427433325debb9f08c4f2d0ba902d (patch)
treefa8fbc933b6ed9ea2cdbc918d4317c95992c26e7 /tests
parent9634dc440269fc03f825a6d18b371d8e612ba9ec (diff)
Use QInputMethod instead of deprecated QInputPanel
Similarly deprecate Qt.application.inputPanel and introduce replacement Qt.inputMethod. Change-Id: Ie4fd467f93f75023c86b0a2d038d858fe5001146 Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Sami Kananoja <sami.kananoja@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qtquick2/qdeclarativeapplication/tst_qdeclarativeapplication.cpp20
-rw-r--r--tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp6
-rw-r--r--tests/auto/qtquick2/qquicktextedit/tst_qquicktextedit.cpp66
-rw-r--r--tests/auto/qtquick2/qquicktextinput/tst_qquicktextinput.cpp70
-rw-r--r--tests/auto/shared/platforminputcontext.h8
5 files changed, 93 insertions, 77 deletions
diff --git a/tests/auto/qtquick2/qdeclarativeapplication/tst_qdeclarativeapplication.cpp b/tests/auto/qtquick2/qdeclarativeapplication/tst_qdeclarativeapplication.cpp
index fa19338f89..6b921a7356 100644
--- a/tests/auto/qtquick2/qdeclarativeapplication/tst_qdeclarativeapplication.cpp
+++ b/tests/auto/qtquick2/qdeclarativeapplication/tst_qdeclarativeapplication.cpp
@@ -44,7 +44,7 @@
#include <QtDeclarative/qdeclarativeengine.h>
#include <QtQuick/qquickitem.h>
#include <QtQuick/qquickview.h>
-#include <QtGui/qinputpanel.h>
+#include <QtGui/qinputmethod.h>
class tst_qdeclarativeapplication : public QObject
{
@@ -56,6 +56,7 @@ private slots:
void active();
void layoutDirection();
void inputPanel();
+ void inputMethod();
private:
QDeclarativeEngine engine;
@@ -135,9 +136,24 @@ void tst_qdeclarativeapplication::inputPanel()
item->setParentItem(view.rootObject());
// check that the inputPanel property maches with application's input panel
- QCOMPARE(qvariant_cast<QObject*>(item->property("inputPanel")), qApp->inputPanel());
+ QCOMPARE(qvariant_cast<QObject*>(item->property("inputPanel")), qApp->inputMethod());
}
+void tst_qdeclarativeapplication::inputMethod()
+{
+ // technically not in QDeclarativeApplication, but testing anyway here
+ QDeclarativeComponent component(&engine);
+ component.setData("import QtQuick 2.0; Item { property variant inputMethod: Qt.inputMethod }", QUrl::fromLocalFile(""));
+ QQuickItem *item = qobject_cast<QQuickItem *>(component.create());
+ QVERIFY(item);
+ QQuickView view;
+ item->setParentItem(view.rootObject());
+
+ // check that the inputMethod property maches with application's input method
+ QCOMPARE(qvariant_cast<QObject*>(item->property("inputMethod")), qApp->inputMethod());
+}
+
+
QTEST_MAIN(tst_qdeclarativeapplication)
#include "tst_qdeclarativeapplication.moc"
diff --git a/tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp b/tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp
index 5a0086393c..4f1225e937 100644
--- a/tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp
+++ b/tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp
@@ -727,9 +727,9 @@ void tst_qquicktext::horizontalAlignment_RightToLeft()
QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().left() < canvas->width()/2);
// empty text with implicit alignment follows the system locale-based
- // keyboard input direction from QInputPanel::inputDirection()
+ // keyboard input direction from QInputMethod::inputDirection()
text->setText("");
- QCOMPARE(text->hAlign(), qApp->inputPanel()->inputDirection() == Qt::LeftToRight ?
+ QCOMPARE(text->hAlign(), qApp->inputMethod()->inputDirection() == Qt::LeftToRight ?
QQuickText::AlignLeft : QQuickText::AlignRight);
text->setHAlign(QQuickText::AlignRight);
QCOMPARE(text->hAlign(), QQuickText::AlignRight);
@@ -741,7 +741,7 @@ void tst_qquicktext::horizontalAlignment_RightToLeft()
QDeclarativeComponent textComponent(&engine);
textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
- QCOMPARE(textObject->hAlign(), qApp->inputPanel()->inputDirection() == Qt::LeftToRight ?
+ QCOMPARE(textObject->hAlign(), qApp->inputMethod()->inputDirection() == Qt::LeftToRight ?
QQuickText::AlignLeft : QQuickText::AlignRight);
delete textObject;
}
diff --git a/tests/auto/qtquick2/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/qtquick2/qquicktextedit/tst_qquicktextedit.cpp
index a16f62271d..77d17d99d6 100644
--- a/tests/auto/qtquick2/qquicktextedit/tst_qquicktextedit.cpp
+++ b/tests/auto/qtquick2/qquicktextedit/tst_qquicktextedit.cpp
@@ -56,13 +56,13 @@
#include <QtQuick/QQuickView>
#include <QDir>
#include <QStyle>
-#include <QInputPanel>
+#include <QInputMethod>
#include <QClipboard>
#include <QMimeData>
#include <private/qquicktextcontrol_p.h>
#include "../../shared/util.h"
#include "../../shared/platforminputcontext.h"
-#include <private/qinputpanel_p.h>
+#include <private/qinputmethod_p.h>
#ifdef Q_OS_MAC
#include <Carbon/Carbon.h>
@@ -144,7 +144,7 @@ private slots:
void canPaste();
void canPasteEmpty();
void textInput();
- void inputPanelUpdate();
+ void inputMethodUpdate();
void openInputPanel();
void geometrySignals();
void pastingRichText_QTBUG_14003();
@@ -305,8 +305,8 @@ tst_qquicktextedit::tst_qquicktextedit()
void tst_qquicktextedit::cleanup()
{
// ensure not even skipped tests with custom input context leave it dangling
- QInputPanelPrivate *inputPanelPrivate = QInputPanelPrivate::get(qApp->inputPanel());
- inputPanelPrivate->testContext = 0;
+ QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod());
+ inputMethodPrivate->testContext = 0;
}
void tst_qquicktextedit::text()
@@ -630,8 +630,8 @@ void tst_qquicktextedit::hAlign()
void tst_qquicktextedit::hAlign_RightToLeft()
{
PlatformInputContext platformInputContext;
- QInputPanelPrivate *inputPanelPrivate = QInputPanelPrivate::get(qApp->inputPanel());
- inputPanelPrivate->testContext = &platformInputContext;
+ QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod());
+ inputMethodPrivate->testContext = &platformInputContext;
QQuickView canvas(testFileUrl("horizontalAlignment_RightToLeft.qml"));
QQuickTextEdit *textEdit = canvas.rootObject()->findChild<QQuickTextEdit*>("text");
@@ -731,10 +731,10 @@ void tst_qquicktextedit::hAlign_RightToLeft()
{ QInputMethodEvent ev; QGuiApplication::sendEvent(qGuiApp->focusObject(), &ev); }
// empty text with implicit alignment follows the system locale-based
- // keyboard input direction from qApp->inputPanel()->inputDirection
+ // keyboard input direction from qApp->inputMethod()->inputDirection
textEdit->setText("");
platformInputContext.setInputDirection(Qt::LeftToRight);
- QVERIFY(qApp->inputPanel()->inputDirection() == Qt::LeftToRight);
+ QVERIFY(qApp->inputMethod()->inputDirection() == Qt::LeftToRight);
QCOMPARE(textEdit->hAlign(), QQuickTextEdit::AlignLeft);
QVERIFY(textEdit->positionToRectangle(0).x() < canvas.width()/2);
@@ -742,7 +742,7 @@ void tst_qquicktextedit::hAlign_RightToLeft()
platformInputContext.setInputDirection(Qt::RightToLeft);
QCOMPARE(cursorRectangleSpy.count(), 1);
- QVERIFY(qApp->inputPanel()->inputDirection() == Qt::RightToLeft);
+ QVERIFY(qApp->inputMethod()->inputDirection() == Qt::RightToLeft);
QCOMPARE(textEdit->hAlign(), QQuickTextEdit::AlignRight);
QVERIFY(textEdit->positionToRectangle(0).x() > canvas.width()/2);
@@ -2190,11 +2190,11 @@ void tst_qquicktextedit::textInput()
QCOMPARE(queryEvent.value(Qt::ImEnabled).toBool(), false);
}
-void tst_qquicktextedit::inputPanelUpdate()
+void tst_qquicktextedit::inputMethodUpdate()
{
PlatformInputContext platformInputContext;
- QInputPanelPrivate *inputPanelPrivate = QInputPanelPrivate::get(qApp->inputPanel());
- inputPanelPrivate->testContext = &platformInputContext;
+ QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod());
+ inputMethodPrivate->testContext = &platformInputContext;
QQuickView view(testFileUrl("inputMethodEvent.qml"));
view.show();
@@ -2279,8 +2279,8 @@ void tst_qquicktextedit::inputPanelUpdate()
void tst_qquicktextedit::openInputPanel()
{
PlatformInputContext platformInputContext;
- QInputPanelPrivate *inputPanelPrivate = QInputPanelPrivate::get(qApp->inputPanel());
- inputPanelPrivate->testContext = &platformInputContext;
+ QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod());
+ inputMethodPrivate->testContext = &platformInputContext;
QQuickView view(testFileUrl("openInputPanel.qml"));
view.show();
@@ -2297,7 +2297,7 @@ void tst_qquicktextedit::openInputPanel()
qDebug() << &edit << qApp->focusObject();
QVERIFY(qApp->focusObject() != edit);
- QCOMPARE(qApp->inputPanel()->visible(), false);
+ QCOMPARE(qApp->inputMethod()->visible(), false);
// input panel should open on focus
QPoint centerPoint(view.width()/2, view.height()/2);
@@ -2306,24 +2306,24 @@ void tst_qquicktextedit::openInputPanel()
QGuiApplication::processEvents();
QVERIFY(edit->hasActiveFocus());
QCOMPARE(qApp->focusObject(), edit);
- QCOMPARE(qApp->inputPanel()->visible(), true);
+ QCOMPARE(qApp->inputMethod()->visible(), true);
QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint);
// input panel should be re-opened when pressing already focused TextEdit
- qApp->inputPanel()->hide();
- QCOMPARE(qApp->inputPanel()->visible(), false);
+ qApp->inputMethod()->hide();
+ QCOMPARE(qApp->inputMethod()->visible(), false);
QVERIFY(edit->hasActiveFocus());
QTest::mousePress(&view, Qt::LeftButton, noModifiers, centerPoint);
QGuiApplication::processEvents();
- QCOMPARE(qApp->inputPanel()->visible(), true);
+ QCOMPARE(qApp->inputMethod()->visible(), true);
QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint);
// input panel should stay visible if focus is lost to another text editor
- QSignalSpy inputPanelVisibilitySpy(qApp->inputPanel(), SIGNAL(visibleChanged()));
+ QSignalSpy inputPanelVisibilitySpy(qApp->inputMethod(), SIGNAL(visibleChanged()));
QQuickTextEdit anotherEdit;
anotherEdit.setParentItem(view.rootObject());
anotherEdit.setFocus(true);
- QCOMPARE(qApp->inputPanel()->visible(), true);
+ QCOMPARE(qApp->inputMethod()->visible(), true);
QCOMPARE(qApp->focusObject(), qobject_cast<QObject*>(&anotherEdit));
QCOMPARE(inputPanelVisibilitySpy.count(), 0);
@@ -2332,35 +2332,35 @@ void tst_qquicktextedit::openInputPanel()
QCOMPARE(view.activeFocusItem(), view.rootItem());
anotherEdit.setFocus(true);
- qApp->inputPanel()->hide();
+ qApp->inputMethod()->hide();
// input panel should not be opened if TextEdit is read only
edit->setReadOnly(true);
edit->setFocus(true);
- QCOMPARE(qApp->inputPanel()->visible(), false);
+ QCOMPARE(qApp->inputMethod()->visible(), false);
QTest::mousePress(&view, Qt::LeftButton, noModifiers, centerPoint);
QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint);
QGuiApplication::processEvents();
- QCOMPARE(qApp->inputPanel()->visible(), false);
+ QCOMPARE(qApp->inputMethod()->visible(), false);
// input panel should not be opened if focusOnPress is set to false
edit->setFocusOnPress(false);
edit->setFocus(false);
edit->setFocus(true);
- QCOMPARE(qApp->inputPanel()->visible(), false);
+ QCOMPARE(qApp->inputMethod()->visible(), false);
QTest::mousePress(&view, Qt::LeftButton, noModifiers, centerPoint);
QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint);
- QCOMPARE(qApp->inputPanel()->visible(), false);
+ QCOMPARE(qApp->inputMethod()->visible(), false);
// input panel should open when openSoftwareInputPanel is called
edit->openSoftwareInputPanel();
- QCOMPARE(qApp->inputPanel()->visible(), true);
+ QCOMPARE(qApp->inputMethod()->visible(), true);
// input panel should close when closeSoftwareInputPanel is called
edit->closeSoftwareInputPanel();
- QCOMPARE(qApp->inputPanel()->visible(), false);
+ QCOMPARE(qApp->inputMethod()->visible(), false);
- inputPanelPrivate->testContext = 0;
+ inputMethodPrivate->testContext = 0;
}
void tst_qquicktextedit::geometrySignals()
@@ -2463,7 +2463,7 @@ void tst_qquicktextedit::preeditCursorRectangle()
QVERIFY(edit);
QSignalSpy editSpy(edit, SIGNAL(cursorRectangleChanged()));
- QSignalSpy panelSpy(qGuiApp->inputPanel(), SIGNAL(cursorRectangleChanged()));
+ QSignalSpy panelSpy(qGuiApp->inputMethod(), SIGNAL(cursorRectangleChanged()));
QRect currentRect;
@@ -2578,11 +2578,11 @@ void tst_qquicktextedit::cursorRectangleSize()
QCOMPARE(cursorRectFromItem, cursorRectFromPositionToRectangle.toRect());
// item-canvas transform and input item transform match
- QCOMPARE(QQuickItemPrivate::get(textEdit)->itemToCanvasTransform(), qApp->inputPanel()->inputItemTransform());
+ QCOMPARE(QQuickItemPrivate::get(textEdit)->itemToCanvasTransform(), qApp->inputMethod()->inputItemTransform());
// input panel cursorRectangle property and tranformed item cursor rectangle match
QRectF sceneCursorRect = QQuickItemPrivate::get(textEdit)->itemToCanvasTransform().mapRect(cursorRectFromItem);
- QCOMPARE(sceneCursorRect, qApp->inputPanel()->cursorRectangle());
+ QCOMPARE(sceneCursorRect, qApp->inputMethod()->cursorRectangle());
delete canvas;
}
diff --git a/tests/auto/qtquick2/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/qtquick2/qquicktextinput/tst_qquicktextinput.cpp
index 38aad48a74..dd86d03b74 100644
--- a/tests/auto/qtquick2/qquicktextinput/tst_qquicktextinput.cpp
+++ b/tests/auto/qtquick2/qquicktextinput/tst_qquicktextinput.cpp
@@ -41,14 +41,14 @@
#include <qtest.h>
#include <QtTest/QSignalSpy>
#include "../../shared/util.h"
-#include <private/qinputpanel_p.h>
+#include <private/qinputmethod_p.h>
#include <QtDeclarative/qdeclarativeengine.h>
#include <QtDeclarative/qdeclarativeexpression.h>
#include <QFile>
#include <QtQuick/qquickview.h>
#include <QtGui/qguiapplication.h>
#include <QtGui/qstylehints.h>
-#include <QInputPanel>
+#include <QInputMethod>
#include <private/qquicktextinput_p.h>
#include <private/qquicktextinput_p_p.h>
#include <QDebug>
@@ -162,7 +162,7 @@ private slots:
void preeditCursorRectangle();
void inputContextMouseHandler();
void inputMethodComposing();
- void inputPanelUpdate();
+ void inputMethodUpdate();
void cursorRectangleSize();
void getText_data();
@@ -256,8 +256,8 @@ QList<Key> &operator <<(QList<Key> &keys, Qt::Key key)
void tst_qquicktextinput::cleanup()
{
// ensure not even skipped tests with custom input context leave it dangling
- QInputPanelPrivate *inputPanelPrivate = QInputPanelPrivate::get(qApp->inputPanel());
- inputPanelPrivate->testContext = 0;
+ QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod());
+ inputMethodPrivate->testContext = 0;
}
tst_qquicktextinput::tst_qquicktextinput()
@@ -1264,8 +1264,8 @@ void tst_qquicktextinput::horizontalAlignment()
void tst_qquicktextinput::horizontalAlignment_RightToLeft()
{
PlatformInputContext platformInputContext;
- QInputPanelPrivate *inputPanelPrivate = QInputPanelPrivate::get(qApp->inputPanel());
- inputPanelPrivate->testContext = &platformInputContext;
+ QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod());
+ inputMethodPrivate->testContext = &platformInputContext;
QQuickView canvas(testFileUrl("horizontalAlignment_RightToLeft.qml"));
QQuickTextInput *textInput = canvas.rootObject()->findChild<QQuickTextInput*>("text");
@@ -1360,16 +1360,16 @@ void tst_qquicktextinput::horizontalAlignment_RightToLeft()
{ QInputMethodEvent ev; QGuiApplication::sendEvent(qGuiApp->focusObject(), &ev); }
// empty text with implicit alignment follows the system locale-based
- // keyboard input direction from QInputPanel::inputDirection()
+ // keyboard input direction from QInputMethod::inputDirection()
textInput->setText("");
platformInputContext.setInputDirection(Qt::LeftToRight);
- QVERIFY(qApp->inputPanel()->inputDirection() == Qt::LeftToRight);
+ QVERIFY(qApp->inputMethod()->inputDirection() == Qt::LeftToRight);
QCOMPARE(textInput->hAlign(), QQuickTextInput::AlignLeft);
QCOMPARE(textInputPrivate->boundingRect.left() - textInputPrivate->hscroll, qreal(0));
QSignalSpy cursorRectangleSpy(textInput, SIGNAL(cursorRectangleChanged()));
platformInputContext.setInputDirection(Qt::RightToLeft);
- QVERIFY(qApp->inputPanel()->inputDirection() == Qt::RightToLeft);
+ QVERIFY(qApp->inputMethod()->inputDirection() == Qt::RightToLeft);
QCOMPARE(cursorRectangleSpy.count(), 1);
QCOMPARE(textInput->hAlign(), QQuickTextInput::AlignRight);
QVERIFY(textInputPrivate->boundingRect.right() - textInputPrivate->hscroll >= textInput->width() - 1);
@@ -2698,8 +2698,8 @@ void tst_qquicktextinput::simulateKey(QQuickView *view, int key)
void tst_qquicktextinput::openInputPanel()
{
PlatformInputContext platformInputContext;
- QInputPanelPrivate *inputPanelPrivate = QInputPanelPrivate::get(qApp->inputPanel());
- inputPanelPrivate->testContext = &platformInputContext;
+ QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod());
+ inputMethodPrivate->testContext = &platformInputContext;
QQuickView view(testFileUrl("openInputPanel.qml"));
view.show();
@@ -2714,7 +2714,7 @@ void tst_qquicktextinput::openInputPanel()
QVERIFY(input->focusOnPress());
QVERIFY(!input->hasActiveFocus());
QVERIFY(qApp->focusObject() != input);
- QCOMPARE(qApp->inputPanel()->visible(), false);
+ QCOMPARE(qApp->inputMethod()->visible(), false);
// input panel should open on focus
QPoint centerPoint(view.width()/2, view.height()/2);
@@ -2723,25 +2723,25 @@ void tst_qquicktextinput::openInputPanel()
QGuiApplication::processEvents();
QVERIFY(input->hasActiveFocus());
QCOMPARE(qApp->focusObject(), input);
- QCOMPARE(qApp->inputPanel()->visible(), true);
+ QCOMPARE(qApp->inputMethod()->visible(), true);
QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint);
// input panel should be re-opened when pressing already focused TextInput
- qApp->inputPanel()->hide();
- QCOMPARE(qApp->inputPanel()->visible(), false);
+ qApp->inputMethod()->hide();
+ QCOMPARE(qApp->inputMethod()->visible(), false);
QVERIFY(input->hasActiveFocus());
QTest::mousePress(&view, Qt::LeftButton, noModifiers, centerPoint);
QGuiApplication::processEvents();
- QCOMPARE(qApp->inputPanel()->visible(), true);
+ QCOMPARE(qApp->inputMethod()->visible(), true);
QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint);
// input panel should stay visible if focus is lost to another text inputor
- QSignalSpy inputPanelVisibilitySpy(qApp->inputPanel(), SIGNAL(visibleChanged()));
+ QSignalSpy inputPanelVisibilitySpy(qApp->inputMethod(), SIGNAL(visibleChanged()));
QQuickTextInput anotherInput;
anotherInput.componentComplete();
anotherInput.setParentItem(view.rootObject());
anotherInput.setFocus(true);
- QCOMPARE(qApp->inputPanel()->visible(), true);
+ QCOMPARE(qApp->inputMethod()->visible(), true);
QCOMPARE(qApp->focusObject(), qobject_cast<QObject*>(&anotherInput));
QCOMPARE(inputPanelVisibilitySpy.count(), 0);
@@ -2750,33 +2750,33 @@ void tst_qquicktextinput::openInputPanel()
QCOMPARE(view.activeFocusItem(), view.rootItem());
anotherInput.setFocus(true);
- qApp->inputPanel()->hide();
+ qApp->inputMethod()->hide();
// input panel should not be opened if TextInput is read only
input->setReadOnly(true);
input->setFocus(true);
- QCOMPARE(qApp->inputPanel()->visible(), false);
+ QCOMPARE(qApp->inputMethod()->visible(), false);
QTest::mousePress(&view, Qt::LeftButton, noModifiers, centerPoint);
QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint);
QGuiApplication::processEvents();
- QCOMPARE(qApp->inputPanel()->visible(), false);
+ QCOMPARE(qApp->inputMethod()->visible(), false);
// input panel should not be opened if focusOnPress is set to false
input->setFocusOnPress(false);
input->setFocus(false);
input->setFocus(true);
- QCOMPARE(qApp->inputPanel()->visible(), false);
+ QCOMPARE(qApp->inputMethod()->visible(), false);
QTest::mousePress(&view, Qt::LeftButton, noModifiers, centerPoint);
QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint);
- QCOMPARE(qApp->inputPanel()->visible(), false);
+ QCOMPARE(qApp->inputMethod()->visible(), false);
// input panel should open when openSoftwareInputPanel is called
input->openSoftwareInputPanel();
- QCOMPARE(qApp->inputPanel()->visible(), true);
+ QCOMPARE(qApp->inputMethod()->visible(), true);
// input panel should close when closeSoftwareInputPanel is called
input->closeSoftwareInputPanel();
- QCOMPARE(qApp->inputPanel()->visible(), false);
+ QCOMPARE(qApp->inputMethod()->visible(), false);
}
class MyTextInput : public QQuickTextInput
@@ -2993,7 +2993,7 @@ void tst_qquicktextinput::preeditCursorRectangle()
QCOMPARE(currentRect, previousRect);
QSignalSpy inputSpy(input, SIGNAL(cursorRectangleChanged()));
- QSignalSpy panelSpy(qGuiApp->inputPanel(), SIGNAL(cursorRectangleChanged()));
+ QSignalSpy panelSpy(qGuiApp->inputMethod(), SIGNAL(cursorRectangleChanged()));
// Verify that the micro focus rect moves to the left as the cursor position
// is incremented.
@@ -3022,8 +3022,8 @@ void tst_qquicktextinput::preeditCursorRectangle()
void tst_qquicktextinput::inputContextMouseHandler()
{
PlatformInputContext platformInputContext;
- QInputPanelPrivate *inputPanelPrivate = QInputPanelPrivate::get(qApp->inputPanel());
- inputPanelPrivate->testContext = &platformInputContext;
+ QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod());
+ inputMethodPrivate->testContext = &platformInputContext;
QString text = "supercalifragisiticexpialidocious!";
QQuickView view(testFileUrl("inputContext.qml"));
@@ -3060,7 +3060,7 @@ void tst_qquicktextinput::inputContextMouseHandler()
QTest::mouseRelease(&view, Qt::LeftButton, Qt::NoModifier, position);
QGuiApplication::processEvents();
- QCOMPARE(platformInputContext.m_action, QInputPanel::Click);
+ QCOMPARE(platformInputContext.m_action, QInputMethod::Click);
QCOMPARE(platformInputContext.m_invokeActionCallCount, 1);
QCOMPARE(platformInputContext.m_cursorPosition, 2);
}
@@ -3100,11 +3100,11 @@ void tst_qquicktextinput::inputMethodComposing()
QCOMPARE(spy.count(), 2);
}
-void tst_qquicktextinput::inputPanelUpdate()
+void tst_qquicktextinput::inputMethodUpdate()
{
PlatformInputContext platformInputContext;
- QInputPanelPrivate *inputPanelPrivate = QInputPanelPrivate::get(qApp->inputPanel());
- inputPanelPrivate->testContext = &platformInputContext;
+ QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod());
+ inputMethodPrivate->testContext = &platformInputContext;
QQuickView view(testFileUrl("inputContext.qml"));
view.show();
@@ -3216,11 +3216,11 @@ void tst_qquicktextinput::cursorRectangleSize()
QCOMPARE(cursorRectFromItem, cursorRectFromPositionToRectangle.toRect());
// item-canvas transform and input item transform match
- QCOMPARE(QQuickItemPrivate::get(textInput)->itemToCanvasTransform(), qApp->inputPanel()->inputItemTransform());
+ QCOMPARE(QQuickItemPrivate::get(textInput)->itemToCanvasTransform(), qApp->inputMethod()->inputItemTransform());
// input panel cursorRectangle property and tranformed item cursor rectangle match
QRectF sceneCursorRect = QQuickItemPrivate::get(textInput)->itemToCanvasTransform().mapRect(cursorRectFromItem);
- QCOMPARE(sceneCursorRect, qApp->inputPanel()->cursorRectangle());
+ QCOMPARE(sceneCursorRect, qApp->inputMethod()->cursorRectangle());
delete canvas;
}
diff --git a/tests/auto/shared/platforminputcontext.h b/tests/auto/shared/platforminputcontext.h
index 4c73544391..e77cbf34a1 100644
--- a/tests/auto/shared/platforminputcontext.h
+++ b/tests/auto/shared/platforminputcontext.h
@@ -40,13 +40,13 @@
****************************************************************************/
#include <qplatforminputcontext_qpa.h>
-#include <QtGui/QInputPanel>
+#include <QtGui/QInputMethod>
class PlatformInputContext : public QPlatformInputContext
{
public:
PlatformInputContext()
- : m_visible(false), m_action(QInputPanel::Click), m_cursorPosition(0),
+ : m_visible(false), m_action(QInputMethod::Click), m_cursorPosition(0),
m_invokeActionCallCount(0), m_showInputPanelCallCount(0), m_hideInputPanelCallCount(0),
m_updateCallCount(0), m_direction(Qt::LeftToRight)
{
@@ -66,7 +66,7 @@ public:
{
return m_visible;
}
- virtual void invokeAction(QInputPanel::Action action, int cursorPosition)
+ virtual void invokeAction(QInputMethod::Action action, int cursorPosition)
{
m_invokeActionCallCount++;
m_action = action;
@@ -106,7 +106,7 @@ public:
}
bool m_visible;
- QInputPanel::Action m_action;
+ QInputMethod::Action m_action;
int m_cursorPosition;
int m_invokeActionCallCount;
int m_showInputPanelCallCount;