40 #include <QVBoxLayout>
42 #include <QPlainTextEdit>
43 #include <QTranslator>
52 #include <QtTest/private/qtesthelpers_p.h>
57 static inline QPoint widgetToWindowPos(
const QWidget *
w,
const QPoint &
pos)
61 return window->mapFromGlobal(
w->mapToGlobal(
pos));
99 void removeItemAt_data();
100 void removeItem_data();
103 void insertItem_QString_QObject();
105 #if !defined(Q_OS_DARWIN)
107 void activatedCount();
108 void activatedCount_data();
110 void check_accelKeys();
111 void check_cursorKeys1();
112 void check_cursorKeys2();
113 void check_cursorKeys3();
117 void allowActiveAndDisabled();
118 void taskQTBUG56860_focus();
120 void check_homeKey();
127 void check_altPress();
128 void check_altClosePress();
129 #if !defined(Q_OS_DARWIN)
130 void check_shortcutPress();
131 void check_menuPosition();
132 void taskQTBUG46812_doNotLeaveMenubarHighlighted();
134 void task223138_triggered();
135 void task256322_highlight();
136 void menubarSizeHint();
138 void taskQTBUG4965_escapeEaten();
140 void taskQTBUG11823_crashwithInvisibleActions();
141 void closeOnSecondClickAndOpenOnThirdClick();
142 void cornerWidgets_data();
143 void cornerWidgets();
144 void taskQTBUG53205_crashReparentNested();
146 void taskQTBUG56275_reinsertMenuInParentlessQMenuBar();
147 void QTBUG_57404_existingMenuItemException();
148 void defaultEditMenuItems();
151 void QTBUG_25669_menubarActionDoubleTriggered();
152 void taskQTBUG55966_subMenuRemoved();
153 void QTBUG_58344_invalidIcon();
155 void addActionQt5connect();
156 void QTBUG_65488_hiddenActionTriggered();
158 void onSimpleActivated(
QAction*);
159 void onComplexActionTriggered();
170 QAction* m_lastSimpleAcceleratorId;
171 int m_simpleActivatedCount;
172 int m_complexTriggerCount[int(
'k')];
177 void tst_QMenuBar::getSetCheck()
221 m_lastSimpleAcceleratorId =
action;
222 m_simpleActivatedCount++;
225 void tst_QMenuBar::cleanup()
232 TestMenu tst_QMenuBar::initSimpleMenuBar(
QMenuBar *mb,
bool forceNonNative) {
239 #if QT_CONFIG(shortcut)
249 #if QT_CONFIG(shortcut)
255 #if QT_CONFIG(shortcut)
263 m_lastSimpleAcceleratorId = 0;
264 m_simpleActivatedCount = 0;
273 return initSimpleMenuBar(
w.menuBar(), forceNonNative);
296 #if QT_CONFIG(shortcut)
305 if (
QAction *
a = qobject_cast<QAction *>(sender()))
306 m_complexTriggerCount[
a->data().toInt()]++;
319 for (
char c =
'a';
c <
'c'; ++
c)
322 menu = addNumberedMenu(mb, 2);
325 for (
char c =
'c';
c <
'g'; ++
c)
328 for (
char c =
'g';
c <
'i'; ++
c)
333 #if QT_CONFIG(shortcut)
339 std::fill(m_complexTriggerCount, m_complexTriggerCount +
sizeof(m_complexTriggerCount) /
sizeof(
int), 0);
348 return initComplexMenuBar(
w.menuBar());
352 #if !defined(Q_OS_DARWIN)
353 void tst_QMenuBar::accel()
356 QSKIP(
"Wayland: This fails. Figure out why.");
373 #if !defined(Q_OS_DARWIN)
374 void tst_QMenuBar::activatedCount()
377 QSKIP(
"Wayland: This fails. Figure out why.");
381 QFETCH(
bool, forceNonNative );
382 initWindowWithSimpleMenuBar(
w, forceNonNative);
389 QCOMPARE( m_simpleActivatedCount, 2 );
392 void tst_QMenuBar::activatedCount_data()
394 QTest::addColumn<bool>(
"forceNonNative");
400 void tst_QMenuBar::clear()
408 for (
int i = 0;
i < 10;
i++) {
410 for (
int k = 0; k <
i; k++)
419 void tst_QMenuBar::count()
424 for (
int i = 0;
i < 10;
i++) {
430 void tst_QMenuBar::removeItem_data()
432 QTest::addColumn<int>(
"removeIndex");
439 void tst_QMenuBar::removeItem()
466 QVERIFY( menuBarActions.
at(0) == action1 );
467 QVERIFY( menuBarActions.
at(1) == action2 );
468 QVERIFY( menuBarActions.
at(2) == action3 );
471 QFETCH(
int, removeIndex );
472 switch (removeIndex )
500 void tst_QMenuBar::removeItemAt_data()
502 QTest::addColumn<int>(
"removeIndex");
508 void tst_QMenuBar::removeItemAt()
533 QFETCH(
int, removeIndex );
536 switch (removeIndex )
561 void tst_QMenuBar::insertItem_QString_QObject()
575 #if !defined(Q_OS_DARWIN)
576 void tst_QMenuBar::check_accelKeys()
579 QSKIP(
"Wayland: This fails. Figure out why.");
582 initWindowWithComplexMenuBar(
w);
589 QCOMPARE(m_complexTriggerCount[1], 0);
590 QCOMPARE(m_complexTriggerCount[2], 0);
591 QCOMPARE(m_complexTriggerCount[3], 0);
592 QCOMPARE(m_complexTriggerCount[4], 0);
593 QCOMPARE(m_complexTriggerCount[
int(
'a')], 0);
594 QCOMPARE(m_complexTriggerCount[
int(
'b')], 0);
595 QCOMPARE(m_complexTriggerCount[
int(
'c')], 0);
596 QCOMPARE(m_complexTriggerCount[
int(
'd')], 0);
599 QCOMPARE(m_complexTriggerCount[1], 0);
600 QCOMPARE(m_complexTriggerCount[2], 0);
601 QCOMPARE(m_complexTriggerCount[3], 0);
602 QCOMPARE(m_complexTriggerCount[4], 0);
603 QCOMPARE(m_complexTriggerCount[
int(
'a')], 1);
604 QCOMPARE(m_complexTriggerCount[
int(
'b')], 0);
605 QCOMPARE(m_complexTriggerCount[
int(
'c')], 0);
606 QCOMPARE(m_complexTriggerCount[
int(
'd')], 0);
609 QCOMPARE(m_complexTriggerCount[1], 0);
610 QCOMPARE(m_complexTriggerCount[2], 0);
611 QCOMPARE(m_complexTriggerCount[3], 0);
612 QCOMPARE(m_complexTriggerCount[4], 0);
613 QCOMPARE(m_complexTriggerCount[
int(
'a')], 1);
614 QCOMPARE(m_complexTriggerCount[
int(
'b')], 0);
615 QCOMPARE(m_complexTriggerCount[
int(
'c')], 1);
616 QCOMPARE(m_complexTriggerCount[
int(
'd')], 0);
619 QCOMPARE(m_complexTriggerCount[1], 0);
620 QCOMPARE(m_complexTriggerCount[2], 0);
621 QCOMPARE(m_complexTriggerCount[3], 0);
622 QCOMPARE(m_complexTriggerCount[4], 0);
623 QCOMPARE(m_complexTriggerCount[
int(
'a')], 1);
624 QCOMPARE(m_complexTriggerCount[
int(
'b')], 1);
625 QCOMPARE(m_complexTriggerCount[
int(
'c')], 1);
626 QCOMPARE(m_complexTriggerCount[
int(
'd')], 0);
629 QCOMPARE(m_complexTriggerCount[1], 0);
630 QCOMPARE(m_complexTriggerCount[2], 0);
631 QCOMPARE(m_complexTriggerCount[3], 0);
632 QCOMPARE(m_complexTriggerCount[4], 0);
633 QCOMPARE(m_complexTriggerCount[
int(
'a')], 1);
634 QCOMPARE(m_complexTriggerCount[
int(
'b')], 1);
635 QCOMPARE(m_complexTriggerCount[
int(
'c')], 1);
636 QCOMPARE(m_complexTriggerCount[
int(
'd')], 1);
639 QCOMPARE(m_complexTriggerCount[1], 0);
640 QCOMPARE(m_complexTriggerCount[2], 0);
641 QCOMPARE(m_complexTriggerCount[3], 1);
642 QCOMPARE(m_complexTriggerCount[4], 0);
643 QCOMPARE(m_complexTriggerCount[
int(
'a')], 1);
644 QCOMPARE(m_complexTriggerCount[
int(
'b')], 1);
645 QCOMPARE(m_complexTriggerCount[
int(
'c')], 1);
646 QCOMPARE(m_complexTriggerCount[
int(
'd')], 1);
651 #if !defined(Q_OS_DARWIN)
652 void tst_QMenuBar::check_cursorKeys1()
654 if (qgetenv(
"XDG_CURRENT_DESKTOP") ==
"Unity")
655 QSKIP(
"This test is flaky on Ubuntu/Unity due to regression introduced by QTBUG-39362");
658 QSKIP(
"Wayland: This fails. Figure out why.");
661 initWindowWithComplexMenuBar(
w);
669 QCOMPARE(m_complexTriggerCount[3], 0);
670 QCOMPARE(m_complexTriggerCount[4], 0);
671 QCOMPARE(m_complexTriggerCount[
int(
'a')], 0);
672 QCOMPARE(m_complexTriggerCount[
int(
'b')], 0);
673 QCOMPARE(m_complexTriggerCount[
int(
'c')], 0);
674 QCOMPARE(m_complexTriggerCount[
int(
'd')], 0);
677 QTest::keyClick(
static_cast<QWidget *
>(0),
Qt::Key_Down );
681 QCOMPARE(m_complexTriggerCount[3], 0);
682 QCOMPARE(m_complexTriggerCount[4], 0);
683 QCOMPARE(m_complexTriggerCount[
int(
'a')], 0);
684 QCOMPARE(m_complexTriggerCount[
int(
'b')], 1);
685 QCOMPARE(m_complexTriggerCount[
int(
'c')], 0);
686 QCOMPARE(m_complexTriggerCount[
int(
'd')], 0);
691 #if !defined(Q_OS_DARWIN)
692 void tst_QMenuBar::check_cursorKeys2()
694 if (qgetenv(
"XDG_CURRENT_DESKTOP") ==
"Unity")
695 QSKIP(
"This test is flaky on Ubuntu/Unity due to regression introduced by QTBUG-39362");
698 QSKIP(
"Wayland: This fails. Figure out why.");
701 initWindowWithComplexMenuBar(
w);
710 QTest::keyClick(
static_cast<QWidget *
>(0),
Qt::Key_Left );
711 QTest::keyClick(
static_cast<QWidget *
>(0),
Qt::Key_Down );
713 QTest::keyClick(
static_cast<QWidget *
>(0),
Qt::Key_Down );
717 QCOMPARE(m_complexTriggerCount[3], 0);
718 QCOMPARE(m_complexTriggerCount[4], 0);
719 QCOMPARE(m_complexTriggerCount[
int(
'a')], 0);
720 QCOMPARE(m_complexTriggerCount[
int(
'b')], 0);
721 QCOMPARE(m_complexTriggerCount[
int(
'c')], 0);
722 QCOMPARE(m_complexTriggerCount[
int(
'd')], 1);
730 #if !defined(Q_OS_DARWIN)
731 void tst_QMenuBar::check_cursorKeys3()
733 if (qgetenv(
"XDG_CURRENT_DESKTOP") ==
"Unity")
734 QSKIP(
"This test is flaky on Ubuntu/Unity due to regression introduced by QTBUG-39362");
737 QSKIP(
"Wayland: This fails. Figure out why.");
740 initWindowWithComplexMenuBar(
w);
749 QTest::keyClick(
static_cast<QWidget *
>(0),
Qt::Key_Left );
750 QTest::keyClick(
static_cast<QWidget *
>(0),
Qt::Key_Down );
754 QCOMPARE(m_complexTriggerCount[3], 0);
755 QCOMPARE(m_complexTriggerCount[4], 0);
756 QCOMPARE(m_complexTriggerCount[
int(
'a')], 0);
757 QCOMPARE(m_complexTriggerCount[
int(
'b')], 1);
758 QCOMPARE(m_complexTriggerCount[
int(
'c')], 0);
759 QCOMPARE(m_complexTriggerCount[
int(
'd')], 0);
763 void tst_QMenuBar::taskQTBUG56860_focus()
765 #if defined(Q_OS_DARWIN)
766 QSKIP(
"Native key events are needed to test menu action activation on macOS.");
769 QSKIP(
"Wayland: This fails. Figure out why.");
779 QPlainTextEdit *
e =
new QPlainTextEdit;
780 e->setObjectName(
"edit");
782 w.setCentralWidget(
e);
793 QTest::keyClick(
static_cast<QWidget *
>(0),
Qt::Key_Down );
803 QTest::keyClick(
static_cast<QWidget *
>(0),
Qt::Key_Down );
813 void tst_QMenuBar::check_homeKey()
817 QSKIP(
"This test has been \"temporarily\" disabled at least since 2009 :)");
822 initWindowWithComplexMenuBar(
w);
831 QTest::keyClick(
static_cast<QWidget *
>(0),
Qt::Key_Down );
832 QTest::keyClick(
static_cast<QWidget *
>(0),
Qt::Key_Down );
833 QTest::keyClick(
static_cast<QWidget *
>(0),
Qt::Key_Down );
834 QTest::keyClick(
static_cast<QWidget *
>(0),
Qt::Key_Home );
839 QCOMPARE(m_complexTriggerCount[
int(
'c')], 1);
840 QCOMPARE(m_complexTriggerCount[3], 0);
841 QCOMPARE(m_complexTriggerCount[4], 0);
842 QCOMPARE(m_complexTriggerCount[
int(
'a')], 0);
843 QCOMPARE(m_complexTriggerCount[
int(
'b')], 0);
844 QCOMPARE(m_complexTriggerCount[
int(
'd')], 0);
845 QCOMPARE(m_complexTriggerCount[
int(
'e')], 0);
846 QCOMPARE(m_complexTriggerCount[
int(
'f')], 0);
847 QCOMPARE(m_complexTriggerCount[
int(
'g')], 0);
848 QCOMPARE(m_complexTriggerCount[
int(
'h')], 0);
854 void tst_QMenuBar::check_endKey()
858 QSKIP(
"This test has been \"temporarily\" disabled at least since 2009 :)");
863 initWindowWithComplexMenuBar(
w);
872 QTest::keyClick(
static_cast<QWidget *
>(0),
Qt::Key_End );
877 QCOMPARE(m_complexTriggerCount[
int(
'h')], 1);
878 QCOMPARE(m_complexTriggerCount[3], 0);
879 QCOMPARE(m_complexTriggerCount[4], 0);
880 QCOMPARE(m_complexTriggerCount[
int(
'a')], 0);
881 QCOMPARE(m_complexTriggerCount[
int(
'b')], 0);
882 QCOMPARE(m_complexTriggerCount[
int(
'c')], 0);
883 QCOMPARE(m_complexTriggerCount[
int(
'd')], 0);
884 QCOMPARE(m_complexTriggerCount[
int(
'e')], 0);
885 QCOMPARE(m_complexTriggerCount[
int(
'f')], 0);
886 QCOMPARE(m_complexTriggerCount[
int(
'g')], 0);
896 #if !defined(Q_OS_DARWIN)
897 void tst_QMenuBar::check_escKey()
900 QSKIP(
"Wayland: This fails. Figure out why.");
927 qWarning(
"Skipping menu button test on minimal/offscreen platforms");
932 QTest::keyClick(
static_cast<QWidget *
>(0),
Qt::Key_Down );
939 QVERIFY2(m_complexTriggerCount[
int(
'c')] == 1,
"Expected item 2C to be selected");
1050 void tst_QMenuBar::allowActiveAndDisabled()
1058 QMenu fileMenu(
"&File");
1061 QAction *act = fileMenu.addAction(
"Disabled");
1065 QMenu disabledMenu(
"Disabled");
1066 disabledMenu.setEnabled(
false);
1067 QMenu activeMenu(
"Active");
1090 void tst_QMenuBar::check_altPress()
1093 QSKIP(
"Wayland: This fails. Figure out why.");
1096 QSKIP(
QString(
"this is not supposed to work in the %1 style. Skipping." ).
1097 arg(
qApp->style()->objectName()).toLatin1());
1101 initWindowWithSimpleMenuBar(
w);
1113 void tst_QMenuBar::check_altClosePress()
1116 QSKIP(
"Wayland: This fails. Figure out why.");
1120 QSKIP((
"This test is not supposed to work in the " +
style->objectName().toLatin1()
1121 +
" style. Skipping.").constData());
1126 w.menuBar()->setNativeMenuBar(
false);
1145 #if !defined(Q_OS_DARWIN)
1146 void tst_QMenuBar::check_shortcutPress()
1149 QSKIP(
"Wayland: This fails. Figure out why.");
1158 QCOMPARE(m_complexTriggerCount[3], 0);
1161 QCOMPARE(m_complexTriggerCount[3], 1);
1162 QVERIFY(!
w.menuBar()->activeAction());
1171 class LayoutDirectionSaver
1176 : m_oldDirection(
qApp->layoutDirection())
1181 ~LayoutDirectionSaver()
1183 qApp->setLayoutDirection(m_oldDirection);
1191 #if !defined(Q_OS_DARWIN)
1192 void tst_QMenuBar::check_menuPosition()
1195 QSKIP(
"Wayland: This fails. Figure out why.");
1201 QRect availRect =
w.screen()->availableGeometry();
1202 QRect screenRect =
w.screen()->geometry();
1204 while(
menu.
sizeHint().height() < (screenRect.height()*2/3)) {
1208 w.menuBar()->setNativeMenuBar(
false);
1212 qApp->setActiveWindow(&
w);
1217 w.move(availRect.topLeft());
1218 QRect mbItemRect =
w.menuBar()->actionGeometry(menu_action);
1219 mbItemRect.moveTo(
w.menuBar()->mapToGlobal(mbItemRect.topLeft()));
1222 QCOMPARE(
menu.
pos(), QPoint(mbItemRect.x(), mbItemRect.bottom() + 1));
1228 w.move(0,screenRect.bottom() - screenRect.height()/4);
1229 QRect mbItemRect =
w.menuBar()->actionGeometry(menu_action);
1230 mbItemRect.moveTo(
w.menuBar()->mapToGlobal(mbItemRect.topLeft()));
1239 w.move(0,screenRect.y() + screenRect.height()/2);
1240 QRect mbItemRect =
w.menuBar()->actionGeometry(menu_action);
1241 mbItemRect.moveTo(
w.menuBar()->mapToGlobal(mbItemRect.topLeft()));
1244 QPoint firstPoint = QPoint(mbItemRect.right()+1, screenRect.bottom() -
menu.
height() + 1);
1245 QPoint secondPoint = QPoint(mbItemRect.right()+1, availRect.bottom() -
menu.
height() + 1);
1255 QRect mbItemRect =
w.menuBar()->actionGeometry(menu_action);
1256 mbItemRect.moveTo(
w.menuBar()->mapToGlobal(mbItemRect.topLeft()));
1269 const QPoint localPos = widgetToWindowPos(mb, bottomRight);
1270 const QPoint globalPos =
w.mapToGlobal(localPos);
1279 void tst_QMenuBar::task223138_triggered()
1283 centerOnScreen(&
win);
1311 void tst_QMenuBar::task256322_highlight()
1314 QSKIP(
"Highlighting does not work correctly for minimal platform");
1317 QSKIP(
"Wayland: This fails. Figure out why.");
1320 win.menuBar()->setNativeMenuBar(
false);
1323 file->setText(
"file");
1325 QAction *file2 =
win.menuBar()->addMenu(&menu2);
1327 QAction *nothing =
win.menuBar()->addAction(
"nothing");
1329 centerOnScreen(&
win);
1334 const QPoint filePos = menuBarActionWindowPos(
win.menuBar(),
file);
1343 const QPoint file2Pos = menuBarActionWindowPos(
win.menuBar(), file2);
1349 QPoint nothingCenter = menuBarActionWindowPos(
win.menuBar(), nothing);
1356 void tst_QMenuBar::menubarSizeHint()
1363 const QWidget *
widget = 0)
const override
1370 case PM_MenuBarHMargin:
1372 case PM_MenuBarVMargin:
1374 case PM_MenuBarPanelWidth:
1396 centerOnScreen(&mb);
1419 + QSize(panelWidth + hmargin, panelWidth + vmargin);
1428 void tst_QMenuBar::taskQTBUG4965_escapeEaten()
1434 #if QT_CONFIG(shortcut)
1437 centerOnScreen(&menubar);
1457 void tst_QMenuBar::taskQTBUG11823_crashwithInvisibleActions()
1460 QSKIP(
"Wayland: This fails. Figure out why.");
1468 centerOnScreen(&menubar);
1478 a->setVisible(
false);
1488 void tst_QMenuBar::closeOnSecondClickAndOpenOnThirdClick()
1491 QSKIP(
"Wayland: This fails. Figure out why.");
1519 void tst_QMenuBar::cornerWidgets_data()
1521 QTest::addColumn<Qt::Corner>(
"corner");
1530 return result.toLocal8Bit();
1533 void tst_QMenuBar::cornerWidgets()
1535 enum { cornerWidgetWidth = 100 };
1539 #if defined(Q_OS_MACOS)
1540 QSKIP(
"Test interferes with native menu bars on this platform");
1556 QLabel *cornerLabel =
new QLabel(dataTag);
1557 cornerLabel->setFixedWidth(cornerWidgetWidth);
1568 QVERIFY2(fileMenuGeometry.left() >= cornerWidgetWidth,
1569 msgComparison(fileMenuGeometry.left(),
">=", cornerWidgetWidth));
1570 QVERIFY2(menuBarWidth - editMenuGeometry.right() < cornerWidgetWidth,
1571 msgComparison(menuBarWidth - editMenuGeometry.right(),
"<", cornerWidgetWidth));
1574 QVERIFY2(fileMenuGeometry.left() < cornerWidgetWidth,
1575 msgComparison(fileMenuGeometry.left(),
"<", cornerWidgetWidth));
1576 QVERIFY2(menuBarWidth - editMenuGeometry.right() >= cornerWidgetWidth,
1577 msgComparison(menuBarWidth - editMenuGeometry.right(),
">=", cornerWidgetWidth));
1589 void tst_QMenuBar::taskQTBUG53205_crashReparentNested()
1601 QWidget movingParent(&hiddenParent, {});
1604 QWidget containerWidget(&movingParent, {});
1608 windowedParent.
reset(
new QWidget(
nullptr, Qt::WindowFlags()));
1609 windowedParent->setGeometry(400, 10, 300, 300);
1611 windowedParent->show();
1615 QWidget containedWidget(&containerWidget, {});
1617 taskQTBUG53205MenuBar =
new QMenuBar(&containedWidget);
1623 movingParent.setParent(windowedParent.data(), {});
1625 taskQTBUG53205MenuBar->setParent(
nullptr);
1626 taskQTBUG53205MenuBar->setParent(&containedWidget);
1629 movingParent.setParent(&hiddenParent, {});
1630 windowedParent.reset();
1632 testMenus.
actions[0]->trigger();
1635 void tst_QMenuBar::QTBUG_65488_hiddenActionTriggered()
1638 win.menuBar()->setNativeMenuBar(
false);
1639 QAction *act1 =
win.menuBar()->addAction(
"A very long named action that make menuBar item wide enough");
1642 QRect actRect =
win.menuBar()->actionGeometry(act1);
1644 win.resize(actRect.width() - 10,
win.size().height());
1655 void tst_QMenuBar::platformMenu()
1659 if (!platformMenuBar)
1660 QSKIP(
"No platform menubar implementation available on this platform.");
1684 void tst_QMenuBar::addActionQt5connect()
1687 auto functor = [&flag](){ flag =
true; };
1709 void tst_QMenuBar::QTBUG_25669_menubarActionDoubleTriggered()
1712 win.menuBar()->setNativeMenuBar(
false);
1713 QAction *act1 =
win.menuBar()->addAction(
"Action1");
1714 QAction *act2 =
win.menuBar()->addAction(
"Action2");
1721 QPoint posAct1 = menuBarActionWindowPos(
win.menuBar(), act1);
1722 QPoint posAct2 = menuBarActionWindowPos(
win.menuBar(), act2);
1736 QWidget *
parent = taskQTBUG53205MenuBar->parentWidget();
1737 taskQTBUG53205MenuBar->setParent(
nullptr);
1738 taskQTBUG53205MenuBar->setParent(
parent);
1742 #if !defined(Q_OS_DARWIN)
1743 void tst_QMenuBar::taskQTBUG46812_doNotLeaveMenubarHighlighted()
1746 QSKIP(
"Wayland: This fails. Figure out why.");
1749 QWidget *centralWidget =
new QWidget;
1759 QCOMPARE(m_simpleActivatedCount, 0);
1763 QCOMPARE(m_simpleActivatedCount, 0);
1767 QCOMPARE(m_simpleActivatedCount, 2);
1771 QCOMPARE(m_simpleActivatedCount, 2);
1775 QCOMPARE(m_simpleActivatedCount, 2);
1782 void tst_QMenuBar::taskQTBUG56275_reinsertMenuInParentlessQMenuBar()
1801 void tst_QMenuBar::QTBUG_57404_existingMenuItemException()
1814 copyAction->setShortcut(QKeySequence(
"Ctrl+C"));
1825 void tst_QMenuBar::defaultEditMenuItems()
1831 const char *disambiguation =
nullptr,
int n = -1)
const override
1838 qApp->installTranslator(&testTranslator);
1844 mw.menuBar()->addMenu(
"Editieren")->
addAction(
"Undo");
1852 void tst_QMenuBar::taskQTBUG55966_subMenuRemoved()
1855 QSKIP(
"Wayland: This fails. Figure out why.");
1863 action->setMenu(subMenu);
1872 void tst_QMenuBar::QTBUG_58344_invalidIcon()
1882 #include "tst_qmenubar.moc"
small capitals from c petite p scientific i
[1]
The QAction class provides an abstraction for user commands that can be added to different user inter...
void setMenuRole(MenuRole menuRole)
void triggered(bool checked=false)
void setText(const QString &text)
void activate(ActionEvent event)
QString text
the action's descriptive text
void setData(const QVariant &var)
static QWidget * focusWidget()
static QWidgetList topLevelWidgets()
static void setEffectEnabled(Qt::UIEffect, bool enable=true)
static QWidget * activePopupWidget()
static void setActiveWindow(QWidget *act)
The QByteArray class provides an array of bytes.
The QChar class provides a 16-bit Unicode character.
QChar toUpper() const noexcept
static void sendPostedEvents(QObject *receiver=nullptr, int event_type=0)
The QDebug class provides an output stream for debugging information.
QScreen * primaryScreen
the primary (or default) screen of the application.
QString platformName
The name of the underlying platform plugin.
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal.
qsizetype size() const noexcept
const_reference at(qsizetype i) const noexcept
qsizetype count() const noexcept
The QMainWindow class provides a main application window.\inmodule QtWidgets.
Q_INVOKABLE QObject(QObject *parent=nullptr)
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
void setObjectName(const QString &name)
The QProxyStyle class is a convenience class that simplifies dynamically overriding QStyle elements.
int pixelMetric(PixelMetric metric, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const override
void reset(T *other=nullptr) noexcept(noexcept(Cleanup::cleanup(std::declval< T * >())))
The QString class provides a Unicode character string.
static QString number(int, int base=10)
The QStringList class provides a list of strings.
The QStyleFactory class creates QStyle objects.
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI.
@ SH_MenuBar_AltKeyNavigation
@ SH_Menu_AllowActiveAndDisabled
The QStyleOption class stores the parameters used by QStyle functions.
The QTranslator class provides internationalization support for text output.
virtual QString translate(const char *context, const char *sourceText, const char *disambiguation=nullptr, int n=-1) const
The QVariant class acts like a union for the most common Qt data types.
The QWindow class represents a window in the underlying windowing system.
QSignalSpy spy(myCustomObject, SIGNAL(mySignal(int, QString, double)))
[0]
Q_TESTLIB_EXPORT QTestData & newRow(const char *dataTag)
Q_TESTLIB_EXPORT const char * currentTestFunction()
Q_GUI_EXPORT bool qWaitForWindowActive(QWindow *window, int timeout=5000)
Q_GUI_EXPORT bool qWaitForWindowExposed(QWindow *window, int timeout=5000)
void mouseMove(QWindow *window, QPoint pos=QPoint(), int delay=-1)
void mouseRelease(QWindow *window, Qt::MouseButton button, Qt::KeyboardModifiers stateKey=Qt::KeyboardModifiers(), QPoint pos=QPoint(), int delay=-1)
Q_TESTLIB_EXPORT const char * currentDataTag()
void mouseClick(QWindow *window, Qt::MouseButton button, Qt::KeyboardModifiers stateKey=Qt::KeyboardModifiers(), QPoint pos=QPoint(), int delay=-1)
void mousePress(QWindow *window, Qt::MouseButton button, Qt::KeyboardModifiers stateKey=Qt::KeyboardModifiers(), QPoint pos=QPoint(), int delay=-1)
Q_CORE_EXPORT void qWait(int ms)
QTextStream & center(QTextStream &stream)
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool startsWith(QByteArrayView haystack, QByteArrayView needle) noexcept
MyMainWidget * mainWindow
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro vuzp8 reg2 vuzp d d ®2 endm macro vzip8 reg2 vzip d d ®2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld[DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld cleanup[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp skip1 beq endif SRC MASK if dst_r_bpp DST_R else add endif PF add sub src_basereg pixdeinterleave mask_basereg pixdeinterleave dst_r_basereg process_pixblock_head pixblock_size cache_preload_simple process_pixblock_tail pixinterleave dst_w_basereg irp beq endif process_pixblock_tail_head tst beq irp if pixblock_size chunk_size tst beq pixld SRC pixld MASK if DST_R else pixld DST_R endif if src_basereg pixdeinterleave mask_basereg pixdeinterleave dst_r_basereg process_pixblock_head if pixblock_size cache_preload_simple endif process_pixblock_tail pixinterleave dst_w_basereg irp if pixblock_size chunk_size tst beq if DST_W else pixst DST_W else mov ORIG_W endif add lsl if lsl endif if lsl endif lsl endif lsl endif lsl endif subs mov DST_W if regs_shortage str endif bge start_of_loop_label endm macro generate_composite_function
set set set set set set set macro pixldst1 op
QList< QString > QStringList
#define Q_DISABLE_COPY(Class)
GLint GLfloat GLfloat GLfloat v2
GLfloat GLfloat GLfloat w
[0]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLdouble GLdouble GLdouble GLdouble top
GLenum GLenum GLsizei count
#define QStringLiteral(str)
#define QTEST_MAIN(TestObject)
#define QSKIP(statement,...)
#define QFETCH(Type, name)
#define QEXPECT_FAIL(dataIndex, comment, mode)
#define QTRY_COMPARE(expr, expected)
#define QVERIFY(statement)
#define QTRY_VERIFY(expr)
#define QVERIFY2(statement, description)
connect(quitButton, &QPushButton::clicked, &app, &QCoreApplication::quit, Qt::QueuedConnection)
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
QT_FORWARD_DECLARE_CLASS(QOpenGLShaderProgram)
void compare(Input input, FnUnderTest fn_under_test, const QByteArray &output)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent