diff options
author | axis <qt-info@nokia.com> | 2009-12-03 08:21:37 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2009-12-03 08:21:37 (GMT) |
commit | 01279a67d5d27089b645a4b6226e32b415709722 (patch) | |
tree | 9d5176a10a056f6eaa4f857d66bddbf9212a9fe3 /tests/auto | |
parent | 78b2e552cca92859b2c126751ca5fc6fd83dd5cf (diff) | |
parent | bc49609893d79dc12af459dad8750530da37e5ec (diff) | |
download | Qt-01279a67d5d27089b645a4b6226e32b415709722.zip Qt-01279a67d5d27089b645a4b6226e32b415709722.tar.gz Qt-01279a67d5d27089b645a4b6226e32b415709722.tar.bz2 |
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt-s60-public into 4.6-staging2
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp | 62 |
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" |