tst_qstyle: Don't fail on empty scroller subcontrols on macOS
macOS hasn't had SC_ScrollBarAddLine and SC_ScrollBarAddLine since 10.7, when transient scrollbars first appeared. We also make the warning message a bit more informative. Change-Id: Idef4684162456d9bc274eea77908a6afe24fa0f5 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>bb10
parent
2673d05dc9
commit
ac8955794f
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue