diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2018-01-11 14:45:26 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2018-01-11 14:53:48 +0000 |
commit | 74e4d18616130fa74208587ee0b12cd778172c9d (patch) | |
tree | 30154b62020bb9435d2219053fc7af821b30b6fe /tests | |
parent | c736c5c27ca1ade83427f7379daef2c46a6df689 (diff) |
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 <mitch.curtis@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/sanity/BLACKLIST | 6 | ||||
-rw-r--r-- | 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 <QtQml/private/qqmljsparser_p.h> #include <QtQml/private/qqmljsast_p.h> #include <QtQml/private/qqmljsastvisitor_p.h> +#include <QtQml/private/qqmlmetatype_p.h> 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()); } } |