From 74e4d18616130fa74208587ee0b12cd778172c9d Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 11 Jan 2018 14:45:26 +0100 Subject: tst_sanity: exclude internal helper types Test file names against registered QML types to avoid including any internal helper types like CursorDelegate.qml and RectangularGlow.qml. Change-Id: Ia3079ea215eea59f7e405a50c3170fb4530f4239 Reviewed-by: Mitch Curtis --- tests/auto/sanity/BLACKLIST | 6 ------ tests/auto/sanity/tst_sanity.cpp | 10 ++++++++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/auto/sanity/BLACKLIST b/tests/auto/sanity/BLACKLIST index 965790e7..b2b1a905 100644 --- a/tests/auto/sanity/BLACKLIST +++ b/tests/auto/sanity/BLACKLIST @@ -1,5 +1,3 @@ -[signalHandlers:material/CursorDelegate.qml] -* [attachedObjects:material/ComboBox.qml] * [attachedObjects:material/Switch.qml] @@ -8,7 +6,3 @@ * [attachedObjects:universal/ComboBox.qml] * -[functions:material/RectangularGlow.qml] -* -[anchors:material/RectangularGlow.qml] -* diff --git a/tests/auto/sanity/tst_sanity.cpp b/tests/auto/sanity/tst_sanity.cpp index 2988c96c..ae442b4a 100644 --- a/tests/auto/sanity/tst_sanity.cpp +++ b/tests/auto/sanity/tst_sanity.cpp @@ -42,6 +42,7 @@ #include #include #include +#include Q_GLOBAL_STATIC(QObjectList, qt_qobjects) @@ -138,12 +139,17 @@ private: void tst_Sanity::initTestCase() { + QQmlEngine engine; + QQmlComponent component(&engine); + component.setData(QString("import QtQuick.Templates 2.%1; Control { }").arg(QT_VERSION_MINOR - 7).toUtf8(), QUrl()); + + const QStringList qmlTypeNames = QQmlMetaType::qmlTypeNames(); + QDirIterator it(QQC2_IMPORT_PATH, QStringList() << "*.qml" << "*.js", QDir::Files, QDirIterator::Subdirectories); - const QStringList excludeDirs = QStringList() << QStringLiteral("snippets") << QStringLiteral("designer"); while (it.hasNext()) { it.next(); QFileInfo info = it.fileInfo(); - if (!excludeDirs.contains(info.dir().dirName())) + if (qmlTypeNames.contains(QStringLiteral("QtQuick.Templates/") + info.baseName())) files.insert(info.dir().dirName() + "/" + info.fileName(), info.filePath()); } } -- cgit v1.2.3