summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks/gui/painting/qtbench
diff options
context:
space:
mode:
Diffstat (limited to 'tests/benchmarks/gui/painting/qtbench')
-rw-r--r--tests/benchmarks/gui/painting/qtbench/CMakeLists.txt8
-rw-r--r--tests/benchmarks/gui/painting/qtbench/benchmarktests.h8
-rw-r--r--tests/benchmarks/gui/painting/qtbench/tst_qtbench.cpp9
3 files changed, 14 insertions, 11 deletions
diff --git a/tests/benchmarks/gui/painting/qtbench/CMakeLists.txt b/tests/benchmarks/gui/painting/qtbench/CMakeLists.txt
index e6e2ed76ab..68fbf0984f 100644
--- a/tests/benchmarks/gui/painting/qtbench/CMakeLists.txt
+++ b/tests/benchmarks/gui/painting/qtbench/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qtbench.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qtbench Binary:
@@ -7,11 +8,8 @@
qt_internal_add_benchmark(tst_bench_qtbench
SOURCES
tst_qtbench.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Test
Qt::Widgets
)
-
-#### Keys ignored in scope 1:.:.:qtbench.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/gui/painting/qtbench/benchmarktests.h b/tests/benchmarks/gui/painting/qtbench/benchmarktests.h
index f29a62a8e0..9d890f1577 100644
--- a/tests/benchmarks/gui/painting/qtbench/benchmarktests.h
+++ b/tests/benchmarks/gui/painting/qtbench/benchmarktests.h
@@ -1,5 +1,5 @@
// Copyright (C) 2016 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
#ifndef BENCHMARKTESTS_H
#define BENCHMARKTESTS_H
@@ -529,13 +529,13 @@ public:
m_staticTexts.append(staticText);
QFontMetrics fm(p->font());
- m_size = QSize(fm.horizontalAdvance(m_text, m_text.length()), fm.height());
+ m_size = QSize(fm.horizontalAdvance(m_text, m_text.size()), fm.height());
break;
}
case PainterQPointMode: {
QFontMetrics fm(p->font());
- m_size = QSize(fm.horizontalAdvance(m_text, m_text.length()), fm.height());
+ m_size = QSize(fm.horizontalAdvance(m_text, m_text.size()), fm.height());
break;
}
@@ -576,7 +576,7 @@ public:
QString name() const override
{
- int letters = m_text.length();
+ int letters = m_text.size();
int lines = m_text.count('\n');
if (lines == 0)
lines = 1;
diff --git a/tests/benchmarks/gui/painting/qtbench/tst_qtbench.cpp b/tests/benchmarks/gui/painting/qtbench/tst_qtbench.cpp
index f24c48c0e1..45b7045f94 100644
--- a/tests/benchmarks/gui/painting/qtbench/tst_qtbench.cpp
+++ b/tests/benchmarks/gui/painting/qtbench/tst_qtbench.cpp
@@ -1,5 +1,7 @@
// 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
+
+#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
#include <qtest.h>
@@ -107,9 +109,13 @@ class tst_QtBench : public QObject
{
Q_OBJECT
+ QList<Benchmark *> benchmarks;
+
private slots:
void qtBench();
void qtBench_data();
+
+ void cleanupTestCase() { qDeleteAll(benchmarks); }
};
QString makeString(int length)
@@ -159,7 +165,6 @@ void tst_QtBench::qtBench_data()
"i erat, sed pellentesque\n"
"mi. Curabitur sed.";
- QList<Benchmark *> benchmarks;
benchmarks << (new DrawText(shortString, DrawText::PainterMode));
benchmarks << (new DrawText(middleString, DrawText::PainterMode));
benchmarks << (new DrawText(longString, DrawText::PainterMode));