Use QInputMethod::isVisible instead of QInputMethod::visible

QInputMethod::visible will be removed in qtbase.

Change-Id: I16ffbe56d55a62ae6a905e3cfdab8ad245d24aa0
Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
This commit is contained in:
Girish Ramakrishnan 2012-04-18 12:16:21 -07:00 committed by Qt by Nokia
parent 360f0d0008
commit 22408c96cd
2 changed files with 22 additions and 22 deletions

View File

@ -2465,7 +2465,7 @@ void tst_qquicktextedit::openInputPanel()
qDebug() << &edit << qApp->focusObject(); qDebug() << &edit << qApp->focusObject();
QVERIFY(qApp->focusObject() != edit); QVERIFY(qApp->focusObject() != edit);
QCOMPARE(qApp->inputMethod()->visible(), false); QCOMPARE(qApp->inputMethod()->isVisible(), false);
// input panel should open on focus // input panel should open on focus
QPoint centerPoint(view.width()/2, view.height()/2); QPoint centerPoint(view.width()/2, view.height()/2);
@ -2474,16 +2474,16 @@ void tst_qquicktextedit::openInputPanel()
QGuiApplication::processEvents(); QGuiApplication::processEvents();
QVERIFY(edit->hasActiveFocus()); QVERIFY(edit->hasActiveFocus());
QCOMPARE(qApp->focusObject(), edit); QCOMPARE(qApp->focusObject(), edit);
QCOMPARE(qApp->inputMethod()->visible(), true); QCOMPARE(qApp->inputMethod()->isVisible(), true);
QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint); QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint);
// input panel should be re-opened when pressing already focused TextEdit // input panel should be re-opened when pressing already focused TextEdit
qApp->inputMethod()->hide(); qApp->inputMethod()->hide();
QCOMPARE(qApp->inputMethod()->visible(), false); QCOMPARE(qApp->inputMethod()->isVisible(), false);
QVERIFY(edit->hasActiveFocus()); QVERIFY(edit->hasActiveFocus());
QTest::mousePress(&view, Qt::LeftButton, noModifiers, centerPoint); QTest::mousePress(&view, Qt::LeftButton, noModifiers, centerPoint);
QGuiApplication::processEvents(); QGuiApplication::processEvents();
QCOMPARE(qApp->inputMethod()->visible(), true); QCOMPARE(qApp->inputMethod()->isVisible(), true);
QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint); QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint);
// input panel should stay visible if focus is lost to another text editor // input panel should stay visible if focus is lost to another text editor
@ -2491,7 +2491,7 @@ void tst_qquicktextedit::openInputPanel()
QQuickTextEdit anotherEdit; QQuickTextEdit anotherEdit;
anotherEdit.setParentItem(view.rootObject()); anotherEdit.setParentItem(view.rootObject());
anotherEdit.setFocus(true); anotherEdit.setFocus(true);
QCOMPARE(qApp->inputMethod()->visible(), true); QCOMPARE(qApp->inputMethod()->isVisible(), true);
QCOMPARE(qApp->focusObject(), qobject_cast<QObject*>(&anotherEdit)); QCOMPARE(qApp->focusObject(), qobject_cast<QObject*>(&anotherEdit));
QCOMPARE(inputPanelVisibilitySpy.count(), 0); QCOMPARE(inputPanelVisibilitySpy.count(), 0);
@ -2505,28 +2505,28 @@ void tst_qquicktextedit::openInputPanel()
// input panel should not be opened if TextEdit is read only // input panel should not be opened if TextEdit is read only
edit->setReadOnly(true); edit->setReadOnly(true);
edit->setFocus(true); edit->setFocus(true);
QCOMPARE(qApp->inputMethod()->visible(), false); QCOMPARE(qApp->inputMethod()->isVisible(), false);
QTest::mousePress(&view, Qt::LeftButton, noModifiers, centerPoint); QTest::mousePress(&view, Qt::LeftButton, noModifiers, centerPoint);
QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint); QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint);
QGuiApplication::processEvents(); QGuiApplication::processEvents();
QCOMPARE(qApp->inputMethod()->visible(), false); QCOMPARE(qApp->inputMethod()->isVisible(), false);
// input panel should not be opened if focusOnPress is set to false // input panel should not be opened if focusOnPress is set to false
edit->setFocusOnPress(false); edit->setFocusOnPress(false);
edit->setFocus(false); edit->setFocus(false);
edit->setFocus(true); edit->setFocus(true);
QCOMPARE(qApp->inputMethod()->visible(), false); QCOMPARE(qApp->inputMethod()->isVisible(), false);
QTest::mousePress(&view, Qt::LeftButton, noModifiers, centerPoint); QTest::mousePress(&view, Qt::LeftButton, noModifiers, centerPoint);
QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint); QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint);
QCOMPARE(qApp->inputMethod()->visible(), false); QCOMPARE(qApp->inputMethod()->isVisible(), false);
// input panel should open when openSoftwareInputPanel is called // input panel should open when openSoftwareInputPanel is called
edit->openSoftwareInputPanel(); edit->openSoftwareInputPanel();
QCOMPARE(qApp->inputMethod()->visible(), true); QCOMPARE(qApp->inputMethod()->isVisible(), true);
// input panel should close when closeSoftwareInputPanel is called // input panel should close when closeSoftwareInputPanel is called
edit->closeSoftwareInputPanel(); edit->closeSoftwareInputPanel();
QCOMPARE(qApp->inputMethod()->visible(), false); QCOMPARE(qApp->inputMethod()->isVisible(), false);
inputMethodPrivate->testContext = 0; inputMethodPrivate->testContext = 0;
} }

View File

@ -2993,7 +2993,7 @@ void tst_qquicktextinput::openInputPanel()
QVERIFY(input->focusOnPress()); QVERIFY(input->focusOnPress());
QVERIFY(!input->hasActiveFocus()); QVERIFY(!input->hasActiveFocus());
QVERIFY(qApp->focusObject() != input); QVERIFY(qApp->focusObject() != input);
QCOMPARE(qApp->inputMethod()->visible(), false); QCOMPARE(qApp->inputMethod()->isVisible(), false);
// input panel should open on focus // input panel should open on focus
QPoint centerPoint(view.width()/2, view.height()/2); QPoint centerPoint(view.width()/2, view.height()/2);
@ -3002,16 +3002,16 @@ void tst_qquicktextinput::openInputPanel()
QGuiApplication::processEvents(); QGuiApplication::processEvents();
QVERIFY(input->hasActiveFocus()); QVERIFY(input->hasActiveFocus());
QCOMPARE(qApp->focusObject(), input); QCOMPARE(qApp->focusObject(), input);
QCOMPARE(qApp->inputMethod()->visible(), true); QCOMPARE(qApp->inputMethod()->isVisible(), true);
QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint); QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint);
// input panel should be re-opened when pressing already focused TextInput // input panel should be re-opened when pressing already focused TextInput
qApp->inputMethod()->hide(); qApp->inputMethod()->hide();
QCOMPARE(qApp->inputMethod()->visible(), false); QCOMPARE(qApp->inputMethod()->isVisible(), false);
QVERIFY(input->hasActiveFocus()); QVERIFY(input->hasActiveFocus());
QTest::mousePress(&view, Qt::LeftButton, noModifiers, centerPoint); QTest::mousePress(&view, Qt::LeftButton, noModifiers, centerPoint);
QGuiApplication::processEvents(); QGuiApplication::processEvents();
QCOMPARE(qApp->inputMethod()->visible(), true); QCOMPARE(qApp->inputMethod()->isVisible(), true);
QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint); QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint);
// input panel should stay visible if focus is lost to another text inputor // input panel should stay visible if focus is lost to another text inputor
@ -3020,7 +3020,7 @@ void tst_qquicktextinput::openInputPanel()
anotherInput.componentComplete(); anotherInput.componentComplete();
anotherInput.setParentItem(view.rootObject()); anotherInput.setParentItem(view.rootObject());
anotherInput.setFocus(true); anotherInput.setFocus(true);
QCOMPARE(qApp->inputMethod()->visible(), true); QCOMPARE(qApp->inputMethod()->isVisible(), true);
QCOMPARE(qApp->focusObject(), qobject_cast<QObject*>(&anotherInput)); QCOMPARE(qApp->focusObject(), qobject_cast<QObject*>(&anotherInput));
QCOMPARE(inputPanelVisibilitySpy.count(), 0); QCOMPARE(inputPanelVisibilitySpy.count(), 0);
@ -3034,28 +3034,28 @@ void tst_qquicktextinput::openInputPanel()
// input panel should not be opened if TextInput is read only // input panel should not be opened if TextInput is read only
input->setReadOnly(true); input->setReadOnly(true);
input->setFocus(true); input->setFocus(true);
QCOMPARE(qApp->inputMethod()->visible(), false); QCOMPARE(qApp->inputMethod()->isVisible(), false);
QTest::mousePress(&view, Qt::LeftButton, noModifiers, centerPoint); QTest::mousePress(&view, Qt::LeftButton, noModifiers, centerPoint);
QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint); QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint);
QGuiApplication::processEvents(); QGuiApplication::processEvents();
QCOMPARE(qApp->inputMethod()->visible(), false); QCOMPARE(qApp->inputMethod()->isVisible(), false);
// input panel should not be opened if focusOnPress is set to false // input panel should not be opened if focusOnPress is set to false
input->setFocusOnPress(false); input->setFocusOnPress(false);
input->setFocus(false); input->setFocus(false);
input->setFocus(true); input->setFocus(true);
QCOMPARE(qApp->inputMethod()->visible(), false); QCOMPARE(qApp->inputMethod()->isVisible(), false);
QTest::mousePress(&view, Qt::LeftButton, noModifiers, centerPoint); QTest::mousePress(&view, Qt::LeftButton, noModifiers, centerPoint);
QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint); QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint);
QCOMPARE(qApp->inputMethod()->visible(), false); QCOMPARE(qApp->inputMethod()->isVisible(), false);
// input panel should open when openSoftwareInputPanel is called // input panel should open when openSoftwareInputPanel is called
input->openSoftwareInputPanel(); input->openSoftwareInputPanel();
QCOMPARE(qApp->inputMethod()->visible(), true); QCOMPARE(qApp->inputMethod()->isVisible(), true);
// input panel should close when closeSoftwareInputPanel is called // input panel should close when closeSoftwareInputPanel is called
input->closeSoftwareInputPanel(); input->closeSoftwareInputPanel();
QCOMPARE(qApp->inputMethod()->visible(), false); QCOMPARE(qApp->inputMethod()->isVisible(), false);
} }
class MyTextInput : public QQuickTextInput class MyTextInput : public QQuickTextInput