From 6a2f7994e8255107954c11d48595dd171d0102b8 Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Tue, 1 Sep 2020 10:52:35 +0900 Subject: Menu: Update mnemonic tests to wait until menu is fully closed Otherwise tst_qquickmenubar of Material style would fail as follows: 1. Type Alt+E to open Edit menu 2. Type Alt+H to switch to Help menu Since the key events of (2) are generated really quick, (2) wouldn't open the Help menu. The Edit menu still exists in the popup stack and blocks the MenuBar shortcuts. I originally thought the closing popup shouldn't block the parent shortcuts. for (QQuickPopup *popup : popups) { if (qobject_cast(popup)) continue; // ignore tooltips (QTBUG-60492) + if (!popup->isOpened()) + continue; // closing, or not yet fully open However, the shortcuts in the closing popup are enabled until the popup gets invisible. So changing the resolution of ambiguous shortcuts would introduce another inconsistency. For example, unambiguous shortcut in the closing popup could be triggered, whereas ambiguous one wouldn't win because of the registration order. Task-number: QTBUG-86276 Pick-to: 5.15 Change-Id: I3510cc7a06294e1d1d3512297fc9389bddc4da3b Reviewed-by: Mitch Curtis --- tests/auto/qquickmenubar/tst_qquickmenubar.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/qquickmenubar/tst_qquickmenubar.cpp b/tests/auto/qquickmenubar/tst_qquickmenubar.cpp index 62cb7363..f18eabc7 100644 --- a/tests/auto/qquickmenubar/tst_qquickmenubar.cpp +++ b/tests/auto/qquickmenubar/tst_qquickmenubar.cpp @@ -464,6 +464,7 @@ void tst_qquickmenubar::mnemonics() // trigger another menubar item to open another menu, leave Alt pressed keySim.press(Qt::Key_Alt); + QTRY_VERIFY(!editMenuBarMenu->isVisible()); keySim.click(Qt::Key_H); // "&Help" QVERIFY(!editMenuBarItem->isHighlighted()); QVERIFY(helpMenuBarItem->isHighlighted()); -- cgit v1.2.3