summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks/corelib/kernel/qmetaobject
diff options
context:
space:
mode:
Diffstat (limited to 'tests/benchmarks/corelib/kernel/qmetaobject')
-rw-r--r--tests/benchmarks/corelib/kernel/qmetaobject/CMakeLists.txt10
-rw-r--r--tests/benchmarks/corelib/kernel/qmetaobject/qmetaobject.pro6
-rw-r--r--tests/benchmarks/corelib/kernel/qmetaobject/tst_bench_qmetaobject.cpp (renamed from tests/benchmarks/corelib/kernel/qmetaobject/main.cpp)75
3 files changed, 24 insertions, 67 deletions
diff --git a/tests/benchmarks/corelib/kernel/qmetaobject/CMakeLists.txt b/tests/benchmarks/corelib/kernel/qmetaobject/CMakeLists.txt
index db4c3ab12e..9e17608c57 100644
--- a/tests/benchmarks/corelib/kernel/qmetaobject/CMakeLists.txt
+++ b/tests/benchmarks/corelib/kernel/qmetaobject/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qmetaobject.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qmetaobject Binary:
@@ -6,12 +7,9 @@
qt_internal_add_benchmark(tst_bench_qmetaobject
SOURCES
- main.cpp
- PUBLIC_LIBRARIES
+ tst_bench_qmetaobject.cpp
+ LIBRARIES
Qt::Gui
Qt::Test
Qt::Widgets
)
-
-#### Keys ignored in scope 1:.:.:qmetaobject.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/corelib/kernel/qmetaobject/qmetaobject.pro b/tests/benchmarks/corelib/kernel/qmetaobject/qmetaobject.pro
deleted file mode 100644
index 0d595ed4da..0000000000
--- a/tests/benchmarks/corelib/kernel/qmetaobject/qmetaobject.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-TEMPLATE = app
-CONFIG += benchmark
-QT += widgets testlib
-
-TARGET = tst_bench_qmetaobject
-SOURCES += main.cpp
diff --git a/tests/benchmarks/corelib/kernel/qmetaobject/main.cpp b/tests/benchmarks/corelib/kernel/qmetaobject/tst_bench_qmetaobject.cpp
index 80bad7977b..6b02fb4ba4 100644
--- a/tests/benchmarks/corelib/kernel/qmetaobject/main.cpp
+++ b/tests/benchmarks/corelib/kernel/qmetaobject/tst_bench_qmetaobject.cpp
@@ -1,35 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtCore>
#include <QtWidgets/QTreeView>
#include <qtest.h>
-class LotsOfSignals : public QObject
+class LotsOfSignals : public QObject // for the unconnected() test
{
Q_OBJECT
public:
@@ -107,13 +82,10 @@ signals:
void extraSignal70();
};
-class tst_qmetaobject: public QObject
+class tst_QMetaObject: public QObject
{
Q_OBJECT
private slots:
- void initTestCase();
- void cleanupTestCase();
-
void indexOfProperty_data();
void indexOfProperty();
void indexOfMethod_data();
@@ -127,15 +99,7 @@ private slots:
void unconnected();
};
-void tst_qmetaobject::initTestCase()
-{
-}
-
-void tst_qmetaobject::cleanupTestCase()
-{
-}
-
-void tst_qmetaobject::indexOfProperty_data()
+void tst_QMetaObject::indexOfProperty_data()
{
QTest::addColumn<QByteArray>("name");
const QMetaObject *mo = &QTreeView::staticMetaObject;
@@ -145,7 +109,7 @@ void tst_qmetaobject::indexOfProperty_data()
}
}
-void tst_qmetaobject::indexOfProperty()
+void tst_QMetaObject::indexOfProperty()
{
QFETCH(QByteArray, name);
const char *p = name.constData();
@@ -155,7 +119,7 @@ void tst_qmetaobject::indexOfProperty()
}
}
-void tst_qmetaobject::indexOfMethod_data()
+void tst_QMetaObject::indexOfMethod_data()
{
QTest::addColumn<QByteArray>("method");
const QMetaObject *mo = &QTreeView::staticMetaObject;
@@ -166,7 +130,7 @@ void tst_qmetaobject::indexOfMethod_data()
}
}
-void tst_qmetaobject::indexOfMethod()
+void tst_QMetaObject::indexOfMethod()
{
QFETCH(QByteArray, method);
const char *p = method.constData();
@@ -176,7 +140,7 @@ void tst_qmetaobject::indexOfMethod()
}
}
-void tst_qmetaobject::indexOfSignal_data()
+void tst_QMetaObject::indexOfSignal_data()
{
QTest::addColumn<QByteArray>("signal");
const QMetaObject *mo = &QTreeView::staticMetaObject;
@@ -189,7 +153,7 @@ void tst_qmetaobject::indexOfSignal_data()
}
}
-void tst_qmetaobject::indexOfSignal()
+void tst_QMetaObject::indexOfSignal()
{
QFETCH(QByteArray, signal);
const char *p = signal.constData();
@@ -199,7 +163,7 @@ void tst_qmetaobject::indexOfSignal()
}
}
-void tst_qmetaobject::indexOfSlot_data()
+void tst_QMetaObject::indexOfSlot_data()
{
QTest::addColumn<QByteArray>("slot");
const QMetaObject *mo = &QTreeView::staticMetaObject;
@@ -212,7 +176,7 @@ void tst_qmetaobject::indexOfSlot_data()
}
}
-void tst_qmetaobject::indexOfSlot()
+void tst_QMetaObject::indexOfSlot()
{
QFETCH(QByteArray, slot);
const char *p = slot.constData();
@@ -222,7 +186,7 @@ void tst_qmetaobject::indexOfSlot()
}
}
-void tst_qmetaobject::unconnected_data()
+void tst_QMetaObject::unconnected_data()
{
QTest::addColumn<int>("signal_index");
QTest::newRow("signal--9") << 9;
@@ -233,19 +197,20 @@ void tst_qmetaobject::unconnected_data()
QTest::newRow("signal--70") << 70;
}
-void tst_qmetaobject::unconnected()
+void tst_QMetaObject::unconnected()
{
LotsOfSignals *obj = new LotsOfSignals;
QFETCH(int, signal_index);
- QVERIFY(obj->metaObject()->methodCount() == 73);
+ // 74: 70 signals in LotsOfSignals, 2 signals, 1 slot + 1 invokable in QObject
+ QCOMPARE(obj->metaObject()->methodCount(), 74);
void *v;
QBENCHMARK {
- //+1 because QObject has one slot
- QMetaObject::metacall(obj, QMetaObject::InvokeMetaMethod, signal_index+1, &v);
+ // Add two because QObject has one slot and one invokable
+ QMetaObject::metacall(obj, QMetaObject::InvokeMetaMethod, signal_index + 2, &v);
}
delete obj;
}
-QTEST_MAIN(tst_qmetaobject)
+QTEST_MAIN(tst_QMetaObject)
-#include "main.moc"
+#include "tst_bench_qmetaobject.moc"