summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'tests/benchmarks/corelib')
-rw-r--r--tests/benchmarks/corelib/CMakeLists.txt4
-rw-r--r--tests/benchmarks/corelib/itemmodels/CMakeLists.txt5
-rw-r--r--tests/benchmarks/corelib/thread/CMakeLists.txt4
-rw-r--r--tests/benchmarks/corelib/time/qdate/tst_bench_qdate.cpp27
4 files changed, 37 insertions, 3 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/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"