summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks
diff options
context:
space:
mode:
Diffstat (limited to 'tests/benchmarks')
-rw-r--r--tests/benchmarks/corelib/corelib.pro2
-rw-r--r--tests/benchmarks/corelib/io/qdiriterator/main.cpp24
-rw-r--r--tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp5
-rw-r--r--tests/benchmarks/corelib/kernel/kernel.pro3
-rw-r--r--tests/benchmarks/corelib/kernel/qtimer_vs_qmetaobject/tst_qtimer_vs_qmetaobject.cpp88
-rw-r--r--tests/benchmarks/corelib/text/qbytearray/main.cpp (renamed from tests/benchmarks/corelib/tools/qbytearray/main.cpp)0
-rw-r--r--tests/benchmarks/corelib/text/qbytearray/qbytearray.pro (renamed from tests/benchmarks/corelib/tools/qbytearray/qbytearray.pro)0
-rw-r--r--tests/benchmarks/corelib/text/qchar/main.cpp (renamed from tests/benchmarks/corelib/tools/qchar/main.cpp)0
-rw-r--r--tests/benchmarks/corelib/text/qchar/qchar.pro (renamed from tests/benchmarks/corelib/tools/qchar/qchar.pro)0
-rw-r--r--tests/benchmarks/corelib/text/qlocale/main.cpp (renamed from tests/benchmarks/corelib/tools/qlocale/main.cpp)0
-rw-r--r--tests/benchmarks/corelib/text/qlocale/qlocale.pro (renamed from tests/benchmarks/corelib/tools/qlocale/qlocale.pro)0
-rw-r--r--tests/benchmarks/corelib/text/qregexp/main.cpp (renamed from tests/benchmarks/corelib/tools/qregexp/main.cpp)0
-rw-r--r--tests/benchmarks/corelib/text/qregexp/qregexp.pro (renamed from tests/benchmarks/corelib/tools/qregexp/qregexp.pro)0
-rw-r--r--tests/benchmarks/corelib/text/qregexp/qregexp.qrc (renamed from tests/benchmarks/corelib/tools/qregexp/qregexp.qrc)0
-rw-r--r--tests/benchmarks/corelib/text/qstring/main.cpp (renamed from tests/benchmarks/corelib/tools/qstring/main.cpp)0
-rw-r--r--tests/benchmarks/corelib/text/qstring/qstring.pro (renamed from tests/benchmarks/corelib/tools/qstring/qstring.pro)0
-rw-r--r--tests/benchmarks/corelib/text/qstringbuilder/main.cpp (renamed from tests/benchmarks/corelib/tools/qstringbuilder/main.cpp)2
-rw-r--r--tests/benchmarks/corelib/text/qstringbuilder/qstringbuilder.pro (renamed from tests/benchmarks/corelib/tools/qstringbuilder/qstringbuilder.pro)0
-rw-r--r--tests/benchmarks/corelib/text/qstringlist/.gitignore (renamed from tests/benchmarks/corelib/tools/qstringlist/.gitignore)0
-rw-r--r--tests/benchmarks/corelib/text/qstringlist/main.cpp (renamed from tests/benchmarks/corelib/tools/qstringlist/main.cpp)0
-rw-r--r--tests/benchmarks/corelib/text/qstringlist/qstringlist.pro (renamed from tests/benchmarks/corelib/tools/qstringlist/qstringlist.pro)0
-rw-r--r--tests/benchmarks/corelib/text/text.pro10
-rw-r--r--tests/benchmarks/corelib/time/qdate/qdate.pro4
-rw-r--r--tests/benchmarks/corelib/time/qdate/tst_bench_qdate.cpp53
-rw-r--r--tests/benchmarks/corelib/time/qdatetime/main.cpp (renamed from tests/benchmarks/corelib/tools/qdatetime/main.cpp)5
-rw-r--r--tests/benchmarks/corelib/time/qdatetime/qdatetime.pro (renamed from tests/benchmarks/corelib/tools/qdatetime/qdatetime.pro)0
-rw-r--r--tests/benchmarks/corelib/time/qtimezone/main.cpp (renamed from tests/benchmarks/corelib/tools/qtimezone/main.cpp)0
-rw-r--r--tests/benchmarks/corelib/time/qtimezone/qtimezone.pro (renamed from tests/benchmarks/corelib/tools/qtimezone/qtimezone.pro)0
-rw-r--r--tests/benchmarks/corelib/time/time.pro5
-rw-r--r--tests/benchmarks/corelib/tools/qhash/paths_small_data.txt56
-rw-r--r--tests/benchmarks/corelib/tools/qvector/qrawvector.h7
-rw-r--r--tests/benchmarks/corelib/tools/tools.pro9
-rw-r--r--tests/benchmarks/gui/image/qimageconversion/tst_qimageconversion.cpp4
-rw-r--r--tests/benchmarks/gui/image/qpixmapcache/tst_qpixmapcache.cpp4
-rw-r--r--tests/benchmarks/gui/painting/qtransform/tst_qtransform.cpp12
-rw-r--r--tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp2
-rw-r--r--tests/benchmarks/opengl/main.cpp5
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/mainview.cpp1
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp2
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp2
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicsview/chiptester/chip.cpp6
41 files changed, 211 insertions, 100 deletions
diff --git a/tests/benchmarks/corelib/corelib.pro b/tests/benchmarks/corelib/corelib.pro
index b5781ad49e..010abd7751 100644
--- a/tests/benchmarks/corelib/corelib.pro
+++ b/tests/benchmarks/corelib/corelib.pro
@@ -4,7 +4,9 @@ SUBDIRS = \
json \
mimetypes \
kernel \
+ text \
thread \
+ time \
tools \
codecs \
plugin
diff --git a/tests/benchmarks/corelib/io/qdiriterator/main.cpp b/tests/benchmarks/corelib/io/qdiriterator/main.cpp
index e71daccf7d..eae752d99a 100644
--- a/tests/benchmarks/corelib/io/qdiriterator/main.cpp
+++ b/tests/benchmarks/corelib/io/qdiriterator/main.cpp
@@ -78,24 +78,22 @@ void tst_qdiriterator::data()
}
#ifdef Q_OS_WIN
-static int posix_helper(const wchar_t *dirpath)
+static int posix_helper(const wchar_t *dirpath, size_t length)
{
int count = 0;
HANDLE hSearch;
WIN32_FIND_DATA fd;
- const size_t origDirPathLength = wcslen(dirpath);
-
wchar_t appendedPath[MAX_PATH];
- wcscpy(appendedPath, dirpath);
- wcscat(appendedPath, L"\\*");
+ Q_ASSERT(MAX_PATH > length + 3);
+ wcsncpy(appendedPath, dirpath, length);
+ wcscpy(appendedPath + length, L"\\*");
#ifndef Q_OS_WINRT
hSearch = FindFirstFile(appendedPath, &fd);
#else
hSearch = FindFirstFileEx(appendedPath, FindExInfoStandard, &fd,
FindExSearchNameMatch, NULL, FIND_FIRST_EX_LARGE_FETCH);
#endif
- appendedPath[origDirPathLength] = 0;
if (hSearch == INVALID_HANDLE_VALUE) {
qWarning("FindFirstFile failed");
@@ -107,10 +105,12 @@ static int posix_helper(const wchar_t *dirpath)
!(fd.cFileName[0] == L'.' && fd.cFileName[1] == L'.' && fd.cFileName[2] == 0))
{
if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
- wcscat(appendedPath, L"\\");
- wcscat(appendedPath, fd.cFileName);
- count += posix_helper(appendedPath);
- appendedPath[origDirPathLength] = 0;
+ // newLength will "point" to where we put a * earlier, so we overwrite that.
+ size_t newLength = length + 1; // "+ 1" for directory separator
+ Q_ASSERT(newLength + wcslen(fd.cFileName) + 1 < MAX_PATH); // "+ 1" for null-terminator
+ wcscpy(appendedPath + newLength, fd.cFileName);
+ newLength += wcslen(fd.cFileName);
+ count += posix_helper(appendedPath, newLength);
}
else {
++count;
@@ -164,8 +164,8 @@ void tst_qdiriterator::posix()
QBENCHMARK {
#ifdef Q_OS_WIN
wchar_t wPath[MAX_PATH];
- path.toWCharArray(wPath);
- count = posix_helper(wPath);
+ const int end = path.toWCharArray(wPath);
+ count = posix_helper(wPath, end);
#else
count = posix_helper(dirpath.constData());
#endif
diff --git a/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp b/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp
index d68264b78f..6ee8b4e93b 100644
--- a/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp
+++ b/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp
@@ -218,8 +218,9 @@ void QFileSystemIteratorPrivate::pushSubDirectory(const QByteArray &path)
#ifdef Q_OS_WIN
wchar_t szSearchPath[MAX_PATH];
- QString::fromLatin1(path).toWCharArray(szSearchPath);
- wcscat(szSearchPath, L"\\*");
+ const int end = QString::fromLatin1(path + "\\*").toWCharArray(szSearchPath);
+ Q_ASSERT(end < MAX_PATH);
+ szSearchPath[end] = L'\0';
#ifndef Q_OS_WINRT
HANDLE dir = FindFirstFile(szSearchPath, &m_fileSearchResult);
#else
diff --git a/tests/benchmarks/corelib/kernel/kernel.pro b/tests/benchmarks/corelib/kernel/kernel.pro
index 02eeeaa254..92f7174419 100644
--- a/tests/benchmarks/corelib/kernel/kernel.pro
+++ b/tests/benchmarks/corelib/kernel/kernel.pro
@@ -5,7 +5,8 @@ SUBDIRS = \
qmetatype \
qobject \
qvariant \
- qcoreapplication
+ qcoreapplication \
+ qtimer_vs_qmetaobject
!qtHaveModule(widgets): SUBDIRS -= \
qmetaobject \
diff --git a/tests/benchmarks/corelib/kernel/qtimer_vs_qmetaobject/tst_qtimer_vs_qmetaobject.cpp b/tests/benchmarks/corelib/kernel/qtimer_vs_qmetaobject/tst_qtimer_vs_qmetaobject.cpp
index 66a29780f0..6af5b8d586 100644
--- a/tests/benchmarks/corelib/kernel/qtimer_vs_qmetaobject/tst_qtimer_vs_qmetaobject.cpp
+++ b/tests/benchmarks/corelib/kernel/qtimer_vs_qmetaobject/tst_qtimer_vs_qmetaobject.cpp
@@ -28,6 +28,7 @@
#include <QtCore>
#include <QtTest/QtTest>
+#include <QThread>
#define INVOKE_COUNT 10000
@@ -35,8 +36,10 @@ class qtimer_vs_qmetaobject : public QObject
{
Q_OBJECT
private slots:
- void testZeroTimerSingleShot();
- void testQueuedInvokeMethod();
+ void bench();
+ void bench_data();
+ void benchBackgroundThread();
+ void benchBackgroundThread_data() { bench_data(); }
};
class InvokeCounter : public QObject {
@@ -47,36 +50,89 @@ public slots:
void invokeSlot() {
count++;
if (count == INVOKE_COUNT)
- QTestEventLoop::instance().exitLoop();
+ emit allInvoked();
}
+signals:
+ void allInvoked();
protected:
int count;
};
-void qtimer_vs_qmetaobject::testZeroTimerSingleShot()
+void qtimer_vs_qmetaobject::bench()
{
+ QFETCH(int, type);
+
+ std::function<void(InvokeCounter*)> invoke;
+ if (type == 0) {
+ invoke = [](InvokeCounter* invokeCounter) {
+ QTimer::singleShot(0, invokeCounter, SLOT(invokeSlot()));
+ };
+ } else if (type == 1) {
+ invoke = [](InvokeCounter* invokeCounter) {
+ QTimer::singleShot(0, invokeCounter, &InvokeCounter::invokeSlot);
+ };
+ } else if (type == 2) {
+ invoke = [](InvokeCounter* invokeCounter) {
+ QTimer::singleShot(0, invokeCounter, [invokeCounter]() {
+ invokeCounter->invokeSlot();
+ });
+ };
+ } else if (type == 3) {
+ invoke = [](InvokeCounter* invokeCounter) {
+ QTimer::singleShot(0, [invokeCounter]() {
+ invokeCounter->invokeSlot();
+ });
+ };
+ } else if (type == 4) {
+ invoke = [](InvokeCounter* invokeCounter) {
+ QMetaObject::invokeMethod(invokeCounter, "invokeSlot", Qt::QueuedConnection);
+ };
+ } else if (type == 5) {
+ invoke = [](InvokeCounter* invokeCounter) {
+ QMetaObject::invokeMethod(invokeCounter, &InvokeCounter::invokeSlot, Qt::QueuedConnection);
+ };
+ } else if (type == 6) {
+ invoke = [](InvokeCounter* invokeCounter) {
+ QMetaObject::invokeMethod(invokeCounter, [invokeCounter]() {
+ invokeCounter->invokeSlot();
+ }, Qt::QueuedConnection);
+ };
+ } else {
+ QFAIL("unhandled data tag");
+ }
+
QBENCHMARK {
InvokeCounter invokeCounter;
+ QSignalSpy spy(&invokeCounter, &InvokeCounter::allInvoked);
for(int i = 0; i < INVOKE_COUNT; ++i) {
- QTimer::singleShot(0, &invokeCounter, SLOT(invokeSlot()));
+ invoke(&invokeCounter);
}
- QTestEventLoop::instance().enterLoop(10);
- QVERIFY(!QTestEventLoop::instance().timeout());
+ QVERIFY(spy.wait(10000));
}
}
-void qtimer_vs_qmetaobject::testQueuedInvokeMethod()
+void qtimer_vs_qmetaobject::bench_data()
{
- QBENCHMARK {
- InvokeCounter invokeCounter;
- for(int i = 0; i < INVOKE_COUNT; ++i) {
- QMetaObject::invokeMethod(&invokeCounter, "invokeSlot", Qt::QueuedConnection);
- }
- QTestEventLoop::instance().enterLoop(10);
- QVERIFY(!QTestEventLoop::instance().timeout());
- }
+ QTest::addColumn<int>("type");
+ QTest::addRow("singleShot_slot") << 0;
+ QTest::addRow("singleShot_pmf") << 1;
+ QTest::addRow("singleShot_functor") << 2;
+ QTest::addRow("singleShot_functor_noctx") << 3;
+ QTest::addRow("invokeMethod_string") << 4;
+ QTest::addRow("invokeMethod_pmf") << 5;
+ QTest::addRow("invokeMethod_functor") << 6;
}
+void qtimer_vs_qmetaobject::benchBackgroundThread()
+{
+#if !QT_CONFIG(cxx11_future)
+ QSKIP("This test requires QThread::create");
+#else
+ QScopedPointer<QThread> thread(QThread::create([this]() { bench(); }));
+ thread->start();
+ QVERIFY(thread->wait());
+#endif
+}
QTEST_MAIN(qtimer_vs_qmetaobject)
diff --git a/tests/benchmarks/corelib/tools/qbytearray/main.cpp b/tests/benchmarks/corelib/text/qbytearray/main.cpp
index e421e7436b..e421e7436b 100644
--- a/tests/benchmarks/corelib/tools/qbytearray/main.cpp
+++ b/tests/benchmarks/corelib/text/qbytearray/main.cpp
diff --git a/tests/benchmarks/corelib/tools/qbytearray/qbytearray.pro b/tests/benchmarks/corelib/text/qbytearray/qbytearray.pro
index cf28b0247f..cf28b0247f 100644
--- a/tests/benchmarks/corelib/tools/qbytearray/qbytearray.pro
+++ b/tests/benchmarks/corelib/text/qbytearray/qbytearray.pro
diff --git a/tests/benchmarks/corelib/tools/qchar/main.cpp b/tests/benchmarks/corelib/text/qchar/main.cpp
index 4dcf86786d..4dcf86786d 100644
--- a/tests/benchmarks/corelib/tools/qchar/main.cpp
+++ b/tests/benchmarks/corelib/text/qchar/main.cpp
diff --git a/tests/benchmarks/corelib/tools/qchar/qchar.pro b/tests/benchmarks/corelib/text/qchar/qchar.pro
index 80a9861f48..80a9861f48 100644
--- a/tests/benchmarks/corelib/tools/qchar/qchar.pro
+++ b/tests/benchmarks/corelib/text/qchar/qchar.pro
diff --git a/tests/benchmarks/corelib/tools/qlocale/main.cpp b/tests/benchmarks/corelib/text/qlocale/main.cpp
index 38d94af143..38d94af143 100644
--- a/tests/benchmarks/corelib/tools/qlocale/main.cpp
+++ b/tests/benchmarks/corelib/text/qlocale/main.cpp
diff --git a/tests/benchmarks/corelib/tools/qlocale/qlocale.pro b/tests/benchmarks/corelib/text/qlocale/qlocale.pro
index e56bbe0341..e56bbe0341 100644
--- a/tests/benchmarks/corelib/tools/qlocale/qlocale.pro
+++ b/tests/benchmarks/corelib/text/qlocale/qlocale.pro
diff --git a/tests/benchmarks/corelib/tools/qregexp/main.cpp b/tests/benchmarks/corelib/text/qregexp/main.cpp
index 798b23f2b0..798b23f2b0 100644
--- a/tests/benchmarks/corelib/tools/qregexp/main.cpp
+++ b/tests/benchmarks/corelib/text/qregexp/main.cpp
diff --git a/tests/benchmarks/corelib/tools/qregexp/qregexp.pro b/tests/benchmarks/corelib/text/qregexp/qregexp.pro
index f64ae781a2..f64ae781a2 100644
--- a/tests/benchmarks/corelib/tools/qregexp/qregexp.pro
+++ b/tests/benchmarks/corelib/text/qregexp/qregexp.pro
diff --git a/tests/benchmarks/corelib/tools/qregexp/qregexp.qrc b/tests/benchmarks/corelib/text/qregexp/qregexp.qrc
index a7fe13c035..a7fe13c035 100644
--- a/tests/benchmarks/corelib/tools/qregexp/qregexp.qrc
+++ b/tests/benchmarks/corelib/text/qregexp/qregexp.qrc
diff --git a/tests/benchmarks/corelib/tools/qstring/main.cpp b/tests/benchmarks/corelib/text/qstring/main.cpp
index 826a843c10..826a843c10 100644
--- a/tests/benchmarks/corelib/tools/qstring/main.cpp
+++ b/tests/benchmarks/corelib/text/qstring/main.cpp
diff --git a/tests/benchmarks/corelib/tools/qstring/qstring.pro b/tests/benchmarks/corelib/text/qstring/qstring.pro
index 9f5e34b915..9f5e34b915 100644
--- a/tests/benchmarks/corelib/tools/qstring/qstring.pro
+++ b/tests/benchmarks/corelib/text/qstring/qstring.pro
diff --git a/tests/benchmarks/corelib/tools/qstringbuilder/main.cpp b/tests/benchmarks/corelib/text/qstringbuilder/main.cpp
index d0dfe3b1a7..0de6d33846 100644
--- a/tests/benchmarks/corelib/tools/qstringbuilder/main.cpp
+++ b/tests/benchmarks/corelib/text/qstringbuilder/main.cpp
@@ -401,7 +401,7 @@ private slots:
}
private:
- const QLatin1Literal l1literal;
+ const QLatin1String l1literal;
const QLatin1String l1string;
const QByteArray ba;
const QString string;
diff --git a/tests/benchmarks/corelib/tools/qstringbuilder/qstringbuilder.pro b/tests/benchmarks/corelib/text/qstringbuilder/qstringbuilder.pro
index fa4cbe3c13..fa4cbe3c13 100644
--- a/tests/benchmarks/corelib/tools/qstringbuilder/qstringbuilder.pro
+++ b/tests/benchmarks/corelib/text/qstringbuilder/qstringbuilder.pro
diff --git a/tests/benchmarks/corelib/tools/qstringlist/.gitignore b/tests/benchmarks/corelib/text/qstringlist/.gitignore
index 3e0cdc952f..3e0cdc952f 100644
--- a/tests/benchmarks/corelib/tools/qstringlist/.gitignore
+++ b/tests/benchmarks/corelib/text/qstringlist/.gitignore
diff --git a/tests/benchmarks/corelib/tools/qstringlist/main.cpp b/tests/benchmarks/corelib/text/qstringlist/main.cpp
index ae355a8b89..ae355a8b89 100644
--- a/tests/benchmarks/corelib/tools/qstringlist/main.cpp
+++ b/tests/benchmarks/corelib/text/qstringlist/main.cpp
diff --git a/tests/benchmarks/corelib/tools/qstringlist/qstringlist.pro b/tests/benchmarks/corelib/text/qstringlist/qstringlist.pro
index 5803e7da0e..5803e7da0e 100644
--- a/tests/benchmarks/corelib/tools/qstringlist/qstringlist.pro
+++ b/tests/benchmarks/corelib/text/qstringlist/qstringlist.pro
diff --git a/tests/benchmarks/corelib/text/text.pro b/tests/benchmarks/corelib/text/text.pro
new file mode 100644
index 0000000000..8c15d0b0c5
--- /dev/null
+++ b/tests/benchmarks/corelib/text/text.pro
@@ -0,0 +1,10 @@
+TEMPLATE = subdirs
+SUBDIRS = \
+ qbytearray \
+ qchar \
+ qlocale \
+ qregexp \
+ qstringbuilder \
+ qstringlist
+
+*g++*: SUBDIRS += qstring
diff --git a/tests/benchmarks/corelib/time/qdate/qdate.pro b/tests/benchmarks/corelib/time/qdate/qdate.pro
new file mode 100644
index 0000000000..a655917135
--- /dev/null
+++ b/tests/benchmarks/corelib/time/qdate/qdate.pro
@@ -0,0 +1,4 @@
+TARGET = tst_bench_qdate
+QT = core testlib
+
+SOURCES += tst_bench_qdate.cpp
diff --git a/tests/benchmarks/corelib/time/qdate/tst_bench_qdate.cpp b/tests/benchmarks/corelib/time/qdate/tst_bench_qdate.cpp
new file mode 100644
index 0000000000..399ac44065
--- /dev/null
+++ b/tests/benchmarks/corelib/time/qdate/tst_bench_qdate.cpp
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtCore module 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 <QDateTime>
+#include <QTest>
+
+class tst_QDate : public QObject
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+ void monthLengths();
+};
+
+void tst_QDate::monthLengths()
+{
+ QBENCHMARK {
+ for (int year = 1900; year <= 2100; year++) {
+ bool check = true;
+ for (int month = 1; month <= 12; month++)
+ check &= QDate::isValid(year, month, QDate(year, month, 1).daysInMonth());
+ Q_UNUSED(check);
+ }
+ }
+}
+
+QTEST_MAIN(tst_QDate)
+#include "tst_bench_qdate.moc"
diff --git a/tests/benchmarks/corelib/tools/qdatetime/main.cpp b/tests/benchmarks/corelib/time/qdatetime/main.cpp
index 2c1e3d97ae..b693400376 100644
--- a/tests/benchmarks/corelib/tools/qdatetime/main.cpp
+++ b/tests/benchmarks/corelib/time/qdatetime/main.cpp
@@ -35,10 +35,7 @@ class tst_QDateTime : public QObject
{
Q_OBJECT
- enum
-#if defined(Q_COMPILER_CLASS_ENUM) || (defined(Q_CC_MSVC) && _MSC_VER >= 1700)
- : qint64
-#endif
+ enum : qint64
{
SECS_PER_DAY = 86400,
MSECS_PER_DAY = 86400000,
diff --git a/tests/benchmarks/corelib/tools/qdatetime/qdatetime.pro b/tests/benchmarks/corelib/time/qdatetime/qdatetime.pro
index a85e7346c6..a85e7346c6 100644
--- a/tests/benchmarks/corelib/tools/qdatetime/qdatetime.pro
+++ b/tests/benchmarks/corelib/time/qdatetime/qdatetime.pro
diff --git a/tests/benchmarks/corelib/tools/qtimezone/main.cpp b/tests/benchmarks/corelib/time/qtimezone/main.cpp
index 65455a7261..65455a7261 100644
--- a/tests/benchmarks/corelib/tools/qtimezone/main.cpp
+++ b/tests/benchmarks/corelib/time/qtimezone/main.cpp
diff --git a/tests/benchmarks/corelib/tools/qtimezone/qtimezone.pro b/tests/benchmarks/corelib/time/qtimezone/qtimezone.pro
index d0531b568b..d0531b568b 100644
--- a/tests/benchmarks/corelib/tools/qtimezone/qtimezone.pro
+++ b/tests/benchmarks/corelib/time/qtimezone/qtimezone.pro
diff --git a/tests/benchmarks/corelib/time/time.pro b/tests/benchmarks/corelib/time/time.pro
new file mode 100644
index 0000000000..b5184845d9
--- /dev/null
+++ b/tests/benchmarks/corelib/time/time.pro
@@ -0,0 +1,5 @@
+TEMPLATE = subdirs
+SUBDIRS = \
+ qdate \
+ qdatetime \
+ qtimezone
diff --git a/tests/benchmarks/corelib/tools/qhash/paths_small_data.txt b/tests/benchmarks/corelib/tools/qhash/paths_small_data.txt
index d5acd28820..662285296f 100644
--- a/tests/benchmarks/corelib/tools/qhash/paths_small_data.txt
+++ b/tests/benchmarks/corelib/tools/qhash/paths_small_data.txt
@@ -47,13 +47,38 @@
./codecs/.obj/debug-shared
./.pch
./.pch/debug-shared
+./text
+./text/text.pro
+./text/qregexp
+./text/qregexp/qregexp.qrc
+./text/qregexp/main.cpp
+./text/qregexp/Makefile
+./text/qregexp/qregexp.pro
+./text/qstringbuilder
+./text/qstringbuilder/main.cpp
+./text/qstringbuilder/Makefile
+./text/qstringbuilder/qstringbuilder.pro
+./text/qstring
+./text/qstring/generatelist.pl
+./text/qstring/data.h
+./text/qstring/qstring.pro
+./text/qstring/main.cpp
+./text/qstring/data.cpp
+./text/qstring/Makefile
+./text/qstring/utf-8.txt
+./text/qstringlist
+./text/qstringlist/qstringlist.pro
+./text/qstringlist/main.cpp
+./text/qstringlist/.gitignore
+./text/qstringlist/Makefile
+./text/qbytearray
+./text/qbytearray/qbytearray.pro
+./text/qbytearray/main.cpp
+./text/qbytearray/Makefile
+./text/.pch
+./text/.pch/debug-shared
./tools
./tools/tools.pro
-./tools/qregexp
-./tools/qregexp/qregexp.qrc
-./tools/qregexp/main.cpp
-./tools/qregexp/Makefile
-./tools/qregexp/qregexp.pro
./tools/qvector
./tools/qvector/tst_vector
./tools/qvector/.pch
@@ -72,31 +97,10 @@
./tools/qvector/qvector.pro
./tools/.pch
./tools/.pch/debug-shared
-./tools/qstringbuilder
-./tools/qstringbuilder/main.cpp
-./tools/qstringbuilder/Makefile
-./tools/qstringbuilder/qstringbuilder.pro
./tools/containers-sequential
./tools/containers-sequential/containers-sequential.pro
./tools/containers-sequential/main.cpp
./tools/containers-sequential/Makefile
-./tools/qstring
-./tools/qstring/generatelist.pl
-./tools/qstring/data.h
-./tools/qstring/qstring.pro
-./tools/qstring/main.cpp
-./tools/qstring/data.cpp
-./tools/qstring/Makefile
-./tools/qstring/utf-8.txt
-./tools/qstringlist
-./tools/qstringlist/qstringlist.pro
-./tools/qstringlist/main.cpp
-./tools/qstringlist/.gitignore
-./tools/qstringlist/Makefile
-./tools/qbytearray
-./tools/qbytearray/qbytearray.pro
-./tools/qbytearray/main.cpp
-./tools/qbytearray/Makefile
./tools/containers-associative
./tools/containers-associative/containers-associative.pro
./tools/containers-associative/main.cpp
diff --git a/tests/benchmarks/corelib/tools/qvector/qrawvector.h b/tests/benchmarks/corelib/tools/qvector/qrawvector.h
index c7173b5b8d..16a911c63a 100644
--- a/tests/benchmarks/corelib/tools/qvector/qrawvector.h
+++ b/tests/benchmarks/corelib/tools/qvector/qrawvector.h
@@ -32,7 +32,6 @@
#include <QtCore/qiterator.h>
#include <QtCore/qdebug.h>
#include <QtCore/qatomic.h>
-#include <QtCore/qalgorithms.h>
#include <QtCore/qlist.h>
#include <QtCore/private/qtools_p.h>
@@ -263,9 +262,9 @@ public:
//static QRawVector<T> fromList(const QList<T> &list);
static inline QRawVector<T> fromStdVector(const std::vector<T> &vector)
- { QRawVector<T> tmp; qCopy(vector.begin(), vector.end(), std::back_inserter(tmp)); return tmp; }
+ { QRawVector<T> tmp; std::copy(vector.begin(), vector.end(), std::back_inserter(tmp)); return tmp; }
inline std::vector<T> toStdVector() const
- { std::vector<T> tmp; qCopy(constBegin(), constEnd(), std::back_inserter(tmp)); return tmp; }
+ { std::vector<T> tmp; std::copy(constBegin(), constEnd(), std::back_inserter(tmp)); return tmp; }
private:
T *allocate(int alloc);
@@ -568,7 +567,7 @@ typename QRawVector<T>::iterator QRawVector<T>::erase(iterator abegin, iterator
int l = int(aend - m_begin);
int n = l - f;
if (QTypeInfo<T>::isComplex) {
- qCopy(m_begin + l, m_begin + m_size, m_begin + f);
+ std::copy(m_begin + l, m_begin + m_size, m_begin + f);
T *i = m_begin + m_size;
T *b = m_begin + m_size - n;
while (i != b) {
diff --git a/tests/benchmarks/corelib/tools/tools.pro b/tests/benchmarks/corelib/tools/tools.pro
index ca9c0a6f89..b4ee0520a6 100644
--- a/tests/benchmarks/corelib/tools/tools.pro
+++ b/tests/benchmarks/corelib/tools/tools.pro
@@ -2,21 +2,12 @@ TEMPLATE = subdirs
SUBDIRS = \
containers-associative \
containers-sequential \
- qbytearray \
qcontiguouscache \
qcryptographichash \
- qdatetime \
qlist \
- qlocale \
qmap \
qrect \
qringbuffer \
qstack \
- qstring \
- qstringbuilder \
- qstringlist \
- qtimezone \
qvector \
qalgorithms
-
-!*g++*: SUBDIRS -= qstring
diff --git a/tests/benchmarks/gui/image/qimageconversion/tst_qimageconversion.cpp b/tests/benchmarks/gui/image/qimageconversion/tst_qimageconversion.cpp
index 605df100ee..570c7b59fa 100644
--- a/tests/benchmarks/gui/image/qimageconversion/tst_qimageconversion.cpp
+++ b/tests/benchmarks/gui/image/qimageconversion/tst_qimageconversion.cpp
@@ -357,10 +357,10 @@ void tst_QImageConversion::convertGenericInplace()
QFETCH(QImage::Format, outputFormat);
QImage::Format inputFormat = inputImage.format();
- QImage tmpImage = qMove(inputImage);
+ QImage tmpImage = std::move(inputImage);
QBENCHMARK {
- tmpImage = (qMove(tmpImage).convertToFormat(outputFormat)).convertToFormat(inputFormat);
+ tmpImage = (std::move(tmpImage).convertToFormat(outputFormat)).convertToFormat(inputFormat);
}
}
diff --git a/tests/benchmarks/gui/image/qpixmapcache/tst_qpixmapcache.cpp b/tests/benchmarks/gui/image/qpixmapcache/tst_qpixmapcache.cpp
index d4be85b5ad..2ded426cdd 100644
--- a/tests/benchmarks/gui/image/qpixmapcache/tst_qpixmapcache.cpp
+++ b/tests/benchmarks/gui/image/qpixmapcache/tst_qpixmapcache.cpp
@@ -106,7 +106,7 @@ void tst_QPixmapCache::find()
if (cacheType) {
QBENCHMARK {
for (int i = 0 ; i <= 10000 ; i++)
- QPixmapCache::find(QString::asprintf("my-key-%d", i), p);
+ QPixmapCache::find(QString::asprintf("my-key-%d", i), &p);
}
} else {
QBENCHMARK {
@@ -155,7 +155,7 @@ void tst_QPixmapCache::styleUseCaseComplexKey()
QPixmapCache::insert(QString::asprintf("%s-%d-%d-%d-%d-%d-%d", QString("my-progressbar-%1").arg(i).toLatin1().constData(), 5, 3, 0, 358, 100, 200), p);
for (int i = 0 ; i <= 10000 ; i++)
- QPixmapCache::find(QString::asprintf("%s-%d-%d-%d-%d-%d-%d", QString("my-progressbar-%1").arg(i).toLatin1().constData(), 5, 3, 0, 358, 100, 200), p);
+ QPixmapCache::find(QString::asprintf("%s-%d-%d-%d-%d-%d-%d", QString("my-progressbar-%1").arg(i).toLatin1().constData(), 5, 3, 0, 358, 100, 200), &p);
}
} else {
QHash<styleStruct, QPixmapCache::Key> hash;
diff --git a/tests/benchmarks/gui/painting/qtransform/tst_qtransform.cpp b/tests/benchmarks/gui/painting/qtransform/tst_qtransform.cpp
index d7a7f383ac..12e85d4842 100644
--- a/tests/benchmarks/gui/painting/qtransform/tst_qtransform.cpp
+++ b/tests/benchmarks/gui/painting/qtransform/tst_qtransform.cpp
@@ -167,9 +167,7 @@ void tst_QTransform::func##_data() \
{ \
QTest::addColumn<QTransform>("transform"); \
QMap<const char *, QTransform> x = generateTransforms(); \
- QMapIterator<const char *, QTransform> it(x); \
- while (it.hasNext()) { \
- it.next(); \
+ for (auto it = x.begin(), end = x.end(); it != end; ++it) { \
QTest::newRow(it.key()) << it.value(); \
} \
}
@@ -180,14 +178,10 @@ void tst_QTransform::func##_data() \
QTest::addColumn<QTransform>("x1"); \
QTest::addColumn<QTransform>("x2"); \
QMap<const char *, QTransform> x = generateTransforms(); \
- QMapIterator<const char *, QTransform> it(x); \
- while (it.hasNext()) { \
- it.next(); \
+ for (auto it = x.cbegin(), end = x.cend(); it != end; ++it) { \
const char *key1 = it.key(); \
QTransform x1 = it.value(); \
- QMapIterator<const char *, QTransform> it2(x); \
- while (it2.hasNext()) { \
- it2.next(); \
+ for (auto it2 = x.cbegin(), end = x.cend(); it2 != end; ++it2) { \
QTest::newRow(QString("%1 + %2").arg(key1).arg(it2.key()).toLatin1().constData()) \
<< x1 << it2.value(); \
} \
diff --git a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp
index b2f4cbd7ba..c182ef7ebf 100644
--- a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp
@@ -908,7 +908,7 @@ void tst_qnetworkreply::httpsRequestChain()
qint64 average = (elapsed / count);
- qSort(helper.timeList);
+ std::sort(helper.timeList.begin(), helper.timeList.end());
qint64 median = helper.timeList.at(5);
qDebug() << "Total:" << elapsed << " Average:" << average << " Median:" << median;
diff --git a/tests/benchmarks/opengl/main.cpp b/tests/benchmarks/opengl/main.cpp
index 5008f1592b..0886c0e55b 100644
--- a/tests/benchmarks/opengl/main.cpp
+++ b/tests/benchmarks/opengl/main.cpp
@@ -76,7 +76,6 @@ void OpenGLBench::initTestCase()
QPainter p(pb);
p.setRenderHint(QPainter::Antialiasing);
- p.setRenderHint(QPainter::HighQualityAntialiasing);
p.drawImage(0, 0, QImage(256, 256, QImage::Format_ARGB32_Premultiplied));
}
@@ -120,7 +119,6 @@ void OpenGLBench::imageDrawing()
QPainter p(pb);
p.setRenderHint(QPainter::SmoothPixmapTransform, smoothPixmapTransform);
p.setRenderHint(QPainter::Antialiasing, highQualityAntialiasing);
- p.setRenderHint(QPainter::HighQualityAntialiasing, highQualityAntialiasing);
QBENCHMARK {
if (pixmap) {
@@ -182,7 +180,6 @@ void OpenGLBench::pathDrawing()
dummy.addRect(-1, -1, 2, 2);
QPainter p(pb);
p.setRenderHint(QPainter::Antialiasing, highQualityAntialiasing);
- p.setRenderHint(QPainter::HighQualityAntialiasing, highQualityAntialiasing);
p.translate(pb->width() / 2, pb->height() / 2);
p.rotate(30);
p.drawPath(dummy);
@@ -196,7 +193,6 @@ void OpenGLBench::pathDrawing()
QBENCHMARK {
p.setRenderHint(QPainter::Antialiasing, highQualityAntialiasing);
- p.setRenderHint(QPainter::HighQualityAntialiasing, highQualityAntialiasing);
p.rotate(0.01);
p.drawPath(path);
@@ -227,7 +223,6 @@ void OpenGLBench::startupCost()
QGLPixelBuffer buffer(512, 512);
QPainter p(&buffer);
p.setRenderHint(QPainter::Antialiasing, highQualityAntialiasing);
- p.setRenderHint(QPainter::HighQualityAntialiasing, highQualityAntialiasing);
p.translate(buffer.width() / 2, buffer.height() / 2);
p.drawPath(path);
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/mainview.cpp b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/mainview.cpp
index c8ccb60dbb..8f7736010d 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/mainview.cpp
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/mainview.cpp
@@ -270,7 +270,6 @@ void MainView::construct()
// Turn off automatic background
setAttribute(Qt::WA_OpaquePaintEvent);
- setAttribute(Qt::WA_NoBackground);
setAttribute(Qt::WA_NoSystemBackground);
setAutoFillBackground(false);
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/benchmarks/widgets/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
index b15aad04cd..e0c5a7f683 100644
--- a/tests/benchmarks/widgets/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
+++ b/tests/benchmarks/widgets/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
@@ -60,7 +60,7 @@ public:
{
Q_UNUSED(option);
Q_UNUSED(widget);
- painter->drawRoundRect(rect());
+ painter->drawRoundedRect(rect(), 25, 25, Qt::RelativeSize);
painter->drawLine(rect().topLeft(), rect().bottomRight());
painter->drawLine(rect().bottomLeft(), rect().topRight());
}
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp b/tests/benchmarks/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp
index 5c97d7f738..caf5455a80 100644
--- a/tests/benchmarks/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp
+++ b/tests/benchmarks/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp
@@ -53,7 +53,7 @@ public:
{
Q_UNUSED(option);
Q_UNUSED(widget);
- painter->drawRoundRect(rect());
+ painter->drawRoundedRect(rect(), 25, 25, Qt::RelativeSize);
painter->drawLine(rect().topLeft(), rect().bottomRight());
painter->drawLine(rect().bottomLeft(), rect().topRight());
}
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicsview/chiptester/chip.cpp b/tests/benchmarks/widgets/graphicsview/qgraphicsview/chiptester/chip.cpp
index cf82282bfe..21eb622f15 100644
--- a/tests/benchmarks/widgets/graphicsview/qgraphicsview/chiptester/chip.cpp
+++ b/tests/benchmarks/widgets/graphicsview/qgraphicsview/chiptester/chip.cpp
@@ -57,9 +57,9 @@ void Chip::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWid
{
Q_UNUSED(widget);
- QColor fillColor = (option->state & QStyle::State_Selected) ? color.dark(150) : color;
+ QColor fillColor = (option->state & QStyle::State_Selected) ? color.darker(150) : color;
if (option->state & QStyle::State_MouseOver)
- fillColor = fillColor.light(125);
+ fillColor = fillColor.lighter(125);
if (option->levelOfDetail < 0.2) {
if (option->levelOfDetail < 0.125) {
@@ -82,7 +82,7 @@ void Chip::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWid
pen.setWidth(width);
QBrush b = painter->brush();
- painter->setBrush(QBrush(fillColor.dark(option->state & QStyle::State_Sunken ? 120 : 100)));
+ painter->setBrush(QBrush(fillColor.darker(option->state & QStyle::State_Sunken ? 120 : 100)));
painter->drawRect(QRect(14, 14, 79, 39));
painter->setBrush(b);