diff options
Diffstat (limited to 'tests/benchmarks/quick')
9 files changed, 105 insertions, 20 deletions
diff --git a/tests/benchmarks/quick/CMakeLists.txt b/tests/benchmarks/quick/CMakeLists.txt index 48edce2029..b9d0cd381f 100644 --- a/tests/benchmarks/quick/CMakeLists.txt +++ b/tests/benchmarks/quick/CMakeLists.txt @@ -5,3 +5,4 @@ add_subdirectory(events) add_subdirectory(colorresolving) +add_subdirectory(curverenderer) diff --git a/tests/benchmarks/quick/colorresolving/CMakeLists.txt b/tests/benchmarks/quick/colorresolving/CMakeLists.txt index 572d02767a..082897799c 100644 --- a/tests/benchmarks/quick/colorresolving/CMakeLists.txt +++ b/tests/benchmarks/quick/colorresolving/CMakeLists.txt @@ -7,25 +7,20 @@ ## tst_colorresolving Test: ##################################################################### -# Collect test data -file(GLOB_RECURSE test_data_glob - RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/data/tst_*) -list(APPEND test_data ${test_data_glob}) - -qt_internal_add_test(tst_colorresolving - GUI - QMLTEST +qt_internal_add_benchmark(tst_colorresolving SOURCES tst_colorresolving.cpp LIBRARIES Qt::Gui - TESTDATA ${test_data} + Qt::QuickTest ) -#### Keys ignored in scope 1:.:.:colorresolving.pro:<TRUE>: -# OTHER_FILES = "$$PWD/data/*.qml" -# TEMPLATE = "app" +qt_internal_extend_target(tst_colorresolving CONDITION NOT ANDROID AND NOT IOS +DEFINES + QUICK_TEST_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}/data" +) -## Scopes: -##################################################################### +qt_internal_extend_target(tst_colorresolving CONDITION ANDROID OR IOS +DEFINES + QUICK_TEST_SOURCE_DIR=":/data" +) diff --git a/tests/benchmarks/quick/colorresolving/data/tst_colorresolving.qml b/tests/benchmarks/quick/colorresolving/data/tst_colorresolving.qml index 6f7ad32f8d..5b16eda8e9 100644 --- a/tests/benchmarks/quick/colorresolving/data/tst_colorresolving.qml +++ b/tests/benchmarks/quick/colorresolving/data/tst_colorresolving.qml @@ -1,5 +1,5 @@ // Copyright (C) 2020 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only import QtTest 1.2 import QtQuick 6.0 diff --git a/tests/benchmarks/quick/colorresolving/tst_colorresolving.cpp b/tests/benchmarks/quick/colorresolving/tst_colorresolving.cpp index fc19ede502..83b4e93079 100644 --- a/tests/benchmarks/quick/colorresolving/tst_colorresolving.cpp +++ b/tests/benchmarks/quick/colorresolving/tst_colorresolving.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2020 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtQuickTest/quicktest.h> QUICK_TEST_MAIN(tst_colorresolving) diff --git a/tests/benchmarks/quick/curverenderer/CMakeLists.txt b/tests/benchmarks/quick/curverenderer/CMakeLists.txt new file mode 100644 index 0000000000..c690bed7cc --- /dev/null +++ b/tests/benchmarks/quick/curverenderer/CMakeLists.txt @@ -0,0 +1,11 @@ +# Copyright (C) 2024 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_benchmark(tst_bench_curverenderer + SOURCES + tst_bench_curverenderer.cpp + LIBRARIES + Qt::Gui + Qt::Test + Qt::QuickShapesPrivate +) diff --git a/tests/benchmarks/quick/curverenderer/tst_bench_curverenderer.cpp b/tests/benchmarks/quick/curverenderer/tst_bench_curverenderer.cpp new file mode 100644 index 0000000000..4f891e96b2 --- /dev/null +++ b/tests/benchmarks/quick/curverenderer/tst_bench_curverenderer.cpp @@ -0,0 +1,78 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#include <qtest.h> +#include <QPainterPath> +#include <QSGNode> +#include <private/qquickshapecurverenderer_p.h> + +class tst_CurveRenderer : public QObject +{ + Q_OBJECT + +public: + tst_CurveRenderer(); + +private slots: + void initTestCase_data(); + + void render_data(); + void render(); +}; + +tst_CurveRenderer::tst_CurveRenderer() +{ +} + +void tst_CurveRenderer::initTestCase_data() +{ + QTest::addColumn<bool>("hasFill"); + QTest::addColumn<int>("strokeWidth"); + // tbd: dashed, gradient fill etc. + + QTest::newRow("onlyfill") << true << 0; + QTest::newRow("onlystroke") << false << 10; + QTest::newRow("strokeandfill") << true << 10; +} + +void tst_CurveRenderer::render_data() +{ + QTest::addColumn<QPainterPath>("path"); + + { + QPainterPath path; + path.moveTo(100, 400); + path.lineTo(200, 400); + path.quadTo(220, 500, 700, 700); + path.cubicTo(600, 600, 800, 200, 200, 50); + path.lineTo(50, 750); + path.cubicTo(600, 700, 300, 200, 750, 50); + path.cubicTo(800, 200, 300, 800, 300, 400); + QTest::newRow("figure1") << path; + } +} + +void tst_CurveRenderer::render() +{ + QFETCH_GLOBAL(bool, hasFill); + QFETCH_GLOBAL(int, strokeWidth); + QFETCH(QPainterPath, path); + + QSGNode dummyNode; + QQuickShapeCurveRenderer renderer(nullptr); + renderer.setRootNode(&dummyNode); + renderer.beginSync(1, nullptr); // Just sets the number of path items to 1; needs no endsync + renderer.setFillColor(0, hasFill ? Qt::yellow : Qt::transparent); + renderer.setStrokeColor(0, Qt::black); + renderer.setStrokeWidth(0, strokeWidth); + + QBENCHMARK { + renderer.beginSync(1, nullptr); + renderer.setPath(0, path); + renderer.endSync(false); + renderer.updateNode(); + } +} + +QTEST_MAIN(tst_CurveRenderer) +#include "tst_bench_curverenderer.moc" diff --git a/tests/benchmarks/quick/events/data/mouseevent.qml b/tests/benchmarks/quick/events/data/mouseevent.qml index 1a08a453b8..216aa48a65 100644 --- a/tests/benchmarks/quick/events/data/mouseevent.qml +++ b/tests/benchmarks/quick/events/data/mouseevent.qml @@ -1,5 +1,5 @@ // Copyright (C) 2017 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only import QtQuick 2.0 Item { diff --git a/tests/benchmarks/quick/events/data/touchevent.qml b/tests/benchmarks/quick/events/data/touchevent.qml index cc0a8e6680..e10271637a 100644 --- a/tests/benchmarks/quick/events/data/touchevent.qml +++ b/tests/benchmarks/quick/events/data/touchevent.qml @@ -1,5 +1,5 @@ // Copyright (C) 2017 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only import QtQuick 2.0 Item { diff --git a/tests/benchmarks/quick/events/tst_events.cpp b/tests/benchmarks/quick/events/tst_events.cpp index 27b31d4a70..c8899f7848 100644 --- a/tests/benchmarks/quick/events/tst_events.cpp +++ b/tests/benchmarks/quick/events/tst_events.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2020 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <qtest.h> #include <QtQuick> |