summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp')
-rw-r--r--tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp53
1 files changed, 36 insertions, 17 deletions
diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
index 9a68655fb6..3a4c4545df 100644
--- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
+++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
@@ -90,7 +90,7 @@ private slots:
void count();
void insertItem_QString_QObject();
-#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_DARWIN)
void accel();
void activatedCount();
@@ -115,7 +115,7 @@ private slots:
void check_altPress();
void check_altClosePress();
-#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_DARWIN)
void check_shortcutPress();
void check_menuPosition();
#endif
@@ -134,6 +134,8 @@ private slots:
void taskQTBUG56275_reinsertMenuInParentlessQMenuBar();
#endif
+ void platformMenu();
+
protected slots:
void onSimpleActivated( QAction*);
void onComplexActionTriggered();
@@ -314,7 +316,7 @@ inline TestMenu tst_QMenuBar::initWindowWithComplexMenuBar(QMainWindow &w)
}
// On Mac/WinCE, native key events are needed to test menu action activation
-#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_DARWIN)
void tst_QMenuBar::accel()
{
// create a popup menu with menu items set the accelerators later...
@@ -332,7 +334,7 @@ void tst_QMenuBar::accel()
#endif
// On Mac/WinCE, native key events are needed to test menu action activation
-#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_DARWIN)
void tst_QMenuBar::activatedCount()
{
// create a popup menu with menu items set the accelerators later...
@@ -523,7 +525,7 @@ void tst_QMenuBar::insertItem_QString_QObject()
}
// On Mac/WinCE, native key events are needed to test menu action activation
-#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_DARWIN)
void tst_QMenuBar::check_accelKeys()
{
QMainWindow w;
@@ -596,7 +598,7 @@ void tst_QMenuBar::check_accelKeys()
#endif
// On Mac/WinCE, native key events are needed to test menu action activation
-#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_DARWIN)
void tst_QMenuBar::check_cursorKeys1()
{
QMainWindow w;
@@ -630,7 +632,7 @@ void tst_QMenuBar::check_cursorKeys1()
#endif
// Qt/Mac,WinCE does not use the native popups/menubar
-#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_DARWIN)
void tst_QMenuBar::check_cursorKeys2()
{
QMainWindow w;
@@ -663,7 +665,7 @@ void tst_QMenuBar::check_cursorKeys2()
If a popupmenu is active you can use Left to move to the menu to the left of it.
*/
// Qt/Mac,WinCE does not use the native popups/menubar
-#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_DARWIN)
void tst_QMenuBar::check_cursorKeys3()
{
QMainWindow w;
@@ -778,7 +780,7 @@ void tst_QMenuBar::check_endKey()
*/
// Qt/Mac,WinCE does not use the native popups/menubar
-#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_DARWIN)
void tst_QMenuBar::check_escKey()
{
QMainWindow w;
@@ -923,7 +925,6 @@ void tst_QMenuBar::check_escKey()
// QCOMPARE(m_complexActionTriggerCount['h'], (uint)itemH_count);
// }
-#ifndef Q_OS_WINCE
void tst_QMenuBar::allowActiveAndDisabled()
{
QMenuBar menuBar;
@@ -963,7 +964,6 @@ void tst_QMenuBar::allowActiveAndDisabled()
else
QCOMPARE(menuBar.activeAction()->text(), fileMenu.title());
}
-#endif
void tst_QMenuBar::check_altPress()
{
@@ -1014,7 +1014,7 @@ void tst_QMenuBar::check_altClosePress()
}
// Qt/Mac,WinCE does not use the native popups/menubar
-#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_DARWIN)
void tst_QMenuBar::check_shortcutPress()
{
QMainWindow w;
@@ -1057,7 +1057,7 @@ private:
};
// Qt/Mac,WinCE does not use the native popups/menubar
-#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_DARWIN)
void tst_QMenuBar::check_menuPosition()
{
QMainWindow w;
@@ -1126,7 +1126,7 @@ void tst_QMenuBar::check_menuPosition()
menu.close();
}
-# ifndef QTEST_NO_CURSOR
+# ifndef QT_NO_CURSOR
// QTBUG-28031: Click at bottom-right corner.
{
w.move(400, 200);
@@ -1140,7 +1140,7 @@ void tst_QMenuBar::check_menuPosition()
QCOMPARE(menu.geometry().right() - 1, globalPos.x());
menu.close();
}
-# endif // QTEST_NO_CURSOR
+# endif // QT_NO_CURSOR
}
#endif
@@ -1213,7 +1213,7 @@ void tst_QMenuBar::task256322_highlight()
QTRY_VERIFY(!menu2.isVisible());
QVERIFY(!menu.isVisible());
#ifdef Q_OS_MAC
- if ((QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) && (win.menuBar()->activeAction() != nothing))
+ if (win.menuBar()->activeAction() != nothing)
QEXPECT_FAIL("", "QTBUG-30565: Unstable test", Continue);
#endif
QTRY_COMPARE(win.menuBar()->activeAction(), nothing);
@@ -1396,7 +1396,7 @@ void tst_QMenuBar::cornerWidgets()
QFETCH(Qt::Corner, corner);
-#if defined(Q_OS_OSX) || defined(Q_OS_WINCE)
+#if defined(Q_OS_OSX)
QSKIP("Test interferes with native menu bars on this platform");
#endif
@@ -1492,6 +1492,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();