summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-01-24 10:33:37 +0100
committerOswald Buddenhagen <oswald.buddenhagen@qt.io>2017-01-25 20:06:06 +0100
commit318b58562ae89453fb98e8145cd0440e14ba60b0 (patch)
tree622bc032cf076b4569621032f3a3315d95c3ae88 /tests
parentc28fde3fdac19fd5a5f614bb7983080031c924b3 (diff)
parent79352528a1726b4551ea4d9285dd2394dd0d43da (diff)
Merge remote-tracking branch 'origin/5.8' into dev
Conflicts: .qmake.conf mkspecs/common/msvc-desktop.conf mkspecs/common/msvc-version.conf mkspecs/common/winrt_winphone/qmake.conf mkspecs/features/mac/default_post.prf mkspecs/features/mac/sdk.prf mkspecs/features/qt.prf mkspecs/features/uikit/default_post.prf mkspecs/features/winrt/default_pre.prf mkspecs/winphone-arm-msvc2013/qmake.conf mkspecs/winphone-x86-msvc2013/qmake.conf mkspecs/winrt-arm-msvc2013/qmake.conf mkspecs/winrt-x64-msvc2013/qmake.conf mkspecs/winrt-x86-msvc2013/qmake.conf qmake/generators/win32/msvc_vcproj.cpp src/gui/kernel/qwindowsysteminterface.cpp src/network/kernel/qhostaddress.cpp src/plugins/platforms/mirclient/qmirclientplugin.cpp src/plugins/platforms/mirclient/qmirclientplugin.h src/widgets/util/qsystemtrayicon.cpp tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp tools/configure/Makefile.mingw tools/configure/Makefile.win32 Done-with: Jake Petroules <jake.petroules@qt.io> Done-with: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Change-Id: I4be3262d3994e11929d3b1ded2c3379783797dbe
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp64
-rw-r--r--tests/auto/corelib/codecs/utf8/tst_utf8.cpp33
-rw-r--r--tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp76
-rw-r--r--tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp172
-rw-r--r--tests/auto/corelib/kernel/qobject/test/test.pro3
-rw-r--r--tests/auto/corelib/kernel/qobject/tst_qobject.cpp35
-rw-r--r--tests/auto/corelib/kernel/qsharedmemory/qsharedmemory.pro7
-rw-r--r--tests/auto/corelib/kernel/qtimer/qtimer.pro3
-rw-r--r--tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp8
-rw-r--r--tests/auto/corelib/thread/qfuture/qfuture.pro2
-rw-r--r--tests/auto/corelib/thread/qfuturesynchronizer/qfuturesynchronizer.pro2
-rw-r--r--tests/auto/corelib/thread/qresultstore/qresultstore.pro2
-rw-r--r--tests/auto/corelib/tools/qlocale/tst_qlocale.cpp39
-rw-r--r--tests/auto/gui/text/qfont/tst_qfont.cpp16
-rw-r--r--tests/auto/network/bearer/qnetworkconfiguration/tst_qnetworkconfiguration.cpp4
-rw-r--r--tests/auto/network/bearer/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp10
-rw-r--r--tests/auto/network/bearer/qnetworksession/test/tst_qnetworksession.cpp6
-rw-r--r--tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp1
-rw-r--r--tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp140
-rw-r--r--tests/auto/network/ssl/qssldiffiehellmanparameters/tst_qssldiffiehellmanparameters.cpp35
-rw-r--r--tests/auto/other/lancelot/lancelot.pro2
-rw-r--r--tests/auto/printsupport/kernel/qprintdevice/qprintdevice.pro2
-rw-r--r--tests/auto/printsupport/kernel/qprinterinfo/qprinterinfo.pro2
-rw-r--r--tests/auto/testlib/selftests/test/test.pro2
-rw-r--r--tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp82
-rw-r--r--tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp14
-rw-r--r--tests/auto/widgets/kernel/qstackedlayout/tst_qstackedlayout.cpp2
-rw-r--r--tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp25
-rw-r--r--tests/benchmarks/corelib/tools/qdatetime/main.cpp5
29 files changed, 592 insertions, 202 deletions
diff --git a/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp b/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp
index 25b6216075..290c2abc98 100644
--- a/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp
+++ b/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp
@@ -40,6 +40,16 @@
#ifdef BAD_TIMER_RESOLUTION
static const char timerError[] = "On this platform, consistent timing is not working properly due to bad timer resolution";
+
+# define WAIT_FOR_STOPPED(animation, duration) \
+ QTest::qWait(duration); \
+ if (animation.state() != QAbstractAnimation::Stopped) \
+ QEXPECT_FAIL("", timerError, Abort); \
+ QCOMPARE(animation.state(), QAbstractAnimation::Stopped)
+#else
+// Use QTRY_COMPARE with one additional timer tick
+# define WAIT_FOR_STOPPED(animation, duration) \
+ QTRY_COMPARE_WITH_TIMEOUT(animation.state(), QAbstractAnimation::Stopped, (duration))
#endif
class TestablePauseAnimation : public QPauseAnimation
@@ -108,11 +118,10 @@ void tst_QPauseAnimation::changeDirectionWhileRunning()
TestablePauseAnimation animation;
animation.setDuration(400);
animation.start();
- QTest::qWait(100);
- QCOMPARE(animation.state(), QAbstractAnimation::Running);
+ QTRY_COMPARE(animation.state(), QAbstractAnimation::Running);
animation.setDirection(QAbstractAnimation::Backward);
- QTest::qWait(animation.totalDuration() + 50);
- QCOMPARE(animation.state(), QAbstractAnimation::Stopped);
+ const int expectedDuration = animation.totalDuration() + 100;
+ WAIT_FOR_STOPPED(animation, expectedDuration);
}
void tst_QPauseAnimation::noTimerUpdates_data()
@@ -137,14 +146,9 @@ void tst_QPauseAnimation::noTimerUpdates()
animation.setDuration(duration);
animation.setLoopCount(loopCount);
animation.start();
- QTest::qWait(animation.totalDuration() + 100);
-
-#ifdef BAD_TIMER_RESOLUTION
- if (animation.state() != QAbstractAnimation::Stopped)
- QEXPECT_FAIL("", timerError, Abort);
-#endif
+ const int expectedDuration = animation.totalDuration() + 150;
+ WAIT_FOR_STOPPED(animation, expectedDuration);
- QCOMPARE(animation.state(), QAbstractAnimation::Stopped);
const int expectedLoopCount = 1 + loopCount;
#ifdef BAD_TIMER_RESOLUTION
@@ -166,13 +170,9 @@ void tst_QPauseAnimation::multiplePauseAnimations()
animation.start();
animation2.start();
- QTest::qWait(animation.totalDuration() + 100);
-#ifdef BAD_TIMER_RESOLUTION
- if (animation.state() != QAbstractAnimation::Stopped)
- QEXPECT_FAIL("", timerError, Abort);
-#endif
- QCOMPARE(animation.state(), QAbstractAnimation::Stopped);
+ const int expectedDuration = animation.totalDuration() + 150;
+ WAIT_FOR_STOPPED(animation, expectedDuration);
#ifdef BAD_TIMER_RESOLUTION
if (animation2.state() != QAbstractAnimation::Running)
@@ -192,13 +192,7 @@ void tst_QPauseAnimation::multiplePauseAnimations()
#endif
QCOMPARE(animation2.m_updateCurrentTimeCount, 2);
- QTest::qWait(550);
-
-#ifdef BAD_TIMER_RESOLUTION
- if (animation2.state() != QAbstractAnimation::Stopped)
- QEXPECT_FAIL("", timerError, Abort);
-#endif
- QCOMPARE(animation2.state(), QAbstractAnimation::Stopped);
+ WAIT_FOR_STOPPED(animation2, 600);
#ifdef BAD_TIMER_RESOLUTION
if (animation2.m_updateCurrentTimeCount != 3)
@@ -229,13 +223,9 @@ void tst_QPauseAnimation::pauseAndPropertyAnimations()
QCOMPARE(pause.state(), QAbstractAnimation::Running);
QCOMPARE(pause.m_updateCurrentTimeCount, 2);
- QTest::qWait(animation.totalDuration() + 100);
+ const int expectedDuration = animation.totalDuration() + 150;
+ WAIT_FOR_STOPPED(animation, expectedDuration);
-#ifdef BAD_TIMER_RESOLUTION
- if (animation.state() != QAbstractAnimation::Stopped)
- QEXPECT_FAIL("", timerError, Abort);
-#endif
- QCOMPARE(animation.state(), QAbstractAnimation::Stopped);
QCOMPARE(pause.state(), QAbstractAnimation::Stopped);
QVERIFY(pause.m_updateCurrentTimeCount > 3);
}
@@ -405,13 +395,8 @@ void tst_QPauseAnimation::multipleSequentialGroups()
// This is a pretty long animation so it tends to get rather out of sync
// when using the consistent timer, so run for an extra half second for good
// measure...
- QTest::qWait(group.totalDuration() + 500);
-
-#ifdef BAD_TIMER_RESOLUTION
- if (group.state() != QAbstractAnimation::Stopped)
- QEXPECT_FAIL("", timerError, Abort);
-#endif
- QCOMPARE(group.state(), QAbstractAnimation::Stopped);
+ const int expectedDuration = group.totalDuration() + 550;
+ WAIT_FOR_STOPPED(group, expectedDuration);
#ifdef BAD_TIMER_RESOLUTION
if (subgroup1.state() != QAbstractAnimation::Stopped)
@@ -449,8 +434,9 @@ void tst_QPauseAnimation::zeroDuration()
TestablePauseAnimation animation;
animation.setDuration(0);
animation.start();
- QTest::qWait(animation.totalDuration() + 100);
- QCOMPARE(animation.state(), QAbstractAnimation::Stopped);
+ const int expectedDuration = animation.totalDuration() + 150;
+ WAIT_FOR_STOPPED(animation, expectedDuration);
+
QCOMPARE(animation.m_updateCurrentTimeCount, 1);
}
diff --git a/tests/auto/corelib/codecs/utf8/tst_utf8.cpp b/tests/auto/corelib/codecs/utf8/tst_utf8.cpp
index 5666726a8c..8f78aa937c 100644
--- a/tests/auto/corelib/codecs/utf8/tst_utf8.cpp
+++ b/tests/auto/corelib/codecs/utf8/tst_utf8.cpp
@@ -237,39 +237,6 @@ void tst_Utf8::nonCharacters_data()
QTest::addColumn<QByteArray>("utf8");
QTest::addColumn<QString>("utf16");
- // Unicode has a couple of "non-characters" that one can use internally
- // These characters may be used for interchange;
- // see: http://www.unicode.org/versions/corrigendum9.html
- //
- // Those are the last two entries each Unicode Plane (U+FFFE, U+FFFF,
- // U+1FFFE, U+1FFFF, etc.) as well as the entries between U+FDD0 and
- // U+FDEF (inclusive)
-
- // U+FDD0 through U+FDEF
- for (int i = 0; i < 32; ++i) {
- char utf8[] = { char(0357), char(0267), char(0220 + i), 0 };
- QString utf16 = QChar(0xfdd0 + i);
- QTest::newRow(qPrintable(QString::number(0xfdd0 + i, 16))) << QByteArray(utf8) << utf16;
- }
-
- // the last two in Planes 1 through 16
- for (uint plane = 1; plane <= 16; ++plane) {
- for (uint lower = 0xfffe; lower < 0x10000; ++lower) {
- uint ucs4 = (plane << 16) | lower;
- char utf8[] = { char(0xf0 | uchar(ucs4 >> 18)),
- char(0x80 | (uchar(ucs4 >> 12) & 0x3f)),
- char(0x80 | (uchar(ucs4 >> 6) & 0x3f)),
- char(0x80 | (uchar(ucs4) & 0x3f)),
- 0 };
- ushort utf16[] = { QChar::highSurrogate(ucs4), QChar::lowSurrogate(ucs4), 0 };
-
- QTest::newRow(qPrintable(QString::number(ucs4, 16))) << QByteArray(utf8) << QString::fromUtf16(utf16);
- }
- }
-
- QTest::newRow("fffe") << QByteArray("\xEF\xBF\xBE") << QString(QChar(0xfffe));
- QTest::newRow("ffff") << QByteArray("\xEF\xBF\xBF") << QString(QChar(0xffff));
-
extern void loadNonCharactersRows();
loadNonCharactersRows();
}
diff --git a/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp b/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp
index e946f3104a..564b8547b1 100644
--- a/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp
+++ b/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp
@@ -68,6 +68,8 @@ private slots:
void itemData();
+ void persistIndexOnLayoutChange();
+
protected:
void verifyIdentity(QAbstractItemModel *model, const QModelIndex &parent = QModelIndex());
@@ -377,5 +379,79 @@ void tst_QIdentityProxyModel::itemData()
QCOMPARE(proxy.itemData(topIndex).value(Qt::DisplayRole).toString(), QStringLiteral("Monday_appended"));
}
+void dump(QAbstractItemModel* model, QString const& indent = " - ", QModelIndex const& parent = {})
+{
+ for (auto row = 0; row < model->rowCount(parent); ++row)
+ {
+ auto idx = model->index(row, 0, parent);
+ qDebug() << (indent + idx.data().toString());
+ dump(model, indent + "- ", idx);
+ }
+}
+
+void tst_QIdentityProxyModel::persistIndexOnLayoutChange()
+{
+ DynamicTreeModel model;
+
+ QList<int> ancestors;
+ for (auto i = 0; i < 3; ++i)
+ {
+ Q_UNUSED(i);
+ ModelInsertCommand insertCommand(&model);
+ insertCommand.setAncestorRowNumbers(ancestors);
+ insertCommand.setStartRow(0);
+ insertCommand.setEndRow(0);
+ insertCommand.doCommand();
+ ancestors.push_back(0);
+ }
+ ModelInsertCommand insertCommand(&model);
+ insertCommand.setAncestorRowNumbers(ancestors);
+ insertCommand.setStartRow(0);
+ insertCommand.setEndRow(1);
+ insertCommand.doCommand();
+
+ // dump(&model);
+ // " - 1"
+ // " - - 2"
+ // " - - - 3"
+ // " - - - - 4"
+ // " - - - - 5"
+
+ QIdentityProxyModel proxy;
+ proxy.setSourceModel(&model);
+
+ QPersistentModelIndex persistentIndex;
+
+ QPersistentModelIndex sourcePersistentIndex = model.match(model.index(0, 0), Qt::DisplayRole, "5", 1, Qt::MatchRecursive).first();
+
+ QCOMPARE(sourcePersistentIndex.data().toString(), QStringLiteral("5"));
+
+ bool gotLayoutAboutToBeChanged = false;
+ bool gotLayoutChanged = false;
+
+ QObject::connect(&proxy, &QAbstractItemModel::layoutAboutToBeChanged, &proxy, [&proxy, &persistentIndex, &gotLayoutAboutToBeChanged]
+ {
+ gotLayoutAboutToBeChanged = true;
+ persistentIndex = proxy.match(proxy.index(0, 0), Qt::DisplayRole, "5", 1, Qt::MatchRecursive).first();
+ });
+
+ QObject::connect(&proxy, &QAbstractItemModel::layoutChanged, &proxy, [&proxy, &persistentIndex, &sourcePersistentIndex, &gotLayoutChanged]
+ {
+ gotLayoutChanged = true;
+ QCOMPARE(QModelIndex(persistentIndex), proxy.mapFromSource(sourcePersistentIndex));
+ });
+
+ ModelChangeChildrenLayoutsCommand layoutChangeCommand(&model, 0);
+
+ layoutChangeCommand.setAncestorRowNumbers(QList<int>{0, 0, 0});
+ layoutChangeCommand.setSecondAncestorRowNumbers(QList<int>{0, 0});
+
+ layoutChangeCommand.doCommand();
+
+ QVERIFY(gotLayoutAboutToBeChanged);
+ QVERIFY(gotLayoutChanged);
+ QVERIFY(persistentIndex.isValid());
+}
+
QTEST_MAIN(tst_QIdentityProxyModel)
#include "tst_qidentityproxymodel.moc"
diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
index 38e3c6890d..7b6c470dc4 100644
--- a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
+++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
@@ -145,6 +145,9 @@ private slots:
void canDropMimeData();
void filterHint();
+ void sourceLayoutChangeLeavesValidPersistentIndexes();
+ void rowMoveLeavesValidPersistentIndexes();
+
protected:
void buildHierarchy(const QStringList &data, QAbstractItemModel *model);
void checkHierarchy(const QStringList &data, const QAbstractItemModel *model);
@@ -4181,5 +4184,174 @@ void tst_QSortFilterProxyModel::filterHint()
QAbstractItemModel::NoLayoutChangeHint);
}
+/**
+
+ Creates a model where each item has one child, to a set depth,
+ and the last item has no children. For a model created with
+ setDepth(4):
+
+ - 1
+ - - 2
+ - - - 3
+ - - - - 4
+*/
+class StepTreeModel : public QAbstractItemModel
+{
+ Q_OBJECT
+public:
+ StepTreeModel(QObject * parent = 0)
+ : QAbstractItemModel(parent), m_depth(0) {}
+
+ int columnCount(const QModelIndex& = QModelIndex()) const override { return 1; }
+
+ int rowCount(const QModelIndex& parent = QModelIndex()) const override
+ {
+ quintptr parentId = (parent.isValid()) ? parent.internalId() : 0;
+ return (parentId < m_depth) ? 1 : 0;
+ }
+
+ QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const override
+ {
+ if (role != Qt::DisplayRole)
+ return QVariant();
+
+ return QString::number(index.internalId());
+ }
+
+ QModelIndex index(int, int, const QModelIndex& parent = QModelIndex()) const override
+ {
+ quintptr parentId = (parent.isValid()) ? parent.internalId() : 0;
+ if (parentId >= m_depth)
+ return QModelIndex();
+
+ return createIndex(0, 0, parentId + 1);
+ }
+
+ QModelIndex parent(const QModelIndex& index) const override
+ {
+ if (index.internalId() == 0)
+ return QModelIndex();
+
+ return createIndex(0, 0, index.internalId() - 1);
+ }
+
+ void setDepth(quintptr depth)
+ {
+ int parentIdWithLayoutChange = (m_depth < depth) ? m_depth : depth;
+
+ QList<QPersistentModelIndex> parentsOfLayoutChange;
+ parentsOfLayoutChange.push_back(createIndex(0, 0, parentIdWithLayoutChange));
+
+ layoutAboutToBeChanged(parentsOfLayoutChange);
+
+ auto existing = persistentIndexList();
+
+ QList<QModelIndex> updated;
+
+ for (auto idx : existing) {
+ if (indexDepth(idx) <= depth)
+ updated.push_back(idx);
+ else
+ updated.push_back({});
+ }
+
+ m_depth = depth;
+
+ changePersistentIndexList(existing, updated);
+
+ layoutChanged(parentsOfLayoutChange);
+ }
+
+private:
+ static quintptr indexDepth(QModelIndex const& index)
+ {
+ return (index.isValid()) ? 1 + indexDepth(index.parent()) : 0;
+ }
+
+private:
+ quintptr m_depth;
+};
+
+void tst_QSortFilterProxyModel::sourceLayoutChangeLeavesValidPersistentIndexes()
+{
+ StepTreeModel model;
+ Q_SET_OBJECT_NAME(model);
+ model.setDepth(4);
+
+ QSortFilterProxyModel proxy1;
+ proxy1.setSourceModel(&model);
+ Q_SET_OBJECT_NAME(proxy1);
+
+ proxy1.setFilterRegExp("1|2");
+
+ // The current state of things:
+ // model proxy
+ // - 1 - 1
+ // - - 2 - - 2
+ // - - - 3
+ // - - - - 4
+
+ // The setDepth call below removes '4' with a layoutChanged call.
+ // Because the proxy filters that out anyway, the proxy doesn't need
+ // to emit any signals or update persistent indexes.
+
+ QPersistentModelIndex persistentIndex = proxy1.index(0, 0, proxy1.index(0, 0));
+
+ model.setDepth(3);
+
+ // Calling parent() causes the internalPointer to be used.
+ // Before fixing QTBUG-47711, that could be a dangling pointer.
+ // The use of qDebug here makes sufficient use of the heap to
+ // cause corruption at runtime with normal use on linux (before
+ // the fix). valgrind confirms the fix.
+ qDebug() << persistentIndex.parent();
+ QVERIFY(persistentIndex.parent().isValid());
+}
+
+void tst_QSortFilterProxyModel::rowMoveLeavesValidPersistentIndexes()
+{
+ DynamicTreeModel model;
+ Q_SET_OBJECT_NAME(model);
+
+ QList<int> ancestors;
+ for (auto i = 0; i < 5; ++i)
+ {
+ Q_UNUSED(i);
+ ModelInsertCommand insertCommand(&model);
+ insertCommand.setAncestorRowNumbers(ancestors);
+ insertCommand.setStartRow(0);
+ insertCommand.setEndRow(0);
+ insertCommand.doCommand();
+ ancestors.push_back(0);
+ }
+
+ QSortFilterProxyModel proxy1;
+ proxy1.setSourceModel(&model);
+ Q_SET_OBJECT_NAME(proxy1);
+
+ proxy1.setFilterRegExp("1|2");
+
+ auto item5 = model.match(model.index(0, 0), Qt::DisplayRole, "5", 1, Qt::MatchRecursive).first();
+ auto item3 = model.match(model.index(0, 0), Qt::DisplayRole, "3", 1, Qt::MatchRecursive).first();
+
+ Q_ASSERT(item5.isValid());
+ Q_ASSERT(item3.isValid());
+
+ QPersistentModelIndex persistentIndex = proxy1.match(proxy1.index(0, 0), Qt::DisplayRole, "2", 1, Qt::MatchRecursive).first();
+
+ ModelMoveCommand moveCommand(&model, 0);
+ moveCommand.setAncestorRowNumbers(QList<int>{0, 0, 0, 0});
+ moveCommand.setStartRow(0);
+ moveCommand.setEndRow(0);
+ moveCommand.setDestRow(0);
+ moveCommand.setDestAncestors(QList<int>{0, 0, 0});
+ moveCommand.doCommand();
+
+ // Calling parent() causes the internalPointer to be used.
+ // Before fixing QTBUG-47711 (moveRows case), that could be
+ // a dangling pointer.
+ QVERIFY(persistentIndex.parent().isValid());
+}
+
QTEST_MAIN(tst_QSortFilterProxyModel)
#include "tst_qsortfilterproxymodel.moc"
diff --git a/tests/auto/corelib/kernel/qobject/test/test.pro b/tests/auto/corelib/kernel/qobject/test/test.pro
index f3bc045455..4e77cb48c5 100644
--- a/tests/auto/corelib/kernel/qobject/test/test.pro
+++ b/tests/auto/corelib/kernel/qobject/test/test.pro
@@ -3,5 +3,8 @@ TARGET = ../tst_qobject
QT = core-private network testlib
SOURCES = ../tst_qobject.cpp
+# Force C++17 if available (needed due to P0012R1)
+contains(QT_CONFIG, c++1z): CONFIG += c++1z
+
!winrt: TEST_HELPER_INSTALLS = ../signalbug/signalbug
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
index 5eea858107..f44c40c27f 100644
--- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
+++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
@@ -120,6 +120,7 @@ private slots:
void connectCxx0x();
void connectToStaticCxx0x();
void connectCxx0xTypeMatching();
+ void connectCxx17Noexcept();
void connectConvert();
void connectWithReference();
void connectManyArguments();
@@ -4755,10 +4756,13 @@ class LotsOfSignalsAndSlots: public QObject
public slots:
void slot_v() {}
+ void slot_v_noexcept() Q_DECL_NOTHROW {}
void slot_vi(int) {}
+ void slot_vi_noexcept() Q_DECL_NOTHROW {}
void slot_vii(int, int) {}
void slot_viii(int, int, int) {}
int slot_i() { return 0; }
+ int slot_i_noexcept() Q_DECL_NOTHROW { return 0; }
int slot_ii(int) { return 0; }
int slot_iii(int, int) { return 0; }
int slot_iiii(int, int, int) { return 0; }
@@ -4772,13 +4776,18 @@ class LotsOfSignalsAndSlots: public QObject
void slot_vPFvvE(fptr) {}
void const_slot_v() const {};
+ void const_slot_v_noexcept() const Q_DECL_NOTHROW {}
void const_slot_vi(int) const {};
+ void const_slot_vi_noexcept(int) const Q_DECL_NOTHROW {}
static void static_slot_v() {}
+ static void static_slot_v_noexcept() Q_DECL_NOTHROW {}
static void static_slot_vi(int) {}
+ static void static_slot_vi_noexcept(int) Q_DECL_NOTHROW {}
static void static_slot_vii(int, int) {}
static void static_slot_viii(int, int, int) {}
static int static_slot_i() { return 0; }
+ static int static_slot_i_noexcept() Q_DECL_NOTHROW { return 0; }
static int static_slot_ii(int) { return 0; }
static int static_slot_iii(int, int) { return 0; }
static int static_slot_iiii(int, int, int) { return 0; }
@@ -4941,6 +4950,32 @@ void tst_QObject::connectCxx0xTypeMatching()
}
+void receiverFunction_noexcept() Q_DECL_NOTHROW {}
+struct Functor_noexcept { void operator()() Q_DECL_NOTHROW {} };
+void tst_QObject::connectCxx17Noexcept()
+{
+ // this is about connecting signals to slots with the Q_DECL_NOTHROW qualifier
+ // as semantics changed due to http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0012r1.html
+ typedef LotsOfSignalsAndSlots Foo;
+ Foo obj;
+
+ QObject::connect(&obj, &Foo::signal_v, &obj, &Foo::slot_v_noexcept);
+ QObject::connect(&obj, &Foo::signal_v, &obj, &Foo::slot_i_noexcept);
+ QObject::connect(&obj, &Foo::signal_v, &obj, &Foo::slot_vi_noexcept);
+
+ QObject::connect(&obj, &Foo::signal_vii, &Foo::static_slot_v_noexcept);
+ QObject::connect(&obj, &Foo::signal_vii, &Foo::static_slot_i_noexcept);
+ QObject::connect(&obj, &Foo::signal_vii, &Foo::static_slot_vi_noexcept);
+
+ QVERIFY(QObject::connect(&obj, &Foo::signal_vi, &obj, &Foo::const_slot_vi_noexcept));
+ QVERIFY(QObject::connect(&obj, &Foo::signal_vi, &obj, &Foo::const_slot_v_noexcept));
+
+ QObject::connect(&obj, &Foo::signal_v, receiverFunction_noexcept);
+
+ Functor_noexcept fn;
+ QObject::connect(&obj, &Foo::signal_v, fn);
+}
+
class StringVariant : public QObject
{ Q_OBJECT
signals:
diff --git a/tests/auto/corelib/kernel/qsharedmemory/qsharedmemory.pro b/tests/auto/corelib/kernel/qsharedmemory/qsharedmemory.pro
index 69062a9741..3a4697750e 100644
--- a/tests/auto/corelib/kernel/qsharedmemory/qsharedmemory.pro
+++ b/tests/auto/corelib/kernel/qsharedmemory/qsharedmemory.pro
@@ -1,5 +1,6 @@
TEMPLATE = subdirs
-!winrt: SUBDIRS = sharedmemoryhelper
-
-SUBDIRS += test
+qtConfig(sharedmemory) {
+ !winrt: SUBDIRS = sharedmemoryhelper
+ SUBDIRS += test
+}
diff --git a/tests/auto/corelib/kernel/qtimer/qtimer.pro b/tests/auto/corelib/kernel/qtimer/qtimer.pro
index 8afdbb148e..b27d862bc5 100644
--- a/tests/auto/corelib/kernel/qtimer/qtimer.pro
+++ b/tests/auto/corelib/kernel/qtimer/qtimer.pro
@@ -2,3 +2,6 @@ CONFIG += testcase
TARGET = tst_qtimer
QT = core testlib
SOURCES = tst_qtimer.cpp
+
+# Force C++17 if available
+contains(QT_CONFIG, c++1z): CONFIG += c++1z
diff --git a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
index fe97695d19..29ff552f6a 100644
--- a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
+++ b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
@@ -767,6 +767,11 @@ class StaticEventLoop
public:
static void quitEventLoop()
{
+ quitEventLoop_noexcept();
+ }
+
+ static void quitEventLoop_noexcept() Q_DECL_NOTHROW
+ {
QVERIFY(!_e.isNull());
_e->quit();
if (_t)
@@ -787,6 +792,9 @@ void tst_QTimer::singleShotToFunctors()
QTimer::singleShot(0, &StaticEventLoop::quitEventLoop);
QCOMPARE(_e->exec(), 0);
+ QTimer::singleShot(0, &StaticEventLoop::quitEventLoop_noexcept);
+ QCOMPARE(_e->exec(), 0);
+
QThread t1;
QObject c1;
c1.moveToThread(&t1);
diff --git a/tests/auto/corelib/thread/qfuture/qfuture.pro b/tests/auto/corelib/thread/qfuture/qfuture.pro
index ed9e189668..b1667760d6 100644
--- a/tests/auto/corelib/thread/qfuture/qfuture.pro
+++ b/tests/auto/corelib/thread/qfuture/qfuture.pro
@@ -1,5 +1,5 @@
CONFIG += testcase
TARGET = tst_qfuture
-QT = core core-private testlib concurrent
+QT = core core-private testlib
SOURCES = tst_qfuture.cpp
DEFINES += QT_STRICT_ITERATORS
diff --git a/tests/auto/corelib/thread/qfuturesynchronizer/qfuturesynchronizer.pro b/tests/auto/corelib/thread/qfuturesynchronizer/qfuturesynchronizer.pro
index 5eebd12deb..0d20117ed0 100644
--- a/tests/auto/corelib/thread/qfuturesynchronizer/qfuturesynchronizer.pro
+++ b/tests/auto/corelib/thread/qfuturesynchronizer/qfuturesynchronizer.pro
@@ -1,4 +1,4 @@
CONFIG += testcase
TARGET = tst_qfuturesynchronizer
-QT = core testlib concurrent
+QT = core testlib
SOURCES = tst_qfuturesynchronizer.cpp
diff --git a/tests/auto/corelib/thread/qresultstore/qresultstore.pro b/tests/auto/corelib/thread/qresultstore/qresultstore.pro
index 2f6c18f64c..bbebe0976b 100644
--- a/tests/auto/corelib/thread/qresultstore/qresultstore.pro
+++ b/tests/auto/corelib/thread/qresultstore/qresultstore.pro
@@ -1,5 +1,5 @@
CONFIG += testcase
TARGET = tst_qresultstore
-QT = core-private testlib concurrent
+QT = core-private testlib
SOURCES = tst_qresultstore.cpp
DEFINES += QT_STRICT_ITERATORS
diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
index 7681f4755c..f56cff4d29 100644
--- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
+++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
@@ -186,12 +186,50 @@ void tst_QLocale::ctor()
QVERIFY(l.country() == default_country);
}
+#define TEST_CTOR(req_lang, req_script, req_country, exp_lang, exp_script, exp_country) \
+ { \
+ QLocale l(QLocale::req_lang, QLocale::req_script, QLocale::req_country); \
+ QCOMPARE((int)l.language(), (int)exp_lang); \
+ QCOMPARE((int)l.script(), (int)exp_script); \
+ QCOMPARE((int)l.country(), (int)exp_country); \
+ }
+
+ // Exact matches
+ TEST_CTOR(Chinese, SimplifiedHanScript, China, QLocale::Chinese, QLocale::SimplifiedHanScript, QLocale::China);
+ TEST_CTOR(Chinese, TraditionalHanScript, Taiwan, QLocale::Chinese, QLocale::TraditionalHanScript, QLocale::Taiwan);
+ TEST_CTOR(Chinese, TraditionalHanScript, HongKong, QLocale::Chinese, QLocale::TraditionalHanScript, QLocale::HongKong);
+
+ // Best match for AnyCountry
+ TEST_CTOR(Chinese, SimplifiedHanScript, AnyCountry, QLocale::Chinese, QLocale::SimplifiedHanScript, QLocale::China);
+ TEST_CTOR(Chinese, TraditionalHanScript, AnyCountry, QLocale::Chinese, QLocale::TraditionalHanScript, QLocale::Taiwan);
+
+ // Best match for AnyScript (and change country to supported one, if necessary)
+ TEST_CTOR(Chinese, AnyScript, China, QLocale::Chinese, QLocale::SimplifiedHanScript, QLocale::China);
+ TEST_CTOR(Chinese, AnyScript, Taiwan, QLocale::Chinese, QLocale::TraditionalHanScript, QLocale::Taiwan);
+ TEST_CTOR(Chinese, AnyScript, HongKong, QLocale::Chinese, QLocale::TraditionalHanScript, QLocale::HongKong);
+ TEST_CTOR(Chinese, AnyScript, UnitedStates, QLocale::Chinese, QLocale::SimplifiedHanScript, QLocale::China);
+
+ // Fully-specified not found; find best alternate country
+ TEST_CTOR(Chinese, SimplifiedHanScript, Taiwan, QLocale::Chinese, QLocale::SimplifiedHanScript, QLocale::China);
+ TEST_CTOR(Chinese, SimplifiedHanScript, UnitedStates, QLocale::Chinese, QLocale::SimplifiedHanScript, QLocale::China);
+ TEST_CTOR(Chinese, TraditionalHanScript, China, QLocale::Chinese, QLocale::TraditionalHanScript, QLocale::Taiwan);
+ TEST_CTOR(Chinese, TraditionalHanScript, UnitedStates, QLocale::Chinese, QLocale::TraditionalHanScript, QLocale::Taiwan);
+
+ // Fully-specified not found; find best alternate script
+ TEST_CTOR(Chinese, LatinScript, China, QLocale::Chinese, QLocale::SimplifiedHanScript, QLocale::China);
+ TEST_CTOR(Chinese, LatinScript, Taiwan, QLocale::Chinese, QLocale::TraditionalHanScript, QLocale::Taiwan);
+
+ // Fully-specified not found; find best alternate country and script
+ TEST_CTOR(Chinese, LatinScript, UnitedStates, QLocale::Chinese, QLocale::SimplifiedHanScript, QLocale::China);
+
+#undef TEST_CTOR
#define TEST_CTOR(req_lang, req_country, exp_lang, exp_country) \
{ \
QLocale l(QLocale::req_lang, QLocale::req_country); \
QCOMPARE((int)l.language(), (int)exp_lang); \
QCOMPARE((int)l.country(), (int)exp_country); \
}
+
{
QLocale l(QLocale::C, QLocale::AnyCountry);
QCOMPARE(l.language(), QLocale::C);
@@ -295,7 +333,6 @@ void tst_QLocale::ctor()
TEST_CTOR(Uzbek, AnyCountry, QLocale::Uzbek, QLocale::Uzbekistan)
#undef TEST_CTOR
-
#define TEST_CTOR(req_lc, exp_lang, exp_country) \
{ \
QLocale l(req_lc); \
diff --git a/tests/auto/gui/text/qfont/tst_qfont.cpp b/tests/auto/gui/text/qfont/tst_qfont.cpp
index a6d8944656..2603206ab0 100644
--- a/tests/auto/gui/text/qfont/tst_qfont.cpp
+++ b/tests/auto/gui/text/qfont/tst_qfont.cpp
@@ -63,6 +63,7 @@ private slots:
void defaultFamily_data();
void defaultFamily();
void toAndFromString();
+ void fromStringWithoutStyleName();
void sharing();
};
@@ -358,6 +359,8 @@ void tst_QFont::serialize_data()
// Versions <= Qt 2.1 had broken point size serialization,
// so we set an integer point size.
basicFont.setPointSize(9);
+ // Versions <= Qt 5.4 didn't serialize styleName, so clear it
+ basicFont.setStyleName(QString());
QFont font = basicFont;
QTest::newRow("defaultConstructed") << font << QDataStream::Qt_1_0;
@@ -559,6 +562,19 @@ void tst_QFont::toAndFromString()
}
}
+void tst_QFont::fromStringWithoutStyleName()
+{
+ QFont font1;
+ font1.fromString("Noto Sans,12,-1,5,50,0,0,0,0,0,Regular");
+
+ QFont font2 = font1;
+ const QString str = "Times,16,-1,5,50,0,0,0,0,0";
+ font2.fromString(str);
+
+ QCOMPARE(font2.toString(), str);
+}
+
+
void tst_QFont::sharing()
{
// QFontCache references the engineData
diff --git a/tests/auto/network/bearer/qnetworkconfiguration/tst_qnetworkconfiguration.cpp b/tests/auto/network/bearer/qnetworkconfiguration/tst_qnetworkconfiguration.cpp
index 6ca881d38a..9c49e0c173 100644
--- a/tests/auto/network/bearer/qnetworkconfiguration/tst_qnetworkconfiguration.cpp
+++ b/tests/auto/network/bearer/qnetworkconfiguration/tst_qnetworkconfiguration.cpp
@@ -115,7 +115,7 @@ void tst_QNetworkConfiguration::comparison()
QSignalSpy spy(&manager, SIGNAL(updateCompleted()));
manager.updateConfigurations(); //initiate scans
- QTRY_VERIFY_WITH_TIMEOUT(spy.count() == 1, TestTimeOut); //wait for scan to complete
+ QTRY_VERIFY_WITH_TIMEOUT(spy.count() >= 1, TestTimeOut); //wait for scan to complete
QList<QNetworkConfiguration> configs = manager.allConfigurations(QNetworkConfiguration::Discovered);
QVERIFY(configs.count());
@@ -162,7 +162,7 @@ void tst_QNetworkConfiguration::isRoamingAvailable()
//force update to get maximum list
QSignalSpy spy(&manager, SIGNAL(updateCompleted()));
manager.updateConfigurations(); //initiate scans
- QTRY_VERIFY_WITH_TIMEOUT(spy.count() == 1, TestTimeOut); //wait for scan to complete
+ QTRY_VERIFY_WITH_TIMEOUT(spy.count() >= 1, TestTimeOut); //wait for scan to complete
foreach(QNetworkConfiguration c, configs)
{
diff --git a/tests/auto/network/bearer/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp b/tests/auto/network/bearer/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp
index 838612f638..b251a65420 100644
--- a/tests/auto/network/bearer/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp
+++ b/tests/auto/network/bearer/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp
@@ -68,7 +68,7 @@ void tst_QNetworkConfigurationManager::allConfigurations()
QSignalSpy spy(&manager, SIGNAL(updateCompleted()));
manager.updateConfigurations(); //initiate scans
- QTRY_VERIFY_WITH_TIMEOUT(spy.count() == 1, TestTimeOut); //wait for scan to complete
+ QTRY_VERIFY_WITH_TIMEOUT(spy.count() >= 1, TestTimeOut); //wait for scan to complete
QList<QNetworkConfiguration> configs = manager.allConfigurations();
@@ -145,7 +145,7 @@ void tst_QNetworkConfigurationManager::defaultConfiguration()
QNetworkConfigurationManager manager;
QSignalSpy spy(&manager, SIGNAL(updateCompleted()));
manager.updateConfigurations(); //initiate scans
- QTRY_VERIFY_WITH_TIMEOUT(spy.count() == 1, TestTimeOut); //wait for scan to complete
+ QTRY_VERIFY_WITH_TIMEOUT(spy.count() >= 1, TestTimeOut); //wait for scan to complete
QList<QNetworkConfiguration> configs = manager.allConfigurations();
QNetworkConfiguration defaultConfig = manager.defaultConfiguration();
@@ -175,7 +175,7 @@ void tst_QNetworkConfigurationManager::configurationFromIdentifier()
//force an update to get maximum number of configs
QSignalSpy spy(&manager, SIGNAL(updateCompleted()));
manager.updateConfigurations(); //initiate scans
- QTRY_VERIFY_WITH_TIMEOUT(spy.count() == 1, TestTimeOut); //wait for scan to complete
+ QTRY_VERIFY_WITH_TIMEOUT(spy.count() >= 1, TestTimeOut); //wait for scan to complete
QList<QNetworkConfiguration> configs = manager.allConfigurations();
@@ -203,7 +203,7 @@ protected:
preScanConfigs = manager.allConfigurations();
QSignalSpy spy(&manager, SIGNAL(updateCompleted()));
manager.updateConfigurations(); //initiate scans
- QTRY_VERIFY_WITH_TIMEOUT(spy.count() == 1, TestTimeOut); //wait for scan to complete
+ QTRY_VERIFY_WITH_TIMEOUT(spy.count() >= 1, TestTimeOut); //wait for scan to complete
configs = manager.allConfigurations();
}
public:
@@ -229,7 +229,7 @@ void tst_QNetworkConfigurationManager::usedInThread()
QList<QNetworkConfiguration> preScanConfigs = manager.allConfigurations();
QSignalSpy spy(&manager, SIGNAL(updateCompleted()));
manager.updateConfigurations(); //initiate scans
- QTRY_VERIFY_WITH_TIMEOUT(spy.count() == 1, TestTimeOut); //wait for scan to complete
+ QTRY_VERIFY_WITH_TIMEOUT(spy.count() >= 1, TestTimeOut); //wait for scan to complete
QList<QNetworkConfiguration> configs = manager.allConfigurations();
QCOMPARE(thread.configs, configs);
//Don't compare pre scan configs, because these may be cached and therefore give different results
diff --git a/tests/auto/network/bearer/qnetworksession/test/tst_qnetworksession.cpp b/tests/auto/network/bearer/qnetworksession/test/tst_qnetworksession.cpp
index 4ae511cf54..138a0859cd 100644
--- a/tests/auto/network/bearer/qnetworksession/test/tst_qnetworksession.cpp
+++ b/tests/auto/network/bearer/qnetworksession/test/tst_qnetworksession.cpp
@@ -106,7 +106,7 @@ void tst_QNetworkSession::initTestCase()
QSignalSpy spy(&manager, SIGNAL(updateCompleted()));
manager.updateConfigurations();
- QTRY_VERIFY_WITH_TIMEOUT(spy.count() == 1, TestTimeOut);
+ QTRY_VERIFY_WITH_TIMEOUT(spy.count() >= 1, TestTimeOut);
lackeyDir = QFINDTESTDATA("lackey");
QVERIFY2(!lackeyDir.isEmpty(), qPrintable(
@@ -1007,7 +1007,7 @@ QNetworkConfiguration suitableConfiguration(QString bearerType, QNetworkConfigur
QSignalSpy updateSpy(&mgr, SIGNAL(updateCompleted()));
mgr.updateConfigurations();
- QTRY_NOOP(updateSpy.count() == 1);
+ QTRY_NOOP(updateSpy.count() >= 1);
if (updateSpy.count() != 1) {
qDebug("tst_QNetworkSession::suitableConfiguration() failure: unable to update configurations");
return QNetworkConfiguration();
@@ -1052,7 +1052,7 @@ void updateConfigurations()
QNetworkConfigurationManager mgr;
QSignalSpy updateSpy(&mgr, SIGNAL(updateCompleted()));
mgr.updateConfigurations();
- QTRY_NOOP(updateSpy.count() == 1);
+ QTRY_NOOP(updateSpy.count() >= 1);
}
// A convenience-function: updates and prints all available confiurations and their states
diff --git a/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp b/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp
index 364e435d3d..a715c38f32 100644
--- a/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp
+++ b/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp
@@ -271,6 +271,7 @@ void tst_QHostAddress::specialAddresses()
//check special address equal to itself (QTBUG-22898), note two overloads of operator==
QVERIFY(QHostAddress(address) == QHostAddress(address));
QVERIFY(QHostAddress(address) == address);
+ QVERIFY(address == QHostAddress(address));
QVERIFY(!(QHostAddress(address) != QHostAddress(address)));
QVERIFY(!(QHostAddress(address) != address));
diff --git a/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp b/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp
index c945d77cda..18da122000 100644
--- a/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp
+++ b/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp
@@ -54,7 +54,6 @@ class tst_QSocks5SocketEngine : public QObject, public QAbstractSocketEngineRece
private slots:
void initTestCase();
- void init();
void construction();
void errorTest_data();
void errorTest();
@@ -74,13 +73,6 @@ private slots:
void incomplete();
protected slots:
- void tcpSocketNonBlocking_hostFound();
- void tcpSocketNonBlocking_connected();
- void tcpSocketNonBlocking_closed();
- void tcpSocketNonBlocking_readyRead();
- void tcpSocketNonBlocking_bytesWritten(qint64);
- void exitLoopSlot();
- void downloadBigFileSlot();
void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *auth);
private:
@@ -89,11 +81,6 @@ private:
void closeNotification() { }
void exceptionNotification() { }
void connectionNotification() { }
- QTcpSocket *tcpSocketNonBlocking_socket;
- QStringList tcpSocketNonBlocking_data;
- qint64 tcpSocketNonBlocking_totalWritten;
- QTcpSocket *tmpSocket;
- qint64 bytesAvailable;
};
class MiniSocks5ResponseHandler : public QObject
@@ -153,12 +140,6 @@ void tst_QSocks5SocketEngine::initTestCase()
QVERIFY(QtNetworkSettings::verifyTestNetworkSettings());
}
-void tst_QSocks5SocketEngine::init()
-{
- tmpSocket = 0;
- bytesAvailable = 0;
-}
-
//---------------------------------------------------------------------------
void tst_QSocks5SocketEngine::construction()
{
@@ -631,13 +612,27 @@ void tst_QSocks5SocketEngine::tcpSocketNonBlockingTest()
{
QSocks5SocketEngineHandler socks5;
+ qint64 tcpSocketNonBlocking_totalWritten = 0;
+ QStringList tcpSocketNonBlocking_data;
QTcpSocket socket;
- connect(&socket, SIGNAL(hostFound()), SLOT(tcpSocketNonBlocking_hostFound()));
- connect(&socket, SIGNAL(connected()), SLOT(tcpSocketNonBlocking_connected()));
- connect(&socket, SIGNAL(disconnected()), SLOT(tcpSocketNonBlocking_closed()));
- connect(&socket, SIGNAL(bytesWritten(qint64)), SLOT(tcpSocketNonBlocking_bytesWritten(qint64)));
- connect(&socket, SIGNAL(readyRead()), SLOT(tcpSocketNonBlocking_readyRead()));
- tcpSocketNonBlocking_socket = &socket;
+ connect(&socket, &QAbstractSocket::hostFound,
+ &QTestEventLoop::instance(), &QTestEventLoop::exitLoop);
+ connect(&socket, &QAbstractSocket::connected,
+ &QTestEventLoop::instance(), &QTestEventLoop::exitLoop);
+ connect(&socket, &QIODevice::bytesWritten,
+ [&tcpSocketNonBlocking_totalWritten] (qint64 written)
+ {
+ tcpSocketNonBlocking_totalWritten += written;
+ QTestEventLoop::instance().exitLoop();
+ });
+
+ connect(&socket, &QIODevice::readyRead,
+ [&tcpSocketNonBlocking_data, &socket] ()
+ {
+ while (socket.canReadLine())
+ tcpSocketNonBlocking_data.append(socket.readLine());
+ QTestEventLoop::instance().exitLoop();
+ });
// Connect
socket.connectToHost(QtNetworkSettings::serverName(), 143);
@@ -725,62 +720,50 @@ void tst_QSocks5SocketEngine::tcpSocketNonBlockingTest()
QCOMPARE(socket.state(), QTcpSocket::UnconnectedState);
}
-void tst_QSocks5SocketEngine::tcpSocketNonBlocking_hostFound()
-{
- QTestEventLoop::instance().exitLoop();
-}
-
-void tst_QSocks5SocketEngine::tcpSocketNonBlocking_connected()
-{
- QTestEventLoop::instance().exitLoop();
-}
-
-void tst_QSocks5SocketEngine::tcpSocketNonBlocking_readyRead()
-{
- while (tcpSocketNonBlocking_socket->canReadLine())
- tcpSocketNonBlocking_data.append(tcpSocketNonBlocking_socket->readLine());
-
- QTestEventLoop::instance().exitLoop();
-}
-
-void tst_QSocks5SocketEngine::tcpSocketNonBlocking_bytesWritten(qint64 written)
-{
- tcpSocketNonBlocking_totalWritten += written;
- QTestEventLoop::instance().exitLoop();
-}
-
-void tst_QSocks5SocketEngine::tcpSocketNonBlocking_closed()
-{
-}
-
//----------------------------------------------------------------------------------
void tst_QSocks5SocketEngine::downloadBigFile()
{
QSocks5SocketEngineHandler socks5;
- if (tmpSocket)
- delete tmpSocket;
- tmpSocket = new QTcpSocket;
-
- connect(tmpSocket, SIGNAL(connected()), SLOT(exitLoopSlot()));
- connect(tmpSocket, SIGNAL(readyRead()), SLOT(downloadBigFileSlot()));
-
- tmpSocket->connectToHost(QtNetworkSettings::serverName(), 80);
+ QTcpSocket socket;
+ qint64 bytesAvailable = 0;
+ connect(&socket, &QAbstractSocket::connected,
+ &QTestEventLoop::instance(), &QTestEventLoop::exitLoop);
+ connect(&socket, &QIODevice::readyRead,
+ [&socket, &bytesAvailable] ()
+ {
+ const QByteArray tmp = socket.readAll();
+ int correction = tmp.indexOf(char(0), 0); //skip header
+ if (correction == -1)
+ correction = 0;
+ bytesAvailable += (tmp.size() - correction);
+ if (bytesAvailable >= 10000000)
+ QTestEventLoop::instance().exitLoop();
+ });
+
+ connect(&socket, QOverload<QAbstractSocket::SocketError>::of(&QAbstractSocket::error),
+ [&socket] (QAbstractSocket::SocketError errorCode)
+ {
+ qWarning().noquote().nospace() << QTest::currentTestFunction()
+ << ": error " << errorCode << ": " << socket.errorString();
+ });
+
+ socket.connectToHost(QtNetworkSettings::serverName(), 80);
QTestEventLoop::instance().enterLoop(30);
if (QTestEventLoop::instance().timeout())
QFAIL("Network operation timed out");
QByteArray hostName = QtNetworkSettings::serverName().toLatin1();
- QCOMPARE(tmpSocket->state(), QAbstractSocket::ConnectedState);
- QVERIFY(tmpSocket->write("GET /qtest/mediumfile HTTP/1.0\r\n") > 0);
- QVERIFY(tmpSocket->write("HOST: ") > 0);
- QVERIFY(tmpSocket->write(hostName.data()) > 0);
- QVERIFY(tmpSocket->write("\r\n") > 0);
- QVERIFY(tmpSocket->write("\r\n") > 0);
+ QCOMPARE(socket.state(), QAbstractSocket::ConnectedState);
+ QVERIFY(socket.write("GET /qtest/mediumfile HTTP/1.0\r\n") > 0);
+ QVERIFY(socket.write("HOST: ") > 0);
+ QVERIFY(socket.write(hostName.data()) > 0);
+ QVERIFY(socket.write("\r\n") > 0);
+ QVERIFY(socket.write("\r\n") > 0);
+
- bytesAvailable = 0;
QTime stopWatch;
stopWatch.start();
@@ -791,31 +774,12 @@ void tst_QSocks5SocketEngine::downloadBigFile()
QCOMPARE(bytesAvailable, qint64(10000000));
- QCOMPARE(tmpSocket->state(), QAbstractSocket::ConnectedState);
+ QCOMPARE(socket.state(), QAbstractSocket::ConnectedState);
/*qDebug("\t\t%.1fMB/%.1fs: %.1fMB/s",
bytesAvailable / (1024.0 * 1024.0),
stopWatch.elapsed() / 1024.0,
(bytesAvailable / (stopWatch.elapsed() / 1000.0)) / (1024 * 1024));*/
-
- delete tmpSocket;
- tmpSocket = 0;
-}
-
-void tst_QSocks5SocketEngine::exitLoopSlot()
-{
- QTestEventLoop::instance().exitLoop();
-}
-
-
-void tst_QSocks5SocketEngine::downloadBigFileSlot()
-{
- QByteArray tmp=tmpSocket->readAll();
- int correction=tmp.indexOf((char)0,0); //skip header
- if (correction==-1) correction=0;
- bytesAvailable += (tmp.size()-correction);
- if (bytesAvailable >= 10000000)
- QTestEventLoop::instance().exitLoop();
}
void tst_QSocks5SocketEngine::passwordAuth()
diff --git a/tests/auto/network/ssl/qssldiffiehellmanparameters/tst_qssldiffiehellmanparameters.cpp b/tests/auto/network/ssl/qssldiffiehellmanparameters/tst_qssldiffiehellmanparameters.cpp
index f3b9003fbb..ddf503eed6 100644
--- a/tests/auto/network/ssl/qssldiffiehellmanparameters/tst_qssldiffiehellmanparameters.cpp
+++ b/tests/auto/network/ssl/qssldiffiehellmanparameters/tst_qssldiffiehellmanparameters.cpp
@@ -42,6 +42,13 @@
#include <QSslSocket>
#include <QByteArray>
+// Default DH parameters, exported by qssldiffiehellmanparameters.cpp.
+QT_BEGIN_NAMESPACE
+extern Q_AUTOTEST_EXPORT const char *qssl_dhparams_default_base64;
+QT_END_NAMESPACE
+
+QT_USE_NAMESPACE
+
class tst_QSslDiffieHellmanParameters : public QObject
{
Q_OBJECT
@@ -54,6 +61,7 @@ private Q_SLOTS:
void constructionPEM();
void unsafe512Bits();
void unsafeNonPrime();
+ void defaultIsValid();
#endif
};
@@ -157,6 +165,33 @@ void tst_QSslDiffieHellmanParameters::unsafeNonPrime()
#endif
}
+void tst_QSslDiffieHellmanParameters::defaultIsValid()
+{
+ // The QSslDiffieHellmanParameters::defaultParameters() method takes a shortcut,
+ // by not verifying the passed-in parameters. Instead, it simply assigns the default
+ // DH parameters to the derData field of QSslDiffieHellmanParametersPrivate.
+ //
+ // This test ensures that our default parameters pass the internal verification tests
+ // by constructing, using fromEncoded(), a QSslDiffieHellmanParameters instance that
+ // we expect to be equivalent to the one returned by defaultParameters(). By using
+ // fromEncoded() we go through the internal verification mechanisms. Finally, to ensure
+ // the two instances are equivalent, we compare them.
+
+ const auto dh = QSslDiffieHellmanParameters::fromEncoded(
+ QByteArray::fromBase64(QByteArray(qssl_dhparams_default_base64)),
+ QSsl::Der
+ );
+
+ const auto defaultdh = QSslDiffieHellmanParameters::defaultParameters();
+
+#ifndef QT_NO_OPENSSL
+ QCOMPARE(dh.isEmpty(), false);
+ QCOMPARE(dh.isValid(), true);
+ QCOMPARE(dh.error(), QSslDiffieHellmanParameters::NoError);
+ QCOMPARE(dh, defaultdh);
+#endif
+}
+
#endif // QT_NO_SSL
QTEST_MAIN(tst_QSslDiffieHellmanParameters)
diff --git a/tests/auto/other/lancelot/lancelot.pro b/tests/auto/other/lancelot/lancelot.pro
index 798482f02c..73c12e67a2 100644
--- a/tests/auto/other/lancelot/lancelot.pro
+++ b/tests/auto/other/lancelot/lancelot.pro
@@ -1,6 +1,6 @@
CONFIG += testcase
TARGET = tst_lancelot
-QT += xml testlib
+QT += testlib
SOURCES += tst_lancelot.cpp \
paintcommands.cpp
diff --git a/tests/auto/printsupport/kernel/qprintdevice/qprintdevice.pro b/tests/auto/printsupport/kernel/qprintdevice/qprintdevice.pro
index 56c1b60d94..a859f15fbb 100644
--- a/tests/auto/printsupport/kernel/qprintdevice/qprintdevice.pro
+++ b/tests/auto/printsupport/kernel/qprintdevice/qprintdevice.pro
@@ -2,6 +2,6 @@ CONFIG += testcase
TARGET = tst_qprintdevice
SOURCES += tst_qprintdevice.cpp
-QT += printsupport-private network testlib
+QT += printsupport-private testlib
DEFINES += QT_USE_USING_NAMESPACE
diff --git a/tests/auto/printsupport/kernel/qprinterinfo/qprinterinfo.pro b/tests/auto/printsupport/kernel/qprinterinfo/qprinterinfo.pro
index f397f48bb8..36261780fd 100644
--- a/tests/auto/printsupport/kernel/qprinterinfo/qprinterinfo.pro
+++ b/tests/auto/printsupport/kernel/qprinterinfo/qprinterinfo.pro
@@ -2,6 +2,6 @@ CONFIG += testcase
TARGET = tst_qprinterinfo
SOURCES += tst_qprinterinfo.cpp
-QT += printsupport network testlib
+QT += printsupport testlib
DEFINES += QT_USE_USING_NAMESPACE
diff --git a/tests/auto/testlib/selftests/test/test.pro b/tests/auto/testlib/selftests/test/test.pro
index a2a1dd3f0b..a7487736b3 100644
--- a/tests/auto/testlib/selftests/test/test.pro
+++ b/tests/auto/testlib/selftests/test/test.pro
@@ -1,6 +1,6 @@
CONFIG += testcase
SOURCES += ../tst_selftests.cpp
-QT = core xml testlib-private
+QT = core testlib-private
TARGET = ../tst_selftests
diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
index 32a324b888..1078dcc2e9 100644
--- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
+++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
@@ -169,6 +169,9 @@ private slots:
void moveSectionAndReset();
void moveSectionAndRemove();
void saveRestore();
+ void restoreQt4State();
+ void restoreToMoreColumns();
+ void restoreBeforeSetModel();
void defaultSectionSizeTest();
void defaultSectionSizeTestStyles();
@@ -1523,11 +1526,11 @@ public:
{
return hasIndex(row, column, parent) ? createIndex(row, column) : QModelIndex();
}
- int rowCount(const QModelIndex & /* parent */) const
+ int rowCount(const QModelIndex & /*parent*/ = QModelIndex()) const
{
return 8;
}
- int columnCount(const QModelIndex &/*parent= QModelIndex()*/) const
+ int columnCount(const QModelIndex &/*parent*/ = QModelIndex()) const
{
return m_col_count;
}
@@ -1588,41 +1591,56 @@ void tst_QHeaderView::moveSectionAndRemove()
QCOMPARE(v.count(), 0);
}
-void tst_QHeaderView::saveRestore()
+static QByteArray savedState()
{
- SimpleModel m;
+ QStandardItemModel m(4, 4);
QHeaderView h1(Qt::Horizontal);
h1.setModel(&m);
h1.swapSections(0, 2);
h1.resizeSection(1, 10);
h1.setSortIndicatorShown(true);
- h1.setSortIndicator(1,Qt::DescendingOrder);
- QByteArray s1 = h1.saveState();
+ h1.setSortIndicator(2, Qt::DescendingOrder);
+ h1.setSectionHidden(3, true);
+ return h1.saveState();
+}
+
+void tst_QHeaderView::saveRestore()
+{
+ QStandardItemModel m(4, 4);
+ const QByteArray s1 = savedState();
QHeaderView h2(Qt::Vertical);
QSignalSpy spy(&h2, SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)));
h2.setModel(&m);
- h2.restoreState(s1);
+ QVERIFY(h2.restoreState(s1));
QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.at(0).at(0).toInt(), 1);
+ QCOMPARE(spy.at(0).at(0).toInt(), 2);
QCOMPARE(h2.logicalIndex(0), 2);
QCOMPARE(h2.logicalIndex(2), 0);
QCOMPARE(h2.sectionSize(1), 10);
- QCOMPARE(h2.sortIndicatorSection(), 1);
+ QCOMPARE(h2.sortIndicatorSection(), 2);
QCOMPARE(h2.sortIndicatorOrder(), Qt::DescendingOrder);
QCOMPARE(h2.isSortIndicatorShown(), true);
+ QVERIFY(!h2.isSectionHidden(2));
+ QVERIFY(h2.isSectionHidden(3));
+ QCOMPARE(h2.hiddenSectionCount(), 1);
QByteArray s2 = h2.saveState();
-
QCOMPARE(s1, s2);
+
QVERIFY(!h2.restoreState(QByteArrayLiteral("Garbage")));
+}
+void tst_QHeaderView::restoreQt4State()
+{
// QTBUG-40462
// Setting from Qt4, where information about multiple sections were grouped together in one
// sectionItem object
+ QStandardItemModel m(4, 10);
+ QHeaderView h2(Qt::Vertical);
QByteArray settings_qt4 =
QByteArray::fromHex("000000ff00000000000000010000000100000000010000000000000000000000000000"
"0000000003e80000000a0101000100000000000000000000000064ffffffff00000081"
@@ -1652,6 +1670,50 @@ void tst_QHeaderView::saveRestore()
QCOMPARE(h2.saveState(), old_state);
}
+void tst_QHeaderView::restoreToMoreColumns()
+{
+ // Restore state onto a model with more columns
+ const QByteArray s1 = savedState();
+ QHeaderView h4(Qt::Horizontal);
+ QStandardItemModel fiveColumnsModel(1, 5);
+ h4.setModel(&fiveColumnsModel);
+ QCOMPARE(fiveColumnsModel.columnCount(), 5);
+ QCOMPARE(h4.count(), 5);
+ QVERIFY(h4.restoreState(s1));
+ QCOMPARE(fiveColumnsModel.columnCount(), 5);
+ QCOMPARE(h4.count(), 5);
+ QCOMPARE(h4.sectionSize(1), 10);
+ for (int i = 0; i < h4.count(); ++i)
+ QVERIFY(h4.sectionSize(i) > 0 || h4.isSectionHidden(i));
+ QVERIFY(!h4.isSectionHidden(2));
+ QVERIFY(h4.isSectionHidden(3));
+ QCOMPARE(h4.hiddenSectionCount(), 1);
+ QCOMPARE(h4.sortIndicatorSection(), 2);
+ QCOMPARE(h4.sortIndicatorOrder(), Qt::DescendingOrder);
+}
+
+void tst_QHeaderView::restoreBeforeSetModel()
+{
+ QHeaderView h2(Qt::Horizontal);
+ const QByteArray s1 = savedState();
+ // First restore
+ QVERIFY(h2.restoreState(s1));
+ // Then setModel
+ QStandardItemModel model(4, 4);
+ h2.setModel(&model);
+
+ // Check the result
+ QCOMPARE(h2.logicalIndex(0), 2);
+ QCOMPARE(h2.logicalIndex(2), 0);
+ QCOMPARE(h2.sectionSize(1), 10);
+ QCOMPARE(h2.sortIndicatorSection(), 2);
+ QCOMPARE(h2.sortIndicatorOrder(), Qt::DescendingOrder);
+ QCOMPARE(h2.isSortIndicatorShown(), true);
+ QVERIFY(!h2.isSectionHidden(2));
+ QVERIFY(h2.isSectionHidden(3));
+ QCOMPARE(h2.hiddenSectionCount(), 1);
+}
+
void tst_QHeaderView::defaultSectionSizeTest()
{
// Setup
diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
index e5e9b87df4..8c7c5f1050 100644
--- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
+++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
@@ -151,6 +151,7 @@ private slots:
void taskQTBUG_7232_AllowUserToControlSingleStep();
void taskQTBUG_51086_skippingIndexesInSelectedIndexes();
void expandingListItems();
+ void taskQTBUG_47694_indexOutOfBoundBatchLayout();
};
// Testing get/set functions
@@ -2510,5 +2511,18 @@ void tst_QListView::expandingListItems()
QVERIFY(w.visualRect(item1->index()).width() < w.visualRect(item2->index()).width());
}
+void tst_QListView::taskQTBUG_47694_indexOutOfBoundBatchLayout()
+{
+ QListView view;
+ view.setLayoutMode(QListView::Batched);
+ int batchSize = view.batchSize();
+
+ QStandardItemModel model(batchSize + 1, 1);
+
+ view.setModel(&model);
+
+ view.scrollTo(model.index(batchSize - 1, 0));
+}
+
QTEST_MAIN(tst_QListView)
#include "tst_qlistview.moc"
diff --git a/tests/auto/widgets/kernel/qstackedlayout/tst_qstackedlayout.cpp b/tests/auto/widgets/kernel/qstackedlayout/tst_qstackedlayout.cpp
index 835b6ca799..5be4846b3e 100644
--- a/tests/auto/widgets/kernel/qstackedlayout/tst_qstackedlayout.cpp
+++ b/tests/auto/widgets/kernel/qstackedlayout/tst_qstackedlayout.cpp
@@ -377,7 +377,7 @@ void tst_QStackedLayout::replaceWidget()
QCOMPARE(stackLayout->indexOf(replaceFrom), 1);
QCOMPARE(stackLayout->indexOf(replaceTo), -1);
- stackLayout->replaceWidget(replaceFrom, replaceTo);
+ delete stackLayout->replaceWidget(replaceFrom, replaceTo);
QCOMPARE(stackLayout->indexOf(replaceFrom), -1);
QCOMPARE(stackLayout->indexOf(replaceTo), 1);
diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
index 434876eb3c..f8dc5d91a2 100644
--- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
+++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
@@ -93,6 +93,7 @@ private slots:
#if !defined(Q_OS_DARWIN)
void accel();
void activatedCount();
+ void activatedCount_data();
void check_accelKeys();
void check_cursorKeys1();
@@ -145,8 +146,8 @@ protected slots:
void slotForTaskQTBUG53205();
private:
- TestMenu initSimpleMenuBar(QMenuBar *mb);
- TestMenu initWindowWithSimpleMenuBar(QMainWindow &w);
+ TestMenu initSimpleMenuBar(QMenuBar *mb, bool forceNonNative = true);
+ TestMenu initWindowWithSimpleMenuBar(QMainWindow &w, bool forceNonNative = true);
QAction *createCharacterAction(QMenu *menu, char lowerAscii);
QMenu *addNumberedMenu(QMenuBar *mb, int n);
TestMenu initComplexMenuBar(QMenuBar *mb);
@@ -214,10 +215,10 @@ void tst_QMenuBar::cleanup()
// Create a simple menu bar and connect its actions to onSimpleActivated().
-TestMenu tst_QMenuBar::initSimpleMenuBar(QMenuBar *mb)
-{
+TestMenu tst_QMenuBar::initSimpleMenuBar(QMenuBar *mb, bool forceNonNative) {
TestMenu result;
- mb->setNativeMenuBar(false);
+ if (forceNonNative)
+ mb->setNativeMenuBar(false);
connect(mb, SIGNAL(triggered(QAction*)), this, SLOT(onSimpleActivated(QAction*)));
QMenu *menu = mb->addMenu(QStringLiteral("&accel"));
QAction *action = menu->addAction(QStringLiteral("menu1") );
@@ -245,11 +246,11 @@ TestMenu tst_QMenuBar::initSimpleMenuBar(QMenuBar *mb)
return result;
}
-inline TestMenu tst_QMenuBar::initWindowWithSimpleMenuBar(QMainWindow &w)
+inline TestMenu tst_QMenuBar::initWindowWithSimpleMenuBar(QMainWindow &w, bool forceNonNative)
{
w.resize(200, 200);
centerOnScreen(&w);
- return initSimpleMenuBar(w.menuBar());
+ return initSimpleMenuBar(w.menuBar(), forceNonNative);
}
// add a menu with number n, set number as data.
@@ -347,7 +348,8 @@ void tst_QMenuBar::activatedCount()
{
// create a popup menu with menu items set the accelerators later...
QMainWindow w;
- initWindowWithSimpleMenuBar(w);
+ QFETCH( bool, forceNonNative );
+ initWindowWithSimpleMenuBar(w, forceNonNative);
w.show();
QApplication::setActiveWindow(&w);
QVERIFY(QTest::qWaitForWindowActive(&w));
@@ -356,6 +358,13 @@ void tst_QMenuBar::activatedCount()
//wait(5000);
QCOMPARE( m_simpleActivatedCount, 2 ); //1 from the popupmenu and 1 from the menubar
}
+
+void tst_QMenuBar::activatedCount_data()
+{
+ QTest::addColumn<bool>("forceNonNative");
+ QTest::newRow( "forcing non-native menubar" ) << true;
+ QTest::newRow( "not forcing non-native menubar" ) << false;
+}
#endif
void tst_QMenuBar::clear()
diff --git a/tests/benchmarks/corelib/tools/qdatetime/main.cpp b/tests/benchmarks/corelib/tools/qdatetime/main.cpp
index 8f43a412b7..2c1e3d97ae 100644
--- a/tests/benchmarks/corelib/tools/qdatetime/main.cpp
+++ b/tests/benchmarks/corelib/tools/qdatetime/main.cpp
@@ -547,8 +547,9 @@ void tst_QDateTime::currentMSecsSinceEpoch()
void tst_QDateTime::fromString()
{
- QString format = "yyy-MM-dd hh:mm:ss.zzz t";
- QString input = "2010-01-01 13:12:11.999 UTC";
+ QString format = "yyyy-MM-dd hh:mm:ss.zzz";
+ QString input = "2010-01-01 13:12:11.999";
+ QVERIFY(QDateTime::fromString(input, format).isValid());
QBENCHMARK {
for (int i = 0; i < 1000; ++i)
QDateTime::fromString(input, format);