diff options
Diffstat (limited to 'tests/benchmarks')
8 files changed, 105 insertions, 6 deletions
diff --git a/tests/benchmarks/corelib/io/qfileinfo/main.cpp b/tests/benchmarks/corelib/io/qfileinfo/main.cpp index 5180e7c29e..6cc96777a1 100644 --- a/tests/benchmarks/corelib/io/qfileinfo/main.cpp +++ b/tests/benchmarks/corelib/io/qfileinfo/main.cpp @@ -81,7 +81,7 @@ void qfileinfo::symLinkTargetPerformanceLNK() QString linkTarget; QBENCHMARK { for(int i=0; i<100; i++) - linkTarget = info.readLink(); + linkTarget = info.symLinkTarget(); } QVERIFY(QFile::remove("link.lnk")); } @@ -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); @@ -102,7 +104,7 @@ void qfileinfo::symLinkTargetPerformanceMounpoint() QString linkTarget; QBENCHMARK { for(int i=0; i<100; i++) - linkTarget = info.readLink(); + linkTarget = info.symLinkTarget(); } QVERIFY(QDir().rmdir(mountpoint)); } 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/gui/image/qimageconversion/tst_qimageconversion.cpp b/tests/benchmarks/gui/image/qimageconversion/tst_qimageconversion.cpp index e0f69bee11..605df100ee 100644 --- a/tests/benchmarks/gui/image/qimageconversion/tst_qimageconversion.cpp +++ b/tests/benchmarks/gui/image/qimageconversion/tst_qimageconversion.cpp @@ -200,6 +200,8 @@ void tst_QImageConversion::convertRgb32_data() QTest::newRow("argb32 -> argb8565pm") << argb32 << QImage::Format_ARGB8565_Premultiplied; QTest::newRow("argb32 -> argb4444pm") << argb32 << QImage::Format_ARGB4444_Premultiplied; QTest::newRow("argb32 -> argb6666pm") << argb32 << QImage::Format_ARGB6666_Premultiplied; + QTest::newRow("argb32 -> rgba64") << argb32 << QImage::Format_RGBA64; + QTest::newRow("argb32 -> rgba64pm") << argb32 << QImage::Format_RGBA64_Premultiplied; QTest::newRow("argb32pm -> rgb16") << argb32pm << QImage::Format_RGB16; QTest::newRow("argb32pm -> rgb32") << argb32pm << QImage::Format_RGB32; @@ -239,6 +241,7 @@ void tst_QImageConversion::convertGeneric_data() QImage a2rgb30 = argb32.convertToFormat(QImage::Format_A2RGB30_Premultiplied); QImage rgb666 = rgb32.convertToFormat(QImage::Format_RGB666); QImage argb4444 = argb32.convertToFormat(QImage::Format_ARGB4444_Premultiplied); + QImage rgba64pm = argb32.convertToFormat(QImage::Format_RGBA64_Premultiplied); QTest::newRow("indexed8 -> rgb32") << i8 << QImage::Format_RGB32; QTest::newRow("indexed8 -> argb32") << i8 << QImage::Format_ARGB32; @@ -289,6 +292,13 @@ void tst_QImageConversion::convertGeneric_data() QTest::newRow("argb4444pm -> rgba8888pm") << argb4444 << QImage::Format_RGBA8888_Premultiplied; QTest::newRow("argb4444pm -> rgb30") << argb4444 << QImage::Format_RGB30; QTest::newRow("argb4444pm -> a2bgr30") << argb4444 << QImage::Format_A2BGR30_Premultiplied; + + QTest::newRow("rgba64pm -> argb32") << rgba64pm << QImage::Format_ARGB32; + QTest::newRow("rgba64pm -> rgbx8888") << rgba64pm << QImage::Format_RGBX8888; + QTest::newRow("rgba64pm -> rgba8888pm") << rgba64pm << QImage::Format_RGBA8888_Premultiplied; + QTest::newRow("rgba64pm -> rgb30") << rgba64pm << QImage::Format_RGB30; + QTest::newRow("rgba64pm -> a2bgr30") << rgba64pm << QImage::Format_A2BGR30_Premultiplied; + QTest::newRow("rgba64pm -> rgba64") << rgba64pm << QImage::Format_RGBA64; } void tst_QImageConversion::convertGeneric() 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" |