From 22408c96cdf4597c410fcde1d01df9f8c53fd8c8 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Wed, 18 Apr 2012 12:16:21 -0700 Subject: [PATCH] Use QInputMethod::isVisible instead of QInputMethod::visible QInputMethod::visible will be removed in qtbase. Change-Id: I16ffbe56d55a62ae6a905e3cfdab8ad245d24aa0 Reviewed-by: Andrew den Exter --- .../quick/qquicktextedit/tst_qquicktextedit.cpp | 22 +++++++++++----------- .../quick/qquicktextinput/tst_qquicktextinput.cpp | 22 +++++++++++----------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp index f218f64..4cebc3e 100644 --- a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp +++ b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp @@ -2465,7 +2465,7 @@ void tst_qquicktextedit::openInputPanel() qDebug() << &edit << qApp->focusObject(); QVERIFY(qApp->focusObject() != edit); - QCOMPARE(qApp->inputMethod()->visible(), false); + QCOMPARE(qApp->inputMethod()->isVisible(), false); // input panel should open on focus QPoint centerPoint(view.width()/2, view.height()/2); @@ -2474,16 +2474,16 @@ void tst_qquicktextedit::openInputPanel() QGuiApplication::processEvents(); QVERIFY(edit->hasActiveFocus()); QCOMPARE(qApp->focusObject(), edit); - QCOMPARE(qApp->inputMethod()->visible(), true); + QCOMPARE(qApp->inputMethod()->isVisible(), true); QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint); // input panel should be re-opened when pressing already focused TextEdit qApp->inputMethod()->hide(); - QCOMPARE(qApp->inputMethod()->visible(), false); + QCOMPARE(qApp->inputMethod()->isVisible(), false); QVERIFY(edit->hasActiveFocus()); QTest::mousePress(&view, Qt::LeftButton, noModifiers, centerPoint); QGuiApplication::processEvents(); - QCOMPARE(qApp->inputMethod()->visible(), true); + QCOMPARE(qApp->inputMethod()->isVisible(), true); QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint); // input panel should stay visible if focus is lost to another text editor @@ -2491,7 +2491,7 @@ void tst_qquicktextedit::openInputPanel() QQuickTextEdit anotherEdit; anotherEdit.setParentItem(view.rootObject()); anotherEdit.setFocus(true); - QCOMPARE(qApp->inputMethod()->visible(), true); + QCOMPARE(qApp->inputMethod()->isVisible(), true); QCOMPARE(qApp->focusObject(), qobject_cast(&anotherEdit)); QCOMPARE(inputPanelVisibilitySpy.count(), 0); @@ -2505,28 +2505,28 @@ void tst_qquicktextedit::openInputPanel() // input panel should not be opened if TextEdit is read only edit->setReadOnly(true); edit->setFocus(true); - QCOMPARE(qApp->inputMethod()->visible(), false); + QCOMPARE(qApp->inputMethod()->isVisible(), false); QTest::mousePress(&view, Qt::LeftButton, noModifiers, centerPoint); QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint); QGuiApplication::processEvents(); - QCOMPARE(qApp->inputMethod()->visible(), false); + QCOMPARE(qApp->inputMethod()->isVisible(), false); // input panel should not be opened if focusOnPress is set to false edit->setFocusOnPress(false); edit->setFocus(false); edit->setFocus(true); - QCOMPARE(qApp->inputMethod()->visible(), false); + QCOMPARE(qApp->inputMethod()->isVisible(), false); QTest::mousePress(&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 edit->openSoftwareInputPanel(); - QCOMPARE(qApp->inputMethod()->visible(), true); + QCOMPARE(qApp->inputMethod()->isVisible(), true); // input panel should close when closeSoftwareInputPanel is called edit->closeSoftwareInputPanel(); - QCOMPARE(qApp->inputMethod()->visible(), false); + QCOMPARE(qApp->inputMethod()->isVisible(), false); inputMethodPrivate->testContext = 0; } diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp index 925e4f9..ab664ae 100644 --- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp +++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp @@ -2993,7 +2993,7 @@ void tst_qquicktextinput::openInputPanel() QVERIFY(input->focusOnPress()); QVERIFY(!input->hasActiveFocus()); QVERIFY(qApp->focusObject() != input); - QCOMPARE(qApp->inputMethod()->visible(), false); + QCOMPARE(qApp->inputMethod()->isVisible(), false); // input panel should open on focus QPoint centerPoint(view.width()/2, view.height()/2); @@ -3002,16 +3002,16 @@ void tst_qquicktextinput::openInputPanel() QGuiApplication::processEvents(); QVERIFY(input->hasActiveFocus()); QCOMPARE(qApp->focusObject(), input); - QCOMPARE(qApp->inputMethod()->visible(), true); + QCOMPARE(qApp->inputMethod()->isVisible(), true); QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint); // input panel should be re-opened when pressing already focused TextInput qApp->inputMethod()->hide(); - QCOMPARE(qApp->inputMethod()->visible(), false); + QCOMPARE(qApp->inputMethod()->isVisible(), false); QVERIFY(input->hasActiveFocus()); QTest::mousePress(&view, Qt::LeftButton, noModifiers, centerPoint); QGuiApplication::processEvents(); - QCOMPARE(qApp->inputMethod()->visible(), true); + QCOMPARE(qApp->inputMethod()->isVisible(), true); QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint); // input panel should stay visible if focus is lost to another text inputor @@ -3020,7 +3020,7 @@ void tst_qquicktextinput::openInputPanel() anotherInput.componentComplete(); anotherInput.setParentItem(view.rootObject()); anotherInput.setFocus(true); - QCOMPARE(qApp->inputMethod()->visible(), true); + QCOMPARE(qApp->inputMethod()->isVisible(), true); QCOMPARE(qApp->focusObject(), qobject_cast(&anotherInput)); QCOMPARE(inputPanelVisibilitySpy.count(), 0); @@ -3034,28 +3034,28 @@ void tst_qquicktextinput::openInputPanel() // input panel should not be opened if TextInput is read only input->setReadOnly(true); input->setFocus(true); - QCOMPARE(qApp->inputMethod()->visible(), false); + QCOMPARE(qApp->inputMethod()->isVisible(), false); QTest::mousePress(&view, Qt::LeftButton, noModifiers, centerPoint); QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint); 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->setFocusOnPress(false); input->setFocus(false); input->setFocus(true); - QCOMPARE(qApp->inputMethod()->visible(), false); + QCOMPARE(qApp->inputMethod()->isVisible(), false); QTest::mousePress(&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->openSoftwareInputPanel(); - QCOMPARE(qApp->inputMethod()->visible(), true); + QCOMPARE(qApp->inputMethod()->isVisible(), true); // input panel should close when closeSoftwareInputPanel is called input->closeSoftwareInputPanel(); - QCOMPARE(qApp->inputMethod()->visible(), false); + QCOMPARE(qApp->inputMethod()->isVisible(), false); } class MyTextInput : public QQuickTextInput -- 2.7.4