diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2017-05-03 21:09:46 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2017-05-04 07:34:08 +0000 |
commit | 932d5f78296e604c57c8ebcfe5c94f5ce62238f4 (patch) | |
tree | e5e17dd04bfbecff0a4f61b7f7b190b079912fc5 | |
parent | 0efd4f15979cc6186cae3f29613245aa457bc170 (diff) |
tst_snippets: skip style-specific screenshots when appropriatev5.9.0-beta4
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 <mitch.curtis@qt.io>
-rw-r--r-- | tests/auto/snippets/snippets.pro | 2 | ||||
-rw-r--r-- | tests/auto/snippets/tst_snippets.cpp | 9 |
2 files changed, 10 insertions, 1 deletions
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 <QtTest> #include <QtQuick> +#include <QtQuickControls2> typedef QPair<QString, QString> 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<QQuickWindow *>(root); if (!window) { QQuickView *view = new QQuickView; |