diff options
author | Sami Merilä <sami.merila@nokia.com> | 2009-09-28 13:24:48 (GMT) |
---|---|---|
committer | Sami Merilä <sami.merila@nokia.com> | 2009-09-28 13:24:48 (GMT) |
commit | 3a52aeb622da3f7d4171ea64df7896fa5d2d7d4a (patch) | |
tree | b506f888fb69c3ca83ebdbba64a9ac9df83a9480 /tests/auto/qsoftkeymanager | |
parent | 726ce1dcba37d85bc743559e1b882a72413d1d82 (diff) | |
download | Qt-3a52aeb622da3f7d4171ea64df7896fa5d2d7d4a.zip Qt-3a52aeb622da3f7d4171ea64df7896fa5d2d7d4a.tar.gz Qt-3a52aeb622da3f7d4171ea64df7896fa5d2d7d4a.tar.bz2 |
Triggering softkey action for disbled widget causes a crash.
Softkey actions need to copy enable state from action widget to prevent
crash when action is triggered and action widget is disabled.
OPEN: dynamically setting enable state for softkey actions.
Task-number: QT-2117
Reviewed-by: Jason Barron
Diffstat (limited to 'tests/auto/qsoftkeymanager')
-rw-r--r-- | tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp b/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp index 8788117..832605e 100644 --- a/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp +++ b/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp @@ -62,6 +62,7 @@ public slots: private slots: void updateSoftKeysCompressed(); void handleCommand(); + void checkSoftkeyEnableStates(); }; class EventListener : public QObject @@ -169,6 +170,23 @@ void tst_QSoftKeyManager::handleCommand() QCOMPARE(spy1.count(), 1); } +/* + This tests that softkey enable state follows the state of widget that owns the action + to which the softkey is related to. +*/ +void tst_QSoftKeyManager::checkSoftkeyEnableStates() +{ + QWidget w1, w2; + w1.setEnabled(false); + w2.setEnabled(true); + + QAction *disabledAction = QSoftKeyManager::createAction(QSoftKeyManager::OkSoftKey, &w1); + QAction *enabledAction = QSoftKeyManager::createAction(QSoftKeyManager::OkSoftKey, &w2); + + QVERIFY(disabledAction->isEnabled()==false); + QVERIFY(enabledAction->isEnabled()==true); +} + QTEST_MAIN(tst_QSoftKeyManager) #include "tst_qsoftkeymanager.moc" |