diff options
author | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-11-04 12:11:53 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-11-04 13:06:48 +0000 |
commit | 081d6a9dd5d39df7a0d16727b2547285e95b7e80 (patch) | |
tree | 15a0945fc2f00d57a982c7a6a99c1de153ca907b /tests/benchmarks | |
parent | cc12d8c34c472e6395fed567f9e3910ad49301d3 (diff) |
tst_creationtime: use components
This makes it easier to add different styles to the test.
Change-Id: I6be66d09d58317d454fbf219cdbbb43c6000d3cd
Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
Diffstat (limited to 'tests/benchmarks')
-rw-r--r-- | tests/benchmarks/creationtime/tst_creationtime.cpp | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/tests/benchmarks/creationtime/tst_creationtime.cpp b/tests/benchmarks/creationtime/tst_creationtime.cpp index 20fcfbbe..3eccc654 100644 --- a/tests/benchmarks/creationtime/tst_creationtime.cpp +++ b/tests/benchmarks/creationtime/tst_creationtime.cpp @@ -59,19 +59,11 @@ void tst_CreationTime::init() engine.clearComponentCache(); } -static QStringList listControls(const QString &path) -{ - QStringList controls; - foreach (const QFileInfo &entry, QDir(path).entryInfoList(QStringList("*.qml"), QDir::Files)) - controls += entry.baseName(); - return controls; -} - static void addTestRows(const QString &path) { - QStringList controls = listControls(path); - foreach (const QString &control, controls) - QTest::newRow(qPrintable(control)) << control.toUtf8(); + QFileInfoList entries = QDir(path).entryInfoList(QStringList("*.qml"), QDir::Files); + foreach (const QFileInfo &entry, entries) + QTest::newRow(qPrintable(entry.baseName())) << QUrl::fromLocalFile(entry.absoluteFilePath()); } static void doBenchmark(QQmlComponent *component) @@ -89,29 +81,29 @@ static void doBenchmark(QQmlComponent *component) void tst_CreationTime::controls() { - QFETCH(QByteArray, control); + QFETCH(QUrl, url); QQmlComponent component(&engine); - component.setData("import Qt.labs.controls 1.0;" + control + "{}", QUrl()); + component.loadUrl(url); doBenchmark(&component); } void tst_CreationTime::controls_data() { - QTest::addColumn<QByteArray>("control"); + QTest::addColumn<QUrl>("url"); addTestRows(QQC2_IMPORT_PATH "/controls"); } void tst_CreationTime::calendar() { - QFETCH(QByteArray, control); + QFETCH(QUrl, url); QQmlComponent component(&engine); - component.setData("import Qt.labs.calendar 1.0;" + control + "{}", QUrl()); + component.loadUrl(url); doBenchmark(&component); } void tst_CreationTime::calendar_data() { - QTest::addColumn<QByteArray>("control"); + QTest::addColumn<QUrl>("url"); addTestRows(QQC2_IMPORT_PATH "/calendar"); } |