From 0da153d47da2dcc59b33bc47ea949ceaf3189579 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Fri, 28 May 2010 14:06:41 +1000 Subject: Active window focus gain should not open virtual keypad Task-number: Reviewed-by: Martin Jones --- .../qdeclarativetextedit/tst_qdeclarativetextedit.cpp | 13 +++++++++++-- .../qdeclarativetextinput/tst_qdeclarativetextinput.cpp | 13 +++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index 0df28d02e8..d3e3c3aed2 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -915,9 +915,18 @@ void tst_qdeclarativetextedit::sendRequestSoftwareInputPanelEvent() edit.setFocus(false); QCOMPARE(ic.openInputPanelReceived, false); QCOMPARE(ic.closeInputPanelReceived, true); + ic.closeInputPanelReceived = false; + + // active window focus reason should not cause input panel to open + QGraphicsObject * editObject = qobject_cast(&edit); + editObject->setFocus(Qt::ActiveWindowFocusReason); + QCOMPARE(ic.openInputPanelReceived, false); + QCOMPARE(ic.closeInputPanelReceived, false); + + // and input panel should not open if focus has already been set edit.setFocus(true); - QCOMPARE(ic.openInputPanelReceived, true); - QCOMPARE(ic.closeInputPanelReceived, true); + QCOMPARE(ic.openInputPanelReceived, false); + QCOMPARE(ic.closeInputPanelReceived, false); edit.setShowInputPanelOnFocus(true); QCOMPARE(inputPanelonFocusSpy.count(),2); diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index 155223d9a7..c01cfa59f8 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -819,9 +819,18 @@ void tst_qdeclarativetextinput::sendRequestSoftwareInputPanelEvent() input.setFocus(false); QCOMPARE(ic.openInputPanelReceived, false); QCOMPARE(ic.closeInputPanelReceived, true); + ic.closeInputPanelReceived = false; + + // active window focus reason should not cause input panel to open + QGraphicsObject * inputObject = qobject_cast(&input); + inputObject->setFocus(Qt::ActiveWindowFocusReason); + QCOMPARE(ic.openInputPanelReceived, false); + QCOMPARE(ic.closeInputPanelReceived, false); + + // and input panel should not open if focus has already been set input.setFocus(true); - QCOMPARE(ic.openInputPanelReceived, true); - QCOMPARE(ic.closeInputPanelReceived, true); + QCOMPARE(ic.openInputPanelReceived, false); + QCOMPARE(ic.closeInputPanelReceived, false); input.setShowInputPanelOnFocus(true); QCOMPARE(inputPanelonFocusSpy.count(),2); -- cgit v1.2.3