diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2009-04-20 16:30:01 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2009-04-20 16:30:01 (GMT) |
commit | 4708acb70e1e71bf22e85f7335dcaf1401aba3bb (patch) | |
tree | 36043e3def5d50dde51846dea44e376e902524ac /tests/auto/qaction | |
parent | 556216129bf5738c6ad92807ece1dac233b8b96f (diff) | |
parent | 07703ade86edcd6565c373f63e34306209d1a90a (diff) | |
download | Qt-4708acb70e1e71bf22e85f7335dcaf1401aba3bb.zip Qt-4708acb70e1e71bf22e85f7335dcaf1401aba3bb.tar.gz Qt-4708acb70e1e71bf22e85f7335dcaf1401aba3bb.tar.bz2 |
Merge branch '4.5'
Conflicts:
tests/auto/qaction/tst_qaction.cpp
Diffstat (limited to 'tests/auto/qaction')
-rw-r--r-- | tests/auto/qaction/tst_qaction.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/auto/qaction/tst_qaction.cpp b/tests/auto/qaction/tst_qaction.cpp index 1ec21f2..1b73f06 100644 --- a/tests/auto/qaction/tst_qaction.cpp +++ b/tests/auto/qaction/tst_qaction.cpp @@ -46,6 +46,7 @@ #include <qevent.h> #include <qaction.h> #include <qmenu.h> +#include <qlineedit.h> //TESTED_CLASS= //TESTED_FILES= @@ -74,6 +75,7 @@ private slots: void setStandardKeys(); void alternateShortcuts(); void enabledVisibleInteraction(); + void invisibleActionWithComplexShortcut(); void task200823_tooltip(); void task229128TriggeredSignalWithoutActiongroup(); void task229128TriggeredSignalWhenInActiongroup(); @@ -365,5 +367,36 @@ void tst_QAction::task229128TriggeredSignalWhenInActiongroup() QCOMPARE(actionSpy.count(), 1); } +void tst_QAction::invisibleActionWithComplexShortcut() +{ + QAction action(0); + action.setShortcut(QKeySequence(Qt::CTRL + Qt::Key_E, Qt::Key_1)); + + QLineEdit edit; + edit.addAction(&action); + edit.show(); + QTest::qWait(100); + + QSignalSpy spy(&action, SIGNAL(triggered())); + + action.setVisible(true); + QTest::keyPress(&edit, Qt::Key_E, Qt::ControlModifier); + QTest::keyRelease(&edit, Qt::Key_E, Qt::ControlModifier); + QTest::keyPress(&edit, Qt::Key_1, Qt::NoModifier); + QTest::keyRelease(&edit, Qt::Key_1, Qt::NoModifier); + QCOMPARE(spy.count(), 1); + QCOMPARE(edit.text(), QLatin1String("")); + + edit.clear(); + spy.clear(); + action.setVisible(false); + QTest::keyPress(&edit, Qt::Key_E, Qt::ControlModifier); + QTest::keyRelease(&edit, Qt::Key_E, Qt::ControlModifier); + QTest::keyPress(&edit, Qt::Key_1, Qt::NoModifier); + QTest::keyRelease(&edit, Qt::Key_1, Qt::NoModifier); + QCOMPARE(spy.count(), 0); + QCOMPARE(edit.text(), QLatin1String("1")); +} + QTEST_MAIN(tst_QAction) #include "tst_qaction.moc" |