diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-11-23 14:48:51 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2009-11-23 14:53:38 (GMT) |
commit | 0bad605066f4cacabb2547b9b8895b69dac3d431 (patch) | |
tree | cfc76017ae9d0b5f2d3670032579fa4ed55a13ac /tests/auto/qmenubar | |
parent | db5e4496229a776768464d1d3d2e1f8e81bd6ba0 (diff) | |
download | Qt-0bad605066f4cacabb2547b9b8895b69dac3d431.zip Qt-0bad605066f4cacabb2547b9b8895b69dac3d431.tar.gz Qt-0bad605066f4cacabb2547b9b8895b69dac3d431.tar.bz2 |
Make the menubar filter out EScape only if there is a current action
Task-number: QTBUG-4965
Reviewed-by: gabi
Diffstat (limited to 'tests/auto/qmenubar')
-rw-r--r-- | tests/auto/qmenubar/tst_qmenubar.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/qmenubar/tst_qmenubar.cpp b/tests/auto/qmenubar/tst_qmenubar.cpp index 4291c3e..320cd8d 100644 --- a/tests/auto/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/qmenubar/tst_qmenubar.cpp @@ -167,6 +167,7 @@ private slots: void task223138_triggered(); void task256322_highlight(); void menubarSizeHint(); + void taskQTBUG4965_escapeEaten(); #if defined(QT3_SUPPORT) void indexBasedInsertion_data(); @@ -1664,6 +1665,27 @@ void tst_QMenuBar::menubarSizeHint() QCOMPARE(resSize, mb.sizeHint()); } +void tst_QMenuBar::taskQTBUG4965_escapeEaten() +{ + QMenuBar menubar; + QMenu menu("menu1"); + QAction *first = menubar.addMenu(&menu); + menu.addAction("quit", &menubar, SLOT(close()), QKeySequence("ESC")); + menubar.show(); + menubar.setActiveWindow(); + QTest::qWaitForWindowShown(&menubar); + menubar.setActiveAction(first); + QTRY_VERIFY(menu.isVisible()); + QCOMPARE(menubar.activeAction(), first); + QTest::keyClick(0, Qt::Key_Escape); + QVERIFY(!menu.isVisible()); + QTRY_VERIFY(menubar.hasFocus()); + QCOMPARE(menubar.activeAction(), first); + QTest::keyClick(0, Qt::Key_Escape); + QVERIFY(!menubar.activeAction()); + QTest::keyClick(0, Qt::Key_Escape); //now the action should be triggered + QTRY_VERIFY(!menubar.isVisible()); +} #if defined(QT3_SUPPORT) void tst_QMenuBar::indexBasedInsertion_data() |