diff options
author | Alexander Volkov <a.volkov@rusbitech.ru> | 2015-06-10 13:33:09 +0300 |
---|---|---|
committer | Alexander Volkov <a.volkov@rusbitech.ru> | 2015-08-17 09:03:22 +0000 |
commit | 0636ec4ff5d25845b4020358d0570afb92ce580c (patch) | |
tree | 7294ae8376d746060aeec9e0febc920663a078a7 /tests | |
parent | 734557bb8491c92f918718ea8448ec2ee6b0a328 (diff) |
Open menu on the third click on QMenuBar on X11
We don't replay mouse events after closing popups on X11.
This leads to the bug when the menu doesn't show after
clicking three times on the menu bar. It can be fixed by
reverting 78d7192338e2cbba0c9b53c429d35b9437b7e1cd, but
then we need an alternative fix for QTBUG-32807 on Windows.
So don't replay mouse events for the menu bar on all
platforms.
Change-Id: I3db8e24a6de6f35b0a17dffac6a131f1cad42e6d
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp index f7cc69f83d..31e9c737e2 100644 --- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp @@ -128,7 +128,7 @@ private slots: void taskQTBUG4965_escapeEaten(); #endif void taskQTBUG11823_crashwithInvisibleActions(); - void closeOnSecondClick(); + void closeOnSecondClickAndOpenOnThirdClick(); void cornerWidgets_data(); void cornerWidgets(); @@ -1312,7 +1312,7 @@ void tst_QMenuBar::taskQTBUG11823_crashwithInvisibleActions() QCOMPARE(menubar.activeAction(), m); //the active action shouldn't have changed } -void tst_QMenuBar::closeOnSecondClick() // QTBUG-32807, menu should close on 2nd click. +void tst_QMenuBar::closeOnSecondClickAndOpenOnThirdClick() // QTBUG-32807, menu should close on 2nd click. { QMainWindow mainWindow; mainWindow.resize(300, 200); @@ -1322,17 +1322,20 @@ void tst_QMenuBar::closeOnSecondClick() // QTBUG-32807, menu should close on 2nd #endif QMenuBar *menuBar = mainWindow.menuBar(); menuBar->setNativeMenuBar(false); - QMenu *fileMenu = menuBar->addMenu(QStringLiteral("closeOnSecondClick")); + QMenu *fileMenu = menuBar->addMenu(QStringLiteral("OpenCloseOpen")); fileMenu->addAction(QStringLiteral("Quit")); mainWindow.show(); QApplication::setActiveWindow(&mainWindow); QVERIFY(QTest::qWaitForWindowActive(&mainWindow)); const QPoint center = menuBar->actionGeometry(fileMenu->menuAction()).center(); + const QPoint globalPos = menuBar->mapToGlobal(center); QTest::mouseMove(menuBar, center); QTest::mouseClick(menuBar, Qt::LeftButton, 0, center); QTRY_VERIFY(fileMenu->isVisible()); - QTest::mouseClick(menuBar, Qt::LeftButton, 0, center); + QTest::mouseClick(fileMenu, Qt::LeftButton, 0, fileMenu->mapFromGlobal(globalPos)); QTRY_VERIFY(!fileMenu->isVisible()); + QTest::mouseClick(menuBar, Qt::LeftButton, 0, center); + QTRY_VERIFY(fileMenu->isVisible()); } Q_DECLARE_METATYPE(Qt::Corner) |