summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets/styles/qstyle/tst_qstyle.cpp')
-rw-r--r--tests/auto/widgets/styles/qstyle/tst_qstyle.cpp40
1 files changed, 11 insertions, 29 deletions
diff --git a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
index fcb05f6b74..d5ef2fe94b 100644
--- a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
+++ b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
@@ -88,9 +88,6 @@ private slots:
void testFusionStyle();
#endif
void testWindowsStyle();
-#if defined(Q_OS_WIN) && !defined(QT_NO_STYLE_WINDOWSXP)
- void testWindowsXPStyle();
-#endif
#if defined(Q_OS_WIN) && !defined(QT_NO_STYLE_WINDOWSVISTA)
void testWindowsVistaStyle();
#endif
@@ -148,14 +145,6 @@ void tst_QStyle::testStyleFactory()
#ifndef QT_NO_STYLE_WINDOWS
QVERIFY(keys.contains("Windows"));
#endif
-#ifdef Q_OS_WIN
- if (QSysInfo::WindowsVersion >= QSysInfo::WV_XP &&
- (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))
- QVERIFY(keys.contains("WindowsXP"));
- if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA &&
- (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))
- QVERIFY(keys.contains("WindowsVista"));
-#endif
foreach (QString styleName , keys) {
QStyle *style = QStyleFactory::create(styleName);
@@ -301,16 +290,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;
@@ -341,17 +336,6 @@ void tst_QStyle::testWindowsStyle()
delete wstyle;
}
-#if defined(Q_OS_WIN) && !defined(QT_NO_STYLE_WINDOWSXP)
-// WindowsXP style
-void tst_QStyle::testWindowsXPStyle()
-{
- QStyle *xpstyle = QStyleFactory::create("WindowsXP");
- QVERIFY(testAllFunctions(xpstyle));
- lineUpLayoutTest(xpstyle);
- delete xpstyle;
-}
-#endif
-
void writeImage(const QString &fileName, QImage image)
{
QImageWriter imageWriter(fileName);
@@ -374,8 +358,6 @@ void tst_QStyle::testWindowsVistaStyle()
if (QSysInfo::WindowsVersion == QSysInfo::WV_VISTA)
testPainting(vistastyle, "vista");
- else if (QSysInfo::WindowsVersion == QSysInfo::WV_XP)
- testPainting(vistastyle, "xp");
delete vistastyle;
}
#endif