From 932d5f78296e604c57c8ebcfe5c94f5ce62238f4 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 3 May 2017 21:09:46 +0200 Subject: tst_snippets: skip style-specific screenshots when appropriate For example, don't take screenshots of qtquickcontrols2-material-*.qml snippets when running with another style than the Material style. Change-Id: Ifef5b841d16314ba5d131a7d56f57251d6780ae7 Reviewed-by: Mitch Curtis --- tests/auto/snippets/snippets.pro | 2 +- tests/auto/snippets/tst_snippets.cpp | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/auto/snippets/snippets.pro b/tests/auto/snippets/snippets.pro index 82191220..6f366f23 100644 --- a/tests/auto/snippets/snippets.pro +++ b/tests/auto/snippets/snippets.pro @@ -1,7 +1,7 @@ TEMPLATE = app TARGET = tst_snippets -QT += quick testlib +QT += quick quickcontrols2 testlib CONFIG += testcase macos:CONFIG -= app_bundle diff --git a/tests/auto/snippets/tst_snippets.cpp b/tests/auto/snippets/tst_snippets.cpp index 97b10fe1..1185bde9 100644 --- a/tests/auto/snippets/tst_snippets.cpp +++ b/tests/auto/snippets/tst_snippets.cpp @@ -36,6 +36,7 @@ #include #include +#include typedef QPair QStringPair; @@ -111,6 +112,14 @@ void tst_Snippets::verify() QVERIFY(warnings.isEmpty()); if (takeScreenshots) { + const QString currentDataTag = QLatin1String(QTest::currentDataTag()); + static const QString currentStyle = QQuickStyle::name(); + static const QStringList availableStyles = QQuickStyle::availableStyles(); + for (const QString &availableStyle : availableStyles) { + if (currentStyle != availableStyle && currentDataTag.startsWith("qtquickcontrols2-" + availableStyle.toLower() + "-")) + QSKIP(qPrintable(QString("Not running with the %1 style").arg(availableStyle))); + } + QQuickWindow *window = qobject_cast(root); if (!window) { QQuickView *view = new QQuickView; -- cgit v1.2.3