diff options
Diffstat (limited to 'tests/benchmarks')
9 files changed, 108 insertions, 10 deletions
diff --git a/tests/benchmarks/corelib/CMakeLists.txt b/tests/benchmarks/corelib/CMakeLists.txt index 855e7ee2fa..890cbcfc6b 100644 --- a/tests/benchmarks/corelib/CMakeLists.txt +++ b/tests/benchmarks/corelib/CMakeLists.txt @@ -4,7 +4,9 @@ add_subdirectory(io) add_subdirectory(itemmodels) add_subdirectory(json) -add_subdirectory(mimetypes) +if(QT_FEATURE_mimetype) + add_subdirectory(mimetypes) +endif() add_subdirectory(kernel) add_subdirectory(text) add_subdirectory(thread) diff --git a/tests/benchmarks/corelib/io/qdiriterator/tst_bench_qdiriterator.cpp b/tests/benchmarks/corelib/io/qdiriterator/tst_bench_qdiriterator.cpp index d97cb5cc75..66448bf838 100644 --- a/tests/benchmarks/corelib/io/qdiriterator/tst_bench_qdiriterator.cpp +++ b/tests/benchmarks/corelib/io/qdiriterator/tst_bench_qdiriterator.cpp @@ -269,8 +269,7 @@ void tst_QDirIterator::stdRecursiveDirectoryIterator() // than the other methods in this source file. QBENCHMARK { int c = 0; - for (const auto &dirEntry : fs::recursive_directory_iterator( - dirpath.data(), fs::directory_options::skip_permission_denied, ec)) { + for (const auto &dirEntry : fs::recursive_directory_iterator(dirpath.data(), ec)) { if (dirEntry.is_directory()) continue; c++; diff --git a/tests/benchmarks/corelib/itemmodels/CMakeLists.txt b/tests/benchmarks/corelib/itemmodels/CMakeLists.txt index c74f36709c..cff884ebcc 100644 --- a/tests/benchmarks/corelib/itemmodels/CMakeLists.txt +++ b/tests/benchmarks/corelib/itemmodels/CMakeLists.txt @@ -1 +1,4 @@ -add_subdirectory(qsortfilterproxymodel) + +if(QT_FEATURE_proxymodel) + add_subdirectory(qsortfilterproxymodel) +endif() diff --git a/tests/benchmarks/corelib/thread/CMakeLists.txt b/tests/benchmarks/corelib/thread/CMakeLists.txt index 48bf0572a6..fd7cbe6117 100644 --- a/tests/benchmarks/corelib/thread/CMakeLists.txt +++ b/tests/benchmarks/corelib/thread/CMakeLists.txt @@ -1,7 +1,9 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: BSD-3-Clause -add_subdirectory(qfuture) +if(QT_FEATURE_future) + add_subdirectory(qfuture) +endif() add_subdirectory(qmutex) add_subdirectory(qreadwritelock) add_subdirectory(qthreadstorage) diff --git a/tests/benchmarks/corelib/time/qdate/tst_bench_qdate.cpp b/tests/benchmarks/corelib/time/qdate/tst_bench_qdate.cpp index 581c300d36..7dde3bf426 100644 --- a/tests/benchmarks/corelib/time/qdate/tst_bench_qdate.cpp +++ b/tests/benchmarks/corelib/time/qdate/tst_bench_qdate.cpp @@ -4,6 +4,7 @@ #include <QDate> #include <QTest> #include <QList> +using namespace Qt::StringLiterals; class tst_QDate : public QObject { @@ -33,6 +34,9 @@ private Q_SLOTS: void addDays(); void addMonths(); void addYears(); + + void fromString_data(); + void fromString(); }; QList<QDate> tst_QDate::daily(qint64 start, qint64 end) @@ -184,5 +188,28 @@ void tst_QDate::addYears() Q_UNUSED(store); } +void tst_QDate::fromString_data() +{ + QTest::addColumn<QString>("string"); + QTest::addColumn<QString>("format"); + QTest::addColumn<int>("baseYear"); + + QTest::newRow("yyyyMMdd") << u"20240412"_s << u"yyyyMMdd"_s << 2000; + QTest::newRow("yyyy-MM-dd") << u"2024-04-12"_s << u"yyyy-MM-dd"_s << 2000; + QTest::newRow("YYYYMMDD") << u"20240412"_s << u"YYYYMMDD"_s << 2000; // Invalid, QTBUG-124465. +} + +void tst_QDate::fromString() +{ + QFETCH(const QString, string); + QFETCH(const QString, format); + QFETCH(const int, baseYear); + QDate date; + QBENCHMARK { + date = QDate::fromString(string, format, baseYear); + } + Q_UNUSED(date); +} + QTEST_MAIN(tst_QDate) #include "tst_bench_qdate.moc" diff --git a/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp b/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp index e100f63e34..7954e964b3 100644 --- a/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp +++ b/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp @@ -197,6 +197,9 @@ private slots: void drawTransformedSemiTransparentImage(); void drawTransformedFilledImage(); + void drawPathExceedingDevice_data(); + void drawPathExceedingDevice(); + private: void setupBrushes(); void createPrimitives(); @@ -1661,6 +1664,56 @@ void tst_QPainter::drawTransformedFilledImage() } } +void tst_QPainter::drawPathExceedingDevice_data() +{ + QTest::addColumn<int>("dim"); + QTest::addColumn<QPainterPath>("path"); + + const int dim = 512; + QPainterPath p; + const int ext = 10 * dim; + for (int i = 0; i < ext; i += (ext / 50)) { + p.lineTo(ext, i); + p.lineTo(0, dim); + p.moveTo(0, 0); + } + + { + QPainterPath preClip; + preClip.addRect(0, 0, dim, dim); + QTest::newRow("devicesize") << dim << p.intersected(preClip); + } + + { + QPainterPath preClip; + preClip.addRect(0, 0, 2*dim, 2*dim); + QTest::newRow("devicesizex2") << dim << p.intersected(preClip); + } + + { + QPainterPath preClip; + preClip.addRect(0, 0, 5*dim, 5*dim); + QTest::newRow("devicesizex5") << dim << p.intersected(preClip); + } + + QTest::newRow("devicesizex10") << dim << p; +} + +void tst_QPainter::drawPathExceedingDevice() +{ + QFETCH(int, dim); + QFETCH(QPainterPath, path); + + QImage img(dim, dim, QImage::Format_RGB32); + QPainter p(&img); + p.setRenderHint(QPainter::Antialiasing); + p.setPen(QPen(Qt::black, 3)); + p.setBrush(Qt::NoBrush); + + QBENCHMARK { + p.drawPath(path); + } +} QTEST_MAIN(tst_QPainter) diff --git a/tests/benchmarks/gui/text/qtext/main.cpp b/tests/benchmarks/gui/text/qtext/main.cpp index 121bc43573..9a2740253c 100644 --- a/tests/benchmarks/gui/text/qtext/main.cpp +++ b/tests/benchmarks/gui/text/qtext/main.cpp @@ -25,7 +25,9 @@ public: private slots: void loadHtml_data(); +#ifndef QT_NO_TEXTHTMLPARSER void loadHtml(); +#endif void shaping_data(); void shaping(); @@ -47,9 +49,11 @@ private slots: void paintLayoutToPixmap(); void paintLayoutToPixmap_painterFill(); +#ifndef QT_NO_TEXTHTMLPARSER void document(); void paintDocToPixmap(); void paintDocToPixmap_painterFill(); +#endif private: QSize setupTextLayout(QTextLayout *layout, bool wrap = true, int wrapWidth = 100); @@ -76,6 +80,7 @@ void tst_QText::loadHtml_data() + parag; } +#ifndef QT_NO_TEXTHTMLPARSER void tst_QText::loadHtml() { QFETCH(QString, source); @@ -84,6 +89,7 @@ void tst_QText::loadHtml() doc.setHtml(source); } } +#endif void tst_QText::shaping_data() { @@ -371,6 +377,7 @@ void tst_QText::paintLayoutToPixmap_painterFill() } } +#ifndef QT_NO_TEXTHTMLPARSER void tst_QText::document() { QTextDocument *doc = new QTextDocument; @@ -413,6 +420,7 @@ void tst_QText::paintDocToPixmap_painterFill() doc->drawContents(&p); } } +#endif QTEST_MAIN(tst_QText) diff --git a/tests/benchmarks/network/access/CMakeLists.txt b/tests/benchmarks/network/access/CMakeLists.txt index bc085cad61..bc5148af55 100644 --- a/tests/benchmarks/network/access/CMakeLists.txt +++ b/tests/benchmarks/network/access/CMakeLists.txt @@ -4,8 +4,10 @@ add_subdirectory(qfile_vs_qnetworkaccessmanager) add_subdirectory(qhttpheaders) add_subdirectory(qnetworkreply) -add_subdirectory(qnetworkreply_from_cache) -add_subdirectory(qnetworkdiskcache) +if(QT_FEATURE_networkdiskcache) + add_subdirectory(qnetworkreply_from_cache) + add_subdirectory(qnetworkdiskcache) +endif() if(QT_FEATURE_private_tests) add_subdirectory(qdecompresshelper) endif() diff --git a/tests/benchmarks/network/socket/CMakeLists.txt b/tests/benchmarks/network/socket/CMakeLists.txt index 034f618737..d60f60a972 100644 --- a/tests/benchmarks/network/socket/CMakeLists.txt +++ b/tests/benchmarks/network/socket/CMakeLists.txt @@ -1,6 +1,8 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: BSD-3-Clause -add_subdirectory(qlocalsocket) -add_subdirectory(qtcpserver) -add_subdirectory(qudpsocket) +if(QT_FEATURE_localserver) + add_subdirectory(qlocalsocket) + add_subdirectory(qtcpserver) + add_subdirectory(qudpsocket) +endif() |