diff options
Diffstat (limited to 'tests/benchmarks/corelib/itemmodels/qsortfilterproxymodel/tst_bench_qsortfilterproxymodel.cpp')
-rw-r--r-- | tests/benchmarks/corelib/itemmodels/qsortfilterproxymodel/tst_bench_qsortfilterproxymodel.cpp | 45 |
1 files changed, 17 insertions, 28 deletions
diff --git a/tests/benchmarks/corelib/itemmodels/qsortfilterproxymodel/tst_bench_qsortfilterproxymodel.cpp b/tests/benchmarks/corelib/itemmodels/qsortfilterproxymodel/tst_bench_qsortfilterproxymodel.cpp index 7c641a42ae..0411972ce3 100644 --- a/tests/benchmarks/corelib/itemmodels/qsortfilterproxymodel/tst_bench_qsortfilterproxymodel.cpp +++ b/tests/benchmarks/corelib/itemmodels/qsortfilterproxymodel/tst_bench_qsortfilterproxymodel.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 Igor Kushnir <igorkuo@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$ -** -****************************************************************************/ +// Copyright (C) 2021 Igor Kushnir <igorkuo@gmail.com> +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QSortFilterProxyModel> #include <QString> @@ -56,6 +31,7 @@ class tst_QSortFilterProxyModel : public QObject private slots: void clearFilter_data(); void clearFilter(); + void setSourceModel(); private: QStringList m_numberList; ///< Cache the strings for efficiency. @@ -97,7 +73,7 @@ void tst_QSortFilterProxyModel::clearFilter() { QFETCH(const int, itemCount); resizeNumberList(m_numberList, itemCount); - QStringListModel model(qAsConst(m_numberList)); + QStringListModel model(std::as_const(m_numberList)); QCOMPARE(model.rowCount(), itemCount); QSortFilterProxyModel proxy; @@ -118,6 +94,19 @@ void tst_QSortFilterProxyModel::clearFilter() QCOMPARE(proxy.rowCount(), itemCount); } +void tst_QSortFilterProxyModel::setSourceModel() +{ + QStringListModel model1; + QStringListModel model2; + + QSortFilterProxyModel proxy; + + QBENCHMARK { + proxy.setSourceModel(&model1); + proxy.setSourceModel(&model2); + } +} + QTEST_MAIN(tst_QSortFilterProxyModel) #include "tst_bench_qsortfilterproxymodel.moc" |