From 7703e6a9fc397b86b2520a14fc104569ed24e07f Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 20 Apr 2016 10:13:21 +0200 Subject: Tests: prepare for the upcoming import rename Looks like a duplicate string right now, but after the import rename, the target path (eg. QT_INSTALL_QML/QtQuick/Controls.2/Material) and the source path (eg. src/imports/controls/material) no longer have a common structure, so pass both paths to addTestRows(). Change-Id: I39228ed5f23434289a5bea95977bbd0e7a378641 Reviewed-by: Mitch Curtis --- tests/benchmarks/creationtime/tst_creationtime.cpp | 12 ++++++------ tests/benchmarks/objectcount/tst_objectcount.cpp | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'tests/benchmarks') diff --git a/tests/benchmarks/creationtime/tst_creationtime.cpp b/tests/benchmarks/creationtime/tst_creationtime.cpp index f6ad0a26..ec82df35 100644 --- a/tests/benchmarks/creationtime/tst_creationtime.cpp +++ b/tests/benchmarks/creationtime/tst_creationtime.cpp @@ -65,7 +65,7 @@ void tst_CreationTime::init() engine.clearComponentCache(); } -static void addTestRows(QQmlEngine *engine, const QString &targetPath, const QStringList &skiplist = QStringList()) +static void addTestRows(QQmlEngine *engine, const QString &sourcePath, const QString &targetPath, const QStringList &skiplist = QStringList()) { // We cannot use QQmlComponent to load QML files directly from the source tree. // For styles that use internal QML types (eg. material/Ripple.qml), the source @@ -78,7 +78,7 @@ static void addTestRows(QQmlEngine *engine, const QString &targetPath, const QSt // the engine's import path. This way we can use QQmlComponent to load each QML file // for benchmarking. - QFileInfoList entries = QDir(QQC2_IMPORT_PATH "/" + targetPath).entryInfoList(QStringList("*.qml"), QDir::Files); + QFileInfoList entries = QDir(QQC2_IMPORT_PATH "/" + sourcePath).entryInfoList(QStringList("*.qml"), QDir::Files); foreach (const QFileInfo &entry, entries) { QString name = entry.baseName(); if (!skiplist.contains(name)) { @@ -121,7 +121,7 @@ void tst_CreationTime::controls() void tst_CreationTime::controls_data() { QTest::addColumn("url"); - addTestRows(&engine, "controls", QStringList() << "CheckIndicator" << "RadioIndicator" << "SwitchIndicator"); + addTestRows(&engine, "controls", "controls", QStringList() << "CheckIndicator" << "RadioIndicator" << "SwitchIndicator"); } void tst_CreationTime::material() @@ -133,7 +133,7 @@ void tst_CreationTime::material() void tst_CreationTime::material_data() { QTest::addColumn("url"); - addTestRows(&engine, "controls/material", QStringList() << "Ripple" << "SliderHandle" << "CheckIndicator" << "RadioIndicator" << "SwitchIndicator"); + addTestRows(&engine, "controls/material", "controls/material", QStringList() << "Ripple" << "SliderHandle" << "CheckIndicator" << "RadioIndicator" << "SwitchIndicator"); } void tst_CreationTime::universal() @@ -145,7 +145,7 @@ void tst_CreationTime::universal() void tst_CreationTime::universal_data() { QTest::addColumn("url"); - addTestRows(&engine, "controls/universal", QStringList() << "CheckIndicator" << "RadioIndicator" << "SwitchIndicator"); + addTestRows(&engine, "controls/universal", "controls/universal", QStringList() << "CheckIndicator" << "RadioIndicator" << "SwitchIndicator"); } void tst_CreationTime::calendar() @@ -157,7 +157,7 @@ void tst_CreationTime::calendar() void tst_CreationTime::calendar_data() { QTest::addColumn("url"); - addTestRows(&engine, "calendar"); + addTestRows(&engine, "calendar", "calendar"); } QTEST_MAIN(tst_CreationTime) diff --git a/tests/benchmarks/objectcount/tst_objectcount.cpp b/tests/benchmarks/objectcount/tst_objectcount.cpp index a14ea792..c0b5440b 100644 --- a/tests/benchmarks/objectcount/tst_objectcount.cpp +++ b/tests/benchmarks/objectcount/tst_objectcount.cpp @@ -105,7 +105,7 @@ static void printItems(const QList &items) } } -static void addTestRows(QQmlEngine *engine, const QString &targetPath, const QStringList &skiplist = QStringList()) +static void addTestRows(QQmlEngine *engine, const QString &sourcePath, const QString &targetPath, const QStringList &skiplist = QStringList()) { // We cannot use QQmlComponent to load QML files directly from the source tree. // For styles that use internal QML types (eg. material/Ripple.qml), the source @@ -118,7 +118,7 @@ static void addTestRows(QQmlEngine *engine, const QString &targetPath, const QSt // the engine's import path. This way we can use QQmlComponent to load each QML file // for benchmarking. - QFileInfoList entries = QDir(QQC2_IMPORT_PATH "/" + targetPath).entryInfoList(QStringList("*.qml"), QDir::Files); + QFileInfoList entries = QDir(QQC2_IMPORT_PATH "/" + sourcePath).entryInfoList(QStringList("*.qml"), QDir::Files); foreach (const QFileInfo &entry, entries) { QString name = entry.baseName(); if (!skiplist.contains(name)) { @@ -165,7 +165,7 @@ void tst_ObjectCount::calendar() void tst_ObjectCount::calendar_data() { QTest::addColumn("url"); - addTestRows(&engine, "calendar"); + addTestRows(&engine, "calendar", "calendar"); } void tst_ObjectCount::controls() @@ -177,7 +177,7 @@ void tst_ObjectCount::controls() void tst_ObjectCount::controls_data() { QTest::addColumn("url"); - addTestRows(&engine, "controls", QStringList() << "CheckIndicator" << "RadioIndicator" << "SwitchIndicator"); + addTestRows(&engine, "controls", "controls", QStringList() << "CheckIndicator" << "RadioIndicator" << "SwitchIndicator"); } void tst_ObjectCount::material() @@ -189,7 +189,7 @@ void tst_ObjectCount::material() void tst_ObjectCount::material_data() { QTest::addColumn("url"); - addTestRows(&engine, "controls/material", QStringList() << "Ripple" << "SliderHandle" << "CheckIndicator" << "RadioIndicator" << "SwitchIndicator"); + addTestRows(&engine, "controls/material", "controls/material", QStringList() << "Ripple" << "SliderHandle" << "CheckIndicator" << "RadioIndicator" << "SwitchIndicator"); } void tst_ObjectCount::universal() @@ -201,7 +201,7 @@ void tst_ObjectCount::universal() void tst_ObjectCount::universal_data() { QTest::addColumn("url"); - addTestRows(&engine, "controls/universal", QStringList() << "CheckIndicator" << "RadioIndicator" << "SwitchIndicator"); + addTestRows(&engine, "controls/universal", "controls/universal", QStringList() << "CheckIndicator" << "RadioIndicator" << "SwitchIndicator"); } QTEST_MAIN(tst_ObjectCount) -- cgit v1.2.3