summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks
diff options
context:
space:
mode:
Diffstat (limited to 'tests/benchmarks')
-rw-r--r--tests/benchmarks/corelib/io/qfileinfo/main.cpp4
-rw-r--r--tests/benchmarks/corelib/io/qtextstream/qtextstream.pro2
-rw-r--r--tests/benchmarks/corelib/mimetypes/qmimedatabase/main.cpp11
-rw-r--r--tests/benchmarks/corelib/tools/qmap/qmap.pro2
-rw-r--r--tests/benchmarks/widgets/itemviews/itemviews.pro3
-rw-r--r--tests/benchmarks/widgets/itemviews/qlistview/qlistview.pro7
-rw-r--r--tests/benchmarks/widgets/itemviews/qlistview/tst_qlistview.cpp68
7 files changed, 93 insertions, 4 deletions
diff --git a/tests/benchmarks/corelib/io/qfileinfo/main.cpp b/tests/benchmarks/corelib/io/qfileinfo/main.cpp
index 5180e7c29e..104c01d118 100644
--- a/tests/benchmarks/corelib/io/qfileinfo/main.cpp
+++ b/tests/benchmarks/corelib/io/qfileinfo/main.cpp
@@ -94,7 +94,9 @@ void qfileinfo::symLinkTargetPerformanceMounpoint()
QString rootVolume = QString::fromWCharArray(buffer);
QString mountpoint = "mountpoint";
rootVolume.replace("\\\\?\\","\\??\\");
- FileSystem::createNtfsJunction(rootVolume, mountpoint);
+ QString errorMessage;
+ QVERIFY2(FileSystem::createNtfsJunction(rootVolume, mountpoint, &errorMessage) == ERROR_SUCCESS,
+ qPrintable(errorMessage));
QFileInfo info(mountpoint);
info.setCaching(false);
diff --git a/tests/benchmarks/corelib/io/qtextstream/qtextstream.pro b/tests/benchmarks/corelib/io/qtextstream/qtextstream.pro
index 758930c139..e8170319f2 100644
--- a/tests/benchmarks/corelib/io/qtextstream/qtextstream.pro
+++ b/tests/benchmarks/corelib/io/qtextstream/qtextstream.pro
@@ -1,5 +1,5 @@
TEMPLATE = app
-TARGET = tst_bench_qtemporaryfile
+TARGET = tst_bench_qtextstream
QT = core testlib
diff --git a/tests/benchmarks/corelib/mimetypes/qmimedatabase/main.cpp b/tests/benchmarks/corelib/mimetypes/qmimedatabase/main.cpp
index 704119b921..1b432f3b3e 100644
--- a/tests/benchmarks/corelib/mimetypes/qmimedatabase/main.cpp
+++ b/tests/benchmarks/corelib/mimetypes/qmimedatabase/main.cpp
@@ -35,6 +35,7 @@ class tst_QMimeDatabase: public QObject
private slots:
void inheritsPerformance();
+ void benchMimeTypeForName();
};
void tst_QMimeDatabase::inheritsPerformance()
@@ -70,5 +71,15 @@ void tst_QMimeDatabase::inheritsPerformance()
// parsing XML, and then keeps being around 4.5 MB for all the in-memory hashes.
}
+void tst_QMimeDatabase::benchMimeTypeForName()
+{
+ QMimeDatabase db;
+
+ QBENCHMARK {
+ const auto s = db.mimeTypeForName(QStringLiteral("text/plain"));
+ QVERIFY(s.isValid());
+ }
+}
+
QTEST_MAIN(tst_QMimeDatabase)
#include "main.moc"
diff --git a/tests/benchmarks/corelib/tools/qmap/qmap.pro b/tests/benchmarks/corelib/tools/qmap/qmap.pro
index 6a0c8d62bd..6c9bf5e8d6 100644
--- a/tests/benchmarks/corelib/tools/qmap/qmap.pro
+++ b/tests/benchmarks/corelib/tools/qmap/qmap.pro
@@ -1,4 +1,4 @@
-TARGET = tst_qmap
+TARGET = tst_bench_qmap
QT = core testlib
INCLUDEPATH += .
SOURCES += main.cpp
diff --git a/tests/benchmarks/widgets/itemviews/itemviews.pro b/tests/benchmarks/widgets/itemviews/itemviews.pro
index a23cdf7b97..0c3256f307 100644
--- a/tests/benchmarks/widgets/itemviews/itemviews.pro
+++ b/tests/benchmarks/widgets/itemviews/itemviews.pro
@@ -1,4 +1,5 @@
TEMPLATE = subdirs
SUBDIRS = \
qtableview \
- qheaderview
+ qheaderview \
+ qlistview
diff --git a/tests/benchmarks/widgets/itemviews/qlistview/qlistview.pro b/tests/benchmarks/widgets/itemviews/qlistview/qlistview.pro
new file mode 100644
index 0000000000..68537d09ea
--- /dev/null
+++ b/tests/benchmarks/widgets/itemviews/qlistview/qlistview.pro
@@ -0,0 +1,7 @@
+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
new file mode 100644
index 0000000000..01496743c2
--- /dev/null
+++ b/tests/benchmarks/widgets/itemviews/qlistview/tst_qlistview.cpp
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QListView>
+#include <QStandardItemModel>
+
+
+class tst_QListView : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QListView() = default;
+ virtual ~tst_QListView() = default;
+
+private slots:
+ void benchSetCurrentIndex();
+};
+
+void tst_QListView::benchSetCurrentIndex()
+{
+ QStandardItemModel sm(50000, 1);
+ QListView lv;
+ lv.setModel(&sm);
+ const int rc = lv.model()->rowCount();
+ for (int i = 0; i < rc; i+= 100)
+ lv.setRowHidden(i, true);
+ lv.setCurrentIndex(lv.model()->index(0, 0, QModelIndex()));
+ lv.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&lv));
+
+ QBENCHMARK_ONCE {
+ while (lv.currentIndex().row() < rc - 20)
+ lv.setCurrentIndex(lv.model()->index(lv.currentIndex().row() + 17,
+ lv.currentIndex().column(),
+ QModelIndex()));
+ }
+}
+
+
+QTEST_MAIN(tst_QListView)
+#include "tst_qlistview.moc"