diff options
author | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-10-10 20:57:48 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-10-10 20:12:40 +0000 |
commit | 66126d9e558dc70d49257021f29fbfb4a01d25e9 (patch) | |
tree | f3cfee9ed2213e3219732dfe5af66212f280817c /tests/auto/sanity/tst_sanity.cpp | |
parent | ad471146a715299bd3acab69f0cacb8a58d72d84 (diff) |
tst_sanity/tst_creationtime: use the source tree
Pick the interesting .qml files straight from the project source tree,
instead of matching files from the engine's import path list, which
might contain undesired stray files eg. while working on multiple
features and switching between branches. The tests would fail if it
found a file that cannot be instantiated.
Change-Id: Ice1e1be3568162a45fafdea3a725e3e3eb27e10d
Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
Diffstat (limited to 'tests/auto/sanity/tst_sanity.cpp')
-rw-r--r-- | tests/auto/sanity/tst_sanity.cpp | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/tests/auto/sanity/tst_sanity.cpp b/tests/auto/sanity/tst_sanity.cpp index bf6a3d11..ac5bcfba 100644 --- a/tests/auto/sanity/tst_sanity.cpp +++ b/tests/auto/sanity/tst_sanity.cpp @@ -135,20 +135,14 @@ private: QStringList m_errors; }; -static QMap<QString, QString> listQmlFiles(const QDir &dir) -{ - QMap<QString, QString> files; - foreach (const QFileInfo &entry, dir.entryInfoList(QStringList() << "*.qml" << "*.js", QDir::Files)) - files.insert(entry.baseName(), entry.absoluteFilePath()); - return files; -} - void tst_Sanity::initTestCase() { - QQmlEngine engine; - foreach (const QString &path, engine.importPathList()) { - files.unite(listQmlFiles(QDir(path + "/Qt/labs/calendar"))); - files.unite(listQmlFiles(QDir(path + "/Qt/labs/controls"))); + QDirIterator it(QQC2_IMPORT_PATH, QStringList() << "*.qml" << "*.js", QDir::Files, QDirIterator::Subdirectories); + while (it.hasNext()) { + it.next(); + QFileInfo info = it.fileInfo(); + if (info.dir().dirName() != QStringLiteral("snippets") && info.dir().dirName() != QStringLiteral("designer")) + files.insert(info.baseName(), info.filePath()); } } |