Add a test case for removing a submenu from the menubar

If 5ca9631d3a is reverted, this test
segfaults on Unity most of the times.

Task-number: QTBUG-55966
Change-Id: Ice59842e0a1a7930e3cd10c4c7319ef033fe6a58
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
Dmitry Shachnev 2016-11-15 17:04:36 +03:00 committed by Shawn Rutledge
parent e3ca4287d9
commit f88f405401

View File

@ -133,6 +133,7 @@ private slots:
#ifdef Q_OS_MACOS
void taskQTBUG56275_reinsertMenuInParentlessQMenuBar();
#endif
void taskQTBUG55966_subMenuRemoved();
void platformMenu();
@ -1541,5 +1542,22 @@ void tst_QMenuBar::taskQTBUG56275_reinsertMenuInParentlessQMenuBar()
}
#endif // Q_OS_MACOS
void tst_QMenuBar::taskQTBUG55966_subMenuRemoved()
{
QMainWindow window;
QMenuBar *menubar = window.menuBar();
QMenu *parentMenu = menubar->addMenu("Parent menu");
QAction *action = parentMenu->addAction("Action in parent menu");
QMenu *subMenu = new QMenu("Submenu");
action->setMenu(subMenu);
delete subMenu;
window.show();
QApplication::setActiveWindow(&window);
QVERIFY(QTest::qWaitForWindowActive(&window));
QTest::qWait(500);
}
QTEST_MAIN(tst_QMenuBar)
#include "tst_qmenubar.moc"