summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks/gui/kernel
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2018-03-22 10:47:02 +0100
committerChristian Ehrlicher <ch.ehrlicher@gmx.de>2018-03-27 16:50:44 +0000
commit3c4ea1b3c662d17b4b82a55a4b10e50226dbb14f (patch)
treea2ca9e32253876baea3da909b6744e0c0c8cde89 /tests/benchmarks/gui/kernel
parente3fa4af68ecf50c3d32e576b4b05bfefecd18c1b (diff)
Benchmark: move widgets benchmarks still in gui subdirectory to widgets
Move all widget-dependent benchmarks which were still in gui subdirectory to widgets Task-number: QTBUG-23129 Change-Id: I1359f1ea4036cacdfdbe08ff9ecdf1e2c75a005b Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'tests/benchmarks/gui/kernel')
-rw-r--r--tests/benchmarks/gui/kernel/kernel.pro4
-rw-r--r--tests/benchmarks/gui/kernel/qapplication/main.cpp58
-rw-r--r--tests/benchmarks/gui/kernel/qapplication/qapplication.pro8
-rw-r--r--tests/benchmarks/gui/kernel/qwidget/qwidget.pro4
-rw-r--r--tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp243
5 files changed, 1 insertions, 316 deletions
diff --git a/tests/benchmarks/gui/kernel/kernel.pro b/tests/benchmarks/gui/kernel/kernel.pro
index 607e58b6c0..acc6dc402d 100644
--- a/tests/benchmarks/gui/kernel/kernel.pro
+++ b/tests/benchmarks/gui/kernel/kernel.pro
@@ -1,6 +1,4 @@
TEMPLATE = subdirs
-qtHaveModule(widgets): SUBDIRS = \
- qapplication \
- qwidget \
+SUBDIRS = \
qguimetatype \
qguivariant
diff --git a/tests/benchmarks/gui/kernel/qapplication/main.cpp b/tests/benchmarks/gui/kernel/qapplication/main.cpp
deleted file mode 100644
index 49de765ef0..0000000000
--- a/tests/benchmarks/gui/kernel/qapplication/main.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-#include <QApplication>
-
-#include <qtest.h>
-
-
-class tst_qapplication : public QObject
-{
- Q_OBJECT
-private slots:
- void ctor();
-};
-
-/*
- Test the performance of the QApplication constructor.
-
- Note: results from the second start on can be misleading,
- since all global statics are already initialized.
-*/
-void tst_qapplication::ctor()
-{
- // simulate reasonable argc, argv
- int argc = 1;
- char *argv[] = { const_cast<char*>("tst_qapplication") };
- QBENCHMARK {
- QApplication app(argc, argv);
- }
-}
-
-QTEST_APPLESS_MAIN(tst_qapplication)
-
-#include "main.moc"
diff --git a/tests/benchmarks/gui/kernel/qapplication/qapplication.pro b/tests/benchmarks/gui/kernel/qapplication/qapplication.pro
deleted file mode 100644
index 86a016d42e..0000000000
--- a/tests/benchmarks/gui/kernel/qapplication/qapplication.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-QT += widgets testlib
-
-TEMPLATE = app
-TARGET = tst_bench_qapplication
-
-CONFIG += release
-
-SOURCES += main.cpp
diff --git a/tests/benchmarks/gui/kernel/qwidget/qwidget.pro b/tests/benchmarks/gui/kernel/qwidget/qwidget.pro
deleted file mode 100644
index 758c9c5b98..0000000000
--- a/tests/benchmarks/gui/kernel/qwidget/qwidget.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-QT += widgets testlib
-
-TARGET = tst_bench_qwidget
-SOURCES += tst_qwidget.cpp
diff --git a/tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp b/tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp
deleted file mode 100644
index b9af7a55cd..0000000000
--- a/tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp
+++ /dev/null
@@ -1,243 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#include <qtest.h>
-
-#include <QtWidgets/QLayout>
-#include <QtGui/QPainter>
-
-static void processEvents()
-{
- QApplication::processEvents();
- QApplication::processEvents();
-}
-
-class UpdateWidget : public QWidget
-{
-public:
- UpdateWidget(int rows, int columns)
- : QWidget(0), rowCount(0), columnCount(0), opaqueChildren(false)
- {
- fill(rows, columns);
- }
-
- UpdateWidget(QWidget *parent = 0)
- : QWidget(parent), rowCount(0), columnCount(0), opaqueChildren(false) {}
-
- void fill(int rows, int columns)
- {
- if (rows == rowCount && columns == columnCount)
- return;
- delete layout();
- QGridLayout *layout = new QGridLayout;
- rowCount = rows;
- columnCount = columns;
- for (int row = 0; row < rowCount; ++row) {
- for (int column = 0; column < columnCount; ++column) {
- UpdateWidget *widget = new UpdateWidget;
- widget->setFixedSize(20, 20);
- layout->addWidget(widget, row, column);
- children.append(widget);
- }
- }
- setLayout(layout);
- adjustSize();
- QTest::qWait(250);
- processEvents();
- }
-
- void setOpaqueChildren(bool enable)
- {
- if (opaqueChildren != enable) {
- foreach (QWidget *w, children)
- w->setAttribute(Qt::WA_OpaquePaintEvent, enable);
- opaqueChildren = enable;
- processEvents();
- }
- }
-
- void paintEvent(QPaintEvent *)
- {
- static int color = Qt::black;
-
- QPainter painter(this);
- painter.fillRect(rect(), Qt::GlobalColor(color));
-
- if (++color > Qt::darkYellow)
- color = Qt::black;
- }
-
- QRegion updateRegion;
- QList<UpdateWidget*> children;
- int rowCount;
- int columnCount;
- bool opaqueChildren;
-};
-
-class tst_QWidget : public QObject
-{
- Q_OBJECT
-
-public slots:
- void initTestCase();
- void init();
-
-private slots:
- void update_data();
- void update();
- void updatePartial_data();
- void updatePartial();
- void updateComplex_data();
- void updateComplex();
-
-private:
- UpdateWidget widget;
-};
-
-void tst_QWidget::initTestCase()
-{
- widget.show();
- QVERIFY(QTest::qWaitForWindowExposed(&widget));
- QTest::qWait(300);
- processEvents();
-}
-
-void tst_QWidget::init()
-{
- QVERIFY(widget.isVisible());
- for (int i = 0; i < 3; ++i)
- processEvents();
-}
-
-void tst_QWidget::update_data()
-{
- QTest::addColumn<int>("rows");
- QTest::addColumn<int>("columns");
- QTest::addColumn<int>("numUpdates");
- QTest::addColumn<bool>("opaque");
-
- QTest::newRow("10x10x1 transparent") << 10 << 10 << 1 << false;
- QTest::newRow("10x10x10 transparent") << 10 << 10 << 10 << false;
- QTest::newRow("10x10x100 transparent") << 10 << 10 << 100 << false;
- QTest::newRow("10x10x1 opaque") << 10 << 10 << 1 << true;
- QTest::newRow("10x10x10 opaque") << 10 << 10 << 10 << true;
- QTest::newRow("10x10x100 opaque") << 10 << 10 << 100 << true;
- QTest::newRow("25x25x1 transparent ") << 25 << 25 << 1 << false;
- QTest::newRow("25x25x10 transparent") << 25 << 25 << 10 << false;
- QTest::newRow("25x25x100 transparent") << 25 << 25 << 100 << false;
- QTest::newRow("25x25x1 opaque") << 25 << 25 << 1 << true;
- QTest::newRow("25x25x10 opaque") << 25 << 25 << 10 << true;
- QTest::newRow("25x25x100 opaque") << 25 << 25 << 100 << true;
-}
-
-void tst_QWidget::update()
-{
- QFETCH(int, rows);
- QFETCH(int, columns);
- QFETCH(int, numUpdates);
- QFETCH(bool, opaque);
-
- widget.fill(rows, columns);
- widget.setOpaqueChildren(opaque);
-
- QBENCHMARK {
- for (int i = 0; i < widget.children.size(); ++i) {
- for (int j = 0; j < numUpdates; ++j)
- widget.children.at(i)->update();
- QApplication::processEvents();
- }
- }
-
- QApplication::processEvents();
-}
-
-void tst_QWidget::updatePartial_data()
-{
- update_data();
-}
-
-void tst_QWidget::updatePartial()
-{
- QFETCH(int, rows);
- QFETCH(int, columns);
- QFETCH(int, numUpdates);
- QFETCH(bool, opaque);
-
- widget.fill(rows, columns);
- widget.setOpaqueChildren(opaque);
-
- QBENCHMARK {
- for (int i = 0; i < widget.children.size(); ++i) {
- QWidget *w = widget.children[i];
- const int x = w->width() / 2;
- const int y = w->height() / 2;
- for (int j = 0; j < numUpdates; ++j) {
- w->update(0, 0, x, y);
- w->update(x, 0, x, y);
- w->update(0, y, x, y);
- w->update(x, y, x, y);
- }
- QApplication::processEvents();
- }
- }
-}
-
-void tst_QWidget::updateComplex_data()
-{
- update_data();
-}
-
-void tst_QWidget::updateComplex()
-{
- QFETCH(int, rows);
- QFETCH(int, columns);
- QFETCH(int, numUpdates);
- QFETCH(bool, opaque);
-
- widget.fill(rows, columns);
- widget.setOpaqueChildren(opaque);
-
- QBENCHMARK {
- for (int i = 0; i < widget.children.size(); ++i) {
- QWidget *w = widget.children[i];
- const int x = w->width() / 2;
- const int y = w->height() / 2;
- QRegion r1(0, 0, x, y, QRegion::Ellipse);
- QRegion r2(x, y, x, y, QRegion::Ellipse);
- for (int j = 0; j < numUpdates; ++j) {
- w->update(r1);
- w->update(r2);
- }
- QApplication::processEvents();
- }
- }
-}
-
-QTEST_MAIN(tst_QWidget)
-
-#include "tst_qwidget.moc"