aboutsummaryrefslogtreecommitdiffstats
path: root/tests/benchmarks/objectcount/tst_objectcount.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/benchmarks/objectcount/tst_objectcount.cpp')
-rw-r--r--tests/benchmarks/objectcount/tst_objectcount.cpp49
1 files changed, 8 insertions, 41 deletions
diff --git a/tests/benchmarks/objectcount/tst_objectcount.cpp b/tests/benchmarks/objectcount/tst_objectcount.cpp
index fcb6be5b..c37469c3 100644
--- a/tests/benchmarks/objectcount/tst_objectcount.cpp
+++ b/tests/benchmarks/objectcount/tst_objectcount.cpp
@@ -38,6 +38,9 @@
#include <QtQuick>
#include <QtCore/private/qhooks_p.h>
#include <iostream>
+#include "../../auto/shared/visualtestutil.h"
+
+using namespace QQuickVisualTestUtil;
static int qt_verbose = qgetenv("VERBOSE").toInt() != 0;
@@ -88,49 +91,13 @@ void tst_ObjectCount::cleanup()
qtHookData[QHooks::RemoveQObject] = 0;
}
-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
- // dir would be added as an "implicit" import path overriding the actual import
- // path (qtbase/qml/QtQuick/Controls.2/Material). => The QML engine fails to load
- // the style C++ plugin from the implicit import path (the source dir).
- //
- // Therefore we only use the source tree for finding out the set of QML files that
- // a particular style implements, and then we locate the respective QML files in
- // the engine's import path. This way we can use QQmlComponent to load each QML file
- // for benchmarking.
-
- const QFileInfoList entries = QDir(QQC2_IMPORT_PATH "/" + sourcePath).entryInfoList(QStringList("*.qml"), QDir::Files);
- for (const QFileInfo &entry : entries) {
- QString name = entry.baseName();
- if (!skiplist.contains(name)) {
- const auto importPathList = engine->importPathList();
- for (const QString &importPath : importPathList) {
- QString name = entry.dir().dirName() + "/" + entry.fileName();
- QString filePath = importPath + "/" + targetPath + "/" + entry.fileName();
- if (QFile::exists(filePath)) {
- QTest::newRow(qPrintable(name)) << QUrl::fromLocalFile(filePath);
- break;
- } else {
- filePath = QQmlFile::urlToLocalFileOrQrc(filePath);
- if (!filePath.isEmpty() && QFile::exists(filePath)) {
- QTest::newRow(qPrintable(name)) << QUrl(filePath);
- break;
- }
- }
- }
- }
- }
-}
-
static void initTestRows(QQmlEngine *engine)
{
- addTestRows(engine, "controls", "QtQuick/Controls.2");
- addTestRows(engine, "controls/fusion", "QtQuick/Controls.2/Fusion", QStringList() << "ButtonPanel" << "CheckIndicator" << "RadioIndicator" << "SliderGroove" << "SliderHandle" << "SwitchIndicator");
- addTestRows(engine, "controls/imagine", "QtQuick/Controls.2/Imagine");
- addTestRows(engine, "controls/material", "QtQuick/Controls.2/Material", QStringList() << "Ripple" << "SliderHandle" << "CheckIndicator" << "RadioIndicator" << "SwitchIndicator" << "BoxShadow" << "ElevationEffect" << "CursorDelegate");
- addTestRows(engine, "controls/universal", "QtQuick/Controls.2/Universal", QStringList() << "CheckIndicator" << "RadioIndicator" << "SwitchIndicator");
+ addTestRowForEachControl(engine, "controls", "QtQuick/Controls.2");
+ addTestRowForEachControl(engine, "controls/fusion", "QtQuick/Controls.2/Fusion", QStringList() << "ButtonPanel" << "CheckIndicator" << "RadioIndicator" << "SliderGroove" << "SliderHandle" << "SwitchIndicator");
+ addTestRowForEachControl(engine, "controls/imagine", "QtQuick/Controls.2/Imagine");
+ addTestRowForEachControl(engine, "controls/material", "QtQuick/Controls.2/Material", QStringList() << "Ripple" << "SliderHandle" << "CheckIndicator" << "RadioIndicator" << "SwitchIndicator" << "BoxShadow" << "ElevationEffect" << "CursorDelegate");
+ addTestRowForEachControl(engine, "controls/universal", "QtQuick/Controls.2/Universal", QStringList() << "CheckIndicator" << "RadioIndicator" << "SwitchIndicator");
}
template <typename T>