summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/widgets/qmenu
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2019-07-31 08:28:28 +0300
committerMarc Mutz <marc.mutz@kdab.com>2019-08-01 12:55:07 +0000
commit4726f47b41e507a967c8995609e11947dde4c250 (patch)
treecb975c2e5c2309306c6522f18bd5beb5176c39ad /tests/auto/widgets/widgets/qmenu
parentf23f9ba041a790566ca1553d4dc138af3c49db80 (diff)
Port users of get{Contents,Text}Margins() missed first time around
Done-with: Sona Kurazyan <sona.kurazyan@qt.io> Change-Id: I5b584cbe468429c53c2d661a0d7957d74e7ad691 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests/auto/widgets/widgets/qmenu')
-rw-r--r--tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
index 4f5a2ce1a6..9c40c0bd57 100644
--- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
+++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
@@ -951,8 +951,7 @@ void tst_QMenu::menuSizeHint()
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);
@@ -962,15 +961,15 @@ void tst_QMenu::menuSizeHint()
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);
@@ -1571,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
@@ -1585,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);
}