aboutsummaryrefslogtreecommitdiffstats
path: root/tests/benchmarks
diff options
context:
space:
mode:
Diffstat (limited to 'tests/benchmarks')
-rw-r--r--tests/benchmarks/creationtime/creationtime.pro2
-rw-r--r--tests/benchmarks/creationtime/tst_creationtime.cpp22
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)