diff options
Diffstat (limited to 'tests/benchmarks/widgets/itemviews')
11 files changed, 39 insertions, 145 deletions
diff --git a/tests/benchmarks/widgets/itemviews/CMakeLists.txt b/tests/benchmarks/widgets/itemviews/CMakeLists.txt index 76747b527d..33224ca61f 100644 --- a/tests/benchmarks/widgets/itemviews/CMakeLists.txt +++ b/tests/benchmarks/widgets/itemviews/CMakeLists.txt @@ -1,4 +1,5 @@ -# Generated from itemviews.pro. +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause add_subdirectory(qtableview) add_subdirectory(qheaderview) diff --git a/tests/benchmarks/widgets/itemviews/itemviews.pro b/tests/benchmarks/widgets/itemviews/itemviews.pro deleted file mode 100644 index 0c3256f307..0000000000 --- a/tests/benchmarks/widgets/itemviews/itemviews.pro +++ /dev/null @@ -1,5 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS = \ - qtableview \ - qheaderview \ - qlistview diff --git a/tests/benchmarks/widgets/itemviews/qheaderview/CMakeLists.txt b/tests/benchmarks/widgets/itemviews/qheaderview/CMakeLists.txt index 8271ff9df3..ee98e2e8c3 100644 --- a/tests/benchmarks/widgets/itemviews/qheaderview/CMakeLists.txt +++ b/tests/benchmarks/widgets/itemviews/qheaderview/CMakeLists.txt @@ -1,17 +1,15 @@ -# Generated from qheaderview.pro. +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause ##################################################################### ## tst_bench_qheaderview Binary: ##################################################################### -qt_add_benchmark(tst_bench_qheaderview +qt_internal_add_benchmark(tst_bench_qheaderview SOURCES qheaderviewbench.cpp - PUBLIC_LIBRARIES + LIBRARIES Qt::Gui Qt::Test Qt::Widgets ) - -#### Keys ignored in scope 1:.:.:qheaderview.pro:<TRUE>: -# TEMPLATE = "app" diff --git a/tests/benchmarks/widgets/itemviews/qheaderview/qheaderview.pro b/tests/benchmarks/widgets/itemviews/qheaderview/qheaderview.pro deleted file mode 100644 index 7e8415e495..0000000000 --- a/tests/benchmarks/widgets/itemviews/qheaderview/qheaderview.pro +++ /dev/null @@ -1,7 +0,0 @@ -QT += widgets testlib - -TEMPLATE = app -TARGET = tst_bench_qheaderview - -SOURCES += qheaderviewbench.cpp - diff --git a/tests/benchmarks/widgets/itemviews/qheaderview/qheaderviewbench.cpp b/tests/benchmarks/widgets/itemviews/qheaderview/qheaderviewbench.cpp index 49ce060580..f04ca82cdc 100644 --- a/tests/benchmarks/widgets/itemviews/qheaderview/qheaderviewbench.cpp +++ b/tests/benchmarks/widgets/itemviews/qheaderview/qheaderviewbench.cpp @@ -1,32 +1,7 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Thorbjørn Lund Martsum - tmartsum[at]gmail.com -** 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 <QtTest/QtTest> +// Copyright (C) 2012 Thorbjørn Lund Martsum - tmartsum[at]gmail.com +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#include <QTest> #include <QtWidgets/QtWidgets> class BenchQHeaderView : public QObject @@ -126,7 +101,7 @@ void BenchQHeaderView::init() m_model->setData(m_model->index(i, 0), QVariant(i)); s.setNum(i); s += QLatin1Char('.'); - s += 'a' + (i % 25); + s += QLatin1Char('a' + (i % 25)); m_model->setData(m_model->index(i, 1), QVariant(s)); } m_tv->setUpdatesEnabled(m_updatesEnabled); diff --git a/tests/benchmarks/widgets/itemviews/qlistview/CMakeLists.txt b/tests/benchmarks/widgets/itemviews/qlistview/CMakeLists.txt index 0e8dcd01bc..9b40adadb1 100644 --- a/tests/benchmarks/widgets/itemviews/qlistview/CMakeLists.txt +++ b/tests/benchmarks/widgets/itemviews/qlistview/CMakeLists.txt @@ -1,17 +1,15 @@ -# Generated from qlistview.pro. +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause ##################################################################### ## tst_bench_qlistview Binary: ##################################################################### -qt_add_benchmark(tst_bench_qlistview +qt_internal_add_benchmark(tst_bench_qlistview SOURCES tst_qlistview.cpp - PUBLIC_LIBRARIES + LIBRARIES Qt::Gui Qt::Test Qt::Widgets ) - -#### Keys ignored in scope 1:.:.:qlistview.pro:<TRUE>: -# TEMPLATE = "app" diff --git a/tests/benchmarks/widgets/itemviews/qlistview/qlistview.pro b/tests/benchmarks/widgets/itemviews/qlistview/qlistview.pro deleted file mode 100644 index 68537d09ea..0000000000 --- a/tests/benchmarks/widgets/itemviews/qlistview/qlistview.pro +++ /dev/null @@ -1,7 +0,0 @@ -QT += widgets testlib - -TEMPLATE = app -TARGET = tst_bench_qlistview - -SOURCES += tst_qlistview.cpp - diff --git a/tests/benchmarks/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/benchmarks/widgets/itemviews/qlistview/tst_qlistview.cpp index 01496743c2..2e588adc58 100644 --- a/tests/benchmarks/widgets/itemviews/qlistview/tst_qlistview.cpp +++ b/tests/benchmarks/widgets/itemviews/qlistview/tst_qlistview.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <qtest.h> #include <QListView> diff --git a/tests/benchmarks/widgets/itemviews/qtableview/CMakeLists.txt b/tests/benchmarks/widgets/itemviews/qtableview/CMakeLists.txt index 0245ba6d47..aae0f7e4e6 100644 --- a/tests/benchmarks/widgets/itemviews/qtableview/CMakeLists.txt +++ b/tests/benchmarks/widgets/itemviews/qtableview/CMakeLists.txt @@ -1,17 +1,15 @@ -# Generated from qtableview.pro. +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause ##################################################################### ## tst_bench_qtableview Binary: ##################################################################### -qt_add_benchmark(tst_bench_qtableview +qt_internal_add_benchmark(tst_bench_qtableview SOURCES tst_qtableview.cpp - PUBLIC_LIBRARIES + LIBRARIES Qt::Gui Qt::Test Qt::Widgets ) - -#### Keys ignored in scope 1:.:.:qtableview.pro:<TRUE>: -# TEMPLATE = "app" diff --git a/tests/benchmarks/widgets/itemviews/qtableview/qtableview.pro b/tests/benchmarks/widgets/itemviews/qtableview/qtableview.pro deleted file mode 100644 index bd2306d646..0000000000 --- a/tests/benchmarks/widgets/itemviews/qtableview/qtableview.pro +++ /dev/null @@ -1,7 +0,0 @@ -QT += widgets testlib - -TEMPLATE = app -TARGET = tst_bench_qtableview - -SOURCES += tst_qtableview.cpp - diff --git a/tests/benchmarks/widgets/itemviews/qtableview/tst_qtableview.cpp b/tests/benchmarks/widgets/itemviews/qtableview/tst_qtableview.cpp index 858d8a4ff8..e625066800 100644 --- a/tests/benchmarks/widgets/itemviews/qtableview/tst_qtableview.cpp +++ b/tests/benchmarks/widgets/itemviews/qtableview/tst_qtableview.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** 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 <qtest.h> #include <QDebug> @@ -40,16 +15,16 @@ class QtTestTableModel: public QAbstractTableModel public: - QtTestTableModel(int rows = 0, int columns = 0, QObject *parent = 0) + QtTestTableModel(int rows = 0, int columns = 0, QObject *parent = nullptr) : QAbstractTableModel(parent), row_count(rows), column_count(columns) {} - int rowCount(const QModelIndex& = QModelIndex()) const { return row_count; } - int columnCount(const QModelIndex& = QModelIndex()) const { return column_count; } + int rowCount(const QModelIndex & = QModelIndex()) const override { return row_count; } + int columnCount(const QModelIndex & = QModelIndex()) const override { return column_count; } bool isEditable(const QModelIndex &) const { return true; } - QVariant data(const QModelIndex &idx, int role) const + QVariant data(const QModelIndex &idx, int role) const override { if (!idx.isValid() || idx.row() >= row_count || idx.column() >= column_count) { qWarning() << "Invalid modelIndex [%d,%d,%p]" << idx; @@ -62,7 +37,7 @@ public: return QVariant(); } - bool insertRows(int start, int count, const QModelIndex &parent = QModelIndex()) + bool insertRows(int start, int count, const QModelIndex &parent = QModelIndex()) override { if (start < 0 || start > row_count) return false; @@ -73,7 +48,7 @@ public: return true; } - bool removeRows(int start, int count, const QModelIndex &parent = QModelIndex()) + bool removeRows(int start, int count, const QModelIndex &parent = QModelIndex()) override { if (start < 0 || start >= row_count || row_count < count) return false; @@ -84,7 +59,7 @@ public: return true; } - bool insertColumns(int start, int count, const QModelIndex &parent = QModelIndex()) + bool insertColumns(int start, int count, const QModelIndex &parent = QModelIndex()) override { if (start < 0 || start > column_count) return false; @@ -95,7 +70,7 @@ public: return true; } - bool removeColumns(int start, int count, const QModelIndex &parent = QModelIndex()) + bool removeColumns(int start, int count, const QModelIndex &parent = QModelIndex()) override { if (start < 0 || start >= column_count || column_count < count) return false; @@ -258,13 +233,13 @@ void tst_QTableView::rowInsertion_data() void tst_QTableView::rowInsertion() { - QFETCH(SpanList, spans); + QFETCH(const SpanList, spans); QtTestTableModel model(10, 10); QTableView view; view.setModel(&model); - foreach (QRect span, spans) + for (QRect span : spans) view.setSpan(span.top(), span.left(), span.height(), span.width()); view.show(); QTest::qWait(50); @@ -284,13 +259,13 @@ void tst_QTableView::rowRemoval_data() void tst_QTableView::rowRemoval() { - QFETCH(SpanList, spans); + QFETCH(const SpanList, spans); QtTestTableModel model(10, 10); QTableView view; view.setModel(&model); - foreach (QRect span, spans) + for (QRect span : spans) view.setSpan(span.top(), span.left(), span.height(), span.width()); view.show(); QTest::qWait(50); @@ -307,14 +282,14 @@ void tst_QTableView::columnInsertion_data() void tst_QTableView::columnInsertion() { - QFETCH(SpanList, spans); + QFETCH(const SpanList, spans); QtTestTableModel model(10, 10); QTableView view; view.setModel(&model); // Same set as for rowInsertion, just swapping columns and rows. - foreach (QRect span, spans) + for (QRect span : spans) view.setSpan(span.left(), span.top(), span.width(), span.height()); view.show(); QTest::qWait(50); @@ -334,14 +309,14 @@ void tst_QTableView::columnRemoval_data() void tst_QTableView::columnRemoval() { - QFETCH(SpanList, spans); + QFETCH(const SpanList, spans); QtTestTableModel model(10, 10); QTableView view; view.setModel(&model); // Same set as for rowRemoval, just swapping columns and rows. - foreach (QRect span, spans) + for (QRect span : spans) view.setSpan(span.left(), span.top(), span.width(), span.height()); view.show(); QTest::qWait(50); |