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/benchmarks/creationtime | |
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/benchmarks/creationtime')
-rw-r--r-- | tests/benchmarks/creationtime/creationtime.pro | 2 | ||||
-rw-r--r-- | tests/benchmarks/creationtime/tst_creationtime.cpp | 22 |
2 files changed, 8 insertions, 16 deletions
diff --git a/tests/benchmarks/creationtime/creationtime.pro b/tests/benchmarks/creationtime/creationtime.pro index 050e29aa..4383a759 100644 --- a/tests/benchmarks/creationtime/creationtime.pro +++ b/tests/benchmarks/creationtime/creationtime.pro @@ -5,5 +5,7 @@ QT += qml testlib CONFIG += testcase osx:CONFIG -= app_bundle +DEFINES += QQC2_IMPORT_PATH=\\\"$$absolute_path(../../../src/imports)\\\" + SOURCES += \ tst_creationtime.cpp diff --git a/tests/benchmarks/creationtime/tst_creationtime.cpp b/tests/benchmarks/creationtime/tst_creationtime.cpp index 32ba17ff..20fcfbbe 100644 --- a/tests/benchmarks/creationtime/tst_creationtime.cpp +++ b/tests/benchmarks/creationtime/tst_creationtime.cpp @@ -59,27 +59,17 @@ void tst_CreationTime::init() engine.clearComponentCache(); } -static QStringList listControls(const QDir &dir) +static QStringList listControls(const QString &path) { QStringList controls; - foreach (const QFileInfo &entry, dir.entryInfoList(QStringList("*.qml"), QDir::Files)) + foreach (const QFileInfo &entry, QDir(path).entryInfoList(QStringList("*.qml"), QDir::Files)) controls += entry.baseName(); return controls; } -static void addTestRows(const QStringList &importPaths, const QString &importPath) +static void addTestRows(const QString &path) { - QStringList controls; - foreach (const QString &path, importPaths) { - QDir dir(path); - if (dir.cd(importPath)) { - foreach (const QString &control, listControls(dir)) { - if (!controls.contains(control)) - controls += control; - } - } - } - + QStringList controls = listControls(path); foreach (const QString &control, controls) QTest::newRow(qPrintable(control)) << control.toUtf8(); } @@ -108,7 +98,7 @@ void tst_CreationTime::controls() void tst_CreationTime::controls_data() { QTest::addColumn<QByteArray>("control"); - addTestRows(engine.importPathList(), "Qt/labs/controls"); + addTestRows(QQC2_IMPORT_PATH "/controls"); } void tst_CreationTime::calendar() @@ -122,7 +112,7 @@ void tst_CreationTime::calendar() void tst_CreationTime::calendar_data() { QTest::addColumn<QByteArray>("control"); - addTestRows(engine.importPathList(), "Qt/labs/calendar"); + addTestRows(QQC2_IMPORT_PATH "/calendar"); } QTEST_MAIN(tst_CreationTime) |