diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-08-15 13:09:55 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-08-15 16:53:19 +0200 |
commit | c7ec7cd2a1ae9bec31113fae1f1e549b2bf98e0b (patch) | |
tree | fc81fba4e7815ea061da277cf3bcf3102866932f /tests/auto/widgets/widgets/qmenu | |
parent | 7947032e2d1d68b2c0f79874db7adcf560851f29 (diff) | |
parent | 6132260da394a9627947f0fe6a279c20863b6ad2 (diff) |
Merge branch 'wip/qt6' into wip/cmake
Change-Id: I50ac36b8803c296998149e98cc61e38687cdd14b
Diffstat (limited to 'tests/auto/widgets/widgets/qmenu')
-rw-r--r-- | tests/auto/widgets/widgets/qmenu/BLACKLIST | 12 | ||||
-rw-r--r-- | tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp | 21 |
2 files changed, 15 insertions, 18 deletions
diff --git a/tests/auto/widgets/widgets/qmenu/BLACKLIST b/tests/auto/widgets/widgets/qmenu/BLACKLIST index bac14ea225..ad6d2f340c 100644 --- a/tests/auto/widgets/widgets/qmenu/BLACKLIST +++ b/tests/auto/widgets/widgets/qmenu/BLACKLIST @@ -1,13 +1,13 @@ [task258920_mouseBorder] -osx -[submenuTearOffDontClose] -osx-10.12 ci +osx-10.14 +osx-10.13 [layoutDirection] +osx-10.12 +osx-10.13 # Fails when enabling synchronous expose events QTBUG-62092 -osx ci [pushButtonPopulateOnAboutToShow] -osx +osx-10.13 [tearOff] -osx +osx-10.14 [activeSubMenuPosition] winrt diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp index 3bfbe754ef..9c40c0bd57 100644 --- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp +++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp @@ -610,7 +610,7 @@ void tst_QMenu::widgetActionFocus() static QMenu *getTornOffMenu() { - foreach (QWidget *w, QApplication::allWidgets()) { + for (QWidget *w : QApplication::allWidgets()) { if (w->isVisible() && w->inherits("QTornOffMenu")) return static_cast<QMenu *>(w); } @@ -948,30 +948,28 @@ void tst_QMenu::menuSizeHint() { QMenu menu; //this is a list of arbitrary strings so that we check the geometry - QStringList list = QStringList() << "trer" << "ezrfgtgvqd" << "sdgzgzerzerzer" << "eerzertz" << "er"; - foreach (QString str, list) + for (auto str : {"trer", "ezrfgtgvqd", "sdgzgzerzerzer", "eerzertz", "er"}) menu.addAction(str); - int left, top, right, bottom; - menu.getContentsMargins(&left, &top, &right, &bottom); + const QMargins cm = menu.contentsMargins(); const int panelWidth = menu.style()->pixelMetric(QStyle::PM_MenuPanelWidth, 0, &menu); const int hmargin = menu.style()->pixelMetric(QStyle::PM_MenuHMargin, 0, &menu), vmargin = menu.style()->pixelMetric(QStyle::PM_MenuVMargin, 0, &menu); int maxWidth =0; QRect result; - foreach (QAction *action, menu.actions()) { + for (QAction *action : menu.actions()) { maxWidth = qMax(maxWidth, menu.actionGeometry(action).width()); result |= menu.actionGeometry(action); - QCOMPARE(result.x(), left + hmargin + panelWidth); - QCOMPARE(result.y(), top + vmargin + panelWidth); + QCOMPARE(result.x(), cm.left() + hmargin + panelWidth); + QCOMPARE(result.y(), cm.top() + vmargin + panelWidth); } QStyleOption opt(0); opt.rect = menu.rect(); opt.state = QStyle::State_None; - QSize resSize = QSize(result.x(), result.y()) + result.size() + QSize(hmargin + right + panelWidth, vmargin + top + panelWidth); + QSize resSize = QSize(result.x(), result.y()) + result.size() + QSize(hmargin + cm.right() + panelWidth, vmargin + cm.top() + panelWidth); resSize = menu.style()->sizeFromContents(QStyle::CT_Menu, &opt, resSize.expandedTo(QApplication::globalStrut()), &menu); @@ -1572,8 +1570,7 @@ void tst_QMenu::menuSize_Scrolling() int hmargin = style()->pixelMetric(QStyle::PM_MenuHMargin, nullptr, this); int fw = style()->pixelMetric(QStyle::PM_MenuPanelWidth, nullptr, this); - int leftMargin, topMargin, rightMargin, bottomMargin; - getContentsMargins(&leftMargin, &topMargin, &rightMargin, &bottomMargin); + const QMargins cm = contentsMargins(); QRect lastItem = actionGeometry(actions().at(actions().length() - 1)); QSize s = size(); #ifdef Q_OS_WINRT @@ -1586,7 +1583,7 @@ void tst_QMenu::menuSize_Scrolling() return; } - QCOMPARE( s.width(), lastItem.right() + fw + hmargin + rightMargin + 1); + QCOMPARE( s.width(), lastItem.right() + fw + hmargin + cm.right() + 1); QMenu::showEvent(e); } |