summaryrefslogtreecommitdiffstats
path: root/tests/auto/qsoftkeymanager
diff options
context:
space:
mode:
authorJanne Anttila <janne.anttila@digia.com>2009-12-02 13:08:53 (GMT)
committerJanne Anttila <janne.anttila@digia.com>2009-12-02 13:08:53 (GMT)
commit855d2702ffff37452ff3bc0e1576d1d17fdb76c2 (patch)
tree16cfc4e38166a843003aaaaa5cd088bf75fb04a6 /tests/auto/qsoftkeymanager
parent7c70e69511817127aa4691339af4a6aa07c1502a (diff)
downloadQt-855d2702ffff37452ff3bc0e1576d1d17fdb76c2.zip
Qt-855d2702ffff37452ff3bc0e1576d1d17fdb76c2.tar.gz
Qt-855d2702ffff37452ff3bc0e1576d1d17fdb76c2.tar.bz2
Fixed softkey merging/traversing over window boundaries.
If current dialog implementation had parent and no softkeys set, the dialog got softkeys from parent. This commit changes the behaviour so that softkeys are not traversed over window boundaries. Also added autotest for the bug report. Task-number: QTBUG-6163 Reviewed-by: Jason Barron
Diffstat (limited to 'tests/auto/qsoftkeymanager')
-rw-r--r--tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp62
1 files changed, 62 insertions, 0 deletions
diff --git a/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp b/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp
index 87e0533..f923739 100644
--- a/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp
+++ b/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp
@@ -73,6 +73,7 @@ private slots:
void updateSoftKeysCompressed();
void handleCommand();
void checkSoftkeyEnableStates();
+ void noMergingOverWindowBoundary();
private: // utils
inline void simulateSymbianCommand(int command)
@@ -235,5 +236,66 @@ void tst_QSoftKeyManager::checkSoftkeyEnableStates()
QCOMPARE(spy1.count(), 5);
}
+/*
+ This tests that the softkeys are not merged over window boundaries. I.e. dialogs
+ don't get softkeys of base widget by default - QTBUG-6163.
+*/
+void tst_QSoftKeyManager::noMergingOverWindowBoundary()
+{
+ // Create base window against which the dialog softkeys will ve verified
+ QWidget base;
+
+ QAction* baseLeft = new QAction(tr("BaseLeft"), &base);
+ baseLeft->setSoftKeyRole(QAction::PositiveSoftKey);
+ base.addAction(baseLeft);
+
+ QAction* baseRight = new QAction(tr("BaseRight"), &base);
+ baseRight->setSoftKeyRole(QAction::NegativeSoftKey);
+ base.addAction(baseRight);
+
+ base.showMaximized();
+ QApplication::processEvents();
+
+ QSignalSpy baseLeftSpy(baseLeft, SIGNAL(triggered()));
+ QSignalSpy baseRightSpy(baseRight, SIGNAL(triggered()));
+
+ //Verify that both base softkeys emit triggered signals
+ simulateSymbianCommand(s60CommandStart);
+ simulateSymbianCommand(s60CommandStart + 1);
+
+ QCOMPARE(baseLeftSpy.count(), 1);
+ QCOMPARE(baseRightSpy.count(), 1);
+ baseLeftSpy.clear();
+ baseRightSpy.clear();
+
+ // Verify that no softkey merging when using dialog without parent
+ QDialog dlg;
+ dlg.show();
+
+ QApplication::processEvents();
+
+ simulateSymbianCommand(s60CommandStart);
+ simulateSymbianCommand(s60CommandStart + 1);
+
+ QCOMPARE(baseLeftSpy.count(), 0);
+ QCOMPARE(baseRightSpy.count(), 0);
+
+ // Ensure base view has focus again
+ dlg.hide();
+ base.showMaximized();
+
+ // Verify that no softkey merging when using dialog with parent
+ QDialog dlg2(&base);
+ dlg2.show();
+
+ QApplication::processEvents();
+
+ simulateSymbianCommand(s60CommandStart);
+ simulateSymbianCommand(s60CommandStart + 1);
+
+ QCOMPARE(baseLeftSpy.count(), 0);
+ QCOMPARE(baseRightSpy.count(), 0);
+}
+
QTEST_MAIN(tst_QSoftKeyManager)
#include "tst_qsoftkeymanager.moc"