summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
index ca58dc1247..475ce2a317 100644
--- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
+++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
@@ -131,6 +131,8 @@ private slots:
void cornerWidgets();
void taskQTBUG53205_crashReparentNested();
+ void platformMenu();
+
protected slots:
void onSimpleActivated( QAction*);
void onComplexActionTriggered();
@@ -1487,6 +1489,25 @@ void tst_QMenuBar::taskQTBUG53205_crashReparentNested()
testMenus.actions[0]->trigger();
}
+// QTBUG-56526
+void tst_QMenuBar::platformMenu()
+{
+ QMenuBar menuBar;
+ QPlatformMenuBar *platformMenuBar = menuBar.platformMenuBar();
+ if (!platformMenuBar)
+ QSKIP("No platform menubar implementation available on this platform.");
+
+ // QMenu must not create a platform menu instance at creation time, because
+ // on Unity the type of the platform menu instance must be different (QGtk3Menu
+ // vs. QDbusPlatformMenu) depending on whether the menu is in the global menubar
+ // or a standalone context menu.
+ QMenu *menu = new QMenu(&menuBar);
+ QVERIFY(!menu->platformMenu());
+
+ menuBar.addMenu(menu);
+ QVERIFY(menu->platformMenu());
+}
+
void tst_QMenuBar::slotForTaskQTBUG53205()
{
QWidget *parent = taskQTBUG53205MenuBar->parentWidget();