aboutsummaryrefslogtreecommitdiffstats
path: root/tests/benchmarks/quickcontrols2
diff options
context:
space:
mode:
Diffstat (limited to 'tests/benchmarks/quickcontrols2')
-rw-r--r--tests/benchmarks/quickcontrols2/CMakeLists.txt4
-rw-r--r--tests/benchmarks/quickcontrols2/benchmarks.pro4
-rw-r--r--tests/benchmarks/quickcontrols2/creationtime/CMakeLists.txt48
-rw-r--r--tests/benchmarks/quickcontrols2/creationtime/creationtime.pro11
-rw-r--r--tests/benchmarks/quickcontrols2/creationtime/data/dependencies.qml8
-rw-r--r--tests/benchmarks/quickcontrols2/creationtime/tst_creationtime.cpp177
-rw-r--r--tests/benchmarks/quickcontrols2/objectcount/CMakeLists.txt55
-rw-r--r--tests/benchmarks/quickcontrols2/objectcount/data/dependencies.qml8
-rw-r--r--tests/benchmarks/quickcontrols2/objectcount/objectcount.pro11
-rw-r--r--tests/benchmarks/quickcontrols2/objectcount/tst_objectcount.cpp160
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_abstractbutton.qml16
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_busyindicator.qml14
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_button.qml15
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_checkbox.qml15
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_checkdelegate.qml16
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_combobox.qml15
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_container.qml15
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_control.qml15
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_delaybutton.qml15
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_dial.qml14
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_dialog.qml28
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_dialogbuttonbox.qml14
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_drawer.qml21
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_frame.qml17
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_groupbox.qml18
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_itemdelegate.qml15
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_label.qml14
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_menu.qml22
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_menuitem.qml17
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_menuseparator.qml13
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_page.qml18
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_pageindicator.qml15
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_pane.qml17
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_popup.qml26
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_progressbar.qml14
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_radiobutton.qml16
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_radiodelegate.qml17
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_rangeslider.qml15
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_roundbutton.qml15
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_scrollbar.qml17
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_scrollindicator.qml16
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_scrollview.qml23
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_slider.qml14
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_spinbox.qml14
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_stackview.qml18
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_swipedelegate.qml15
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_swipeview.qml24
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_switch.qml15
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_switchdelegate.qml16
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_tabbar.qml23
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_tabbutton.qml16
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_textarea.qml14
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_textfield.qml14
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_toolbutton.qml15
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_toolseparator.qml13
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_tooltip.qml20
-rw-r--r--tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_tumbler.qml15
57 files changed, 1270 insertions, 0 deletions
diff --git a/tests/benchmarks/quickcontrols2/CMakeLists.txt b/tests/benchmarks/quickcontrols2/CMakeLists.txt
new file mode 100644
index 0000000000..3f2bf2f96c
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/CMakeLists.txt
@@ -0,0 +1,4 @@
+# Generated from benchmarks.pro.
+
+add_subdirectory(creationtime)
+add_subdirectory(objectcount)
diff --git a/tests/benchmarks/quickcontrols2/benchmarks.pro b/tests/benchmarks/quickcontrols2/benchmarks.pro
new file mode 100644
index 0000000000..7c4ca2243b
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/benchmarks.pro
@@ -0,0 +1,4 @@
+TEMPLATE = subdirs
+SUBDIRS += \
+ creationtime \
+ objectcount
diff --git a/tests/benchmarks/quickcontrols2/creationtime/CMakeLists.txt b/tests/benchmarks/quickcontrols2/creationtime/CMakeLists.txt
new file mode 100644
index 0000000000..ad39b3ea0b
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/creationtime/CMakeLists.txt
@@ -0,0 +1,48 @@
+# Generated from creationtime.pro.
+
+if (NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_creationtime LANGUAGES C CXX ASM)
+ find_package(Qt6BuildInternals COMPONENTS STANDALONE_TEST)
+endif()
+
+#####################################################################
+## tst_creationtime Test:
+#####################################################################
+
+qt_internal_add_test(tst_creationtime
+ SOURCES
+ tst_creationtime.cpp
+ DEFINES
+ QQC2_IMPORT_PATH=\\\"${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/quickcontrols2\\\"
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+ Qt::Gui
+ Qt::GuiPrivate
+ Qt::Qml
+ Qt::QmlPrivate
+ Qt::QuickControls2
+ Qt::QuickControls2Private
+ Qt::QuickControlsTestUtilsPrivate
+ Qt::QuickPrivate
+ Qt::QuickTemplates2Private
+ Qt::QuickTest
+ Qt::QuickTestUtilsPrivate
+ Qt::TestPrivate
+)
+
+#### Keys ignored in scope 1:.:.:creationtime.pro:<TRUE>:
+# TEMPLATE = "app"
+
+## Scopes:
+#####################################################################
+
+qt_internal_extend_target(tst_creationtime CONDITION ANDROID OR IOS
+ DEFINES
+ QT_QMLTEST_DATADIR=\\\":/data\\\"
+)
+
+qt_internal_extend_target(tst_creationtime CONDITION NOT ANDROID AND NOT IOS
+ DEFINES
+ QT_QMLTEST_DATADIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}/data\\\"
+)
diff --git a/tests/benchmarks/quickcontrols2/creationtime/creationtime.pro b/tests/benchmarks/quickcontrols2/creationtime/creationtime.pro
new file mode 100644
index 0000000000..7d15ebd445
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/creationtime/creationtime.pro
@@ -0,0 +1,11 @@
+TEMPLATE = app
+TARGET = tst_creationtime
+
+QT += qml testlib quickcontrols2
+CONFIG += testcase
+macos:CONFIG -= app_bundle
+
+include(../../../auto/shared/util.pri)
+
+SOURCES += \
+ tst_creationtime.cpp
diff --git a/tests/benchmarks/quickcontrols2/creationtime/data/dependencies.qml b/tests/benchmarks/quickcontrols2/creationtime/data/dependencies.qml
new file mode 100644
index 0000000000..3b8476177f
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/creationtime/data/dependencies.qml
@@ -0,0 +1,8 @@
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Controls.Fusion
+import QtQuick.Controls.Imagine
+import QtQuick.Controls.Material
+import QtQuick.Controls.Universal
+
+Control { }
diff --git a/tests/benchmarks/quickcontrols2/creationtime/tst_creationtime.cpp b/tests/benchmarks/quickcontrols2/creationtime/tst_creationtime.cpp
new file mode 100644
index 0000000000..d0259e9a01
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/creationtime/tst_creationtime.cpp
@@ -0,0 +1,177 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/qscopedpointer.h>
+#include <QtTest>
+#include <QtQml>
+#include <QtQuickControls2/qquickstyle.h>
+
+#include <QtQuickTestUtils/private/viewtestutils_p.h>
+#include <QtQuickTestUtils/private/visualtestutils_p.h>
+#include <QtQuickControlsTestUtils/private/controlstestutils_p.h>
+
+using namespace QQuickControlsTestUtils;
+using namespace QQuickVisualTestUtils;
+
+class tst_CreationTime : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void initTestCase();
+ void init();
+
+ void basicStyle();
+ void basicStyle_data();
+
+ void fusion();
+ void fusion_data();
+
+ void imagine();
+ void imagine_data();
+
+ void material();
+ void material_data();
+
+ void universal();
+ void universal_data();
+
+private:
+ QQuickStyleHelper styleHelper;
+};
+
+void tst_CreationTime::initTestCase()
+{
+ styleHelper.engine.reset(new QQmlEngine);
+}
+
+void tst_CreationTime::init()
+{
+ styleHelper.engine->clearComponentCache();
+}
+
+static void doBenchmark(QQuickStyleHelper &styleHelper, const QUrl &url)
+{
+ const QString tagStr = QString::fromLatin1(QTest::currentDataTag());
+ QStringList styleAndFileName = tagStr.split('/');
+ QCOMPARE(styleAndFileName.size(), 2);
+ QString style = styleAndFileName.first();
+ style[0] = style.at(0).toUpper();
+ styleHelper.updateStyle(style);
+
+ QQmlComponent component(styleHelper.engine.data());
+ component.loadUrl(url);
+
+ QObjectList objects;
+ objects.reserve(4096);
+ QBENCHMARK {
+ QObject *object = component.create();
+ QVERIFY2(object, qPrintable(component.errorString()));
+ objects += object;
+ }
+ qDeleteAll(objects);
+}
+
+void tst_CreationTime::basicStyle()
+{
+ QFETCH(QUrl, url);
+ doBenchmark(styleHelper, url);
+}
+
+void tst_CreationTime::basicStyle_data()
+{
+ QTest::addColumn<QUrl>("url");
+ addTestRowForEachControl(styleHelper.engine.data(), QQC2_IMPORT_PATH, "basic", "QtQuick/Controls/Basic",
+ QStringList() << "ApplicationWindow");
+}
+
+void tst_CreationTime::fusion()
+{
+ QFETCH(QUrl, url);
+ doBenchmark(styleHelper, url);
+}
+
+void tst_CreationTime::fusion_data()
+{
+ QTest::addColumn<QUrl>("url");
+ addTestRowForEachControl(styleHelper.engine.data(), QQC2_IMPORT_PATH, "fusion", "QtQuick/Controls/Fusion",
+ QStringList() << "ApplicationWindow" << "ButtonPanel" << "CheckIndicator"
+ << "RadioIndicator" << "SliderGroove" << "SliderHandle" << "SwitchIndicator");
+}
+
+void tst_CreationTime::imagine()
+{
+ QFETCH(QUrl, url);
+ doBenchmark(styleHelper, url);
+}
+
+void tst_CreationTime::imagine_data()
+{
+ QTest::addColumn<QUrl>("url");
+ addTestRowForEachControl(styleHelper.engine.data(), QQC2_IMPORT_PATH, "imagine", "QtQuick/Controls/Imagine",
+ QStringList() << "ApplicationWindow");
+}
+
+void tst_CreationTime::material()
+{
+ QFETCH(QUrl, url);
+ doBenchmark(styleHelper, url);
+}
+
+void tst_CreationTime::material_data()
+{
+ QTest::addColumn<QUrl>("url");
+ addTestRowForEachControl(styleHelper.engine.data(), QQC2_IMPORT_PATH, "material", "QtQuick/Controls/Material",
+ QStringList() << "ApplicationWindow" << "Ripple" << "SliderHandle" << "CheckIndicator" << "RadioIndicator"
+ << "SwitchIndicator" << "BoxShadow" << "ElevationEffect" << "CursorDelegate");
+}
+
+void tst_CreationTime::universal()
+{
+ QFETCH(QUrl, url);
+ doBenchmark(styleHelper, url);
+}
+
+void tst_CreationTime::universal_data()
+{
+ QTest::addColumn<QUrl>("url");
+ addTestRowForEachControl(styleHelper.engine.data(), QQC2_IMPORT_PATH, "universal", "QtQuick/Controls/Universal",
+ QStringList() << "ApplicationWindow" << "CheckIndicator" << "RadioIndicator" << "SwitchIndicator");
+}
+
+QTEST_MAIN(tst_CreationTime)
+
+#include "tst_creationtime.moc"
diff --git a/tests/benchmarks/quickcontrols2/objectcount/CMakeLists.txt b/tests/benchmarks/quickcontrols2/objectcount/CMakeLists.txt
new file mode 100644
index 0000000000..e0434a08eb
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/objectcount/CMakeLists.txt
@@ -0,0 +1,55 @@
+# Generated from objectcount.pro.
+
+if (NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_objectcount LANGUAGES C CXX ASM)
+ find_package(Qt6BuildInternals COMPONENTS STANDALONE_TEST)
+endif()
+
+#####################################################################
+## tst_objectcount Test:
+#####################################################################
+
+file(GLOB_RECURSE test_data_glob
+ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
+ data/*)
+list(APPEND test_data ${test_data_glob})
+
+
+qt_internal_add_test(tst_objectcount
+ SOURCES
+ tst_objectcount.cpp
+ DEFINES
+ QQC2_IMPORT_PATH=\\\"${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/quickcontrols2\\\"
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+ Qt::Gui
+ Qt::GuiPrivate
+ Qt::QmlPrivate
+ Qt::Quick
+ Qt::QuickControls2
+ Qt::QuickControls2Private
+ Qt::QuickControlsTestUtilsPrivate
+ Qt::QuickPrivate
+ Qt::QuickTemplates2Private
+ Qt::QuickTest
+ Qt::QuickTestUtilsPrivate
+ Qt::TestPrivate
+ TESTDATA ${test_data}
+)
+
+#### Keys ignored in scope 1:.:.:objectcount.pro:<TRUE>:
+# TEMPLATE = "app"
+
+## Scopes:
+#####################################################################
+
+qt_internal_extend_target(tst_objectcount CONDITION ANDROID OR IOS
+ DEFINES
+ QT_QMLTEST_DATADIR=\\\":/data\\\"
+)
+
+qt_internal_extend_target(tst_objectcount CONDITION NOT ANDROID AND NOT IOS
+ DEFINES
+ QT_QMLTEST_DATADIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}/data\\\"
+)
diff --git a/tests/benchmarks/quickcontrols2/objectcount/data/dependencies.qml b/tests/benchmarks/quickcontrols2/objectcount/data/dependencies.qml
new file mode 100644
index 0000000000..3b8476177f
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/objectcount/data/dependencies.qml
@@ -0,0 +1,8 @@
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Controls.Fusion
+import QtQuick.Controls.Imagine
+import QtQuick.Controls.Material
+import QtQuick.Controls.Universal
+
+Control { }
diff --git a/tests/benchmarks/quickcontrols2/objectcount/objectcount.pro b/tests/benchmarks/quickcontrols2/objectcount/objectcount.pro
new file mode 100644
index 0000000000..f2f2879a94
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/objectcount/objectcount.pro
@@ -0,0 +1,11 @@
+TEMPLATE = app
+TARGET = tst_objectcount
+
+QT += quick testlib core-private
+CONFIG += testcase
+macos:CONFIG -= app_bundle
+
+include(../../../auto/shared/util.pri)
+
+SOURCES += \
+ tst_objectcount.cpp
diff --git a/tests/benchmarks/quickcontrols2/objectcount/tst_objectcount.cpp b/tests/benchmarks/quickcontrols2/objectcount/tst_objectcount.cpp
new file mode 100644
index 0000000000..14785a5a95
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/objectcount/tst_objectcount.cpp
@@ -0,0 +1,160 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest>
+#include <QtQuick>
+#include <QtCore/private/qhooks_p.h>
+#include <iostream>
+#include <QtQuickTestUtils/private/visualtestutils_p.h>
+#include <QtQuickControlsTestUtils/private/controlstestutils_p.h>
+
+using namespace QQuickVisualTestUtils;
+using namespace QQuickControlsTestUtils;
+
+static int qt_verbose = qEnvironmentVariableIntValue("VERBOSE") != 0;
+
+Q_GLOBAL_STATIC(QObjectList, qt_qobjects)
+
+extern "C" Q_DECL_EXPORT void qt_addQObject(QObject *object)
+{
+ qt_qobjects->append(object);
+}
+
+extern "C" Q_DECL_EXPORT void qt_removeQObject(QObject *object)
+{
+ qt_qobjects->removeAll(object);
+}
+
+class tst_ObjectCount : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void init();
+ void cleanup();
+
+ void qobjects();
+ void qobjects_data();
+
+ void qquickitems();
+ void qquickitems_data();
+
+private:
+ QQmlEngine engine;
+};
+
+void tst_ObjectCount::init()
+{
+ qtHookData[QHooks::AddQObject] = reinterpret_cast<quintptr>(&qt_addQObject);
+ qtHookData[QHooks::RemoveQObject] = reinterpret_cast<quintptr>(&qt_removeQObject);
+
+ // warmup
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick; import QtQuick.Controls; Item { Button {} }", QUrl());
+ delete component.create();
+}
+
+void tst_ObjectCount::cleanup()
+{
+ qtHookData[QHooks::AddQObject] = 0;
+ qtHookData[QHooks::RemoveQObject] = 0;
+}
+
+static void initTestRows(QQmlEngine *engine)
+{
+ addTestRowForEachControl(engine, QQC2_IMPORT_PATH, "basic", "QtQuick/Controls/Basic");
+ addTestRowForEachControl(engine, QQC2_IMPORT_PATH, "fusion", "QtQuick/Controls/Fusion",
+ QStringList() << "ButtonPanel" << "CheckIndicator" << "RadioIndicator" << "SliderGroove" << "SliderHandle" << "SwitchIndicator");
+ addTestRowForEachControl(engine, QQC2_IMPORT_PATH, "imagine", "QtQuick/Controls/Imagine");
+ addTestRowForEachControl(engine, QQC2_IMPORT_PATH, "material", "QtQuick/Controls/Material",
+ QStringList() << "Ripple" << "SliderHandle" << "CheckIndicator" << "RadioIndicator"
+ << "SwitchIndicator" << "BoxShadow" << "ElevationEffect" << "CursorDelegate");
+ addTestRowForEachControl(engine, QQC2_IMPORT_PATH, "universal", "QtQuick/Controls/Universal",
+ QStringList() << "CheckIndicator" << "RadioIndicator" << "SwitchIndicator");
+}
+
+template <typename T>
+static void doBenchmark(QQmlEngine *engine, const QUrl &url)
+{
+ QQmlComponent component(engine);
+
+ qt_qobjects->clear();
+
+ component.loadUrl(url);
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY2(object.data(), qPrintable(component.errorString()));
+
+ QObjectList objects;
+ for (QObject *object : qAsConst(*qt_qobjects())) {
+ if (qobject_cast<T *>(object))
+ objects += object;
+ }
+
+ if (qt_verbose) {
+ for (QObject *object : objects)
+ qInfo() << "\t" << object;
+ }
+
+ QTest::setBenchmarkResult(objects.count(), QTest::Events);
+}
+
+void tst_ObjectCount::qobjects()
+{
+ QFETCH(QUrl, url);
+ doBenchmark<QObject>(&engine, url);
+}
+
+void tst_ObjectCount::qobjects_data()
+{
+ QTest::addColumn<QUrl>("url");
+ initTestRows(&engine);
+}
+
+void tst_ObjectCount::qquickitems()
+{
+ QFETCH(QUrl, url);
+ doBenchmark<QQuickItem>(&engine, url);
+}
+
+void tst_ObjectCount::qquickitems_data()
+{
+ QTest::addColumn<QUrl>("url");
+ initTestRows(&engine);
+}
+
+QTEST_MAIN(tst_ObjectCount)
+
+#include "tst_objectcount.moc"
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_abstractbutton.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_abstractbutton.qml
new file mode 100644
index 0000000000..87b137fb22
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_abstractbutton.qml
@@ -0,0 +1,16 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 2000
+ delegate: AbstractButton {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ checkable: index % 2
+ checked: index % 2
+ down: index % 3
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_busyindicator.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_busyindicator.qml
new file mode 100644
index 0000000000..bc0be40243
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_busyindicator.qml
@@ -0,0 +1,14 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: BusyIndicator {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ running: index % 2
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_button.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_button.qml
new file mode 100644
index 0000000000..9505ebf082
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_button.qml
@@ -0,0 +1,15 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: Button {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ text: "Button"
+ down: index % 2
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_checkbox.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_checkbox.qml
new file mode 100644
index 0000000000..67d9e38236
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_checkbox.qml
@@ -0,0 +1,15 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: CheckBox {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ text: "CheckBox"
+ checked: index % 2
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_checkdelegate.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_checkdelegate.qml
new file mode 100644
index 0000000000..bd7b64cc23
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_checkdelegate.qml
@@ -0,0 +1,16 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: CheckDelegate {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ text: "CheckDelegate"
+ checked: index % 2
+ down: index % 3
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_combobox.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_combobox.qml
new file mode 100644
index 0000000000..f8552b7415
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_combobox.qml
@@ -0,0 +1,15 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 250
+ delegate: ComboBox {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ model: 5
+ currentIndex: index % count
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_container.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_container.qml
new file mode 100644
index 0000000000..238e95e3df
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_container.qml
@@ -0,0 +1,15 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 2000
+ delegate: Container {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ width: 100
+ height: 100
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_control.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_control.qml
new file mode 100644
index 0000000000..20f09477ce
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_control.qml
@@ -0,0 +1,15 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 2000
+ delegate: Control {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ width: 100
+ height: 100
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_delaybutton.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_delaybutton.qml
new file mode 100644
index 0000000000..05ec87483e
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_delaybutton.qml
@@ -0,0 +1,15 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: DelayButton {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ text: "DelayButton"
+ down: index % 2
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_dial.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_dial.qml
new file mode 100644
index 0000000000..de742c7b7e
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_dial.qml
@@ -0,0 +1,14 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 500
+ delegate: Dial {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ value: index / root.staticCount
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_dialog.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_dialog.qml
new file mode 100644
index 0000000000..686149f7b0
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_dialog.qml
@@ -0,0 +1,28 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 200
+ delegate: Item {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ width: dialog.width
+ height: dialog.height
+ Dialog {
+ id: dialog
+ visible: true
+ title: "Dialog"
+ modal: (index % 100) === 0
+ width: parent.width
+ height: parent.height
+ standardButtons: Dialog.Ok | Dialog.Cancel
+ Item {
+ implicitWidth: 200
+ implicitHeight: 200
+ }
+ }
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_dialogbuttonbox.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_dialogbuttonbox.qml
new file mode 100644
index 0000000000..f13d65c507
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_dialogbuttonbox.qml
@@ -0,0 +1,14 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: DialogButtonBox {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ standardButtons: DialogButtonBox.Ok | DialogButtonBox.Cancel
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_drawer.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_drawer.qml
new file mode 100644
index 0000000000..3f7290a41f
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_drawer.qml
@@ -0,0 +1,21 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 250
+ delegate: Item {
+ width: root.width
+ height: root.height
+ Drawer {
+ id: drawer
+ visible: true
+ position: 1.0
+ edge: index % 2 ? Qt.LeftEdge : Qt.RightEdge
+ width: root.width / 3
+ height: parent.height
+ }
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_frame.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_frame.qml
new file mode 100644
index 0000000000..2d3c9a6624
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_frame.qml
@@ -0,0 +1,17 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 2000
+ delegate: Frame {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ Item {
+ implicitWidth: 100
+ implicitHeight: 100
+ }
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_groupbox.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_groupbox.qml
new file mode 100644
index 0000000000..3696f8476a
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_groupbox.qml
@@ -0,0 +1,18 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: GroupBox {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ title: "GroupBox"
+ Item {
+ implicitWidth: 100
+ implicitHeight: 100
+ }
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_itemdelegate.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_itemdelegate.qml
new file mode 100644
index 0000000000..07128da1d2
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_itemdelegate.qml
@@ -0,0 +1,15 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: ItemDelegate {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ text: "ItemDelegate"
+ down: index % 2
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_label.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_label.qml
new file mode 100644
index 0000000000..788006a48d
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_label.qml
@@ -0,0 +1,14 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: Label {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ text: "Label"
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_menu.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_menu.qml
new file mode 100644
index 0000000000..fd8e53b4f9
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_menu.qml
@@ -0,0 +1,22 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 200
+ delegate: Item {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ width: menu.width
+ height: menu.height
+ Menu {
+ id: menu
+ visible: true
+ MenuItem { text: "MenuItem1" }
+ MenuItem { text: "MenuItem2" }
+ MenuItem { text: "MenuItem3" }
+ }
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_menuitem.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_menuitem.qml
new file mode 100644
index 0000000000..6732bc184c
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_menuitem.qml
@@ -0,0 +1,17 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: MenuItem {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ text: "MenuItem"
+ checkable: index % 2
+ checked: index % 2
+ down: index % 3
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_menuseparator.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_menuseparator.qml
new file mode 100644
index 0000000000..8effa17305
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_menuseparator.qml
@@ -0,0 +1,13 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 2000
+ delegate: MenuSeparator {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_page.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_page.qml
new file mode 100644
index 0000000000..f9d06b38af
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_page.qml
@@ -0,0 +1,18 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 2000
+ delegate: Page {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ width: 100
+ height: 100
+ header: Item { }
+ footer: Item { }
+ Item { }
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_pageindicator.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_pageindicator.qml
new file mode 100644
index 0000000000..9b5a691821
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_pageindicator.qml
@@ -0,0 +1,15 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: PageIndicator {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ count: 5
+ currentIndex: index % 5
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_pane.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_pane.qml
new file mode 100644
index 0000000000..a391f69557
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_pane.qml
@@ -0,0 +1,17 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 2000
+ delegate: Pane {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ Item {
+ implicitWidth: 100
+ implicitHeight: 100
+ }
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_popup.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_popup.qml
new file mode 100644
index 0000000000..c2cdaab573
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_popup.qml
@@ -0,0 +1,26 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 500
+ delegate: Item {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ width: popup.width
+ height: popup.height
+ Popup {
+ id: popup
+ visible: true
+ modal: (index % 100) === 0
+ width: parent.width
+ height: parent.height
+ Item {
+ implicitWidth: 100
+ implicitHeight: 100
+ }
+ }
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_progressbar.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_progressbar.qml
new file mode 100644
index 0000000000..d50d9d2681
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_progressbar.qml
@@ -0,0 +1,14 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: ProgressBar {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ value: index / root.staticCount
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_radiobutton.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_radiobutton.qml
new file mode 100644
index 0000000000..f596e852c1
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_radiobutton.qml
@@ -0,0 +1,16 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: RadioButton {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ text: "RadioButton"
+ autoExclusive: false
+ checked: index % 2
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_radiodelegate.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_radiodelegate.qml
new file mode 100644
index 0000000000..7f5734664a
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_radiodelegate.qml
@@ -0,0 +1,17 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: RadioDelegate {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ text: "RadioDelegate"
+ autoExclusive: false
+ checked: index % 2
+ down: index % 3
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_rangeslider.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_rangeslider.qml
new file mode 100644
index 0000000000..725cab29d8
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_rangeslider.qml
@@ -0,0 +1,15 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: RangeSlider {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ first.value: (index / root.staticCount) * 0.5
+ second.value: 0.5 + (index / root.staticCount) * 0.5
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_roundbutton.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_roundbutton.qml
new file mode 100644
index 0000000000..0337a66db8
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_roundbutton.qml
@@ -0,0 +1,15 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: RoundButton {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ text: "X"
+ down: index % 2
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_scrollbar.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_scrollbar.qml
new file mode 100644
index 0000000000..2635240f89
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_scrollbar.qml
@@ -0,0 +1,17 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: ScrollBar {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ height: 100
+ size: index / root.staticCount
+ pressed: index % 2
+ active: true
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_scrollindicator.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_scrollindicator.qml
new file mode 100644
index 0000000000..4e2b90a3b3
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_scrollindicator.qml
@@ -0,0 +1,16 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: ScrollIndicator {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ height: 100
+ size: index / root.staticCount
+ active: true
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_scrollview.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_scrollview.qml
new file mode 100644
index 0000000000..b5f155cb1d
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_scrollview.qml
@@ -0,0 +1,23 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 250
+ delegate: ScrollView {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ width: 100
+ height: 100
+ Item {
+ implicitWidth: 200
+ implicitHeight: 200
+ }
+ ScrollBar.vertical.active: true
+ ScrollBar.vertical.pressed: index % 3 === 1
+ ScrollBar.horizontal.active: true
+ ScrollBar.horizontal.pressed: index % 3 === 2
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_slider.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_slider.qml
new file mode 100644
index 0000000000..0ef3b3faf4
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_slider.qml
@@ -0,0 +1,14 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: Slider {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ value: index / root.staticCount
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_spinbox.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_spinbox.qml
new file mode 100644
index 0000000000..9120a92162
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_spinbox.qml
@@ -0,0 +1,14 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 250
+ delegate: SpinBox {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ value: index / root.staticCount * to
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_stackview.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_stackview.qml
new file mode 100644
index 0000000000..cb6cee10fc
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_stackview.qml
@@ -0,0 +1,18 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 2000
+ delegate: StackView {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ width: 100
+ height: 100
+ initialItem: Item {
+ focus: StackView.status === StackView.Active
+ }
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_swipedelegate.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_swipedelegate.qml
new file mode 100644
index 0000000000..5147bbb6d2
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_swipedelegate.qml
@@ -0,0 +1,15 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: SwitchDelegate {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ text: "SwipeDelegate"
+ down: index % 2
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_swipeview.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_swipeview.qml
new file mode 100644
index 0000000000..b263e620a9
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_swipeview.qml
@@ -0,0 +1,24 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: SwipeView {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ width: 100
+ height: 100
+ Item {
+ focus: SwipeView.isCurrentItem
+ }
+ Item {
+ focus: SwipeView.isCurrentItem
+ }
+ Item {
+ focus: SwipeView.isCurrentItem
+ }
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_switch.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_switch.qml
new file mode 100644
index 0000000000..79cc48e3d0
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_switch.qml
@@ -0,0 +1,15 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: Switch {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ text: "Switch"
+ checked: index % 2
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_switchdelegate.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_switchdelegate.qml
new file mode 100644
index 0000000000..f6f8a7df52
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_switchdelegate.qml
@@ -0,0 +1,16 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: SwitchDelegate {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ text: "SwitchDelegate"
+ checked: index % 2
+ down: index % 3
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_tabbar.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_tabbar.qml
new file mode 100644
index 0000000000..37f6a46371
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_tabbar.qml
@@ -0,0 +1,23 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 250
+ delegate: TabBar {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ currentIndex: index / root.staticCount * count
+ TabButton {
+ text: "Tab1"
+ }
+ TabButton {
+ text: "Tab2"
+ }
+ TabButton {
+ text: "Tab3"
+ }
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_tabbutton.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_tabbutton.qml
new file mode 100644
index 0000000000..27442a7d2c
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_tabbutton.qml
@@ -0,0 +1,16 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: TabButton {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ text: "TabButton"
+ checked: index % 2
+ down: index % 3
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_textarea.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_textarea.qml
new file mode 100644
index 0000000000..88454c0bf1
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_textarea.qml
@@ -0,0 +1,14 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 500
+ delegate: TextArea {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ text: "Text\nArea"
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_textfield.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_textfield.qml
new file mode 100644
index 0000000000..eb279724e3
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_textfield.qml
@@ -0,0 +1,14 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: TextField {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ text: "TextField"
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_toolbutton.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_toolbutton.qml
new file mode 100644
index 0000000000..7dcd85a3fb
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_toolbutton.qml
@@ -0,0 +1,15 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: ToolButton {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ text: "ToolButton"
+ down: index % 2
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_toolseparator.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_toolseparator.qml
new file mode 100644
index 0000000000..48cdd352cc
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_toolseparator.qml
@@ -0,0 +1,13 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 2000
+ delegate: ToolSeparator {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_tooltip.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_tooltip.qml
new file mode 100644
index 0000000000..85e864943c
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_tooltip.qml
@@ -0,0 +1,20 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 500
+ delegate: Item {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ width: tooltip.width
+ height: tooltip.height
+ ToolTip {
+ id: tooltip
+ visible: true
+ text: "ToolTip"
+ }
+ }
+}
diff --git a/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_tumbler.qml b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_tumbler.qml
new file mode 100644
index 0000000000..da747e2300
--- /dev/null
+++ b/tests/benchmarks/quickcontrols2/qmlbench/creation/delegates_tumbler.qml
@@ -0,0 +1,15 @@
+import QtQuick
+import QmlBench
+import QtQuick.Controls
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 250
+ delegate: Tumbler {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ model: 5
+ currentIndex: index % count
+ }
+}