summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets')
-rw-r--r--tests/auto/widgets/styles/qstyle/tst_qstyle.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
index 8422fe2439..3607f1ba92 100644
--- a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
+++ b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
@@ -289,16 +289,22 @@ bool tst_QStyle::testAllFunctions(QStyle *style)
bool tst_QStyle::testScrollBarSubControls()
{
+ const auto *style = testWidget->style();
+ const bool isMacStyle = style->objectName().toLower() == "macintosh";
QScrollBar scrollBar;
setFrameless(&scrollBar);
scrollBar.show();
const QStyleOptionSlider opt = qt_qscrollbarStyleOption(&scrollBar);
- foreach (int subControl, QList<int>() << 1 << 2 << 4 << 8) {
- QRect sr = testWidget->style()->subControlRect(QStyle::CC_ScrollBar, &opt,
- QStyle::SubControl(subControl), &scrollBar);
+ foreach (int sc, QList<int>() << 1 << 2 << 4 << 8) {
+ const auto subControl = static_cast<QStyle::SubControl>(sc);
+ const QRect sr = style->subControlRect(QStyle::CC_ScrollBar, &opt, subControl, &scrollBar);
if (sr.isNull()) {
- qWarning("Null rect for subcontrol %d", subControl);
- return false;
+ // macOS scrollbars no longer have these, so there's no reason to fail
+ if (!(isMacStyle && (subControl == QStyle::SC_ScrollBarAddLine ||
+ subControl == QStyle::SC_ScrollBarSubLine))) {
+ qWarning() << "Unexpected null rect for subcontrol" << subControl;
+ return false;
+ }
}
}
return true;