summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-07-16 03:04:35 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-07-16 03:04:35 +0200
commit9c5b7a6cf781aa0ab4231158528d900f17ca0188 (patch)
treed0b312f938a0b534d0530cdaae91c226be7e04ae
parent7cb006d42703acff353fd3fd60fb40cfb8eadd68 (diff)
parent84e44bf5a9e5dcb0f93c55129f565e34edb7dd1a (diff)
Merge remote-tracking branch 'origin/5.13' into dev
-rw-r--r--src/xmlpatterns/api/qabstractxmlnodemodel.h2
-rw-r--r--src/xmlpatterns/doc/qtxmlpatterns.qdocconf1
-rw-r--r--tests/auto/auto.pro2
-rw-r--r--tests/auto/qquickxmllistmodel/qquickxmllistmodel.pro6
-rw-r--r--tests/auto/qquickxmllistmodel/tst_qquickxmllistmodel.cpp19
-rw-r--r--tests/shared/util.cpp103
-rw-r--r--tests/shared/util.h95
-rw-r--r--tests/shared/util.pri10
8 files changed, 226 insertions, 12 deletions
diff --git a/src/xmlpatterns/api/qabstractxmlnodemodel.h b/src/xmlpatterns/api/qabstractxmlnodemodel.h
index d16a35e6..13e0a186 100644
--- a/src/xmlpatterns/api/qabstractxmlnodemodel.h
+++ b/src/xmlpatterns/api/qabstractxmlnodemodel.h
@@ -127,6 +127,8 @@ public:
{
}
+ QXmlNodeModelIndex &operator=(const QXmlNodeModelIndex &) = default;
+
bool operator==(const QXmlNodeModelIndex &other) const;
bool operator!=(const QXmlNodeModelIndex &other) const;
diff --git a/src/xmlpatterns/doc/qtxmlpatterns.qdocconf b/src/xmlpatterns/doc/qtxmlpatterns.qdocconf
index 7407c123..eb7984ff 100644
--- a/src/xmlpatterns/doc/qtxmlpatterns.qdocconf
+++ b/src/xmlpatterns/doc/qtxmlpatterns.qdocconf
@@ -1,4 +1,5 @@
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
+include($QT_INSTALL_DOCS/config/exampleurl-qtxmlpatterns.qdocconf)
project = QtXmlPatterns
description = Qt XML Patterns Reference Documentation
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index dfec8563..d3537f68 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -53,7 +53,7 @@ xmlpatternsxqts.depends = xmlpatternssdk
xmlpatternsxqts \
xmlpatternsxslts \
-qtHaveModule(quick): SUBIDIRS += qquickxmllistmodel
+qtHaveModule(quick):SUBDIRS += qquickxmllistmodel
!cross_compile: SUBDIRS += host.pro
diff --git a/tests/auto/qquickxmllistmodel/qquickxmllistmodel.pro b/tests/auto/qquickxmllistmodel/qquickxmllistmodel.pro
index e2d873c4..2c7eaccb 100644
--- a/tests/auto/qquickxmllistmodel/qquickxmllistmodel.pro
+++ b/tests/auto/qquickxmllistmodel/qquickxmllistmodel.pro
@@ -3,8 +3,10 @@ TARGET = tst_qquickxmllistmodel
macos:CONFIG -= app_bundle
SOURCES += tst_qquickxmllistmodel.cpp \
- ../../../../src/imports/xmllistmodel/qqmlxmllistmodel.cpp
-HEADERS += ../../../../src/imports/xmllistmodel/qqmlxmllistmodel_p.h
+ $$PWD/../../../src/imports/xmllistmodel/qqmlxmllistmodel.cpp
+HEADERS += $$PWD/../../../src/imports/xmllistmodel/qqmlxmllistmodel_p.h
+
+INCLUDEPATH *= $$PWD/../../../src/imports/xmllistmodel
include (../../shared/util.pri)
diff --git a/tests/auto/qquickxmllistmodel/tst_qquickxmllistmodel.cpp b/tests/auto/qquickxmllistmodel/tst_qquickxmllistmodel.cpp
index b2e5703a..8059afcd 100644
--- a/tests/auto/qquickxmllistmodel/tst_qquickxmllistmodel.cpp
+++ b/tests/auto/qquickxmllistmodel/tst_qquickxmllistmodel.cpp
@@ -44,7 +44,7 @@
#include <QtQml/qqmlengine.h>
#include <QtQml/qqmlcomponent.h>
-#include "../../../../src/imports/xmllistmodel/qqmlxmllistmodel_p.h"
+#include "../../../src/imports/xmllistmodel/qqmlxmllistmodel_p.h"
#include <algorithm>
@@ -110,14 +110,14 @@ private:
QString xml;
if (!data.isEmpty()) {
- QStringList items = data.split(QLatin1Char(';'));
- foreach (const QString &item, items) {
+ const QStringList items = data.split(QLatin1Char(';'));
+ for (const QString &item : items) {
if (item.isEmpty())
continue;
QVariantList variants;
xml += QLatin1String("<item>");
- QStringList fields = item.split(QLatin1Char(','));
- foreach (const QString &field, fields) {
+ const QStringList fields = item.split(QLatin1Char(','));
+ for (const QString &field : fields) {
QStringList values = field.split(QLatin1Char('='));
if (values.count() != 2) {
qWarning() << "makeItemXmlAndData: invalid field:" << field;
@@ -168,7 +168,8 @@ protected:
{
if (m_factory) {
QVariantMap map;
- foreach (const QString &header, req.rawHeaderList())
+ const auto rawHeaderList = req.rawHeaderList();
+ for (const QString &header : rawHeaderList)
map[header] = req.rawHeader(header.toUtf8());
m_factory->lastSentHeaders = map;
}
@@ -421,9 +422,9 @@ void tst_qquickxmllistmodel::headers()
expectedHeaders["Accept"] = "application/xml,*/*";
QCOMPARE(factory.lastSentHeaders.count(), expectedHeaders.count());
- foreach (const QString &header, expectedHeaders.keys()) {
- QVERIFY(factory.lastSentHeaders.contains(header));
- QCOMPARE(factory.lastSentHeaders[header].toString(), expectedHeaders[header].toString());
+ for (auto it = expectedHeaders.cbegin(), end = expectedHeaders.cend(); it != end; ++it) {
+ QVERIFY(factory.lastSentHeaders.contains(it.key()));
+ QCOMPARE(factory.lastSentHeaders[it.key()].toString(), it.value().toString());
}
delete model;
diff --git a/tests/shared/util.cpp b/tests/shared/util.cpp
new file mode 100644
index 00000000..96876428
--- /dev/null
+++ b/tests/shared/util.cpp
@@ -0,0 +1,103 @@
+/****************************************************************************
+**
+** 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 "util.h"
+
+#include <QtCore/QDebug>
+#include <QtCore/QMutexLocker>
+
+QQmlDataTest *QQmlDataTest::m_instance = 0;
+
+QQmlDataTest::QQmlDataTest() :
+#ifdef QT_TESTCASE_BUILDDIR
+ m_dataDirectory(QTest::qFindTestData("data", QT_QMLTEST_DATADIR, 0, QT_TESTCASE_BUILDDIR)),
+#else
+ m_dataDirectory(QTest::qFindTestData("data", QT_QMLTEST_DATADIR, 0)),
+#endif
+
+ m_dataDirectoryUrl(m_dataDirectory.startsWith(QLatin1Char(':'))
+ ? QUrl(QLatin1String("qrc") + m_dataDirectory)
+ : QUrl::fromLocalFile(m_dataDirectory + QLatin1Char('/')))
+{
+ m_instance = this;
+}
+
+QQmlDataTest::~QQmlDataTest()
+{
+ m_instance = 0;
+}
+
+void QQmlDataTest::initTestCase()
+{
+ QVERIFY2(!m_dataDirectory.isEmpty(), "'data' directory not found");
+ m_directory = QFileInfo(m_dataDirectory).absolutePath();
+ if (m_dataDirectoryUrl.scheme() != QLatin1String("qrc"))
+ QVERIFY2(QDir::setCurrent(m_directory), qPrintable(QLatin1String("Could not chdir to ") + m_directory));
+}
+
+QString QQmlDataTest::testFile(const QString &fileName) const
+{
+ if (m_directory.isEmpty())
+ qFatal("QQmlDataTest::initTestCase() not called.");
+ QString result = m_dataDirectory;
+ result += QLatin1Char('/');
+ result += fileName;
+ return result;
+}
+
+Q_GLOBAL_STATIC(QMutex, qQmlTestMessageHandlerMutex)
+
+QQmlTestMessageHandler *QQmlTestMessageHandler::m_instance = 0;
+
+void QQmlTestMessageHandler::messageHandler(QtMsgType, const QMessageLogContext &context, const QString &message)
+{
+ QMutexLocker locker(qQmlTestMessageHandlerMutex());
+ if (QQmlTestMessageHandler::m_instance) {
+ if (QQmlTestMessageHandler::m_instance->m_includeCategories)
+ QQmlTestMessageHandler::m_instance->m_messages.push_back(QString("%1: %2").arg(context.category, message));
+ else
+ QQmlTestMessageHandler::m_instance->m_messages.push_back(message);
+ }
+}
+
+QQmlTestMessageHandler::QQmlTestMessageHandler()
+{
+ QMutexLocker locker(qQmlTestMessageHandlerMutex());
+ Q_ASSERT(!QQmlTestMessageHandler::m_instance);
+ QQmlTestMessageHandler::m_instance = this;
+ m_oldHandler = qInstallMessageHandler(messageHandler);
+ m_includeCategories = false;
+}
+
+QQmlTestMessageHandler::~QQmlTestMessageHandler()
+{
+ QMutexLocker locker(qQmlTestMessageHandlerMutex());
+ Q_ASSERT(QQmlTestMessageHandler::m_instance);
+ qInstallMessageHandler(m_oldHandler);
+ QQmlTestMessageHandler::m_instance = 0;
+}
diff --git a/tests/shared/util.h b/tests/shared/util.h
new file mode 100644
index 00000000..6f3f0a06
--- /dev/null
+++ b/tests/shared/util.h
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef QQMLTESTUTILS_H
+#define QQMLTESTUTILS_H
+
+#include <QtCore/QDir>
+#include <QtCore/QUrl>
+#include <QtCore/QCoreApplication>
+#include <QtCore/QStringList>
+#include <QtTest/QTest>
+
+/* Base class for tests with data that are located in a "data" subfolder. */
+
+class QQmlDataTest : public QObject
+{
+ Q_OBJECT
+public:
+ QQmlDataTest();
+ virtual ~QQmlDataTest();
+
+ QString testFile(const QString &fileName) const;
+ inline QString testFile(const char *fileName) const
+ { return testFile(QLatin1String(fileName)); }
+ inline QUrl testFileUrl(const QString &fileName) const
+ { return QUrl::fromLocalFile(testFile(fileName)); }
+ inline QUrl testFileUrl(const char *fileName) const
+ { return testFileUrl(QLatin1String(fileName)); }
+
+ inline QString dataDirectory() const { return m_dataDirectory; }
+ inline QUrl dataDirectoryUrl() const { return m_dataDirectoryUrl; }
+ inline QString directory() const { return m_directory; }
+
+ static inline QQmlDataTest *instance() { return m_instance; }
+
+public slots:
+ virtual void initTestCase();
+
+private:
+ static QQmlDataTest *m_instance;
+
+ const QString m_dataDirectory;
+ const QUrl m_dataDirectoryUrl;
+ QString m_directory;
+};
+
+class QQmlTestMessageHandler
+{
+ Q_DISABLE_COPY(QQmlTestMessageHandler)
+public:
+ QQmlTestMessageHandler();
+ ~QQmlTestMessageHandler();
+
+ const QStringList &messages() const { return m_messages; }
+ const QString messageString() const { return m_messages.join(QLatin1Char('\n')); }
+
+ void clear() { m_messages.clear(); }
+
+ void setIncludeCategoriesEnabled(bool enabled) { m_includeCategories = enabled; }
+
+private:
+ static void messageHandler(QtMsgType, const QMessageLogContext &context, const QString &message);
+
+ static QQmlTestMessageHandler *m_instance;
+ QStringList m_messages;
+ QtMessageHandler m_oldHandler;
+ bool m_includeCategories;
+};
+
+#endif // QQMLTESTUTILS_H
diff --git a/tests/shared/util.pri b/tests/shared/util.pri
new file mode 100644
index 00000000..b54897ac
--- /dev/null
+++ b/tests/shared/util.pri
@@ -0,0 +1,10 @@
+
+INCLUDEPATH += $$PWD
+HEADERS += $$PWD/util.h
+SOURCES += $$PWD/util.cpp
+
+android|ios {
+ DEFINES += QT_QMLTEST_DATADIR=\\\":/data\\\"
+} else {
+ DEFINES += QT_QMLTEST_DATADIR=\\\"$${_PRO_FILE_PWD_}/data\\\"
+}