summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorJoona Petrell <joona.t.petrell@nokia.com>2011-10-11 13:10:50 +0300
committerQt by Nokia <qt-info@nokia.com>2011-10-11 16:03:25 +0200
commite941b37fcc715fc20d7365cae21cd657a215cf8f (patch)
tree4e7345c42f6605b112aa370f0df430b0f054ad7f /tests/auto
parent0e6a4010286569c3c77ed3092dd96aca17e72332 (diff)
Move input panel visibility ownership from QInputPanel to QPlatformInputContext
Now QInputPanel::visible() can be set true even when platform doesn't provide a virtual keyboard. Like keyboard geometry, visibility should be dictated by the platform plugin and not QInputPanel, whose role is more like that of a mediator. QInputPanel::show() and ::hide() calls should be treated as requests that may fail. Changed the QInputPanel's visible property to read-only as a setter that may fail is not really a setter, show() and hide() should be used instead. Enabling the new functionality cannot be activated immediatelly without breaking existing keyboards, added a temporary function handlesInputPanelVisibility that handovers the responsiblity of updating input panel visibility to QInputContextPlatform only once QInputContextPlatform says that it is able to handle it. Change-Id: Ideecaf7225cc3971f33a0ac976bd92cf7767475b Reviewed-on: http://codereview.qt-project.org/6429 Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Pekka Vuorela <pekka.ta.vuorela@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/gui/kernel/qinputpanel/tst_qinputpanel.cpp43
1 files changed, 34 insertions, 9 deletions
diff --git a/tests/auto/gui/kernel/qinputpanel/tst_qinputpanel.cpp b/tests/auto/gui/kernel/qinputpanel/tst_qinputpanel.cpp
index 32215ebdf4..e7f5e84942 100644
--- a/tests/auto/gui/kernel/qinputpanel/tst_qinputpanel.cpp
+++ b/tests/auto/gui/kernel/qinputpanel/tst_qinputpanel.cpp
@@ -50,6 +50,8 @@ class PlatformInputContext : public QPlatformInputContext
public:
PlatformInputContext() :
m_animating(false),
+ m_visible(false),
+ m_handlesInputPanelVisibility(false),
m_updateCallCount(0),
m_resetCallCount(0),
m_commitCallCount(0),
@@ -60,7 +62,7 @@ public:
{}
virtual QRectF keyboardRect() const { return m_keyboardRect; }
- virtual bool isAnimating() { return m_animating; }
+ virtual bool isAnimating() const { return m_animating; }
virtual void reset() { m_resetCallCount++; }
virtual void commit() { m_commitCallCount++; }
@@ -78,8 +80,26 @@ public:
{
m_lastEventType = event->type(); return false;
}
+ virtual void showInputPanel()
+ {
+ m_visible = true;
+ }
+ virtual void hideInputPanel()
+ {
+ m_visible = false;
+ }
+ virtual bool isInputPanelVisible() const
+ {
+ return m_visible;
+ }
+ virtual bool handlesInputPanelVisibility() const
+ {
+ return m_handlesInputPanelVisibility;
+ }
bool m_animating;
+ bool m_visible;
+ bool m_handlesInputPanelVisibility;
int m_updateCallCount;
int m_resetCallCount;
int m_commitCallCount;
@@ -143,17 +163,22 @@ void tst_qinputpanel::initTestCase()
void tst_qinputpanel::visible()
{
- qApp->inputPanel()->show();
- QCOMPARE(qApp->inputPanel()->visible(), true);
+ QCOMPARE(m_platformInputContext.m_handlesInputPanelVisibility, false);
+ for (int index = 0; index < 2; index++) {
+ m_platformInputContext.m_handlesInputPanelVisibility = index;
+ QCOMPARE(qApp->inputPanel()->visible(), false);
+ qApp->inputPanel()->show();
+ QCOMPARE(qApp->inputPanel()->visible(), true);
- qApp->inputPanel()->hide();
- QCOMPARE(qApp->inputPanel()->visible(), false);
+ qApp->inputPanel()->hide();
+ QCOMPARE(qApp->inputPanel()->visible(), false);
- qApp->inputPanel()->setVisible(true);
- QCOMPARE(qApp->inputPanel()->visible(), true);
+ qApp->inputPanel()->setVisible(true);
+ QCOMPARE(qApp->inputPanel()->visible(), true);
- qApp->inputPanel()->setVisible(false);
- QCOMPARE(qApp->inputPanel()->visible(), false);
+ qApp->inputPanel()->setVisible(false);
+ QCOMPARE(qApp->inputPanel()->visible(), false);
+ }
}
void tst_qinputpanel::animating()