From 6cbd098190ce4fc624f8f6427d9caa460109f324 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 4 Jan 2016 18:15:33 +0100 Subject: Support static builds Change-Id: I17bb9131603da912597777b2ec0b9be3894ed858 Reviewed-by: Mitch Curtis --- tests/benchmarks/creationtime/data/dependencies.qml | 7 +++++++ tests/benchmarks/creationtime/tst_creationtime.cpp | 16 ++++++++++------ tests/benchmarks/objectcount/data/dependencies.qml | 7 +++++++ tests/benchmarks/objectcount/tst_objectcount.cpp | 18 +++++++++++------- 4 files changed, 35 insertions(+), 13 deletions(-) create mode 100644 tests/benchmarks/creationtime/data/dependencies.qml create mode 100644 tests/benchmarks/objectcount/data/dependencies.qml (limited to 'tests/benchmarks') diff --git a/tests/benchmarks/creationtime/data/dependencies.qml b/tests/benchmarks/creationtime/data/dependencies.qml new file mode 100644 index 00000000..65fb0414 --- /dev/null +++ b/tests/benchmarks/creationtime/data/dependencies.qml @@ -0,0 +1,7 @@ +import QtQuick 2.6 +import Qt.labs.controls 1.0 +import Qt.labs.controls.material 1.0 +import Qt.labs.controls.universal 1.0 +import Qt.labs.calendar 1.0 + +Control { } diff --git a/tests/benchmarks/creationtime/tst_creationtime.cpp b/tests/benchmarks/creationtime/tst_creationtime.cpp index 2a61b0ea..927dd17d 100644 --- a/tests/benchmarks/creationtime/tst_creationtime.cpp +++ b/tests/benchmarks/creationtime/tst_creationtime.cpp @@ -78,15 +78,19 @@ 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 "/" + targetPath).entryInfoList(QStringList("*.qml"), QDir::Files); foreach (const QFileInfo &entry, entries) { QString name = entry.baseName(); if (!skiplist.contains(name)) { foreach (const QString &importPath, engine->importPathList()) { - QString filePath = QDir(importPath + "/Qt/labs/" + targetPath).absoluteFilePath(entry.fileName()); + QString name = entry.dir().dirName() + "/" + entry.fileName(); + QString filePath = importPath + "/Qt/labs/" + targetPath + "/" + entry.fileName(); if (QFile::exists(filePath)) { QTest::newRow(qPrintable(name)) << QUrl::fromLocalFile(filePath); break; + } else if (QFile::exists(QQmlFile::urlToLocalFileOrQrc(filePath))) { + QTest::newRow(qPrintable(name)) << QUrl(filePath); + break; } } } @@ -117,7 +121,7 @@ void tst_CreationTime::controls() void tst_CreationTime::controls_data() { QTest::addColumn("url"); - addTestRows(&engine, "/controls"); + addTestRows(&engine, "controls"); } void tst_CreationTime::material() @@ -129,7 +133,7 @@ void tst_CreationTime::material() void tst_CreationTime::material_data() { QTest::addColumn("url"); - addTestRows(&engine, "/controls/material", QStringList() << "Ripple" << "SliderHandle"); + addTestRows(&engine, "controls/material", QStringList() << "Ripple" << "SliderHandle"); } void tst_CreationTime::universal() @@ -141,7 +145,7 @@ void tst_CreationTime::universal() void tst_CreationTime::universal_data() { QTest::addColumn("url"); - addTestRows(&engine, "/controls/universal"); + addTestRows(&engine, "controls/universal"); } void tst_CreationTime::calendar() @@ -153,7 +157,7 @@ void tst_CreationTime::calendar() void tst_CreationTime::calendar_data() { QTest::addColumn("url"); - addTestRows(&engine, "/calendar"); + addTestRows(&engine, "calendar"); } QTEST_MAIN(tst_CreationTime) diff --git a/tests/benchmarks/objectcount/data/dependencies.qml b/tests/benchmarks/objectcount/data/dependencies.qml new file mode 100644 index 00000000..65fb0414 --- /dev/null +++ b/tests/benchmarks/objectcount/data/dependencies.qml @@ -0,0 +1,7 @@ +import QtQuick 2.6 +import Qt.labs.controls 1.0 +import Qt.labs.controls.material 1.0 +import Qt.labs.controls.universal 1.0 +import Qt.labs.calendar 1.0 + +Control { } diff --git a/tests/benchmarks/objectcount/tst_objectcount.cpp b/tests/benchmarks/objectcount/tst_objectcount.cpp index b479b0e2..51a968d0 100644 --- a/tests/benchmarks/objectcount/tst_objectcount.cpp +++ b/tests/benchmarks/objectcount/tst_objectcount.cpp @@ -84,7 +84,7 @@ void tst_ObjectCount::init() // warmup QQmlComponent component(&engine); - component.setData("import QtQuick 2.0; import QtQuick.Controls 1.3 as C1; import Qt.labs.controls 1.0 as C2; Row { C1.Button {} C2.Button {} }", QUrl()); + component.setData("import QtQuick 2.0; import Qt.labs.controls 1.0; Item { Button {} }", QUrl()); delete component.create(); } @@ -118,15 +118,19 @@ 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 "/" + targetPath).entryInfoList(QStringList("*.qml"), QDir::Files); foreach (const QFileInfo &entry, entries) { QString name = entry.baseName(); if (!skiplist.contains(name)) { foreach (const QString &importPath, engine->importPathList()) { - QString filePath = QDir(importPath + "/Qt/labs/" + targetPath).absoluteFilePath(entry.fileName()); + QString name = entry.dir().dirName() + "/" + entry.fileName(); + QString filePath = importPath + "/Qt/labs/" + targetPath + "/" + entry.fileName(); if (QFile::exists(filePath)) { QTest::newRow(qPrintable(name)) << QUrl::fromLocalFile(filePath); break; + } else if (QFile::exists(QQmlFile::urlToLocalFileOrQrc(filePath))) { + QTest::newRow(qPrintable(name)) << QUrl(filePath); + break; } } } @@ -161,7 +165,7 @@ void tst_ObjectCount::calendar() void tst_ObjectCount::calendar_data() { QTest::addColumn("url"); - addTestRows(&engine, "/calendar"); + addTestRows(&engine, "calendar"); } void tst_ObjectCount::controls() @@ -173,7 +177,7 @@ void tst_ObjectCount::controls() void tst_ObjectCount::controls_data() { QTest::addColumn("url"); - addTestRows(&engine, "/controls"); + addTestRows(&engine, "controls"); } void tst_ObjectCount::material() @@ -185,7 +189,7 @@ void tst_ObjectCount::material() void tst_ObjectCount::material_data() { QTest::addColumn("url"); - addTestRows(&engine, "/controls/material", QStringList() << "Ripple" << "SliderHandle"); + addTestRows(&engine, "controls/material", QStringList() << "Ripple" << "SliderHandle"); } void tst_ObjectCount::universal() @@ -197,7 +201,7 @@ void tst_ObjectCount::universal() void tst_ObjectCount::universal_data() { QTest::addColumn("url"); - addTestRows(&engine, "/controls/universal"); + addTestRows(&engine, "controls/universal"); } QTEST_MAIN(tst_ObjectCount) -- cgit v1.2.3