summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks
diff options
context:
space:
mode:
Diffstat (limited to 'tests/benchmarks')
-rw-r--r--tests/benchmarks/benchmarks.pro1
-rw-r--r--tests/benchmarks/corelib/io/qdiriterator/main.cpp5
-rw-r--r--tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro7
-rw-r--r--tests/benchmarks/corelib/io/qfile/main.cpp7
-rw-r--r--tests/benchmarks/corelib/io/qfileinfo/main.cpp4
-rw-r--r--tests/benchmarks/corelib/io/qprocess/tst_bench_qprocess.cpp7
-rw-r--r--tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp32
-rw-r--r--tests/benchmarks/corelib/thread/qreadwritelock/qreadwritelock.pro6
-rw-r--r--tests/benchmarks/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp183
-rw-r--r--tests/benchmarks/corelib/thread/thread.pro1
-rw-r--r--tests/benchmarks/corelib/tools/containers-sequential/main.cpp7
-rw-r--r--tests/benchmarks/corelib/tools/qcryptographichash/main.cpp9
-rw-r--r--tests/benchmarks/dbus/qdbustype/qdbustype.pro5
-rw-r--r--tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp3
-rw-r--r--tests/benchmarks/gui/image/qimageconversion/qimageconversion.pro6
-rw-r--r--tests/benchmarks/gui/image/qimagereader/qimagereader.pro20
-rw-r--r--tests/benchmarks/gui/text/qtextdocument/main.cpp71
-rw-r--r--tests/benchmarks/gui/text/qtextdocument/qtextdocument.pro7
-rw-r--r--tests/benchmarks/gui/text/text.pro3
-rw-r--r--tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp18
-rw-r--r--tests/benchmarks/network/kernel/kernel.pro2
-rw-r--r--tests/benchmarks/network/network.pro2
-rw-r--r--tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp3
-rw-r--r--tests/benchmarks/widgets/widgets.pro3
-rw-r--r--tests/benchmarks/widgets/widgets/qtextbrowser/main.cpp56
-rw-r--r--tests/benchmarks/widgets/widgets/qtextbrowser/qtextbrowser.pro6
-rw-r--r--tests/benchmarks/widgets/widgets/widgets.pro3
27 files changed, 390 insertions, 87 deletions
diff --git a/tests/benchmarks/benchmarks.pro b/tests/benchmarks/benchmarks.pro
index 8ee8d017ab..9e288f7aa2 100644
--- a/tests/benchmarks/benchmarks.pro
+++ b/tests/benchmarks/benchmarks.pro
@@ -7,6 +7,7 @@ SUBDIRS = \
qtHaveModule(dbus): SUBDIRS += dbus
qtHaveModule(network): SUBDIRS += network
qtHaveModule(gui): SUBDIRS += gui
+qtHaveModule(widgets): SUBDIRS += widgets
check-trusted.CONFIG += recursive
QMAKE_EXTRA_TARGETS += check-trusted
diff --git a/tests/benchmarks/corelib/io/qdiriterator/main.cpp b/tests/benchmarks/corelib/io/qdiriterator/main.cpp
index a9fd7fd5ec..cd5a83e547 100644
--- a/tests/benchmarks/corelib/io/qdiriterator/main.cpp
+++ b/tests/benchmarks/corelib/io/qdiriterator/main.cpp
@@ -59,10 +59,6 @@ private slots:
void tst_qdiriterator::data()
{
-#if defined(Q_OS_WINCE)
- QByteArray qtdir = qPrintable(QCoreApplication::applicationDirPath());
- qtdir += "/depot";
-#else
#if defined(Q_OS_WIN)
const char *qtdir = "C:\\depot\\qt\\main";
#else
@@ -72,7 +68,6 @@ void tst_qdiriterator::data()
fprintf(stderr, "QTDIR not set\n");
exit(1);
}
-#endif
QTest::addColumn<QByteArray>("dirpath");
QByteArray ba = QByteArray(qtdir) + "/src/corelib";
diff --git a/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro b/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro
index 3cfb0b44de..061b22a5d1 100644
--- a/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro
+++ b/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro
@@ -6,10 +6,3 @@ CONFIG += release
SOURCES += main.cpp qfilesystemiterator.cpp
HEADERS += qfilesystemiterator.h
-
-wince* {
- corelibdir.files = $$QT_SOURCE_TREE/src/corelib
- corelibdir.path = ./depot/src
- DEPLOYMENT += corelibdir
-}
-
diff --git a/tests/benchmarks/corelib/io/qfile/main.cpp b/tests/benchmarks/corelib/io/qfile/main.cpp
index 175dc74074..1966b30773 100644
--- a/tests/benchmarks/corelib/io/qfile/main.cpp
+++ b/tests/benchmarks/corelib/io/qfile/main.cpp
@@ -591,12 +591,7 @@ void tst_qfile::createSmallFiles()
dir.cd("tst");
tmpDirName = dir.absolutePath();
-#if defined(Q_OS_WINCE)
- for (int i = 0; i < 100; ++i)
-#else
- for (int i = 0; i < 1000; ++i)
-#endif
- {
+ for (int i = 0; i < 1000; ++i) {
QFile f(tmpDirName + QLatin1Char('/') + QString::number(i));
f.open(QIODevice::WriteOnly);
f.seek(511);
diff --git a/tests/benchmarks/corelib/io/qfileinfo/main.cpp b/tests/benchmarks/corelib/io/qfileinfo/main.cpp
index 24a32a7c72..5180e7c29e 100644
--- a/tests/benchmarks/corelib/io/qfileinfo/main.cpp
+++ b/tests/benchmarks/corelib/io/qfileinfo/main.cpp
@@ -41,7 +41,7 @@ class qfileinfo : public QObject
private slots:
void existsTemporary();
void existsStatic();
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
void symLinkTargetPerformanceLNK();
void symLinkTargetPerformanceMounpoint();
#endif
@@ -71,7 +71,7 @@ void qfileinfo::existsStatic()
QBENCHMARK { QFileInfo::exists(appPath); }
}
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
void qfileinfo::symLinkTargetPerformanceLNK()
{
QVERIFY(QFile::link("file","link.lnk"));
diff --git a/tests/benchmarks/corelib/io/qprocess/tst_bench_qprocess.cpp b/tests/benchmarks/corelib/io/qprocess/tst_bench_qprocess.cpp
index d8792ed7ef..782cad94a1 100644
--- a/tests/benchmarks/corelib/io/qprocess/tst_bench_qprocess.cpp
+++ b/tests/benchmarks/corelib/io/qprocess/tst_bench_qprocess.cpp
@@ -33,7 +33,7 @@ class tst_QProcess : public QObject
{
Q_OBJECT
-#if !defined(QT_NO_PROCESS) && !defined(Q_OS_WINCE)
+#if !defined(QT_NO_PROCESS)
private slots:
void echoTest_performance();
@@ -41,8 +41,7 @@ private slots:
#endif // QT_NO_PROCESS
};
-#if !defined(QT_NO_PROCESS) && !defined(Q_OS_WINCE)
-// Reading and writing to a process is not supported on Qt/CE
+#if !defined(QT_NO_PROCESS)
void tst_QProcess::echoTest_performance()
{
QProcess process;
@@ -88,7 +87,7 @@ void tst_QProcess::echoTest_performance()
QVERIFY(process.waitForFinished());
}
-#endif // QT_NO_PROCESS && Q_OS_WINCE
+#endif // QT_NO_PROCESS
QTEST_MAIN(tst_QProcess)
#include "tst_bench_qprocess.moc"
diff --git a/tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp
index 9abb9466df..287afff089 100644
--- a/tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp
+++ b/tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp
@@ -37,6 +37,15 @@
class tst_qvariant : public QObject
{
Q_OBJECT
+
+public:
+ enum ABenchmarkEnum {
+ FirstEnumValue,
+ SecondEnumValue,
+ ThirdEnumValue
+ };
+ Q_ENUM(ABenchmarkEnum)
+
private slots:
void testBound();
@@ -50,6 +59,7 @@ private slots:
void stringListVariantCreation();
void bigClassVariantCreation();
void smallClassVariantCreation();
+ void enumVariantCreation();
void doubleVariantSetValue();
void floatVariantSetValue();
@@ -58,6 +68,7 @@ private slots:
void stringListVariantSetValue();
void bigClassVariantSetValue();
void smallClassVariantSetValue();
+ void enumVariantSetValue();
void doubleVariantAssignment();
void floatVariantAssignment();
@@ -136,6 +147,16 @@ void variantCreation<SmallClass>(SmallClass val)
}
}
+template <>
+void variantCreation<tst_qvariant::ABenchmarkEnum>(tst_qvariant::ABenchmarkEnum val)
+{
+ QBENCHMARK {
+ for (int i = 0; i < ITERATION_COUNT; ++i) {
+ QVariant::fromValue(val);
+ }
+ }
+}
+
void tst_qvariant::doubleVariantCreation()
{
@@ -179,6 +200,12 @@ void tst_qvariant::smallClassVariantCreation()
variantCreation<SmallClass>(SmallClass());
}
+void tst_qvariant::enumVariantCreation()
+{
+ variantCreation<ABenchmarkEnum>(FirstEnumValue);
+}
+
+
template <typename T>
static void variantSetValue(T d)
{
@@ -225,6 +252,11 @@ void tst_qvariant::smallClassVariantSetValue()
variantSetValue<SmallClass>(SmallClass());
}
+void tst_qvariant::enumVariantSetValue()
+{
+ variantSetValue<ABenchmarkEnum>(FirstEnumValue);
+}
+
template <typename T>
static void variantAssignment(T d)
{
diff --git a/tests/benchmarks/corelib/thread/qreadwritelock/qreadwritelock.pro b/tests/benchmarks/corelib/thread/qreadwritelock/qreadwritelock.pro
new file mode 100644
index 0000000000..86102adecd
--- /dev/null
+++ b/tests/benchmarks/corelib/thread/qreadwritelock/qreadwritelock.pro
@@ -0,0 +1,6 @@
+TEMPLATE = app
+TARGET = tst_bench_qreadwritelock
+QT = core testlib
+SOURCES += tst_qreadwritelock.cpp
+CONFIG += c++14 # for std::shared_timed_mutex
+
diff --git a/tests/benchmarks/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp b/tests/benchmarks/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp
new file mode 100644
index 0000000000..bdec6c3a0a
--- /dev/null
+++ b/tests/benchmarks/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp
@@ -0,0 +1,183 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Olivier Goffart <ogoffart@woboq.com>
+** Contact: http://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 <QtCore/QtCore>
+#include <QtTest/QtTest>
+#include <mutex>
+#if QT_HAS_INCLUDE(<shared_mutex>)
+#if __cplusplus > 201103L
+#include <shared_mutex>
+#endif
+#endif
+
+// Wrapers that take pointers instead of reference to have the same interface as Qt
+template <typename T>
+struct LockerWrapper : T
+{
+ LockerWrapper(typename T::mutex_type *mtx)
+ : T(*mtx)
+ {
+ }
+};
+
+int threadCount;
+
+class tst_QReadWriteLock : public QObject
+{
+ Q_OBJECT
+public:
+ tst_QReadWriteLock()
+ {
+ // at least 2 threads, even on single cpu/core machines
+ threadCount = qMax(2, QThread::idealThreadCount());
+ qDebug("thread count: %d", threadCount);
+ }
+
+private slots:
+ void uncontended_data();
+ void uncontended();
+ void readOnly_data();
+ void readOnly();
+ // void readWrite();
+};
+
+struct FunctionPtrHolder
+{
+ FunctionPtrHolder(QFunctionPointer value = nullptr)
+ : value(value)
+ {
+ }
+ QFunctionPointer value;
+};
+Q_DECLARE_METATYPE(FunctionPtrHolder)
+
+struct FakeLock
+{
+ FakeLock(volatile int *i) { *i = 0; }
+};
+
+enum { Iterations = 1000000 };
+
+template <typename Mutex, typename Locker>
+void testUncontended()
+{
+ Mutex lock;
+ QBENCHMARK {
+ for (int i = 0; i < Iterations; ++i) {
+ Locker locker(&lock);
+ }
+ }
+}
+
+void tst_QReadWriteLock::uncontended_data()
+{
+ QTest::addColumn<FunctionPtrHolder>("holder");
+
+ QTest::newRow("nothing") << FunctionPtrHolder(testUncontended<int, FakeLock>);
+ QTest::newRow("QMutex") << FunctionPtrHolder(testUncontended<QMutex, QMutexLocker>);
+ QTest::newRow("QReadWriteLock, read")
+ << FunctionPtrHolder(testUncontended<QReadWriteLock, QReadLocker>);
+ QTest::newRow("QReadWriteLock, write")
+ << FunctionPtrHolder(testUncontended<QReadWriteLock, QWriteLocker>);
+ QTest::newRow("std::mutex") << FunctionPtrHolder(
+ testUncontended<std::mutex, LockerWrapper<std::unique_lock<std::mutex>>>);
+#if defined __cpp_lib_shared_timed_mutex
+ QTest::newRow("std::shared_timed_mutex, read") << FunctionPtrHolder(
+ testUncontended<std::shared_timed_mutex,
+ LockerWrapper<std::shared_lock<std::shared_timed_mutex>>>);
+ QTest::newRow("std::shared_timed_mutex, write") << FunctionPtrHolder(
+ testUncontended<std::shared_timed_mutex,
+ LockerWrapper<std::unique_lock<std::shared_timed_mutex>>>);
+#endif
+}
+
+void tst_QReadWriteLock::uncontended()
+{
+ QFETCH(FunctionPtrHolder, holder);
+ holder.value();
+}
+
+static QHash<QString, QString> global_hash;
+
+template <typename Mutex, typename Locker>
+void testReadOnly()
+{
+ struct Thread : QThread
+ {
+ Mutex *lock;
+ void run()
+ {
+ for (int i = 0; i < Iterations; ++i) {
+ QString s = QString::number(i); // Do something outside the lock
+ Locker locker(lock);
+ global_hash.contains(s);
+ }
+ }
+ };
+ Mutex lock;
+ QVector<QThread *> threads;
+ for (int i = 0; i < threadCount; ++i) {
+ auto t = new Thread;
+ t->lock = &lock;
+ threads.append(t);
+ }
+ QBENCHMARK {
+ for (auto t : threads) {
+ t->start();
+ }
+ for (auto t : threads) {
+ t->wait();
+ }
+ }
+ qDeleteAll(threads);
+}
+
+void tst_QReadWriteLock::readOnly_data()
+{
+ QTest::addColumn<FunctionPtrHolder>("holder");
+
+ QTest::newRow("nothing") << FunctionPtrHolder(testReadOnly<int, FakeLock>);
+ QTest::newRow("QMutex") << FunctionPtrHolder(testReadOnly<QMutex, QMutexLocker>);
+ QTest::newRow("QReadWriteLock") << FunctionPtrHolder(testReadOnly<QReadWriteLock, QReadLocker>);
+ QTest::newRow("std::mutex") << FunctionPtrHolder(
+ testReadOnly<std::mutex, LockerWrapper<std::unique_lock<std::mutex>>>);
+#if defined __cpp_lib_shared_timed_mutex
+ QTest::newRow("std::shared_timed_mutex") << FunctionPtrHolder(
+ testReadOnly<std::shared_timed_mutex,
+ LockerWrapper<std::shared_lock<std::shared_timed_mutex>>>);
+#endif
+}
+
+void tst_QReadWriteLock::readOnly()
+{
+ QFETCH(FunctionPtrHolder, holder);
+ holder.value();
+}
+
+QTEST_MAIN(tst_QReadWriteLock)
+#include "tst_qreadwritelock.moc"
diff --git a/tests/benchmarks/corelib/thread/thread.pro b/tests/benchmarks/corelib/thread/thread.pro
index 4e602ceb4e..6b3009bd0c 100644
--- a/tests/benchmarks/corelib/thread/thread.pro
+++ b/tests/benchmarks/corelib/thread/thread.pro
@@ -1,6 +1,7 @@
TEMPLATE = subdirs
SUBDIRS = \
qmutex \
+ qreadwritelock \
qthreadstorage \
qthreadpool \
qwaitcondition \
diff --git a/tests/benchmarks/corelib/tools/containers-sequential/main.cpp b/tests/benchmarks/corelib/tools/containers-sequential/main.cpp
index 9ce8fffa8e..64d3dd5733 100644
--- a/tests/benchmarks/corelib/tools/containers-sequential/main.cpp
+++ b/tests/benchmarks/corelib/tools/containers-sequential/main.cpp
@@ -119,12 +119,7 @@ struct Large { // A "large" item type
int x[1000];
};
-// Embedded devices typically have limited memory
-#if defined(Q_OS_WINCE)
-# define LARGE_MAX_SIZE 2000
-#else
-# define LARGE_MAX_SIZE 20000
-#endif
+#define LARGE_MAX_SIZE 20000
class tst_vector_vs_std : public QObject
{
diff --git a/tests/benchmarks/corelib/tools/qcryptographichash/main.cpp b/tests/benchmarks/corelib/tools/qcryptographichash/main.cpp
index 045beb17f3..5799b32b1c 100644
--- a/tests/benchmarks/corelib/tools/qcryptographichash/main.cpp
+++ b/tests/benchmarks/corelib/tools/qcryptographichash/main.cpp
@@ -34,15 +34,6 @@
#include <time.h>
-#ifdef Q_OS_WINCE
-// no C89 time() on Windows CE:
-// http://blogs.msdn.com/b/cenet/archive/2006/04/29/time-h-on-windows-ce.aspx
-uint time(void *)
-{
- return uint(-1);
-}
-#endif
-
class tst_bench_QCryptographicHash : public QObject
{
Q_OBJECT
diff --git a/tests/benchmarks/dbus/qdbustype/qdbustype.pro b/tests/benchmarks/dbus/qdbustype/qdbustype.pro
index d30bad8ce7..70f803f56f 100644
--- a/tests/benchmarks/dbus/qdbustype/qdbustype.pro
+++ b/tests/benchmarks/dbus/qdbustype/qdbustype.pro
@@ -1,10 +1,9 @@
TARGET = tst_bench_qdbustype
QT -= gui
QT += core-private dbus-private testlib
-contains(QT_CONFIG, dbus-linked) {
+qtConfig(dbus-linked) {
DEFINES += QT_LINKED_LIBDBUS
- LIBS += $$QT_LIBS_DBUS
- QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS
+ QMAKE_USE += dbus
} else {
SOURCES += ../../../../src/dbus/qdbus_symbols.cpp
}
diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
index 7f52bb0eba..0064ecbaaf 100644
--- a/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
@@ -401,9 +401,6 @@ void tst_QGraphicsView::chipTester_data()
void tst_QGraphicsView::chipTester()
{
-#ifdef Q_OS_WINCE_WM
- QSKIP("WinCE WM: Fails on Windows Mobile w/o OpenGL");
-#endif
QFETCH(bool, antialias);
QFETCH(bool, opengl);
QFETCH(int, operation);
diff --git a/tests/benchmarks/gui/image/qimageconversion/qimageconversion.pro b/tests/benchmarks/gui/image/qimageconversion/qimageconversion.pro
index 9e47f979e1..828f36348d 100644
--- a/tests/benchmarks/gui/image/qimageconversion/qimageconversion.pro
+++ b/tests/benchmarks/gui/image/qimageconversion/qimageconversion.pro
@@ -3,6 +3,6 @@ TARGET = tst_bench_imageConversion
QT += testlib
SOURCES += tst_qimageconversion.cpp
-!contains(QT_CONFIG, no-gif):DEFINES += QTEST_HAVE_GIF
-!contains(QT_CONFIG, no-jpeg):DEFINES += QTEST_HAVE_JPEG
-contains(QT_CONFIG, c++11): CONFIG += c++11
+qtConfig(gif): DEFINES += QTEST_HAVE_GIF
+qtConfig(jpeg): DEFINES += QTEST_HAVE_JPEG
+qtConfig(c++11): CONFIG += c++11
diff --git a/tests/benchmarks/gui/image/qimagereader/qimagereader.pro b/tests/benchmarks/gui/image/qimagereader/qimagereader.pro
index e54e2ffce5..7de1eedbdf 100644
--- a/tests/benchmarks/gui/image/qimagereader/qimagereader.pro
+++ b/tests/benchmarks/gui/image/qimagereader/qimagereader.pro
@@ -5,22 +5,6 @@ TARGET = tst_bench_qimagereader
SOURCES += tst_qimagereader.cpp
-!contains(QT_CONFIG, no-gif):DEFINES += QTEST_HAVE_GIF
-!contains(QT_CONFIG, no-jpeg):DEFINES += QTEST_HAVE_JPEG
+qtConfig(gif): DEFINES += QTEST_HAVE_GIF
+qtConfig(jpeg): DEFINES += QTEST_HAVE_JPEG
QT += network
-
-wince {
- addFiles.files = images
- addFiles.path = .
-
- CONFIG(debug, debug|release):{
- imageFormatsPlugins.files = $$QT_BUILD_TREE/plugins/imageformats/*d4.dll
- }
-
- CONFIG(release, debug|release):{
- imageFormatsPlugins.files = $$QT_BUILD_TREE/plugins/imageformats/*[^d]4.dll
- }
- imageFormatsPlugins.path = imageformats
- DEPLOYMENT += addFiles imageFormatsPlugins
-}
-
diff --git a/tests/benchmarks/gui/text/qtextdocument/main.cpp b/tests/benchmarks/gui/text/qtextdocument/main.cpp
new file mode 100644
index 0000000000..17fee3b2eb
--- /dev/null
+++ b/tests/benchmarks/gui/text/qtextdocument/main.cpp
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Robin Burchell <robin.burchell@viroteck.net>
+** 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 <QDebug>
+#include <QTextDocument>
+#include <qtest.h>
+
+class tst_QTextDocument : public QObject
+{
+ Q_OBJECT
+private slots:
+ void mightBeRichText_data();
+ void mightBeRichText();
+};
+
+void tst_QTextDocument::mightBeRichText_data()
+{
+ QTest::addColumn<QString>("source");
+ QTest::addColumn<bool>("isMaybeRichText");
+ QTest::newRow("empty") << QString() << false;
+ QTest::newRow("simple") << QString::fromLatin1("<html><b>Foo</b></html>") << true;
+ QTest::newRow("simple2") << QString::fromLatin1("<b>Foo</b>") << true;
+ QTest::newRow("documentation-header") << QString("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n"
+ "<!DOCTYPE html\n"
+ " PUBLIC ""-//W3C//DTD XHTML 1.0 Strict//EN\" \"DTD/xhtml1-strict.dtd\">\n"
+ "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">")
+ << true;
+ QTest::newRow("br-nospace") << QString("Test <br/> new line") << true;
+ QTest::newRow("br-space") << QString("Test <br /> new line") << true;
+ QTest::newRow("br-invalidspace") << QString("Test <br/ > new line") << false;
+ QTest::newRow("invalid closing tag") << QString("Test <br/ line") << false;
+ QTest::newRow("no tags") << QString("Test line") << false;
+}
+
+void tst_QTextDocument::mightBeRichText()
+{
+ QFETCH(QString, source);
+ QFETCH(bool, isMaybeRichText);
+ QBENCHMARK {
+ QCOMPARE(isMaybeRichText, Qt::mightBeRichText(source));
+ }
+}
+
+QTEST_MAIN(tst_QTextDocument)
+
+#include "main.moc"
diff --git a/tests/benchmarks/gui/text/qtextdocument/qtextdocument.pro b/tests/benchmarks/gui/text/qtextdocument/qtextdocument.pro
new file mode 100644
index 0000000000..67cef8b25c
--- /dev/null
+++ b/tests/benchmarks/gui/text/qtextdocument/qtextdocument.pro
@@ -0,0 +1,7 @@
+QT += testlib
+QT += gui-private
+
+TEMPLATE = app
+TARGET = tst_bench_QTextDocument
+
+SOURCES += main.cpp
diff --git a/tests/benchmarks/gui/text/text.pro b/tests/benchmarks/gui/text/text.pro
index 34e548b4d3..6dc4f5d16e 100644
--- a/tests/benchmarks/gui/text/text.pro
+++ b/tests/benchmarks/gui/text/text.pro
@@ -1,4 +1,5 @@
TEMPLATE = subdirs
SUBDIRS = \
qfontmetrics \
- qtext
+ qtext \
+ qtextdocument
diff --git a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp
index 73035be14f..dfa658df11 100644
--- a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp
@@ -668,12 +668,8 @@ void tst_qnetworkreply::uploadPerformance()
void tst_qnetworkreply::httpUploadPerformance()
{
-#if defined(Q_OS_WINCE_WM)
- // Show some mercy for non-desktop platform/s
- enum {UploadSize = 4*1024*1024}; // 4 MB
-#else
enum {UploadSize = 128*1024*1024}; // 128 MB
-#endif
+
ThreadedDataReaderHttpServer reader;
FixedSizeDataGenerator generator(UploadSize);
@@ -739,12 +735,9 @@ void tst_qnetworkreply::httpDownloadPerformance()
{
QFETCH(bool, serverSendsContentLength);
QFETCH(bool, chunkedEncoding);
-#if defined(Q_OS_WINCE_WM)
- // Show some mercy to non-desktop platform/s
- enum {UploadSize = 4*1024*1024}; // 4 MB
-#else
+
enum {UploadSize = 128*1024*1024}; // 128 MB
-#endif
+
HttpDownloadPerformanceServer server(UploadSize, serverSendsContentLength, chunkedEncoding);
QNetworkRequest request(QUrl("http://127.0.0.1:" + QString::number(server.serverPort()) + "/?bare=1"));
@@ -823,12 +816,7 @@ void tst_qnetworkreply::httpDownloadPerformanceDownloadBuffer()
QFETCH(HttpDownloadPerformanceDownloadBufferTestType, testType);
// On my Linux Desktop the results are already visible with 128 kB, however we use this to have good results.
-#if defined(Q_OS_WINCE_WM)
- // Show some mercy to non-desktop platform/s
- enum {UploadSize = 4*1024*1024}; // 4 MB
-#else
enum {UploadSize = 32*1024*1024}; // 32 MB
-#endif
HttpDownloadPerformanceServer server(UploadSize, true, false);
diff --git a/tests/benchmarks/network/kernel/kernel.pro b/tests/benchmarks/network/kernel/kernel.pro
index 53ec370d60..7b18eefda2 100644
--- a/tests/benchmarks/network/kernel/kernel.pro
+++ b/tests/benchmarks/network/kernel/kernel.pro
@@ -1,4 +1,4 @@
TEMPLATE = subdirs
-contains(QT_CONFIG,private_tests):SUBDIRS += \
+qtConfig(private_tests): SUBDIRS += \
qhostinfo
diff --git a/tests/benchmarks/network/network.pro b/tests/benchmarks/network/network.pro
index ec812407f7..01b3b80ef4 100644
--- a/tests/benchmarks/network/network.pro
+++ b/tests/benchmarks/network/network.pro
@@ -8,7 +8,7 @@ TRUSTED_BENCHMARKS += \
kernel/qhostinfo \
socket/qtcpserver
-contains(QT_CONFIG, openssl) {
+qtConfig(openssl) {
SUBDIRS += ssl
TRUSTED_BENCHMARKS += ssl/qsslsocket
}
diff --git a/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp b/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp
index 2e4a3b3fcd..3e731bec96 100644
--- a/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp
+++ b/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp
@@ -166,9 +166,6 @@ void tst_QTcpServer::ipv6LoopbackPerformanceTest()
QFETCH_GLOBAL(bool, setProxy);
if (setProxy)
return;
-#if defined(Q_OS_WINCE_WM)
- QSKIP("WinCE WM: Not yet supported");
-#endif
QTcpServer server;
if (!server.listen(QHostAddress::LocalHostIPv6, 0)) {
diff --git a/tests/benchmarks/widgets/widgets.pro b/tests/benchmarks/widgets/widgets.pro
new file mode 100644
index 0000000000..8fe49ff2c6
--- /dev/null
+++ b/tests/benchmarks/widgets/widgets.pro
@@ -0,0 +1,3 @@
+TEMPLATE = subdirs
+SUBDIRS = \
+ widgets \
diff --git a/tests/benchmarks/widgets/widgets/qtextbrowser/main.cpp b/tests/benchmarks/widgets/widgets/qtextbrowser/main.cpp
new file mode 100644
index 0000000000..e469ddcb5b
--- /dev/null
+++ b/tests/benchmarks/widgets/widgets/qtextbrowser/main.cpp
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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 <QDebug>
+#include <QTextBrowser>
+#include <qtest.h>
+
+class tst_QTextBrowser : public QObject
+{
+ Q_OBJECT
+private slots:
+ void largeDocumentsLazyLayout();
+};
+
+void tst_QTextBrowser::largeDocumentsLazyLayout()
+{
+ QString sl;
+ for (int i = 0; i < 150000; ++i) {
+ sl.append("long long text\n");
+ }
+
+ QBENCHMARK {
+ QTextBrowser browser;
+ browser.setPlainText(sl);
+ browser.show();
+ }
+}
+
+QTEST_MAIN(tst_QTextBrowser)
+
+#include "main.moc"
diff --git a/tests/benchmarks/widgets/widgets/qtextbrowser/qtextbrowser.pro b/tests/benchmarks/widgets/widgets/qtextbrowser/qtextbrowser.pro
new file mode 100644
index 0000000000..d4a533b335
--- /dev/null
+++ b/tests/benchmarks/widgets/widgets/qtextbrowser/qtextbrowser.pro
@@ -0,0 +1,6 @@
+QT += testlib widgets
+
+TEMPLATE = app
+TARGET = tst_bench_QTextBrowser
+
+SOURCES += main.cpp
diff --git a/tests/benchmarks/widgets/widgets/widgets.pro b/tests/benchmarks/widgets/widgets/widgets.pro
new file mode 100644
index 0000000000..593413a770
--- /dev/null
+++ b/tests/benchmarks/widgets/widgets/widgets.pro
@@ -0,0 +1,3 @@
+TEMPLATE = subdirs
+SUBDIRS = \
+ qtextbrowser \