summaryrefslogtreecommitdiffstats
path: root/src/testlib
diff options
context:
space:
mode:
Diffstat (limited to 'src/testlib')
-rw-r--r--src/testlib/doc/qttestlib.qdocconf1
-rw-r--r--src/testlib/doc/src/dontdocument.qdoc32
-rw-r--r--src/testlib/qbenchmark.cpp3
-rw-r--r--src/testlib/qtest.h4
-rw-r--r--src/testlib/qtestaccessible.h2
-rw-r--r--src/testlib/qtestblacklist.cpp4
-rw-r--r--src/testlib/qtestcase.cpp14
-rw-r--r--src/testlib/qtestcase.h2
-rw-r--r--src/testlib/qtestlog.cpp2
-rw-r--r--src/testlib/qtesttable.cpp10
10 files changed, 56 insertions, 18 deletions
diff --git a/src/testlib/doc/qttestlib.qdocconf b/src/testlib/doc/qttestlib.qdocconf
index 5fdf6d9415..73310221cf 100644
--- a/src/testlib/doc/qttestlib.qdocconf
+++ b/src/testlib/doc/qttestlib.qdocconf
@@ -1,4 +1,5 @@
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
+include($QT_INSTALL_DOCS/config/exampleurl-qtbase.qdocconf)
project = QtTestLib
moduleheader = QtTest
diff --git a/src/testlib/doc/src/dontdocument.qdoc b/src/testlib/doc/src/dontdocument.qdoc
new file mode 100644
index 0000000000..59270c7a4f
--- /dev/null
+++ b/src/testlib/doc/src/dontdocument.qdoc
@@ -0,0 +1,32 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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 Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \dontdocument (QTestEventLoop QTestData QEventSizeOfChecker QSpontaneKeyEvent
+ QTestEvent QTestKeyEvent QTestKeyClicksEvent QTestMouseEvent
+ QTestDelayEvent QMetaTypeId)
+*/
diff --git a/src/testlib/qbenchmark.cpp b/src/testlib/qbenchmark.cpp
index 8d5543a0fc..cbc009c993 100644
--- a/src/testlib/qbenchmark.cpp
+++ b/src/testlib/qbenchmark.cpp
@@ -66,7 +66,8 @@ QBenchmarkGlobalData::QBenchmarkGlobalData()
QBenchmarkGlobalData::~QBenchmarkGlobalData()
{
delete measurer;
- QBenchmarkGlobalData::current = 0;
+ if (QBenchmarkGlobalData::current == this)
+ QBenchmarkGlobalData::current = nullptr;
}
void QBenchmarkGlobalData::setMode(Mode mode)
diff --git a/src/testlib/qtest.h b/src/testlib/qtest.h
index 89abc616d9..7affdcb8b4 100644
--- a/src/testlib/qtest.h
+++ b/src/testlib/qtest.h
@@ -51,7 +51,9 @@
#include <QtCore/qstringlist.h>
#include <QtCore/qcborcommon.h>
#include <QtCore/qdatetime.h>
+#if QT_CONFIG(itemmodel)
#include <QtCore/qabstractitemmodel.h>
+#endif
#include <QtCore/qobject.h>
#include <QtCore/qvariant.h>
#include <QtCore/qurl.h>
@@ -129,12 +131,14 @@ template<> inline char *toString(const QChar &c)
return qstrdup(qPrintable(QString::fromLatin1("QChar: '%1' (0x%2)").arg(c).arg(QString::number(static_cast<int>(c.unicode()), 16))));
}
+#if QT_CONFIG(itemmodel)
template<> inline char *toString(const QModelIndex &idx)
{
char msg[128];
qsnprintf(msg, sizeof(msg), "QModelIndex(%d,%d,%p,%p)", idx.row(), idx.column(), idx.internalPointer(), idx.model());
return qstrdup(msg);
}
+#endif
template<> inline char *toString(const QPoint &p)
{
diff --git a/src/testlib/qtestaccessible.h b/src/testlib/qtestaccessible.h
index d14dcec031..bd77ee77a1 100644
--- a/src/testlib/qtestaccessible.h
+++ b/src/testlib/qtestaccessible.h
@@ -65,7 +65,7 @@ QT_BEGIN_NAMESPACE
class QObject;
// Use pointers since we subclass QAccessibleEvent
-typedef QList<QAccessibleEvent*> EventList;
+using EventList = QList<QAccessibleEvent*>;
bool operator==(const QAccessibleEvent &l, const QAccessibleEvent &r)
{
diff --git a/src/testlib/qtestblacklist.cpp b/src/testlib/qtestblacklist.cpp
index 72bb5688ef..15f01c4af0 100644
--- a/src/testlib/qtestblacklist.cpp
+++ b/src/testlib/qtestblacklist.cpp
@@ -150,8 +150,10 @@ static QSet<QByteArray> keywords()
<< "msvc-2013"
# elif _MSC_VER <= 1900
<< "msvc-2015"
-# else
+# elif _MSC_VER <= 1916
<< "msvc-2017"
+# else
+ << "msvc-2019"
# endif
#endif
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 26ab61b793..cfd3598072 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -301,7 +301,7 @@ class TestMethods {
public:
Q_DISABLE_COPY_MOVE(TestMethods)
- typedef std::vector<QMetaMethod> MetaMethods;
+ using MetaMethods = std::vector<QMetaMethod>;
explicit TestMethods(const QObject *o, const MetaMethods &m = MetaMethods());
@@ -1012,14 +1012,14 @@ public:
WatchDog()
{
QMutexLocker locker(&mutex);
- timeout.store(-1);
+ timeout.storeRelaxed(-1);
start();
waitCondition.wait(&mutex);
}
~WatchDog() {
{
QMutexLocker locker(&mutex);
- timeout.store(0);
+ timeout.storeRelaxed(0);
waitCondition.wakeAll();
}
wait();
@@ -1027,13 +1027,13 @@ public:
void beginTest() {
QMutexLocker locker(&mutex);
- timeout.store(defaultTimeout());
+ timeout.storeRelaxed(defaultTimeout());
waitCondition.wakeAll();
}
void testFinished() {
QMutexLocker locker(&mutex);
- timeout.store(-1);
+ timeout.storeRelaxed(-1);
waitCondition.wakeAll();
}
@@ -1041,7 +1041,7 @@ public:
QMutexLocker locker(&mutex);
waitCondition.wakeAll();
while (1) {
- int t = timeout.load();
+ int t = timeout.loadRelaxed();
if (!t)
break;
if (Q_UNLIKELY(!waitCondition.wait(&mutex, t))) {
@@ -2207,7 +2207,7 @@ QString QTest::qFindTestData(const QString& base, const char *file, int line, co
}
// 3. relative to test source.
- if (found.isEmpty()) {
+ if (found.isEmpty() && qstrncmp(file, ":/", 2) != 0) {
// srcdir is the directory containing the calling source file.
QFileInfo srcdir = QFileInfo(QFile::decodeName(file)).path();
diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h
index 8136452791..c0ddb93bd0 100644
--- a/src/testlib/qtestcase.h
+++ b/src/testlib/qtestcase.h
@@ -341,7 +341,7 @@ namespace QTest
template <typename T>
inline void addColumn(const char *name, T * = nullptr)
{
- typedef std::is_same<T, const char*> QIsSameTConstChar;
+ using QIsSameTConstChar = std::is_same<T, const char*>;
Q_STATIC_ASSERT_X(!QIsSameTConstChar::value, "const char* is not allowed as a test data format.");
addColumnInternal(qMetaTypeId<T>(), name);
}
diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp
index faef3912c4..14543c3cde 100644
--- a/src/testlib/qtestlog.cpp
+++ b/src/testlib/qtestlog.cpp
@@ -219,7 +219,7 @@ namespace QTest {
}
if (type != QtFatalMsg) {
- if (counter.load() <= 0)
+ if (counter.loadRelaxed() <= 0)
return;
if (!counter.deref()) {
diff --git a/src/testlib/qtesttable.cpp b/src/testlib/qtesttable.cpp
index 8d42668a5b..20e0702d44 100644
--- a/src/testlib/qtesttable.cpp
+++ b/src/testlib/qtesttable.cpp
@@ -65,10 +65,10 @@ public:
int type;
};
- typedef std::vector<Element> ElementList;
+ using ElementList = std::vector<Element>;
ElementList elementList;
- typedef std::vector<QTestData *> DataList;
+ using DataList = std::vector<QTestData *>;
DataList dataList;
void addColumn(int elemType, const char *elemName) { elementList.push_back(Element(elemName, elemType)); }
@@ -152,14 +152,12 @@ private:
int QTestTable::indexOf(const char *elementName) const
{
- typedef QTestTablePrivate::ElementList::const_iterator It;
-
QTEST_ASSERT(elementName);
const QTestTablePrivate::ElementList &elementList = d->elementList;
- const It it = std::find_if(elementList.begin(), elementList.end(),
- NamePredicate(elementName));
+ const auto it = std::find_if(elementList.begin(), elementList.end(),
+ NamePredicate(elementName));
return it != elementList.end() ?
int(it - elementList.begin()) : -1;
}