summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp6
-rw-r--r--tests/auto/pdf/qpdfsearchmodel/tst_qpdfsearchmodel.cpp2
-rw-r--r--tests/auto/quick/certificateerror/WebView.qml64
-rw-r--r--tests/auto/quick/certificateerror/certificateerror.pro7
-rw-r--r--tests/auto/quick/certificateerror/certificateerror.qrc5
-rw-r--r--tests/auto/quick/certificateerror/testhandler.cpp63
-rw-r--r--tests/auto/quick/certificateerror/testhandler.h59
-rw-r--r--tests/auto/quick/certificateerror/tst_certificateerror.cpp125
-rw-r--r--tests/auto/quick/dialogs/tst_dialogs.cpp4
-rw-r--r--tests/auto/quick/publicapi/tst_publicapi.cpp281
-rw-r--r--tests/auto/quick/qmltests/data/tst_download.qml42
-rw-r--r--tests/auto/quick/qmltests/tst_qmltests.cpp2
-rw-r--r--tests/auto/quick/qmltests_ssl/data/tst_certificateError.qml4
-rw-r--r--tests/auto/quick/qquickwebengineview/BLACKLIST2
-rw-r--r--tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp16
-rw-r--r--tests/auto/quick/quick.pro5
-rw-r--r--tests/auto/quick/shared/util.h2
-rw-r--r--tests/auto/shared/httpsserver.h2
-rw-r--r--tests/auto/widgets/accessibility/BLACKLIST2
-rw-r--r--tests/auto/widgets/accessibility/tst_accessibility.cpp10
-rw-r--r--tests/auto/widgets/certificateerror/tst_certificateerror.cpp18
-rw-r--r--tests/auto/widgets/loadsignals/tst_loadsignals.cpp12
-rw-r--r--tests/auto/widgets/origins/tst_origins.cpp9
-rw-r--r--tests/auto/widgets/proxy/proxy_server.cpp2
-rw-r--r--tests/auto/widgets/qwebenginedownloadrequest/qwebenginedownloadrequest.pro (renamed from tests/auto/widgets/qwebenginedownloaditem/qwebenginedownloaditem.pro)0
-rw-r--r--tests/auto/widgets/qwebenginedownloadrequest/tst_qwebenginedownloadrequest.cpp (renamed from tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp)369
-rw-r--r--tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp37
-rw-r--r--tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp12
-rw-r--r--tests/auto/widgets/qwebenginesettings/BLACKLIST2
-rw-r--r--tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp2
-rw-r--r--tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp8
-rw-r--r--tests/auto/widgets/spellchecking/tst_spellchecking.cpp20
-rw-r--r--tests/auto/widgets/util.h2
-rw-r--r--tests/auto/widgets/widgets.pro4
-rw-r--r--tests/manual/quick/quick.pro3
-rw-r--r--tests/manual/quick/touchbrowser/AddressBar.qml102
-rw-r--r--tests/manual/quick/touchbrowser/main.cpp100
-rw-r--r--tests/manual/quick/touchbrowser/main.qml65
-rw-r--r--tests/manual/quick/touchbrowser/qml.qrc6
-rw-r--r--tests/manual/quick/touchbrowser/touchbrowser.pro19
-rw-r--r--tests/manual/quick/touchbrowser/touchmockingapplication.cpp287
-rw-r--r--tests/manual/quick/touchbrowser/touchmockingapplication.h72
-rw-r--r--tests/manual/quick/touchbrowser/utils.h49
-rw-r--r--tests/manual/widgets/inputmethods/colorpicker.cpp1
44 files changed, 1395 insertions, 509 deletions
diff --git a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp
index 20e191a4f..33edf25f1 100644
--- a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp
+++ b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp
@@ -30,9 +30,9 @@
#include <QtTest/QtTest>
#include <QtWebEngineCore/qwebengineurlrequestinfo.h>
#include <QtWebEngineCore/qwebengineurlrequestinterceptor.h>
+#include <QtWebEngineCore/qwebenginesettings.h>
#include <QtWebEngineWidgets/qwebenginepage.h>
#include <QtWebEngineWidgets/qwebengineprofile.h>
-#include <QtWebEngineWidgets/qwebenginesettings.h>
#include <httpserver.h>
#include <httpreqrep.h>
@@ -508,8 +508,8 @@ void tst_QWebEngineUrlRequestInterceptor::requestInterceptorByResourceType_data(
QTest::addColumn<int>("resourceType");
QStringList name = { "ui", "io" };
- QVector<InterceptorSetter> setters = { &QWebEngineProfile::setUrlRequestInterceptor,
- &QWebEngineProfile::setRequestInterceptor };
+ QList<InterceptorSetter> setters = { &QWebEngineProfile::setUrlRequestInterceptor,
+ &QWebEngineProfile::setRequestInterceptor };
for (int i = 0; i < 2; i++) {
QTest::newRow(qPrintable(name[i] + "StyleSheet"))
<< setters[i] << styleRequestUrl << firstPartyUrl
diff --git a/tests/auto/pdf/qpdfsearchmodel/tst_qpdfsearchmodel.cpp b/tests/auto/pdf/qpdfsearchmodel/tst_qpdfsearchmodel.cpp
index e690bfc11..c0706faaf 100644
--- a/tests/auto/pdf/qpdfsearchmodel/tst_qpdfsearchmodel.cpp
+++ b/tests/auto/pdf/qpdfsearchmodel/tst_qpdfsearchmodel.cpp
@@ -58,7 +58,7 @@ void tst_QPdfSearchModel::findText()
QPdfSearchModel model;
model.setDocument(&document);
- QVector<QRectF> matches = model.matches(1, "ai");
+ QList<QRectF> matches = model.matches(1, "ai");
qDebug() << matches;
QCOMPARE(matches.count(), 3);
diff --git a/tests/auto/quick/certificateerror/WebView.qml b/tests/auto/quick/certificateerror/WebView.qml
new file mode 100644
index 000000000..97abdfb98
--- /dev/null
+++ b/tests/auto/quick/certificateerror/WebView.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtWebEngine 1.4
+import QtQuick.Window 2.0
+import QtTest 1.0
+import io.qt.tester 1.0
+
+Window {
+ width: 50
+ height: 50
+ visible: true
+
+ TestHandler {
+ id: handler
+ onLoadPage: function(url) {
+ view.url = url
+ }
+ }
+
+ WebEngineView {
+ id: view
+ anchors.fill: parent
+ onLoadingChanged: function(request) {
+ if (request.status === WebEngineView.LoadSucceededStatus) {
+ handler.loadSuccess = true
+ } else if (request.status === WebEngineView.LoadFailedStatus) {
+ handler.loadSuccess = false
+ }
+ }
+ onCertificateError: function(error) {
+ handler.certificateError = error
+ }
+ Component.onCompleted: {
+ view.settings.errorPageEnabled = false
+ }
+ }
+}
diff --git a/tests/auto/quick/certificateerror/certificateerror.pro b/tests/auto/quick/certificateerror/certificateerror.pro
new file mode 100644
index 000000000..27d5a3cc1
--- /dev/null
+++ b/tests/auto/quick/certificateerror/certificateerror.pro
@@ -0,0 +1,7 @@
+include(../tests.pri)
+include(../../shared/https.pri)
+QT *= webenginecore-private webengine webengine-private
+HEADERS += $$PWD/testhandler.h
+SOURCES += $$PWD/testhandler.cpp
+RESOURCES += certificateerror.qrc
+
diff --git a/tests/auto/quick/certificateerror/certificateerror.qrc b/tests/auto/quick/certificateerror/certificateerror.qrc
new file mode 100644
index 000000000..bfc3013e7
--- /dev/null
+++ b/tests/auto/quick/certificateerror/certificateerror.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>WebView.qml</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/quick/certificateerror/testhandler.cpp b/tests/auto/quick/certificateerror/testhandler.cpp
new file mode 100644
index 000000000..cb6710aa3
--- /dev/null
+++ b/tests/auto/quick/certificateerror/testhandler.cpp
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testhandler.h"
+
+TestHandler::TestHandler(QObject *parent) : QObject(parent)
+{
+ setObjectName(QStringLiteral("TestListner"));
+}
+
+void TestHandler::load(const QUrl &page)
+{
+ emit loadPage(page);
+}
+
+void TestHandler::setLoadSuccess(bool success)
+{
+ if (m_loadSuccess != success) {
+ m_loadSuccess = success;
+ emit loadSuccessChanged();
+ }
+}
+
+bool TestHandler::loadSuccess() const
+{
+ return m_loadSuccess;
+}
+
+QWebEngineCertificateError TestHandler::certificateError() const
+{
+ return *m_error;
+}
+
+void TestHandler::setCertificateError(QWebEngineCertificateError error)
+{
+ m_error = new QWebEngineCertificateError(error);
+ emit certificateErrorChanged();
+}
diff --git a/tests/auto/quick/certificateerror/testhandler.h b/tests/auto/quick/certificateerror/testhandler.h
new file mode 100644
index 000000000..a6d95d9a9
--- /dev/null
+++ b/tests/auto/quick/certificateerror/testhandler.h
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTHANDLER_H
+#define TESTHANDLER_H
+
+#include <QWebEngineCertificateError>
+
+class TestHandler : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QWebEngineCertificateError certificateError READ certificateError WRITE
+ setCertificateError NOTIFY certificateErrorChanged)
+ Q_PROPERTY(bool loadSuccess READ loadSuccess WRITE setLoadSuccess NOTIFY loadSuccessChanged)
+public:
+ explicit TestHandler(QObject *parent = nullptr);
+ QWebEngineCertificateError certificateError() const;
+
+ void setCertificateError(QWebEngineCertificateError error);
+ void setLoadSuccess(bool success);
+ bool loadSuccess() const;
+ void load(const QUrl &page);
+
+signals:
+ void loadPage(const QUrl &page);
+ void certificateErrorChanged();
+ void loadSuccessChanged();
+
+private:
+ QWebEngineCertificateError *m_error = nullptr;
+ bool m_loadSuccess = false;
+};
+
+#endif // TESTHANDLER_H
diff --git a/tests/auto/quick/certificateerror/tst_certificateerror.cpp b/tests/auto/quick/certificateerror/tst_certificateerror.cpp
new file mode 100644
index 000000000..3e2dc85fb
--- /dev/null
+++ b/tests/auto/quick/certificateerror/tst_certificateerror.cpp
@@ -0,0 +1,125 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "testhandler.h"
+#include <httpsserver.h>
+#include <util.h>
+#include <QWebEngineCertificateError>
+#include <QQuickWebEngineProfile>
+#include <QQmlApplicationEngine>
+#include <QQuickWindow>
+#include <QtTest/QtTest>
+
+class tst_CertificateError : public QObject
+{
+ Q_OBJECT
+public:
+ tst_CertificateError() { }
+
+private Q_SLOTS:
+ void initTestCase();
+ void handleError_data();
+ void handleError();
+
+private:
+ QScopedPointer<QQmlApplicationEngine> m_engine;
+ QQuickWindow *m_widnow = nullptr;
+ TestHandler *m_handler = nullptr;
+};
+
+void tst_CertificateError::initTestCase()
+{
+ QQuickWebEngineProfile::defaultProfile()->setOffTheRecord(true);
+ qmlRegisterType<TestHandler>("io.qt.tester", 1, 0, "TestHandler");
+ m_engine.reset(new QQmlApplicationEngine());
+ m_engine->load(QUrl(QStringLiteral("qrc:/WebView.qml")));
+ m_widnow = qobject_cast<QQuickWindow *>(m_engine->rootObjects().first());
+ Q_ASSERT(m_widnow);
+ m_handler = m_widnow->findChild<TestHandler *>(QStringLiteral("TestListner"));
+ Q_ASSERT(m_handler);
+}
+
+void tst_CertificateError::handleError_data()
+{
+ QTest::addColumn<bool>("deferError");
+ QTest::addColumn<bool>("acceptCertificate");
+ QTest::addColumn<QString>("expectedContent");
+ QTest::addRow("Reject") << false << false << QString();
+ QTest::addRow("DeferReject") << true << false << QString();
+ QTest::addRow("DeferAccept") << true << true << "TEST";
+}
+
+void tst_CertificateError::handleError()
+{
+ HttpsServer server;
+ server.setExpectError(true);
+ QVERIFY(server.start());
+
+ connect(&server, &HttpsServer::newRequest, [&](HttpReqRep *rr) {
+ rr->setResponseBody(QByteArrayLiteral("<html><body>TEST</body></html>"));
+ rr->sendResponse();
+ });
+
+ QFETCH(bool, deferError);
+ QFETCH(bool, acceptCertificate);
+ QFETCH(QString, expectedContent);
+
+ QSignalSpy certificateErrorSpy(m_handler, &TestHandler::certificateErrorChanged);
+ m_handler->load(server.url());
+ QTRY_COMPARE(certificateErrorSpy.count(), 1);
+ QWebEngineCertificateError error = m_handler->certificateError();
+
+ if (deferError) {
+ error.defer();
+ return;
+ }
+
+ if (acceptCertificate)
+ error.acceptCertificate();
+ else
+ error.rejectCertificate();
+
+ QVERIFY(error.isOverridable());
+ auto chain = error.certificateChain();
+ QCOMPARE(chain.size(), 2);
+ QCOMPARE(chain[0].serialNumber(), "3b:dd:1a:b7:2f:40:32:3b:c1:bf:37:d4:86:bd:56:c1:d0:6b:2a:43");
+ QCOMPARE(chain[1].serialNumber(), "6d:52:fb:b4:57:3b:b2:03:c8:62:7b:7e:44:45:5c:d3:08:87:74:17");
+
+ if (deferError) {
+ QVERIFY(!m_handler->loadSuccess());
+
+ if (acceptCertificate)
+ error.acceptCertificate();
+ else
+ error.rejectCertificate();
+ }
+ QTRY_COMPARE_WITH_TIMEOUT(m_handler->loadSuccess(), acceptCertificate, 3000);
+}
+
+static QByteArrayList params;
+W_QTEST_MAIN(tst_CertificateError, params)
+#include <tst_certificateerror.moc>
diff --git a/tests/auto/quick/dialogs/tst_dialogs.cpp b/tests/auto/quick/dialogs/tst_dialogs.cpp
index 8e802a836..dca872aad 100644
--- a/tests/auto/quick/dialogs/tst_dialogs.cpp
+++ b/tests/auto/quick/dialogs/tst_dialogs.cpp
@@ -30,7 +30,7 @@
#include "server.h"
#include "util.h"
#include <QtWebEngine/private/qquickwebenginedialogrequests_p.h>
-#include <QtWebEngine/private/qquickwebenginecontextmenurequest_p.h>
+#include <QtWebEngineCore/qwebenginecontextmenurequest.h>
#include <QQuickWebEngineProfile>
#include <QQmlApplicationEngine>
#include <QQuickWindow>
@@ -121,7 +121,7 @@ void tst_Dialogs::contextMenuRequested()
QSignalSpy dialogSpy(m_listner, &TestHandler::requestChanged);
QTest::mouseClick(m_widnow, Qt::RightButton);
QTRY_COMPARE(dialogSpy.count(), 1);
- auto dialog = qobject_cast<QQuickWebEngineContextMenuRequest*>(m_listner->request());
+ auto dialog = qobject_cast<QWebEngineContextMenuRequest *>(m_listner->request());
QVERIFY2(dialog, "Incorrect dialog requested");
}
diff --git a/tests/auto/quick/publicapi/tst_publicapi.cpp b/tests/auto/quick/publicapi/tst_publicapi.cpp
index dad962576..29b4eedb6 100644
--- a/tests/auto/quick/publicapi/tst_publicapi.cpp
+++ b/tests/auto/quick/publicapi/tst_publicapi.cpp
@@ -35,23 +35,23 @@
#include <QtTest/QtTest>
#include <QtWebEngine/QQuickWebEngineProfile>
#include <QtWebEngine/QQuickWebEngineScript>
+#include <QtWebEngineCore/QWebEngineCertificateError>
#include <QtWebEngineCore/QWebEngineFindTextResult>
#include <QtWebEngineCore/QWebEngineNotification>
#include <QtWebEngineCore/QWebEngineQuotaRequest>
#include <QtWebEngineCore/QWebEngineRegisterProtocolHandlerRequest>
+#include <QtWebEngineCore/QWebEngineContextMenuRequest>
+#include <QtWebEngineCore/QWebEngineDownloadRequest>
#include <private/qquickwebengineview_p.h>
#include <private/qquickwebengineaction_p.h>
-#include <private/qquickwebenginecertificateerror_p.h>
#include <private/qquickwebengineclientcertificateselection_p.h>
#include <private/qquickwebenginedialogrequests_p.h>
-#include <private/qquickwebenginedownloaditem_p.h>
#include <private/qquickwebenginehistory_p.h>
#include <private/qquickwebengineloadrequest_p.h>
#include <private/qquickwebenginenavigationrequest_p.h>
#include <private/qquickwebenginenewviewrequest_p.h>
#include <private/qquickwebenginesettings_p.h>
#include <private/qquickwebenginesingleton_p.h>
-#include <private/qquickwebenginecontextmenurequest_p.h>
class tst_publicapi : public QObject {
Q_OBJECT
@@ -62,10 +62,9 @@ private Q_SLOTS:
static const QList<const QMetaObject *> typesToCheck = QList<const QMetaObject *>()
<< &QQuickWebEngineView::staticMetaObject
<< &QQuickWebEngineAction::staticMetaObject
- << &QQuickWebEngineCertificateError::staticMetaObject
<< &QQuickWebEngineClientCertificateOption::staticMetaObject
<< &QQuickWebEngineClientCertificateSelection::staticMetaObject
- << &QQuickWebEngineDownloadItem::staticMetaObject
+ << &QWebEngineDownloadRequest::staticMetaObject
<< &QQuickWebEngineHistory::staticMetaObject
<< &QQuickWebEngineHistoryListModel::staticMetaObject
<< &QQuickWebEngineLoadRequest::staticMetaObject
@@ -82,7 +81,8 @@ static const QList<const QMetaObject *> typesToCheck = QList<const QMetaObject *
<< &QQuickWebEngineFileDialogRequest::staticMetaObject
<< &QQuickWebEngineFormValidationMessageRequest::staticMetaObject
<< &QQuickWebEngineTooltipRequest::staticMetaObject
- << &QQuickWebEngineContextMenuRequest::staticMetaObject
+ << &QWebEngineContextMenuRequest::staticMetaObject
+ << &QWebEngineCertificateError::staticMetaObject
<< &QWebEngineQuotaRequest::staticMetaObject
<< &QWebEngineRegisterProtocolHandlerRequest::staticMetaObject
<< &QWebEngineNotification::staticMetaObject
@@ -121,29 +121,31 @@ static const QStringList expectedAPI = QStringList()
<< "QQuickWebEngineAuthenticationDialogRequest.realm --> QString"
<< "QQuickWebEngineAuthenticationDialogRequest.type --> AuthenticationType"
<< "QQuickWebEngineAuthenticationDialogRequest.url --> QUrl"
- << "QQuickWebEngineCertificateError.CertificateAuthorityInvalid --> Error"
- << "QQuickWebEngineCertificateError.CertificateCommonNameInvalid --> Error"
- << "QQuickWebEngineCertificateError.CertificateContainsErrors --> Error"
- << "QQuickWebEngineCertificateError.CertificateDateInvalid --> Error"
- << "QQuickWebEngineCertificateError.CertificateInvalid --> Error"
- << "QQuickWebEngineCertificateError.CertificateKnownInterceptionBlocked --> Error"
- << "QQuickWebEngineCertificateError.CertificateNameConstraintViolation --> Error"
- << "QQuickWebEngineCertificateError.CertificateNoRevocationMechanism --> Error"
- << "QQuickWebEngineCertificateError.CertificateNonUniqueName --> Error"
- << "QQuickWebEngineCertificateError.CertificateRevoked --> Error"
- << "QQuickWebEngineCertificateError.CertificateTransparencyRequired --> Error"
- << "QQuickWebEngineCertificateError.CertificateUnableToCheckRevocation --> Error"
- << "QQuickWebEngineCertificateError.CertificateValidityTooLong --> Error"
- << "QQuickWebEngineCertificateError.CertificateWeakKey --> Error"
- << "QQuickWebEngineCertificateError.CertificateWeakSignatureAlgorithm --> Error"
- << "QQuickWebEngineCertificateError.SslPinnedKeyNotInCertificateChain --> Error"
- << "QQuickWebEngineCertificateError.defer() --> void"
- << "QQuickWebEngineCertificateError.description --> QString"
- << "QQuickWebEngineCertificateError.error --> Error"
- << "QQuickWebEngineCertificateError.ignoreCertificateError() --> void"
- << "QQuickWebEngineCertificateError.overridable --> bool"
- << "QQuickWebEngineCertificateError.rejectCertificate() --> void"
- << "QQuickWebEngineCertificateError.url --> QUrl"
+ << "QWebEngineCertificateError.CertificateAuthorityInvalid --> Type"
+ << "QWebEngineCertificateError.CertificateCommonNameInvalid --> Type"
+ << "QWebEngineCertificateError.CertificateContainsErrors --> Type"
+ << "QWebEngineCertificateError.CertificateDateInvalid --> Type"
+ << "QWebEngineCertificateError.CertificateInvalid --> Type"
+ << "QWebEngineCertificateError.CertificateKnownInterceptionBlocked --> Type"
+ << "QWebEngineCertificateError.CertificateNameConstraintViolation --> Type"
+ << "QWebEngineCertificateError.CertificateNoRevocationMechanism --> Type"
+ << "QWebEngineCertificateError.CertificateNonUniqueName --> Type"
+ << "QWebEngineCertificateError.CertificateRevoked --> Type"
+ << "QWebEngineCertificateError.CertificateTransparencyRequired --> Type"
+ << "QWebEngineCertificateError.CertificateUnableToCheckRevocation --> Type"
+ << "QWebEngineCertificateError.CertificateValidityTooLong --> Type"
+ << "QWebEngineCertificateError.CertificateWeakKey --> Type"
+ << "QWebEngineCertificateError.CertificateWeakSignatureAlgorithm --> Type"
+ << "QWebEngineCertificateError.CertificateSymantecLegacy --> Type"
+ << "QWebEngineCertificateError.SslObsoleteVersion --> Type"
+ << "QWebEngineCertificateError.SslPinnedKeyNotInCertificateChain --> Type"
+ << "QWebEngineCertificateError.defer() --> void"
+ << "QWebEngineCertificateError.description --> QString"
+ << "QWebEngineCertificateError.type --> Type"
+ << "QWebEngineCertificateError.acceptCertificate() --> void"
+ << "QWebEngineCertificateError.overridable --> bool"
+ << "QWebEngineCertificateError.rejectCertificate() --> void"
+ << "QWebEngineCertificateError.url --> QUrl"
<< "QQuickWebEngineClientCertificateOption.issuer --> QString"
<< "QQuickWebEngineClientCertificateOption.subject --> QString"
<< "QQuickWebEngineClientCertificateOption.effectiveDate --> QDateTime"
@@ -157,118 +159,109 @@ static const QStringList expectedAPI = QStringList()
<< "QQuickWebEngineClientCertificateSelection.selectNone() --> void"
<< "QQuickWebEngineColorDialogRequest.accepted --> bool"
<< "QQuickWebEngineColorDialogRequest.color --> QColor"
- << "QQuickWebEngineContextMenuRequest.CanUndo --> EditFlags"
- << "QQuickWebEngineContextMenuRequest.CanRedo --> EditFlags"
- << "QQuickWebEngineContextMenuRequest.CanCut --> EditFlags"
- << "QQuickWebEngineContextMenuRequest.CanCopy --> EditFlags"
- << "QQuickWebEngineContextMenuRequest.CanPaste --> EditFlags"
- << "QQuickWebEngineContextMenuRequest.CanDelete --> EditFlags"
- << "QQuickWebEngineContextMenuRequest.CanSelectAll --> EditFlags"
- << "QQuickWebEngineContextMenuRequest.CanTranslate --> EditFlags"
- << "QQuickWebEngineContextMenuRequest.CanEditRichly --> EditFlags"
+ << "QWebEngineContextMenuRequest.CanUndo --> EditFlags"
+ << "QWebEngineContextMenuRequest.CanRedo --> EditFlags"
+ << "QWebEngineContextMenuRequest.CanCut --> EditFlags"
+ << "QWebEngineContextMenuRequest.CanCopy --> EditFlags"
+ << "QWebEngineContextMenuRequest.CanPaste --> EditFlags"
+ << "QWebEngineContextMenuRequest.CanDelete --> EditFlags"
+ << "QWebEngineContextMenuRequest.CanSelectAll --> EditFlags"
+ << "QWebEngineContextMenuRequest.CanTranslate --> EditFlags"
+ << "QWebEngineContextMenuRequest.CanEditRichly --> EditFlags"
<< "QQuickWebEngineColorDialogRequest.dialogAccept(QColor) --> void"
<< "QQuickWebEngineColorDialogRequest.dialogReject() --> void"
- << "QQuickWebEngineContextMenuRequest.editFlags --> EditFlags"
- << "QQuickWebEngineContextMenuRequest.MediaInError --> MediaFlags"
- << "QQuickWebEngineContextMenuRequest.MediaPaused --> MediaFlags"
- << "QQuickWebEngineContextMenuRequest.MediaMuted --> MediaFlags"
- << "QQuickWebEngineContextMenuRequest.MediaLoop --> MediaFlags"
- << "QQuickWebEngineContextMenuRequest.MediaCanSave --> MediaFlags"
- << "QQuickWebEngineContextMenuRequest.MediaHasAudio --> MediaFlags"
- << "QQuickWebEngineContextMenuRequest.MediaCanToggleControls --> MediaFlags"
- << "QQuickWebEngineContextMenuRequest.MediaControls --> MediaFlags"
- << "QQuickWebEngineContextMenuRequest.MediaCanPrint --> MediaFlags"
- << "QQuickWebEngineContextMenuRequest.MediaCanRotate --> MediaFlags"
- << "QQuickWebEngineContextMenuRequest.MediaTypeAudio --> MediaType"
- << "QQuickWebEngineContextMenuRequest.MediaTypeCanvas --> MediaType"
- << "QQuickWebEngineContextMenuRequest.MediaTypeFile --> MediaType"
- << "QQuickWebEngineContextMenuRequest.MediaTypeImage --> MediaType"
- << "QQuickWebEngineContextMenuRequest.MediaTypeNone --> MediaType"
- << "QQuickWebEngineContextMenuRequest.MediaTypePlugin --> MediaType"
- << "QQuickWebEngineContextMenuRequest.MediaTypeVideo --> MediaType"
- << "QQuickWebEngineContextMenuRequest.accepted --> bool"
- << "QQuickWebEngineContextMenuRequest.isContentEditable --> bool"
- << "QQuickWebEngineContextMenuRequest.linkText --> QString"
- << "QQuickWebEngineContextMenuRequest.linkUrl --> QUrl"
- << "QQuickWebEngineContextMenuRequest.mediaFlags --> MediaFlags"
- << "QQuickWebEngineContextMenuRequest.mediaType --> MediaType"
- << "QQuickWebEngineContextMenuRequest.mediaUrl --> QUrl"
- << "QQuickWebEngineContextMenuRequest.misspelledWord --> QString"
- << "QQuickWebEngineContextMenuRequest.selectedText --> QString"
- << "QQuickWebEngineContextMenuRequest.spellCheckerSuggestions --> QStringList"
- << "QQuickWebEngineContextMenuRequest.x --> int"
- << "QQuickWebEngineContextMenuRequest.y --> int"
- << "QQuickWebEngineDownloadItem.Attachment --> DownloadType"
- << "QQuickWebEngineDownloadItem.CompleteHtmlSaveFormat --> SavePageFormat"
- << "QQuickWebEngineDownloadItem.DownloadAttribute --> DownloadType"
- << "QQuickWebEngineDownloadItem.DownloadCancelled --> DownloadState"
- << "QQuickWebEngineDownloadItem.DownloadCompleted --> DownloadState"
- << "QQuickWebEngineDownloadItem.DownloadInProgress --> DownloadState"
- << "QQuickWebEngineDownloadItem.DownloadInterrupted --> DownloadState"
- << "QQuickWebEngineDownloadItem.DownloadRequested --> DownloadState"
- << "QQuickWebEngineDownloadItem.FileAccessDenied --> DownloadInterruptReason"
- << "QQuickWebEngineDownloadItem.FileBlocked --> DownloadInterruptReason"
- << "QQuickWebEngineDownloadItem.FileFailed --> DownloadInterruptReason"
- << "QQuickWebEngineDownloadItem.FileHashMismatch --> DownloadInterruptReason"
- << "QQuickWebEngineDownloadItem.FileNameTooLong --> DownloadInterruptReason"
- << "QQuickWebEngineDownloadItem.FileNoSpace --> DownloadInterruptReason"
- << "QQuickWebEngineDownloadItem.FileSecurityCheckFailed --> DownloadInterruptReason"
- << "QQuickWebEngineDownloadItem.FileTooLarge --> DownloadInterruptReason"
- << "QQuickWebEngineDownloadItem.FileTooShort --> DownloadInterruptReason"
- << "QQuickWebEngineDownloadItem.FileTransientError --> DownloadInterruptReason"
- << "QQuickWebEngineDownloadItem.FileVirusInfected --> DownloadInterruptReason"
- << "QQuickWebEngineDownloadItem.MimeHtmlSaveFormat --> SavePageFormat"
- << "QQuickWebEngineDownloadItem.NetworkDisconnected --> DownloadInterruptReason"
- << "QQuickWebEngineDownloadItem.NetworkFailed --> DownloadInterruptReason"
- << "QQuickWebEngineDownloadItem.NetworkInvalidRequest --> DownloadInterruptReason"
- << "QQuickWebEngineDownloadItem.NetworkServerDown --> DownloadInterruptReason"
- << "QQuickWebEngineDownloadItem.NetworkTimeout --> DownloadInterruptReason"
- << "QQuickWebEngineDownloadItem.NoReason --> DownloadInterruptReason"
- << "QQuickWebEngineDownloadItem.SavePage --> DownloadType"
- << "QQuickWebEngineDownloadItem.ServerBadContent --> DownloadInterruptReason"
- << "QQuickWebEngineDownloadItem.ServerCertProblem --> DownloadInterruptReason"
- << "QQuickWebEngineDownloadItem.ServerFailed --> DownloadInterruptReason"
- << "QQuickWebEngineDownloadItem.ServerForbidden --> DownloadInterruptReason"
- << "QQuickWebEngineDownloadItem.ServerUnauthorized --> DownloadInterruptReason"
- << "QQuickWebEngineDownloadItem.ServerUnreachable --> DownloadInterruptReason"
- << "QQuickWebEngineDownloadItem.SingleHtmlSaveFormat --> SavePageFormat"
- << "QQuickWebEngineDownloadItem.UnknownSaveFormat --> SavePageFormat"
- << "QQuickWebEngineDownloadItem.UserCanceled --> DownloadInterruptReason"
- << "QQuickWebEngineDownloadItem.UserRequested --> DownloadType"
- << "QQuickWebEngineDownloadItem.accept() --> void"
- << "QQuickWebEngineDownloadItem.cancel() --> void"
- << "QQuickWebEngineDownloadItem.id --> uint"
- << "QQuickWebEngineDownloadItem.interruptReason --> DownloadInterruptReason"
- << "QQuickWebEngineDownloadItem.interruptReasonChanged() --> void"
- << "QQuickWebEngineDownloadItem.interruptReasonString --> QString"
- << "QQuickWebEngineDownloadItem.isFinished --> bool"
- << "QQuickWebEngineDownloadItem.isFinishedChanged() --> void"
- << "QQuickWebEngineDownloadItem.isPaused --> bool"
- << "QQuickWebEngineDownloadItem.isPausedChanged() --> void"
- << "QQuickWebEngineDownloadItem.isSavePageDownload --> bool"
- << "QQuickWebEngineDownloadItem.mimeType --> QString"
- << "QQuickWebEngineDownloadItem.mimeTypeChanged() --> void"
- << "QQuickWebEngineDownloadItem.path --> QString"
- << "QQuickWebEngineDownloadItem.pathChanged() --> void"
- << "QQuickWebEngineDownloadItem.pause() --> void"
- << "QQuickWebEngineDownloadItem.receivedBytes --> qlonglong"
- << "QQuickWebEngineDownloadItem.receivedBytesChanged() --> void"
- << "QQuickWebEngineDownloadItem.resume() --> void"
- << "QQuickWebEngineDownloadItem.savePageFormat --> SavePageFormat"
- << "QQuickWebEngineDownloadItem.savePageFormatChanged() --> void"
- << "QQuickWebEngineDownloadItem.state --> DownloadState"
- << "QQuickWebEngineDownloadItem.stateChanged() --> void"
- << "QQuickWebEngineDownloadItem.totalBytes --> qlonglong"
- << "QQuickWebEngineDownloadItem.totalBytesChanged() --> void"
- << "QQuickWebEngineDownloadItem.type --> DownloadType"
- << "QQuickWebEngineDownloadItem.typeChanged() --> void"
- << "QQuickWebEngineDownloadItem.view --> QQuickWebEngineView*"
- << "QQuickWebEngineDownloadItem.url --> QUrl"
- << "QQuickWebEngineDownloadItem.suggestedFileName --> QString"
- << "QQuickWebEngineDownloadItem.downloadDirectory --> QString"
- << "QQuickWebEngineDownloadItem.downloadDirectoryChanged() --> void"
- << "QQuickWebEngineDownloadItem.downloadFileName --> QString"
- << "QQuickWebEngineDownloadItem.downloadFileNameChanged() --> void"
+ << "QWebEngineContextMenuRequest.editFlags --> EditFlags"
+ << "QWebEngineContextMenuRequest.MediaInError --> MediaFlags"
+ << "QWebEngineContextMenuRequest.MediaPaused --> MediaFlags"
+ << "QWebEngineContextMenuRequest.MediaMuted --> MediaFlags"
+ << "QWebEngineContextMenuRequest.MediaLoop --> MediaFlags"
+ << "QWebEngineContextMenuRequest.MediaCanSave --> MediaFlags"
+ << "QWebEngineContextMenuRequest.MediaHasAudio --> MediaFlags"
+ << "QWebEngineContextMenuRequest.MediaCanToggleControls --> MediaFlags"
+ << "QWebEngineContextMenuRequest.MediaControls --> MediaFlags"
+ << "QWebEngineContextMenuRequest.MediaCanPrint --> MediaFlags"
+ << "QWebEngineContextMenuRequest.MediaCanRotate --> MediaFlags"
+ << "QWebEngineContextMenuRequest.MediaTypeAudio --> MediaType"
+ << "QWebEngineContextMenuRequest.MediaTypeCanvas --> MediaType"
+ << "QWebEngineContextMenuRequest.MediaTypeFile --> MediaType"
+ << "QWebEngineContextMenuRequest.MediaTypeImage --> MediaType"
+ << "QWebEngineContextMenuRequest.MediaTypeNone --> MediaType"
+ << "QWebEngineContextMenuRequest.MediaTypePlugin --> MediaType"
+ << "QWebEngineContextMenuRequest.MediaTypeVideo --> MediaType"
+ << "QWebEngineContextMenuRequest.accepted --> bool"
+ << "QWebEngineContextMenuRequest.isContentEditable --> bool"
+ << "QWebEngineContextMenuRequest.linkText --> QString"
+ << "QWebEngineContextMenuRequest.linkUrl --> QUrl"
+ << "QWebEngineContextMenuRequest.mediaFlags --> MediaFlags"
+ << "QWebEngineContextMenuRequest.mediaType --> MediaType"
+ << "QWebEngineContextMenuRequest.mediaUrl --> QUrl"
+ << "QWebEngineContextMenuRequest.misspelledWord --> QString"
+ << "QWebEngineContextMenuRequest.selectedText --> QString"
+ << "QWebEngineContextMenuRequest.spellCheckerSuggestions --> QStringList"
+ << "QWebEngineContextMenuRequest.position --> QPoint"
+ << "QWebEngineDownloadRequest.CompleteHtmlSaveFormat --> SavePageFormat"
+ << "QWebEngineDownloadRequest.DownloadCancelled --> DownloadState"
+ << "QWebEngineDownloadRequest.DownloadCompleted --> DownloadState"
+ << "QWebEngineDownloadRequest.DownloadInProgress --> DownloadState"
+ << "QWebEngineDownloadRequest.DownloadInterrupted --> DownloadState"
+ << "QWebEngineDownloadRequest.DownloadRequested --> DownloadState"
+ << "QWebEngineDownloadRequest.FileAccessDenied --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.FileBlocked --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.FileFailed --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.FileHashMismatch --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.FileNameTooLong --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.FileNoSpace --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.FileSecurityCheckFailed --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.FileTooLarge --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.FileTooShort --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.FileTransientError --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.FileVirusInfected --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.MimeHtmlSaveFormat --> SavePageFormat"
+ << "QWebEngineDownloadRequest.NetworkDisconnected --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.NetworkFailed --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.NetworkInvalidRequest --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.NetworkServerDown --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.NetworkTimeout --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.NoReason --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.ServerBadContent --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.ServerCertProblem --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.ServerFailed --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.ServerForbidden --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.ServerUnauthorized --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.ServerUnreachable --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.SingleHtmlSaveFormat --> SavePageFormat"
+ << "QWebEngineDownloadRequest.UnknownSaveFormat --> SavePageFormat"
+ << "QWebEngineDownloadRequest.UserCanceled --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.accept() --> void"
+ << "QWebEngineDownloadRequest.cancel() --> void"
+ << "QWebEngineDownloadRequest.id --> uint"
+ << "QWebEngineDownloadRequest.interruptReason --> DownloadInterruptReason"
+ << "QWebEngineDownloadRequest.interruptReasonChanged() --> void"
+ << "QWebEngineDownloadRequest.interruptReasonString --> QString"
+ << "QWebEngineDownloadRequest.isFinished --> bool"
+ << "QWebEngineDownloadRequest.isFinishedChanged() --> void"
+ << "QWebEngineDownloadRequest.isPaused --> bool"
+ << "QWebEngineDownloadRequest.isPausedChanged() --> void"
+ << "QWebEngineDownloadRequest.isSavePageDownload --> bool"
+ << "QWebEngineDownloadRequest.mimeType --> QString"
+ << "QWebEngineDownloadRequest.pause() --> void"
+ << "QWebEngineDownloadRequest.receivedBytes --> qlonglong"
+ << "QWebEngineDownloadRequest.receivedBytesChanged() --> void"
+ << "QWebEngineDownloadRequest.resume() --> void"
+ << "QWebEngineDownloadRequest.savePageFormat --> SavePageFormat"
+ << "QWebEngineDownloadRequest.savePageFormatChanged() --> void"
+ << "QWebEngineDownloadRequest.state --> DownloadState"
+ << "QWebEngineDownloadRequest.stateChanged(QWebEngineDownloadRequest::DownloadState) --> void"
+ << "QWebEngineDownloadRequest.totalBytes --> qlonglong"
+ << "QWebEngineDownloadRequest.totalBytesChanged() --> void"
+ // FIXME << "QWebEngineDownloadRequest.view --> QQuickWebEngineView*"
+ << "QWebEngineDownloadRequest.url --> QUrl"
+ << "QWebEngineDownloadRequest.suggestedFileName --> QString"
+ << "QWebEngineDownloadRequest.downloadDirectory --> QString"
+ << "QWebEngineDownloadRequest.downloadDirectoryChanged() --> void"
+ << "QWebEngineDownloadRequest.downloadFileName --> QString"
+ << "QWebEngineDownloadRequest.downloadFileNameChanged() --> void"
+ << "QWebEngineDownloadRequest.downloadProgress(qlonglong,qlonglong) --> void" // FIXME
<< "QQuickWebEngineFileDialogRequest.FileModeOpen --> FileMode"
<< "QQuickWebEngineFileDialogRequest.FileModeOpenMultiple --> FileMode"
<< "QQuickWebEngineFileDialogRequest.FileModeSave --> FileMode"
@@ -340,8 +333,8 @@ static const QStringList expectedAPI = QStringList()
<< "QQuickWebEngineProfile.cachePath --> QString"
<< "QQuickWebEngineProfile.cachePathChanged() --> void"
<< "QQuickWebEngineProfile.clearHttpCache() --> void"
- << "QQuickWebEngineProfile.downloadFinished(QQuickWebEngineDownloadItem*) --> void"
- << "QQuickWebEngineProfile.downloadRequested(QQuickWebEngineDownloadItem*) --> void"
+ << "QQuickWebEngineProfile.downloadFinished(QWebEngineDownloadRequest*) --> void"
+ << "QQuickWebEngineProfile.downloadRequested(QWebEngineDownloadRequest*) --> void"
<< "QQuickWebEngineProfile.downloadPath --> QString"
<< "QQuickWebEngineProfile.downloadPathChanged() --> void"
<< "QQuickWebEngineProfile.presentNotification(QWebEngineNotification*) --> void"
@@ -688,11 +681,11 @@ static const QStringList expectedAPI = QStringList()
<< "QQuickWebEngineView.backgroundColorChanged() --> void"
<< "QQuickWebEngineView.canGoBack --> bool"
<< "QQuickWebEngineView.canGoForward --> bool"
- << "QQuickWebEngineView.certificateError(QQuickWebEngineCertificateError*) --> void"
+ << "QQuickWebEngineView.certificateError(QWebEngineCertificateError) --> void"
<< "QQuickWebEngineView.colorDialogRequested(QQuickWebEngineColorDialogRequest*) --> void"
<< "QQuickWebEngineView.contentsSize --> QSizeF"
<< "QQuickWebEngineView.contentsSizeChanged(QSizeF) --> void"
- << "QQuickWebEngineView.contextMenuRequested(QQuickWebEngineContextMenuRequest*) --> void"
+ << "QQuickWebEngineView.contextMenuRequested(QWebEngineContextMenuRequest*) --> void"
<< "QQuickWebEngineView.devToolsView --> QQuickWebEngineView*"
<< "QQuickWebEngineView.devToolsViewChanged() --> void"
<< "QQuickWebEngineView.featurePermissionRequested(QUrl,Feature) --> void"
@@ -772,7 +765,9 @@ static const QStringList expectedAPI = QStringList()
<< "QQuickWebEngineView.url --> QUrl"
<< "QQuickWebEngineView.urlChanged() --> void"
<< "QQuickWebEngineView.userScripts --> QQmlListProperty<QQuickWebEngineScript>"
+#if QT_CONFIG(webengine_webchannel)
<< "QQuickWebEngineView.webChannel --> QQmlWebChannel*"
+#endif
<< "QQuickWebEngineView.webChannelChanged() --> void"
<< "QQuickWebEngineView.webChannelWorld --> uint"
<< "QQuickWebEngineView.webChannelWorldChanged(uint) --> void"
diff --git a/tests/auto/quick/qmltests/data/tst_download.qml b/tests/auto/quick/qmltests/data/tst_download.qml
index 1b1750dd8..8607d846d 100644
--- a/tests/auto/quick/qmltests/data/tst_download.qml
+++ b/tests/auto/quick/qmltests/data/tst_download.qml
@@ -155,7 +155,7 @@ TestWebEngineView {
compare(downLoadRequestedSpy.count, 1)
compare(downloadUrl, webEngineView.url)
compare(suggestedFileName, "download.zip")
- compare(downloadState[0], WebEngineDownloadItem.DownloadRequested)
+ compare(downloadState[0], WebEngineDownloadRequest.DownloadRequested)
verify(!downloadInterruptReason)
}
@@ -179,11 +179,11 @@ TestWebEngineView {
compare(downLoadRequestedSpy.count, 1)
compare(downloadUrl, webEngineView.url)
compare(suggestedFileName, "download.zip")
- compare(downloadState[0], WebEngineDownloadItem.DownloadRequested)
- tryCompare(downloadState, "1", WebEngineDownloadItem.DownloadInProgress)
+ compare(downloadState[0], WebEngineDownloadRequest.DownloadRequested)
+ tryCompare(downloadState, "1", WebEngineDownloadRequest.DownloadInProgress)
downloadFinishedSpy.wait()
compare(totalBytes, receivedBytes)
- tryCompare(downloadState, "2", WebEngineDownloadItem.DownloadCompleted)
+ tryCompare(downloadState, "2", WebEngineDownloadRequest.DownloadCompleted)
verify(!downloadInterruptReason)
}
@@ -196,8 +196,8 @@ TestWebEngineView {
compare(downloadUrl, webEngineView.url)
compare(suggestedFileName, "download.zip")
compare(downloadFinishedSpy.count, 1)
- tryCompare(downloadState, "1", WebEngineDownloadItem.DownloadCancelled)
- tryCompare(webEngineView, "downloadInterruptReason", WebEngineDownloadItem.UserCanceled)
+ tryCompare(downloadState, "1", WebEngineDownloadRequest.DownloadCancelled)
+ tryCompare(webEngineView, "downloadInterruptReason", WebEngineDownloadRequest.UserCanceled)
}
function test_downloadLocation() {
@@ -230,15 +230,15 @@ TestWebEngineView {
compare(downLoadRequestedSpy.count, 1);
compare(downloadUrl, webEngineView.url);
compare(suggestedFileName, "download.zip");
- compare(downloadState[0], WebEngineDownloadItem.DownloadRequested);
- tryCompare(downloadState, "1", WebEngineDownloadItem.DownloadInProgress);
+ compare(downloadState[0], WebEngineDownloadRequest.DownloadRequested);
+ tryCompare(downloadState, "1", WebEngineDownloadRequest.DownloadInProgress);
compare(downloadedPath, testDownloadProfile.downloadPath + downloadDirectory + downloadFileName);
compare(downloadDirectoryChanged, 1);
compare(downloadFileNameChanged, 1);
compare(downloadPathChanged, 2);
downloadFinishedSpy.wait();
compare(totalBytes, receivedBytes);
- tryCompare(downloadState, "2", WebEngineDownloadItem.DownloadCompleted);
+ tryCompare(downloadState, "2", WebEngineDownloadRequest.DownloadCompleted);
verify(!downloadInterruptReason);
}
@@ -253,15 +253,15 @@ TestWebEngineView {
compare(downLoadRequestedSpy.count, 1);
compare(downloadUrl, webEngineView.url);
compare(suggestedFileName, "download.zip");
- compare(downloadState[0], WebEngineDownloadItem.DownloadRequested);
- tryCompare(downloadState, "1", WebEngineDownloadItem.DownloadInProgress);
+ compare(downloadState[0], WebEngineDownloadRequest.DownloadRequested);
+ tryCompare(downloadState, "1", WebEngineDownloadRequest.DownloadInProgress);
compare(downloadedPath, testDownloadProfile.downloadPath + downloadDirectory + "download.zip");
compare(downloadDirectoryChanged, 1);
compare(downloadFileNameChanged, 0);
compare(downloadPathChanged, 1);
downloadFinishedSpy.wait();
compare(totalBytes, receivedBytes);
- tryCompare(downloadState, "2", WebEngineDownloadItem.DownloadCompleted);
+ tryCompare(downloadState, "2", WebEngineDownloadRequest.DownloadCompleted);
verify(!downloadInterruptReason);
// Download the same file to another directory with suggested file name.
@@ -277,15 +277,15 @@ TestWebEngineView {
compare(downLoadRequestedSpy.count, 1);
compare(downloadUrl, webEngineView.url);
compare(suggestedFileName, "download.zip");
- compare(downloadState[0], WebEngineDownloadItem.DownloadRequested);
- tryCompare(downloadState, "1", WebEngineDownloadItem.DownloadInProgress);
+ compare(downloadState[0], WebEngineDownloadRequest.DownloadRequested);
+ tryCompare(downloadState, "1", WebEngineDownloadRequest.DownloadInProgress);
compare(downloadedPath, testDownloadProfile.downloadPath + downloadDirectory + "download.zip");
compare(downloadDirectoryChanged, 1);
compare(downloadFileNameChanged, 0);
compare(downloadPathChanged, 1);
downloadFinishedSpy.wait();
compare(totalBytes, receivedBytes);
- tryCompare(downloadState, "2", WebEngineDownloadItem.DownloadCompleted);
+ tryCompare(downloadState, "2", WebEngineDownloadRequest.DownloadCompleted);
verify(!downloadInterruptReason);
// Download same file to same directory second time -> file name should be unified.
@@ -301,15 +301,15 @@ TestWebEngineView {
compare(downLoadRequestedSpy.count, 1);
compare(downloadUrl, webEngineView.url);
compare(suggestedFileName, "download.zip");
- compare(downloadState[0], WebEngineDownloadItem.DownloadRequested);
- tryCompare(downloadState, "1", WebEngineDownloadItem.DownloadInProgress);
+ compare(downloadState[0], WebEngineDownloadRequest.DownloadRequested);
+ tryCompare(downloadState, "1", WebEngineDownloadRequest.DownloadInProgress);
compare(downloadedPath, testDownloadProfile.downloadPath + downloadDirectory + "download (1).zip");
compare(downloadDirectoryChanged, 1);
compare(downloadFileNameChanged, 1);
compare(downloadPathChanged, 1);
downloadFinishedSpy.wait();
compare(totalBytes, receivedBytes);
- tryCompare(downloadState, "2", WebEngineDownloadItem.DownloadCompleted);
+ tryCompare(downloadState, "2", WebEngineDownloadRequest.DownloadCompleted);
verify(!downloadInterruptReason);
}
@@ -323,15 +323,15 @@ TestWebEngineView {
compare(downLoadRequestedSpy.count, 1);
compare(downloadUrl, webEngineView.url);
compare(suggestedFileName, "download.zip");
- compare(downloadState[0], WebEngineDownloadItem.DownloadRequested);
- tryCompare(downloadState, "1", WebEngineDownloadItem.DownloadInProgress);
+ compare(downloadState[0], WebEngineDownloadRequest.DownloadRequested);
+ tryCompare(downloadState, "1", WebEngineDownloadRequest.DownloadInProgress);
compare(downloadedPath, testDownloadProfile.downloadPath + downloadedSetPath);
compare(downloadDirectoryChanged, 1);
compare(downloadFileNameChanged, 1);
compare(downloadPathChanged, 2);
downloadFinishedSpy.wait();
compare(totalBytes, receivedBytes);
- tryCompare(downloadState, "2", WebEngineDownloadItem.DownloadCompleted);
+ tryCompare(downloadState, "2", WebEngineDownloadRequest.DownloadCompleted);
verify(!downloadInterruptReason);
}
}
diff --git a/tests/auto/quick/qmltests/tst_qmltests.cpp b/tests/auto/quick/qmltests/tst_qmltests.cpp
index 5677f9047..209b1fefd 100644
--- a/tests/auto/quick/qmltests/tst_qmltests.cpp
+++ b/tests/auto/quick/qmltests/tst_qmltests.cpp
@@ -130,7 +130,7 @@ int main(int argc, char **argv)
QLocale::setDefault(QLocale("en"));
static QByteArrayList params = {QByteArrayLiteral("--use-fake-device-for-media-stream")};
- QVector<const char *> w_argv(argc); \
+ QList<const char *> w_argv(argc); \
for (int i = 0; i < argc; ++i) \
w_argv[i] = argv[i]; \
for (int i = 0; i < params.size(); ++i) \
diff --git a/tests/auto/quick/qmltests_ssl/data/tst_certificateError.qml b/tests/auto/quick/qmltests_ssl/data/tst_certificateError.qml
index 0629be175..a4bd9597a 100644
--- a/tests/auto/quick/qmltests_ssl/data/tst_certificateError.qml
+++ b/tests/auto/quick/qmltests_ssl/data/tst_certificateError.qml
@@ -42,7 +42,7 @@ TestWebEngineView {
if (deferError)
error.defer()
else if (acceptCertificate)
- error.ignoreCertificateError()
+ error.acceptCertificate()
else
error.rejectCertificate()
}
@@ -97,7 +97,7 @@ TestWebEngineView {
let error = spyError.signalArguments[0][0]
if (data.acceptCertificate)
- error.ignoreCertificateError()
+ error.acceptCertificate()
else
error.rejectCertificate()
}
diff --git a/tests/auto/quick/qquickwebengineview/BLACKLIST b/tests/auto/quick/qquickwebengineview/BLACKLIST
new file mode 100644
index 000000000..d4a35a76a
--- /dev/null
+++ b/tests/auto/quick/qquickwebengineview/BLACKLIST
@@ -0,0 +1,2 @@
+[javascriptClipboard]
+ubuntu-20.04
diff --git a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp
index 5ee30f165..a95c231a1 100644
--- a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp
+++ b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp
@@ -584,7 +584,7 @@ void tst_QQuickWebEngineView::interruptImeTextComposition()
QTest::mouseClick(view->window(), Qt::LeftButton, {}, textInputCenter);
} else if (eventType == "Touch") {
QPoint textInputCenter = elementCenter(view, QStringLiteral("input2"));
- QTouchDevice *touchDevice = QTest::createTouchDevice();
+ QPointingDevice *touchDevice = QTest::createTouchDevice();
QTest::touchEvent(view->window(), touchDevice).press(0, textInputCenter, view->window());
QTest::touchEvent(view->window(), touchDevice).release(0, textInputCenter, view->window());
}
@@ -975,9 +975,7 @@ void tst_QQuickWebEngineView::inputEventForwardingDisabledWhenActiveFocusOnPress
QTest::mousePress(view->window(), Qt::LeftButton);
QTest::mouseRelease(view->window(), Qt::LeftButton);
- QTouchDevice *device = new QTouchDevice;
- device->setType(QTouchDevice::TouchScreen);
- QWindowSystemInterface::registerTouchDevice(device);
+ QPointingDevice *device = QTest::createTouchDevice();
QTest::touchEvent(view->window(), device).press(0, QPoint(0,0), view->window());
QTest::touchEvent(view->window(), device).move(0, QPoint(1, 1), view->window());
@@ -1164,17 +1162,17 @@ void tst_QQuickWebEngineView::setProfile() {
void tst_QQuickWebEngineView::focusChild_data()
{
QTest::addColumn<QString>("interfaceName");
- QTest::addColumn<QVector<QAccessible::Role>>("ancestorRoles");
+ QTest::addColumn<QList<QAccessible::Role>>("ancestorRoles");
- QTest::newRow("QQuickWebEngineView") << QString("QQuickWebEngineView") << QVector<QAccessible::Role>({QAccessible::Client});
- QTest::newRow("RenderWidgetHostViewQtDelegate") << QString("RenderWidgetHostViewQtDelegate") << QVector<QAccessible::Role>({QAccessible::Client});
- QTest::newRow("QQuickView") << QString("QQuickView") << QVector<QAccessible::Role>({QAccessible::Window, QAccessible::Client /* view */});
+ QTest::newRow("QQuickWebEngineView") << QString("QQuickWebEngineView") << QList<QAccessible::Role>({QAccessible::Client});
+ QTest::newRow("RenderWidgetHostViewQtDelegate") << QString("RenderWidgetHostViewQtDelegate") << QList<QAccessible::Role>({QAccessible::Client});
+ QTest::newRow("QQuickView") << QString("QQuickView") << QList<QAccessible::Role>({QAccessible::Window, QAccessible::Client /* view */});
}
void tst_QQuickWebEngineView::focusChild()
{
auto traverseToWebDocumentAccessibleInterface = [](QAccessibleInterface *iface) -> QAccessibleInterface * {
- QFETCH(QVector<QAccessible::Role>, ancestorRoles);
+ QFETCH(QList<QAccessible::Role>, ancestorRoles);
for (int i = 0; i < ancestorRoles.size(); ++i) {
if (iface->childCount() == 0 || iface->role() != ancestorRoles[i])
return nullptr;
diff --git a/tests/auto/quick/quick.pro b/tests/auto/quick/quick.pro
index 41ea5c4c1..4690047b7 100644
--- a/tests/auto/quick/quick.pro
+++ b/tests/auto/quick/quick.pro
@@ -10,7 +10,8 @@ SUBDIRS += \
publicapi \
qquickwebenginedefaultsurfaceformat \
qquickwebengineview \
- qtbug-70248
+ qtbug-70248 \
+ certificateerror
qtConfig(webengine-testsupport) {
SUBDIRS += \
@@ -18,6 +19,8 @@ qtConfig(webengine-testsupport) {
qquickwebengineviewgraphics
}
+!qtHaveModule(quickcontrols): SUBDIRS -= qmltests
+
qtConfig(ssl): SUBDIRS += qmltests_ssl
# QTBUG-66055
diff --git a/tests/auto/quick/shared/util.h b/tests/auto/quick/shared/util.h
index b7b7b1564..132c353ca 100644
--- a/tests/auto/quick/shared/util.h
+++ b/tests/auto/quick/shared/util.h
@@ -173,7 +173,7 @@ int main(int argc, char *argv[]) \
{ \
QtWebEngine::initialize(); \
\
- QVector<const char *> w_argv(argc); \
+ QList<const char *> w_argv(argc); \
for (int i = 0; i < argc; ++i) \
w_argv[i] = argv[i]; \
for (int i = 0; i < params.size(); ++i) \
diff --git a/tests/auto/shared/httpsserver.h b/tests/auto/shared/httpsserver.h
index 32c8e8345..219d5f7a1 100644
--- a/tests/auto/shared/httpsserver.h
+++ b/tests/auto/shared/httpsserver.h
@@ -55,7 +55,7 @@ struct SslTcpServer : QTcpServer
return;
}
- connect(socket, QOverload<QSslSocket::SocketError>::of(&QSslSocket::error),
+ connect(socket, QOverload<QSslSocket::SocketError>::of(&QSslSocket::errorOccurred),
[] (QSslSocket::SocketError e) { qWarning() << "! Socket Error:" << e; });
connect(socket, QOverload<const QList<QSslError> &>::of(&QSslSocket::sslErrors),
[] (const QList<QSslError> &le) { qWarning() << "! SSL Errors:\n" << le; });
diff --git a/tests/auto/widgets/accessibility/BLACKLIST b/tests/auto/widgets/accessibility/BLACKLIST
new file mode 100644
index 000000000..41d3635d2
--- /dev/null
+++ b/tests/auto/widgets/accessibility/BLACKLIST
@@ -0,0 +1,2 @@
+[focusChild]
+*
diff --git a/tests/auto/widgets/accessibility/tst_accessibility.cpp b/tests/auto/widgets/accessibility/tst_accessibility.cpp
index 84382d6f1..e73f7d89b 100644
--- a/tests/auto/widgets/accessibility/tst_accessibility.cpp
+++ b/tests/auto/widgets/accessibility/tst_accessibility.cpp
@@ -151,17 +151,17 @@ void tst_Accessibility::hierarchy()
void tst_Accessibility::focusChild_data()
{
QTest::addColumn<QString>("interfaceName");
- QTest::addColumn<QVector<QAccessible::Role>>("ancestorRoles");
+ QTest::addColumn<QList<QAccessible::Role>>("ancestorRoles");
- QTest::newRow("QWebEngineView") << QString("QWebEngineView") << QVector<QAccessible::Role>({QAccessible::Client});
- QTest::newRow("RenderWidgetHostViewQtDelegate") << QString("RenderWidgetHostViewQtDelegate") << QVector<QAccessible::Role>({QAccessible::Client});
- QTest::newRow("QMainWindow") << QString("QMainWindow") << QVector<QAccessible::Role>({QAccessible::Window, QAccessible::Client /* central widget */, QAccessible::Client /* view */});
+ QTest::newRow("QWebEngineView") << QString("QWebEngineView") << QList<QAccessible::Role>({QAccessible::Client});
+ QTest::newRow("RenderWidgetHostViewQtDelegate") << QString("RenderWidgetHostViewQtDelegate") << QList<QAccessible::Role>({QAccessible::Client});
+ QTest::newRow("QMainWindow") << QString("QMainWindow") << QList<QAccessible::Role>({QAccessible::Window, QAccessible::Client /* central widget */, QAccessible::Client /* view */});
}
void tst_Accessibility::focusChild()
{
auto traverseToWebDocumentAccessibleInterface = [](QAccessibleInterface *iface) -> QAccessibleInterface * {
- QFETCH(QVector<QAccessible::Role>, ancestorRoles);
+ QFETCH(QList<QAccessible::Role>, ancestorRoles);
for (int i = 0; i < ancestorRoles.size(); ++i) {
if (iface->childCount() == 0 || iface->role() != ancestorRoles[i])
return nullptr;
diff --git a/tests/auto/widgets/certificateerror/tst_certificateerror.cpp b/tests/auto/widgets/certificateerror/tst_certificateerror.cpp
index f11d9236c..d57c1788b 100644
--- a/tests/auto/widgets/certificateerror/tst_certificateerror.cpp
+++ b/tests/auto/widgets/certificateerror/tst_certificateerror.cpp
@@ -57,11 +57,18 @@ struct PageWithCertificateErrorHandler : QWebEnginePage
QSignalSpy loadSpy;
QScopedPointer<QWebEngineCertificateError> error;
- bool certificateError(const QWebEngineCertificateError &e) override {
+ void certificateError(QWebEngineCertificateError e) override
+ {
error.reset(new QWebEngineCertificateError(e));
- if (deferError)
+ if (deferError) {
error->defer();
- return acceptCertificate;
+ return;
+ }
+
+ if (acceptCertificate)
+ error->acceptCertificate();
+ else
+ error->rejectCertificate();
}
};
@@ -102,17 +109,14 @@ void tst_CertificateError::handleError()
QCOMPARE(chain[1].serialNumber(), "6d:52:fb:b4:57:3b:b2:03:c8:62:7b:7e:44:45:5c:d3:08:87:74:17");
if (deferError) {
- QVERIFY(page.error->deferred());
- QVERIFY(!page.error->answered());
QCOMPARE(page.loadSpy.count(), 0);
QCOMPARE(toPlainTextSync(&page), QString());
if (acceptCertificate)
- page.error->ignoreCertificateError();
+ page.error->acceptCertificate();
else
page.error->rejectCertificate();
- QVERIFY(page.error->answered());
page.error.reset();
}
QTRY_COMPARE_WITH_TIMEOUT(page.loadSpy.count(), 1, 30000);
diff --git a/tests/auto/widgets/loadsignals/tst_loadsignals.cpp b/tests/auto/widgets/loadsignals/tst_loadsignals.cpp
index 8eeadeeb8..a5d51509a 100644
--- a/tests/auto/widgets/loadsignals/tst_loadsignals.cpp
+++ b/tests/auto/widgets/loadsignals/tst_loadsignals.cpp
@@ -240,14 +240,14 @@ void tst_LoadSignals::fileDownloadDoesNotTriggerLoadSignals_qtbug66661()
// allow the download
QTemporaryDir tempDir;
- QWebEngineDownloadItem::DownloadState downloadState = QWebEngineDownloadItem::DownloadRequested;
+ QWebEngineDownloadRequest::DownloadState downloadState = QWebEngineDownloadRequest::DownloadRequested;
connect(view->page()->profile(), &QWebEngineProfile::downloadRequested,
- [&downloadState, &tempDir](QWebEngineDownloadItem* item){
- connect(item, &QWebEngineDownloadItem::stateChanged, [&downloadState](QWebEngineDownloadItem::DownloadState newState){
+ [&downloadState, &tempDir](QWebEngineDownloadRequest* item){
+ connect(item, &QWebEngineDownloadRequest::stateChanged, [&downloadState](QWebEngineDownloadRequest::DownloadState newState){
downloadState = newState;
});
- item->setDownloadDirectory(tempDir.filePath(QFileInfo(item->path()).path()));
- item->setDownloadFileName(QFileInfo(item->path()).fileName());
+ item->setDownloadDirectory(tempDir.path());
+ item->setDownloadFileName(item->suggestedFileName());
item->accept();
});
@@ -261,7 +261,7 @@ void tst_LoadSignals::fileDownloadDoesNotTriggerLoadSignals_qtbug66661()
|| (loadFinishedSpy->size() != 1), 10000, 100);
// Download must have occurred
- QTRY_COMPARE(downloadState, QWebEngineDownloadItem::DownloadCompleted);
+ QTRY_COMPARE(downloadState, QWebEngineDownloadRequest::DownloadCompleted);
// No further loadStarted should have occurred within this time
QCOMPARE(loadStartedSpy->size(), 1);
diff --git a/tests/auto/widgets/origins/tst_origins.cpp b/tests/auto/widgets/origins/tst_origins.cpp
index c24fbede4..92f94ef5d 100644
--- a/tests/auto/widgets/origins/tst_origins.cpp
+++ b/tests/auto/widgets/origins/tst_origins.cpp
@@ -33,15 +33,16 @@
#include <QtWebEngineCore/qwebengineurlrequestjob.h>
#include <QtWebEngineCore/qwebengineurlscheme.h>
#include <QtWebEngineCore/qwebengineurlschemehandler.h>
+#include <QtWebEngineCore/qwebenginesettings.h>
#include <QtWebEngineWidgets/qwebenginepage.h>
#include <QtWebEngineWidgets/qwebengineprofile.h>
-#include <QtWebEngineWidgets/qwebenginesettings.h>
+
#if defined(WEBSOCKETS)
#include <QtWebSockets/qwebsocket.h>
#include <QtWebSockets/qwebsocketserver.h>
#include <QtWebChannel/qwebchannel.h>
#endif
-#include <QtWidgets/qaction.h>
+#include <qaction.h>
#define QSL QStringLiteral
#define QBAL QByteArrayLiteral
@@ -169,7 +170,7 @@ public:
profile->installUrlSchemeHandler(QBAL("cors"), this);
}
- QVector<QUrl> &requests() { return m_requests; }
+ QList<QUrl> &requests() { return m_requests; }
private:
void requestStarted(QWebEngineUrlRequestJob *job) override
@@ -198,7 +199,7 @@ private:
job->reply(mimeType, file);
}
- QVector<QUrl> m_requests;
+ QList<QUrl> m_requests;
};
class tst_Origins final : public QObject {
diff --git a/tests/auto/widgets/proxy/proxy_server.cpp b/tests/auto/widgets/proxy/proxy_server.cpp
index 3bf915609..3e52de4f2 100644
--- a/tests/auto/widgets/proxy/proxy_server.cpp
+++ b/tests/auto/widgets/proxy/proxy_server.cpp
@@ -39,7 +39,7 @@ ProxyServer::ProxyServer(QObject *parent) : QObject(parent)
void ProxyServer::setCredentials(const QByteArray &user, const QByteArray password)
{
m_auth.append(user);
- m_auth.append(QChar(':'));
+ m_auth.append(':');
m_auth.append(password);
m_auth = m_auth.toBase64();
m_authenticate = true;
diff --git a/tests/auto/widgets/qwebenginedownloaditem/qwebenginedownloaditem.pro b/tests/auto/widgets/qwebenginedownloadrequest/qwebenginedownloadrequest.pro
index 18a66c466..18a66c466 100644
--- a/tests/auto/widgets/qwebenginedownloaditem/qwebenginedownloaditem.pro
+++ b/tests/auto/widgets/qwebenginedownloadrequest/qwebenginedownloadrequest.pro
diff --git a/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp b/tests/auto/widgets/qwebenginedownloadrequest/tst_qwebenginedownloadrequest.cpp
index 81329338c..622cb16b5 100644
--- a/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp
+++ b/tests/auto/widgets/qwebenginedownloadrequest/tst_qwebenginedownloadrequest.cpp
@@ -32,14 +32,14 @@
#include <QTemporaryDir>
#include <QTest>
#include <QRegularExpression>
-#include <QWebEngineDownloadItem>
+#include <QWebEngineDownloadRequest>
#include <QWebEnginePage>
#include <QWebEngineProfile>
#include <QWebEngineSettings>
#include <QWebEngineView>
#include <httpserver.h>
-class tst_QWebEngineDownloadItem : public QObject
+class tst_QWebEngineDownloadRequest : public QObject
{
Q_OBJECT
@@ -77,9 +77,6 @@ private Q_SLOTS:
void downloadToDefaultLocation();
void downloadToNonExistentDir();
void downloadToReadOnlyDir();
-#if QT_DEPRECATED_SINCE(5, 14)
- void downloadPathValidation();
-#endif
void downloadToDirectoryWithFileName_data();
void downloadToDirectoryWithFileName();
@@ -88,16 +85,12 @@ private:
void clickLink(QPoint linkPos);
void simulateUserAction(QPoint linkPos, UserAction action);
- QWebEngineDownloadItem::DownloadType expectedDownloadType(
- UserAction userAction,
- const QByteArray &contentDisposition = QByteArray());
-
HttpServer *m_server;
QWebEngineProfile *m_profile;
QWebEnginePage *m_page;
QWebEngineView *m_view;
- QSet<QWebEngineDownloadItem *> m_requestedDownloads;
- QSet<QWebEngineDownloadItem *> m_finishedDownloads;
+ QSet<QWebEngineDownloadRequest *> m_requestedDownloads;
+ QSet<QWebEngineDownloadRequest *> m_finishedDownloads;
};
class ScopedConnection {
@@ -108,22 +101,22 @@ private:
QMetaObject::Connection m_connection;
};
-Q_DECLARE_METATYPE(tst_QWebEngineDownloadItem::UserAction)
-Q_DECLARE_METATYPE(tst_QWebEngineDownloadItem::FileAction)
+Q_DECLARE_METATYPE(tst_QWebEngineDownloadRequest::UserAction)
+Q_DECLARE_METATYPE(tst_QWebEngineDownloadRequest::FileAction)
-void tst_QWebEngineDownloadItem::initTestCase()
+void tst_QWebEngineDownloadRequest::initTestCase()
{
m_server = new HttpServer();
m_profile = new QWebEngineProfile;
m_profile->setHttpCacheType(QWebEngineProfile::NoCache);
m_profile->settings()->setAttribute(QWebEngineSettings::AutoLoadIconsForPage, false);
- connect(m_profile, &QWebEngineProfile::downloadRequested, [this](QWebEngineDownloadItem *item) {
+ connect(m_profile, &QWebEngineProfile::downloadRequested, [this](QWebEngineDownloadRequest *item) {
m_requestedDownloads.insert(item);
- connect(item, &QWebEngineDownloadItem::destroyed, [this, item](){
+ connect(item, &QWebEngineDownloadRequest::destroyed, [this, item](){
m_requestedDownloads.remove(item);
m_finishedDownloads.remove(item);
});
- connect(item, &QWebEngineDownloadItem::finished, [this, item](){
+ connect(item, &QWebEngineDownloadRequest::isFinishedChanged, [this, item](){
m_finishedDownloads.insert(item);
});
});
@@ -134,14 +127,14 @@ void tst_QWebEngineDownloadItem::initTestCase()
m_view->show();
}
-void tst_QWebEngineDownloadItem::init()
+void tst_QWebEngineDownloadRequest::init()
{
QVERIFY(m_server->start());
}
-void tst_QWebEngineDownloadItem::cleanup()
+void tst_QWebEngineDownloadRequest::cleanup()
{
- for (QWebEngineDownloadItem *item : m_finishedDownloads) {
+ for (QWebEngineDownloadRequest *item : m_finishedDownloads) {
item->deleteLater();
}
QTRY_COMPARE(m_requestedDownloads.count(), 0);
@@ -151,7 +144,7 @@ void tst_QWebEngineDownloadItem::cleanup()
m_profile->setDownloadPath("");
}
-void tst_QWebEngineDownloadItem::cleanupTestCase()
+void tst_QWebEngineDownloadRequest::cleanupTestCase()
{
delete m_view;
delete m_page;
@@ -159,7 +152,7 @@ void tst_QWebEngineDownloadItem::cleanupTestCase()
delete m_server;
}
-void tst_QWebEngineDownloadItem::saveLink(QPoint linkPos)
+void tst_QWebEngineDownloadRequest::saveLink(QPoint linkPos)
{
// Simulate right-clicking on link and choosing "save link as" from menu.
QSignalSpy menuSpy(m_view, &QWebEngineView::customContextMenuRequested);
@@ -176,7 +169,7 @@ void tst_QWebEngineDownloadItem::saveLink(QPoint linkPos)
m_page->triggerAction(QWebEnginePage::DownloadLinkToDisk);
}
-void tst_QWebEngineDownloadItem::clickLink(QPoint linkPos)
+void tst_QWebEngineDownloadRequest::clickLink(QPoint linkPos)
{
// Simulate left-clicking on link.
QTRY_VERIFY(m_view->focusWidget());
@@ -184,7 +177,7 @@ void tst_QWebEngineDownloadItem::clickLink(QPoint linkPos)
QTest::mouseClick(renderWidget, Qt::LeftButton, {}, linkPos);
}
-void tst_QWebEngineDownloadItem::simulateUserAction(QPoint linkPos, UserAction action)
+void tst_QWebEngineDownloadRequest::simulateUserAction(QPoint linkPos, UserAction action)
{
switch (action) {
case SaveLink: return saveLink(linkPos);
@@ -192,17 +185,7 @@ void tst_QWebEngineDownloadItem::simulateUserAction(QPoint linkPos, UserAction a
}
}
-QWebEngineDownloadItem::DownloadType tst_QWebEngineDownloadItem::expectedDownloadType(
- UserAction userAction, const QByteArray &contentDisposition)
-{
- if (userAction == SaveLink)
- return QWebEngineDownloadItem::UserRequested;
- if (contentDisposition == QByteArrayLiteral("attachment"))
- return QWebEngineDownloadItem::Attachment;
- return QWebEngineDownloadItem::DownloadAttribute;
-}
-
-void tst_QWebEngineDownloadItem::downloadLink_data()
+void tst_QWebEngineDownloadRequest::downloadLink_data()
{
QTest::addColumn<UserAction>("userAction");
QTest::addColumn<bool>("anchorHasDownloadAttribute");
@@ -213,7 +196,6 @@ void tst_QWebEngineDownloadItem::downloadLink_data()
QTest::addColumn<QByteArray>("fileDisposition");
QTest::addColumn<bool>("fileHasReferer");
QTest::addColumn<FileAction>("fileAction");
- QTest::addColumn<QWebEngineDownloadItem::DownloadType>("downloadType");
// SaveLink should always trigger a download, even for empty files.
QTest::newRow("save link to empty file")
@@ -399,7 +381,7 @@ void tst_QWebEngineDownloadItem::downloadLink_data()
/* fileAction */ << FileIsDownloaded;
}
-void tst_QWebEngineDownloadItem::downloadLink()
+void tst_QWebEngineDownloadRequest::downloadLink()
{
QFETCH(UserAction, userAction);
QFETCH(bool, anchorHasDownloadAttribute);
@@ -456,31 +438,29 @@ void tst_QWebEngineDownloadItem::downloadLink()
QUrl downloadUrl = m_server->url(slashFileName);
int acceptedCount = 0;
int finishedCount = 0;
- ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadItem *item) {
- QCOMPARE(item->state(), QWebEngineDownloadItem::DownloadRequested);
+ ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadRequest *item) {
+ QCOMPARE(item->state(), QWebEngineDownloadRequest::DownloadRequested);
QCOMPARE(item->isFinished(), false);
QCOMPARE(item->totalBytes(), -1);
QCOMPARE(item->receivedBytes(), 0);
- QCOMPARE(item->interruptReason(), QWebEngineDownloadItem::NoReason);
- QCOMPARE(item->type(), expectedDownloadType(userAction, fileDisposition));
+ QCOMPARE(item->interruptReason(), QWebEngineDownloadRequest::NoReason);
QCOMPARE(item->isSavePageDownload(), false);
QCOMPARE(item->mimeType(), QString(fileMimeTypeDetected));
QCOMPARE(QDir(item->downloadDirectory()).filePath(item->downloadFileName()), suggestedPath);
- QCOMPARE(item->savePageFormat(), QWebEngineDownloadItem::UnknownSaveFormat);
+ QCOMPARE(item->savePageFormat(), QWebEngineDownloadRequest::UnknownSaveFormat);
QCOMPARE(item->url(), downloadUrl);
QCOMPARE(item->page(), m_page);
- connect(item, &QWebEngineDownloadItem::finished, [&, item]() {
- QCOMPARE(item->state(), QWebEngineDownloadItem::DownloadCompleted);
+ connect(item, &QWebEngineDownloadRequest::isFinishedChanged, [&, item]() {
+ QCOMPARE(item->state(), QWebEngineDownloadRequest::DownloadCompleted);
QCOMPARE(item->isFinished(), true);
QCOMPARE(item->totalBytes(), fileContents.size());
QCOMPARE(item->receivedBytes(), fileContents.size());
- QCOMPARE(item->interruptReason(), QWebEngineDownloadItem::NoReason);
- QCOMPARE(item->type(), expectedDownloadType(userAction, fileDisposition));
+ QCOMPARE(item->interruptReason(), QWebEngineDownloadRequest::NoReason);
QCOMPARE(item->isSavePageDownload(), false);
QCOMPARE(item->mimeType(), QString(fileMimeTypeDetected));
QCOMPARE(QDir(item->downloadDirectory()).filePath(item->downloadFileName()), downloadPath);
- QCOMPARE(item->savePageFormat(), QWebEngineDownloadItem::UnknownSaveFormat);
+ QCOMPARE(item->savePageFormat(), QWebEngineDownloadRequest::UnknownSaveFormat);
QCOMPARE(item->url(), downloadUrl);
QCOMPARE(item->page(), m_page);
@@ -526,7 +506,7 @@ void tst_QWebEngineDownloadItem::downloadLink()
QCOMPARE(file.readAll(), fileContents);
}
-void tst_QWebEngineDownloadItem::downloadTwoLinks_data()
+void tst_QWebEngineDownloadRequest::downloadTwoLinks_data()
{
QTest::addColumn<UserAction>("action1");
QTest::addColumn<UserAction>("action2");
@@ -536,7 +516,7 @@ void tst_QWebEngineDownloadItem::downloadTwoLinks_data()
QTest::newRow("Click+Click") << ClickLink << ClickLink;
}
-void tst_QWebEngineDownloadItem::downloadTwoLinks()
+void tst_QWebEngineDownloadRequest::downloadTwoLinks()
{
QFETCH(UserAction, action1);
QFETCH(UserAction, action2);
@@ -569,29 +549,23 @@ void tst_QWebEngineDownloadItem::downloadTwoLinks()
QString standardDir = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
int acceptedCount = 0;
int finishedCount = 0;
- ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadItem *item) {
- QCOMPARE(item->state(), QWebEngineDownloadItem::DownloadRequested);
+ ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadRequest *item) {
+ QCOMPARE(item->state(), QWebEngineDownloadRequest::DownloadRequested);
QCOMPARE(item->isFinished(), false);
QCOMPARE(item->totalBytes(), -1);
QCOMPARE(item->receivedBytes(), 0);
- QCOMPARE(item->interruptReason(), QWebEngineDownloadItem::NoReason);
- QCOMPARE(item->savePageFormat(), QWebEngineDownloadItem::UnknownSaveFormat);
+ QCOMPARE(item->interruptReason(), QWebEngineDownloadRequest::NoReason);
+ QCOMPARE(item->savePageFormat(), QWebEngineDownloadRequest::UnknownSaveFormat);
QCOMPARE(item->mimeType(), QStringLiteral("text/plain"));
QString filePart = QChar('/') + item->url().fileName();
QString fileName = item->url().fileName();
QCOMPARE(QDir(item->downloadDirectory()).filePath(item->downloadFileName()), standardDir + filePart);
// type() is broken due to race condition in DownloadManagerDelegateQt
- if (action1 == ClickLink && action2 == ClickLink) {
- if (filePart == QStringLiteral("/file1"))
- QCOMPARE(item->type(), expectedDownloadType(action1));
- else if (filePart == QStringLiteral("/file2"))
- QCOMPARE(item->type(), expectedDownloadType(action2, QByteArrayLiteral("attachment")));
- else
+ if (action1 == ClickLink && action2 == ClickLink && filePart != QStringLiteral("/file1") && filePart != QStringLiteral("/file2"))
QFAIL(qPrintable("Unexpected file name: " + filePart));
- }
- connect(item, &QWebEngineDownloadItem::finished, [&]() {
+ connect(item, &QWebEngineDownloadRequest::isFinishedChanged, [&]() {
finishedCount++;
});
item->setDownloadDirectory(tmpDir.path());
@@ -617,20 +591,20 @@ void tst_QWebEngineDownloadItem::downloadTwoLinks()
QTRY_COMPARE(finishedCount, 2);
}
-void tst_QWebEngineDownloadItem::downloadPage_data()
+void tst_QWebEngineDownloadRequest::downloadPage_data()
{
QTest::addColumn<bool>("saveWithPageAction");
- QTest::addColumn<QWebEngineDownloadItem::SavePageFormat>("savePageFormat");
- QTest::newRow("SingleHtmlSaveFormat") << false << QWebEngineDownloadItem::SingleHtmlSaveFormat;
- QTest::newRow("CompleteHtmlSaveFormat") << false << QWebEngineDownloadItem::CompleteHtmlSaveFormat;
- QTest::newRow("MimeHtmlSaveFormat") << false << QWebEngineDownloadItem::MimeHtmlSaveFormat;
- QTest::newRow("SavePageAction") << true << QWebEngineDownloadItem::MimeHtmlSaveFormat;
+ QTest::addColumn<QWebEngineDownloadRequest::SavePageFormat>("savePageFormat");
+ QTest::newRow("SingleHtmlSaveFormat") << false << QWebEngineDownloadRequest::SingleHtmlSaveFormat;
+ QTest::newRow("CompleteHtmlSaveFormat") << false << QWebEngineDownloadRequest::CompleteHtmlSaveFormat;
+ QTest::newRow("MimeHtmlSaveFormat") << false << QWebEngineDownloadRequest::MimeHtmlSaveFormat;
+ QTest::newRow("SavePageAction") << true << QWebEngineDownloadRequest::MimeHtmlSaveFormat;
}
-void tst_QWebEngineDownloadItem::downloadPage()
+void tst_QWebEngineDownloadRequest::downloadPage()
{
QFETCH(bool, saveWithPageAction);
- QFETCH(QWebEngineDownloadItem::SavePageFormat, savePageFormat);
+ QFETCH(QWebEngineDownloadRequest::SavePageFormat, savePageFormat);
// Set up HTTP server
int indexRequestCount = 0;
@@ -650,13 +624,12 @@ void tst_QWebEngineDownloadItem::downloadPage()
QUrl downloadUrl = m_server->url("/");
int acceptedCount = 0;
int finishedCount = 0;
- ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadItem *item) {
- QCOMPARE(item->state(), saveWithPageAction ? QWebEngineDownloadItem::DownloadRequested : QWebEngineDownloadItem::DownloadInProgress);
+ ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadRequest *item) {
+ QCOMPARE(item->state(), saveWithPageAction ? QWebEngineDownloadRequest::DownloadRequested : QWebEngineDownloadRequest::DownloadInProgress);
QCOMPARE(item->isFinished(), false);
QCOMPARE(item->totalBytes(), -1);
QCOMPARE(item->receivedBytes(), 0);
- QCOMPARE(item->interruptReason(), QWebEngineDownloadItem::NoReason);
- QCOMPARE(item->type(), QWebEngineDownloadItem::SavePage);
+ QCOMPARE(item->interruptReason(), QWebEngineDownloadRequest::NoReason);
QCOMPARE(item->isSavePageDownload(), true);
// FIXME(juvaldma): why is mimeType always the same?
QCOMPARE(item->mimeType(), QStringLiteral("application/x-mimearchive"));
@@ -674,13 +647,12 @@ void tst_QWebEngineDownloadItem::downloadPage()
QCOMPARE(QDir(item->downloadDirectory()).filePath(item->downloadFileName()), downloadPath);
- connect(item, &QWebEngineDownloadItem::finished, [&, item]() {
- QCOMPARE(item->state(), QWebEngineDownloadItem::DownloadCompleted);
+ connect(item, &QWebEngineDownloadRequest::isFinishedChanged, [&, item]() {
+ QCOMPARE(item->state(), QWebEngineDownloadRequest::DownloadCompleted);
QCOMPARE(item->isFinished(), true);
QCOMPARE(item->totalBytes(), item->receivedBytes());
QVERIFY(item->receivedBytes() > 0);
- QCOMPARE(item->interruptReason(), QWebEngineDownloadItem::NoReason);
- QCOMPARE(item->type(), QWebEngineDownloadItem::SavePage);
+ QCOMPARE(item->interruptReason(), QWebEngineDownloadRequest::NoReason);
QCOMPARE(item->isSavePageDownload(), true);
QCOMPARE(item->mimeType(), QStringLiteral("application/x-mimearchive"));
QCOMPARE(QDir(item->downloadDirectory()).filePath(item->downloadFileName()), downloadPath);
@@ -713,7 +685,7 @@ void tst_QWebEngineDownloadItem::downloadPage()
QVERIFY(file.exists());
}
-void tst_QWebEngineDownloadItem::downloadViaSetUrl()
+void tst_QWebEngineDownloadRequest::downloadViaSetUrl()
{
// Reproduce the scenario described in QTBUG-63388 by triggering downloads
// of the same file multiple times via QWebEnginePage::setUrl
@@ -732,8 +704,8 @@ void tst_QWebEngineDownloadItem::downloadViaSetUrl()
});
// Set up profile and download handler
- QVector<QUrl> downloadUrls;
- ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadItem *item) {
+ QList<QUrl> downloadUrls;
+ ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadRequest *item) {
downloadUrls.append(item->url());
});
@@ -764,7 +736,7 @@ void tst_QWebEngineDownloadItem::downloadViaSetUrl()
}
}
-void tst_QWebEngineDownloadItem::downloadFileNot1()
+void tst_QWebEngineDownloadRequest::downloadFileNot1()
{
// Trigger file download via download() but don't accept().
@@ -772,11 +744,11 @@ void tst_QWebEngineDownloadItem::downloadFileNot1()
rr->sendResponse(404);
});
- QPointer<QWebEngineDownloadItem> downloadItem;
+ QPointer<QWebEngineDownloadRequest> downloadItem;
int downloadCount = 0;
- ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadItem *item) {
+ ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadRequest *item) {
QVERIFY(item);
- QCOMPARE(item->state(), QWebEngineDownloadItem::DownloadRequested);
+ QCOMPARE(item->state(), QWebEngineDownloadRequest::DownloadRequested);
downloadItem = item;
downloadCount++;
});
@@ -786,7 +758,7 @@ void tst_QWebEngineDownloadItem::downloadFileNot1()
QVERIFY(!downloadItem);
}
-void tst_QWebEngineDownloadItem::downloadFileNot2()
+void tst_QWebEngineDownloadRequest::downloadFileNot2()
{
// Trigger file download via download() but call cancel() instead of accept().
@@ -794,11 +766,11 @@ void tst_QWebEngineDownloadItem::downloadFileNot2()
rr->sendResponse(404);
});
- QPointer<QWebEngineDownloadItem> downloadItem;
+ QPointer<QWebEngineDownloadRequest> downloadItem;
int downloadCount = 0;
- ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadItem *item) {
+ ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadRequest *item) {
QVERIFY(item);
- QCOMPARE(item->state(), QWebEngineDownloadItem::DownloadRequested);
+ QCOMPARE(item->state(), QWebEngineDownloadRequest::DownloadRequested);
item->cancel();
downloadItem = item;
downloadCount++;
@@ -807,19 +779,19 @@ void tst_QWebEngineDownloadItem::downloadFileNot2()
m_page->download(m_server->url(QByteArrayLiteral("/file")));
QTRY_COMPARE(downloadCount, 1);
QVERIFY(downloadItem);
- QCOMPARE(downloadItem->state(), QWebEngineDownloadItem::DownloadCancelled);
+ QCOMPARE(downloadItem->state(), QWebEngineDownloadRequest::DownloadCancelled);
}
-void tst_QWebEngineDownloadItem::downloadDeleted()
+void tst_QWebEngineDownloadRequest::downloadDeleted()
{
- QPointer<QWebEngineDownloadItem> downloadItem;
+ QPointer<QWebEngineDownloadRequest> downloadItem;
int downloadCount = 0, finishedCount = 0;
- ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadItem *item) {
+ ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadRequest *item) {
QVERIFY(item);
- QCOMPARE(item->state(), QWebEngineDownloadItem::DownloadRequested);
+ QCOMPARE(item->state(), QWebEngineDownloadRequest::DownloadRequested);
downloadItem = item;
- connect(downloadItem, &QWebEngineDownloadItem::finished, [&]() { ++finishedCount; });
+ connect(downloadItem, &QWebEngineDownloadRequest::isFinishedChanged, [&]() { ++finishedCount; });
++downloadCount;
// accept and schedule deletion, and check if it still finishes
item->accept();
@@ -835,16 +807,16 @@ void tst_QWebEngineDownloadItem::downloadDeleted()
QCOMPARE(finishedCount, 1);
}
-void tst_QWebEngineDownloadItem::downloadDeletedByProfile()
+void tst_QWebEngineDownloadRequest::downloadDeletedByProfile()
{
QPointer<QWebEngineProfile> profile(new QWebEngineProfile);
profile->setHttpCacheType(QWebEngineProfile::NoCache);
profile->settings()->setAttribute(QWebEngineSettings::AutoLoadIconsForPage, false);
bool downloadFinished = false;
- QPointer<QWebEngineDownloadItem> downloadItem;
- connect(profile, &QWebEngineProfile::downloadRequested, [&] (QWebEngineDownloadItem *item) {
- connect(item, &QWebEngineDownloadItem::finished, [&] () {
+ QPointer<QWebEngineDownloadRequest> downloadItem;
+ connect(profile, &QWebEngineProfile::downloadRequested, [&] (QWebEngineDownloadRequest *item) {
+ connect(item, &QWebEngineDownloadRequest::isFinishedChanged, [&] () {
downloadFinished = true;
});
downloadItem = item;
@@ -864,7 +836,7 @@ void tst_QWebEngineDownloadItem::downloadDeletedByProfile()
QTRY_COMPARE(downloadItem.isNull(), true);
}
-void tst_QWebEngineDownloadItem::downloadUniqueFilename_data()
+void tst_QWebEngineDownloadRequest::downloadUniqueFilename_data()
{
QTest::addColumn<QString>("baseName");
QTest::addColumn<QString>("extension");
@@ -873,7 +845,7 @@ void tst_QWebEngineDownloadItem::downloadUniqueFilename_data()
QTest::newRow("tar.gz") << QString("test(1.test)") << QString("tar.gz");
}
-void tst_QWebEngineDownloadItem::downloadUniqueFilename()
+void tst_QWebEngineDownloadRequest::downloadUniqueFilename()
{
QFETCH(QString, baseName);
QFETCH(QString, extension);
@@ -888,7 +860,8 @@ void tst_QWebEngineDownloadItem::downloadUniqueFilename()
// Set up HTTP server
ScopedConnection sc1 = connect(m_server, &HttpServer::newRequest, [&](HttpReqRep *rr) {
- if (rr->requestMethod() == "GET" && rr->requestPath() == ("/" + fileName)) {
+ auto requestPath = QString::fromUtf8(rr->requestPath());
+ if (rr->requestMethod() == "GET" && requestPath == ("/" + fileName)) {
rr->setResponseHeader(QByteArrayLiteral("content-type"), QByteArrayLiteral("application/octet-stream"));
rr->setResponseHeader(QByteArrayLiteral("content-disposition"), QByteArrayLiteral("attachment"));
rr->setResponseBody(QByteArrayLiteral("a"));
@@ -899,16 +872,15 @@ void tst_QWebEngineDownloadItem::downloadUniqueFilename()
});
// Set up profile and download handler
- ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadItem *item) {
+ ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadRequest *item) {
suggestedFileName = item->suggestedFileName();
item->accept();
- connect(item, &QWebEngineDownloadItem::finished, [&, item]() {
- QCOMPARE(item->state(), QWebEngineDownloadItem::DownloadCompleted);
+ connect(item, &QWebEngineDownloadRequest::isFinishedChanged, [&, item]() {
+ QCOMPARE(item->state(), QWebEngineDownloadRequest::DownloadCompleted);
QCOMPARE(item->isFinished(), true);
QCOMPARE(item->totalBytes(), item->receivedBytes());
QVERIFY(item->receivedBytes() > 0);
- QCOMPARE(item->interruptReason(), QWebEngineDownloadItem::NoReason);
- QCOMPARE(item->type(), QWebEngineDownloadItem::Attachment);
+ QCOMPARE(item->interruptReason(), QWebEngineDownloadRequest::NoReason);
QCOMPARE(item->isSavePageDownload(), false);
downloadedFilePath = QDir(item->downloadDirectory()).filePath(item->downloadFileName());
downloadFinished = true;
@@ -930,7 +902,7 @@ void tst_QWebEngineDownloadItem::downloadUniqueFilename()
}
}
-void tst_QWebEngineDownloadItem::downloadUniqueFilenameWithTimestamp()
+void tst_QWebEngineDownloadRequest::downloadUniqueFilenameWithTimestamp()
{
// Set up HTTP server
QString baseName("test(1.test)");
@@ -945,7 +917,8 @@ void tst_QWebEngineDownloadItem::downloadUniqueFilenameWithTimestamp()
m_profile->setDownloadPath(tmpDir.path());
ScopedConnection sc1 = connect(m_server, &HttpServer::newRequest, [&](HttpReqRep *rr) {
- if (rr->requestMethod() == "GET" && rr->requestPath() == ("/" + fileName)) {
+ auto requestPath = QString::fromUtf8(rr->requestPath());
+ if (rr->requestMethod() == "GET" && requestPath == ("/" + fileName)) {
rr->setResponseHeader(QByteArrayLiteral("content-type"), QByteArrayLiteral("application/octet-stream"));
rr->setResponseHeader(QByteArrayLiteral("content-disposition"), QByteArrayLiteral("attachment"));
rr->setResponseBody(QByteArrayLiteral("a"));
@@ -956,15 +929,15 @@ void tst_QWebEngineDownloadItem::downloadUniqueFilenameWithTimestamp()
});
// Set up profile and download handler
- ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadItem *item) {
+ ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadRequest *item) {
suggestedFileName = item->suggestedFileName();
item->accept();
- connect(item, &QWebEngineDownloadItem::finished, [&, item]() {
- QCOMPARE(item->state(), QWebEngineDownloadItem::DownloadCompleted);
+ connect(item, &QWebEngineDownloadRequest::isFinishedChanged, [&, item]() {
+ QCOMPARE(item->state(), QWebEngineDownloadRequest::DownloadCompleted);
QCOMPARE(item->isFinished(), true);
QCOMPARE(item->totalBytes(), item->receivedBytes());
QVERIFY(item->receivedBytes() > 0);
- QCOMPARE(item->interruptReason(), QWebEngineDownloadItem::NoReason);
+ QCOMPARE(item->interruptReason(), QWebEngineDownloadRequest::NoReason);
QCOMPARE(item->page(), m_page);
downloadFinished = true;
downloadedFilePath = QDir(item->downloadDirectory()).filePath(item->downloadFileName());
@@ -1008,7 +981,7 @@ void tst_QWebEngineDownloadItem::downloadUniqueFilenameWithTimestamp()
}
}
-void tst_QWebEngineDownloadItem::downloadToDefaultLocation()
+void tst_QWebEngineDownloadRequest::downloadToDefaultLocation()
{
QTemporaryDir tmpDir;
QVERIFY(tmpDir.isValid());
@@ -1025,7 +998,7 @@ void tst_QWebEngineDownloadItem::downloadToDefaultLocation()
QCOMPARE(m_profile->downloadPath(), QStandardPaths::writableLocation(QStandardPaths::DownloadLocation));
}
-void tst_QWebEngineDownloadItem::downloadToNonExistentDir()
+void tst_QWebEngineDownloadRequest::downloadToNonExistentDir()
{
QString baseName("test(1.test)");
QString extension("txt");
@@ -1040,7 +1013,8 @@ void tst_QWebEngineDownloadItem::downloadToNonExistentDir()
// Set up HTTP server
ScopedConnection sc1 = connect(m_server, &HttpServer::newRequest, [&](HttpReqRep *rr) {
- if (rr->requestMethod() == "GET" && rr->requestPath() == ("/" + fileName)) {
+ auto requestPath = QString::fromUtf8(rr->requestPath());
+ if (rr->requestMethod() == "GET" && requestPath == ("/" + fileName)) {
rr->setResponseHeader(QByteArrayLiteral("content-type"), QByteArrayLiteral("application/octet-stream"));
rr->setResponseHeader(QByteArrayLiteral("content-disposition"), QByteArrayLiteral("attachment"));
rr->setResponseBody(QByteArrayLiteral("a"));
@@ -1051,15 +1025,15 @@ void tst_QWebEngineDownloadItem::downloadToNonExistentDir()
});
// Set up profile and download handler
- ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadItem *item) {
+ ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadRequest *item) {
suggestedFileName = item->suggestedFileName();
item->accept();
- connect(item, &QWebEngineDownloadItem::finished, [&, item]() {
- QCOMPARE(item->state(), QWebEngineDownloadItem::DownloadCompleted);
+ connect(item, &QWebEngineDownloadRequest::isFinishedChanged, [&, item]() {
+ QCOMPARE(item->state(), QWebEngineDownloadRequest::DownloadCompleted);
QCOMPARE(item->isFinished(), true);
QCOMPARE(item->totalBytes(), item->receivedBytes());
QVERIFY(item->receivedBytes() > 0);
- QCOMPARE(item->interruptReason(), QWebEngineDownloadItem::NoReason);
+ QCOMPARE(item->interruptReason(), QWebEngineDownloadRequest::NoReason);
QCOMPARE(item->page(), m_page);
downloadFinished = true;
downloadedFilePath = QDir(item->downloadDirectory()).filePath(item->downloadFileName());
@@ -1077,7 +1051,7 @@ void tst_QWebEngineDownloadItem::downloadToNonExistentDir()
QCOMPARE(suggestedFileName, fileName);
}
-void tst_QWebEngineDownloadItem::downloadToReadOnlyDir()
+void tst_QWebEngineDownloadRequest::downloadToReadOnlyDir()
{
#ifdef Q_OS_WIN
QSKIP("Cannot change file permissions on Windows.");
@@ -1096,7 +1070,8 @@ void tst_QWebEngineDownloadItem::downloadToReadOnlyDir()
// Set up HTTP server
ScopedConnection sc1 = connect(m_server, &HttpServer::newRequest, [&](HttpReqRep *rr) {
- if (rr->requestMethod() == "GET" && rr->requestPath() == ("/" + fileName)) {
+ auto requestPath = QString::fromUtf8(rr->requestPath());
+ if (rr->requestMethod() == "GET" && requestPath == ("/" + fileName)) {
rr->setResponseHeader(QByteArrayLiteral("content-type"), QByteArrayLiteral("application/octet-stream"));
rr->setResponseHeader(QByteArrayLiteral("content-disposition"), QByteArrayLiteral("attachment"));
rr->setResponseBody(QByteArrayLiteral("a"));
@@ -1106,12 +1081,12 @@ void tst_QWebEngineDownloadItem::downloadToReadOnlyDir()
}
});
- QPointer<QWebEngineDownloadItem> downloadItem;
- ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadItem *item) {
+ QPointer<QWebEngineDownloadRequest> downloadItem;
+ ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadRequest *item) {
suggestedFileName = item->suggestedFileName();
downloadItem = item;
item->accept();
- connect(item, &QWebEngineDownloadItem::finished, [&]() {
+ connect(item, &QWebEngineDownloadRequest::isFinishedChanged, [&]() {
downloadFinished = true;
});
downloadAccepted = true;
@@ -1125,9 +1100,9 @@ void tst_QWebEngineDownloadItem::downloadToReadOnlyDir()
QTRY_VERIFY(downloadAccepted);
QVERIFY(downloadItem);
- QTRY_COMPARE(downloadItem->state(), QWebEngineDownloadItem::DownloadInterrupted);
+ QTRY_COMPARE(downloadItem->state(), QWebEngineDownloadRequest::DownloadInterrupted);
QCOMPARE(downloadItem->isFinished(), false);
- QCOMPARE(downloadItem->interruptReason(), QWebEngineDownloadItem::FileAccessDenied);
+ QCOMPARE(downloadItem->interruptReason(), QWebEngineDownloadRequest::FileAccessDenied);
QVERIFY(!QFile(downloadedFilePath).exists());
QCOMPARE(suggestedFileName, fileName);
@@ -1137,125 +1112,7 @@ void tst_QWebEngineDownloadItem::downloadToReadOnlyDir()
QFile(m_profile->downloadPath()).setPermissions(QFileDevice::WriteOwner);
}
-#if QT_DEPRECATED_SINCE(5, 14)
-void tst_QWebEngineDownloadItem::downloadPathValidation()
-{
- const QString fileName = "test.txt";
- QString downloadPath;
- QString originalDownloadPath;
-
- QTemporaryDir tmpDir;
- QVERIFY(tmpDir.isValid());
- m_profile->setDownloadPath(tmpDir.path());
-
- // Set up HTTP server
- ScopedConnection sc1 = connect(m_server, &HttpServer::newRequest, [&](HttpReqRep *rr) {
- if (rr->requestMethod() == "GET" && rr->requestPath() == ("/" + fileName)) {
- rr->setResponseHeader(QByteArrayLiteral("content-type"), QByteArrayLiteral("application/octet-stream"));
- rr->setResponseHeader(QByteArrayLiteral("content-disposition"), QByteArrayLiteral("attachment"));
- rr->setResponseBody(QByteArrayLiteral("a"));
- rr->sendResponse();
- } else {
- rr->sendResponse(404);
- }
- });
-
- // Set up profile and download handler
- QPointer<QWebEngineDownloadItem> downloadItem;
- ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadItem *item) {
- downloadItem = item;
- originalDownloadPath = item->path();
-
- item->setPath(downloadPath);
- item->accept();
-
- connect(item, &QWebEngineDownloadItem::stateChanged, [&, item](QWebEngineDownloadItem::DownloadState downloadState) {
- if (downloadState == QWebEngineDownloadItem::DownloadInterrupted) {
- item->cancel();
- }
- });
-
- connect(item, &QWebEngineDownloadItem::finished, [&, item]() {
- QCOMPARE(item->isFinished(), true);
- QCOMPARE(item->totalBytes(), item->receivedBytes());
- QVERIFY(item->receivedBytes() > 0);
- QCOMPARE(item->page(), m_page);
- });
- });
-
- QString oldPath = QDir::currentPath();
- QDir::setCurrent(tmpDir.path());
-
- // Set only the file name.
- downloadItem.clear();
- originalDownloadPath = "";
- downloadPath = fileName;
- m_page->setUrl(m_server->url("/" + fileName));
- QTRY_VERIFY(downloadItem);
- QTRY_COMPARE(downloadItem->state(), QWebEngineDownloadItem::DownloadCompleted);
- QCOMPARE(downloadItem->interruptReason(), QWebEngineDownloadItem::NoReason);
- QCOMPARE(downloadItem->path(), fileName);
-
- // Set only the directory path.
- downloadItem.clear();
- originalDownloadPath = "";
- downloadPath = tmpDir.path();
- m_page->setUrl(m_server->url("/" + fileName));
- QTRY_VERIFY(downloadItem);
- QTRY_COMPARE(downloadItem->state(), QWebEngineDownloadItem::DownloadCompleted);
- QCOMPARE(downloadItem->interruptReason(), QWebEngineDownloadItem::NoReason);
- QCOMPARE(downloadItem->path(), originalDownloadPath);
-
- // Set only the directory path with separator.
- downloadItem.clear();
- originalDownloadPath = "";
- downloadPath = tmpDir.path() + QDir::separator();
- m_page->setUrl(m_server->url("/" + fileName));
- QTRY_VERIFY(downloadItem);
- QTRY_COMPARE(downloadItem->state(), QWebEngineDownloadItem::DownloadCompleted);
- QCOMPARE(downloadItem->interruptReason(), QWebEngineDownloadItem::NoReason);
- QCOMPARE(downloadItem->path(), originalDownloadPath);
-
- // Set only the directory with the current directory path without ending separator.
- downloadItem.clear();
- originalDownloadPath = "";
- downloadPath = ".";
- m_page->setUrl(m_server->url("/" + fileName));
- QTRY_VERIFY(downloadItem);
- QTRY_COMPARE(downloadItem->state(), QWebEngineDownloadItem::DownloadCompleted);
- QCOMPARE(downloadItem->interruptReason(), QWebEngineDownloadItem::NoReason);
- QCOMPARE(downloadItem->path(), originalDownloadPath);
-
- // Set only the directory with the current directory path with ending separator.
- downloadItem.clear();
- originalDownloadPath = "";
- downloadPath = "./";
- m_page->setUrl(m_server->url("/" + fileName));
- QTRY_VERIFY(downloadItem);
- QTRY_COMPARE(downloadItem->state(), QWebEngineDownloadItem::DownloadCompleted);
- QCOMPARE(downloadItem->interruptReason(), QWebEngineDownloadItem::NoReason);
- QCOMPARE(downloadItem->path(), originalDownloadPath);
-
- downloadItem.clear();
- originalDownloadPath = "";
- downloadPath = "...";
- m_page->setUrl(m_server->url("/" + fileName));
- QTRY_VERIFY(downloadItem);
-#if !defined(Q_OS_WIN)
- QTRY_COMPARE(downloadItem->state(), QWebEngineDownloadItem::DownloadCancelled);
- QCOMPARE(downloadItem->interruptReason(), QWebEngineDownloadItem::FileFailed);
- QCOMPARE(downloadItem->path(), downloadPath);
-#else
- // Windows interprets the "..." path as a valid path. It will be the current path.
- QTRY_COMPARE(downloadItem->state(), QWebEngineDownloadItem::DownloadCompleted);
- QCOMPARE(downloadItem->interruptReason(), QWebEngineDownloadItem::NoReason);
- QCOMPARE(downloadItem->path(), originalDownloadPath);
-#endif // !defined(Q_OS_WIN)
- QDir::setCurrent(oldPath);
-}
-#endif
-
-void tst_QWebEngineDownloadItem::downloadToDirectoryWithFileName_data()
+void tst_QWebEngineDownloadRequest::downloadToDirectoryWithFileName_data()
{
QTest::addColumn<bool>("setDirectoryFirst");
@@ -1263,7 +1120,7 @@ void tst_QWebEngineDownloadItem::downloadToDirectoryWithFileName_data()
QTest::newRow("setFileNameFirst") << false;
}
-void tst_QWebEngineDownloadItem::downloadToDirectoryWithFileName()
+void tst_QWebEngineDownloadRequest::downloadToDirectoryWithFileName()
{
QFETCH(bool, setDirectoryFirst);
QString downloadDirectory;
@@ -1281,7 +1138,8 @@ void tst_QWebEngineDownloadItem::downloadToDirectoryWithFileName()
// Set up HTTP server
ScopedConnection sc1 = connect(m_server, &HttpServer::newRequest, [&](HttpReqRep *rr) {
- if (rr->requestMethod() == "GET" && rr->requestPath() == ("/" + fileName)) {
+ auto requestPath = QString::fromUtf8(rr->requestPath());
+ if (rr->requestMethod() == "GET" && requestPath == ("/" + fileName)) {
rr->setResponseHeader(QByteArrayLiteral("content-type"), QByteArrayLiteral("application/octet-stream"));
rr->setResponseHeader(QByteArrayLiteral("content-disposition"), QByteArrayLiteral("attachment"));
rr->setResponseBody(QByteArrayLiteral("a"));
@@ -1292,7 +1150,7 @@ void tst_QWebEngineDownloadItem::downloadToDirectoryWithFileName()
});
// Set up profile and download handler
- ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadItem *item) {
+ ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadRequest *item) {
if (!downloadDirectory.isEmpty() && setDirectoryFirst) {
item->setDownloadDirectory(downloadDirectory);
@@ -1309,15 +1167,14 @@ void tst_QWebEngineDownloadItem::downloadToDirectoryWithFileName()
QCOMPARE(item->downloadDirectory(), downloadDirectory);
}
- QCOMPARE(item->path(), QDir(item->downloadDirectory()).filePath(item->downloadFileName()));
item->accept();
- connect(item, &QWebEngineDownloadItem::finished, [&, item]() {
- QCOMPARE(item->state(), QWebEngineDownloadItem::DownloadCompleted);
+ connect(item, &QWebEngineDownloadRequest::isFinishedChanged, [&, item]() {
+ QCOMPARE(item->state(), QWebEngineDownloadRequest::DownloadCompleted);
QCOMPARE(item->isFinished(), true);
QCOMPARE(item->totalBytes(), item->receivedBytes());
QVERIFY(item->receivedBytes() > 0);
- QCOMPARE(item->interruptReason(), QWebEngineDownloadItem::NoReason);
+ QCOMPARE(item->interruptReason(), QWebEngineDownloadRequest::NoReason);
QCOMPARE(item->page(), m_page);
downloadFinished = true;
downloadedFilePath = QDir(item->downloadDirectory()).filePath(item->downloadFileName());
@@ -1355,7 +1212,7 @@ void tst_QWebEngineDownloadItem::downloadToDirectoryWithFileName()
QCOMPARE(downloadedSuggestedFileName, fileName);
// Download another file to the same directory and set file name by
- // QWebEngineDownloadItem::setDownloadDirectory() and setDownloadFileName() to avoid uniquification.
+ // QWebEngineDownloadRequest::setDownloadDirectory() and setDownloadFileName() to avoid uniquification.
downloadFinished = false;
downloadDirectory = m_profile->downloadPath() + QDir::separator() + "test1" + QDir::separator();
downloadFileName = "test1.txt";
@@ -1376,7 +1233,7 @@ void tst_QWebEngineDownloadItem::downloadToDirectoryWithFileName()
QCOMPARE(downloadedSuggestedFileName, fileName);
// Download the same file to same directory and set file name by
- // QWebEngineDownloadItem::setDownloadDirectory() and setDownloadFileName() to avoid uniquification.
+ // QWebEngineDownloadRequest::setDownloadDirectory() and setDownloadFileName() to avoid uniquification.
downloadFinished = false;
downloadDirectory = m_profile->downloadPath() + QDir::separator() + "test2" + QDir::separator();
downloadFileName = "test1.txt";
@@ -1398,5 +1255,5 @@ void tst_QWebEngineDownloadItem::downloadToDirectoryWithFileName()
QCOMPARE(downloadedSuggestedFileName, fileName);
}
-QTEST_MAIN(tst_QWebEngineDownloadItem)
-#include "tst_qwebenginedownloaditem.moc"
+QTEST_MAIN(tst_QWebEngineDownloadRequest)
+#include "tst_qwebenginedownloadrequest.moc"
diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
index 040114258..531477b65 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
@@ -31,7 +31,6 @@
#include <QMenu>
#include <QMimeDatabase>
#include <QNetworkProxy>
-#include <QOpenGLWidget>
#include <QPaintEngine>
#include <QPushButton>
#include <QScreen>
@@ -46,7 +45,7 @@
#include <qnetworkcookiejar.h>
#include <qnetworkreply.h>
#include <qnetworkrequest.h>
-#include <qwebenginedownloaditem.h>
+#include <qwebenginedownloadrequest.h>
#include <qwebenginefindtextresult.h>
#include <qwebenginefullscreenrequest.h>
#include <qwebenginehistory.h>
@@ -1068,11 +1067,11 @@ void tst_QWebEnginePage::findText()
void tst_QWebEnginePage::findTextResult()
{
QSignalSpy findTextSpy(m_view->page(), &QWebEnginePage::findTextFinished);
- auto signalResult = [&findTextSpy]() -> QVector<int> {
+ auto signalResult = [&findTextSpy]() -> QList<int> {
if (findTextSpy.count() != 1)
- return QVector<int>({-1, -1});
+ return QList<int>({-1, -1});
auto r = findTextSpy.takeFirst().value(0).value<QWebEngineFindTextResult>();
- return QVector<int>({ r.numberOfMatches(), r.activeMatch() });
+ return QList<int>({ r.numberOfMatches(), r.activeMatch() });
};
// findText will abort in blink if the view has an empty size.
@@ -1084,21 +1083,21 @@ void tst_QWebEnginePage::findTextResult()
QTRY_COMPARE(loadSpy.count(), 1);
QCOMPARE(findTextSync(m_page, ""), false);
- QCOMPARE(signalResult(), QVector<int>({0, 0}));
+ QCOMPARE(signalResult(), QList<int>({0, 0}));
const QStringList words = { "foo", "bar" };
for (const QString &subString : words) {
QCOMPARE(findTextSync(m_page, subString), true);
- QCOMPARE(signalResult(), QVector<int>({1, 1}));
+ QCOMPARE(signalResult(), QList<int>({1, 1}));
QCOMPARE(findTextSync(m_page, ""), false);
- QCOMPARE(signalResult(), QVector<int>({0, 0}));
+ QCOMPARE(signalResult(), QList<int>({0, 0}));
}
QCOMPARE(findTextSync(m_page, "blahhh"), false);
- QCOMPARE(signalResult(), QVector<int>({0, 0}));
+ QCOMPARE(signalResult(), QList<int>({0, 0}));
QCOMPARE(findTextSync(m_page, ""), false);
- QCOMPARE(signalResult(), QVector<int>({0, 0}));
+ QCOMPARE(signalResult(), QList<int>({0, 0}));
}
void tst_QWebEnginePage::findTextSuccessiveShouldCallAllCallbacks()
@@ -1680,9 +1679,9 @@ void tst_QWebEnginePage::savePage()
QWebEnginePage *page = view.page();
connect(page->profile(), &QWebEngineProfile::downloadRequested,
- [] (QWebEngineDownloadItem *item)
+ [] (QWebEngineDownloadRequest *item)
{
- connect(item, &QWebEngineDownloadItem::finished,
+ connect(item, &QWebEngineDownloadRequest::isFinishedChanged,
&QTestEventLoop::instance(), &QTestEventLoop::exitLoop, Qt::QueuedConnection);
});
@@ -1696,7 +1695,7 @@ void tst_QWebEnginePage::savePage()
// Save the loaded page as HTML.
QTemporaryDir tempDir(QDir::tempPath() + "/tst_qwebengineview-XXXXXX");
const QString filePath = tempDir.path() + "/thingumbob.html";
- page->save(filePath, QWebEngineDownloadItem::CompleteHtmlSaveFormat);
+ page->save(filePath, QWebEngineDownloadRequest::CompleteHtmlSaveFormat);
QTestEventLoop::instance().enterLoop(10);
// Load something else.
@@ -2057,7 +2056,7 @@ private Q_SLOTS:
void continueError()
{
- emit error(this->error());
+ emit errorOccurred(this->error());
emit finished();
}
};
@@ -2413,9 +2412,13 @@ void tst_QWebEnginePage::setContent_data()
QString str = QString::fromUtf8("ὕαλον ϕαγεῖν δύναμαι· τοῦτο οὔ με βλάπτει");
QTest::newRow("UTF-8 plain text") << "text/plain; charset=utf-8" << str.toUtf8() << str;
- QTextCodec *utf16 = QTextCodec::codecForName("UTF-16");
- if (utf16)
- QTest::newRow("UTF-16 plain text") << "text/plain; charset=utf-16" << utf16->fromUnicode(str) << str;
+ QBuffer out16;
+ out16.open(QIODevice::WriteOnly);
+ QTextStream stream16(&out16);
+ stream16.setEncoding(QStringConverter::Utf16);
+ stream16 << str;
+ stream16.flush();
+ QTest::newRow("UTF-16 plain text") << "text/plain; charset=utf-16" << out16.buffer() << str;
str = QString::fromUtf8("Une chaîne de caractères à sa façon.");
QTest::newRow("latin-1 plain text") << "text/plain; charset=iso-8859-1" << str.toLatin1() << str;
diff --git a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
index f4c0484eb..544fb8a11 100644
--- a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
+++ b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
@@ -35,11 +35,11 @@
#include <QtWebEngineCore/qwebenginecookiestore.h>
#include <QtWebEngineCore/qwebengineurlscheme.h>
#include <QtWebEngineCore/qwebengineurlschemehandler.h>
+#include <QtWebEngineCore/qwebenginesettings.h>
#include <QtWebEngineWidgets/qwebengineprofile.h>
#include <QtWebEngineWidgets/qwebenginepage.h>
-#include <QtWebEngineWidgets/qwebenginesettings.h>
#include <QtWebEngineWidgets/qwebengineview.h>
-#include <QtWebEngineWidgets/qwebenginedownloaditem.h>
+#include <QtWebEngineCore/qwebenginedownloadrequest.h>
#if QT_CONFIG(webengine_webchannel)
#include <QWebChannel>
@@ -832,10 +832,10 @@ void tst_QWebEngineProfile::httpAcceptLanguage()
void tst_QWebEngineProfile::downloadItem()
{
- qRegisterMetaType<QWebEngineDownloadItem *>();
+ qRegisterMetaType<QWebEngineDownloadRequest *>();
QWebEngineProfile testProfile;
QWebEnginePage page(&testProfile);
- QSignalSpy downloadSpy(&testProfile, SIGNAL(downloadRequested(QWebEngineDownloadItem *)));
+ QSignalSpy downloadSpy(&testProfile, SIGNAL(downloadRequested(QWebEngineDownloadRequest *)));
page.load(QUrl::fromLocalFile(QCoreApplication::applicationFilePath()));
QTRY_COMPARE(downloadSpy.count(), 1);
}
@@ -871,7 +871,7 @@ void tst_QWebEngineProfile::changeHttpUserAgent()
TestServer server;
QVERIFY(server.start());
- QVector<QByteArray> userAgents;
+ QList<QByteArray> userAgents;
connect(&server, &HttpServer::newRequest, [&](HttpReqRep *rr) {
if (rr->requestPath() == "/hedgehog.html")
userAgents.push_back(rr->requestHeader(QByteArrayLiteral("user-agent")));
@@ -898,7 +898,7 @@ void tst_QWebEngineProfile::changeHttpAcceptLanguage()
TestServer server;
QVERIFY(server.start());
- QVector<QByteArray> languages;
+ QList<QByteArray> languages;
connect(&server, &HttpServer::newRequest, [&](HttpReqRep *rr) {
if (rr->requestPath() == "/hedgehog.html")
languages.push_back(rr->requestHeader(QByteArrayLiteral("accept-language")));
diff --git a/tests/auto/widgets/qwebenginesettings/BLACKLIST b/tests/auto/widgets/qwebenginesettings/BLACKLIST
new file mode 100644
index 000000000..d4a35a76a
--- /dev/null
+++ b/tests/auto/widgets/qwebenginesettings/BLACKLIST
@@ -0,0 +1,2 @@
+[javascriptClipboard]
+ubuntu-20.04
diff --git a/tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp b/tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp
index a09901e69..a7c3ccb3c 100644
--- a/tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp
+++ b/tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp
@@ -177,7 +177,7 @@ void tst_QWebEngineSettings::setInAcceptNavigationRequest()
{
NavigationRequestOverride page;
QSignalSpy loadFinishedSpy(&page, SIGNAL(loadFinished(bool)));
- QWebEngineSettings::defaultSettings()->setAttribute(QWebEngineSettings::JavascriptEnabled, false);
+ QWebEngineProfile::defaultProfile()->settings()->setAttribute(QWebEngineSettings::JavascriptEnabled, false);
QVERIFY(!page.settings()->testAttribute(QWebEngineSettings::JavascriptEnabled));
page.load(QUrl("about:blank"));
diff --git a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp
index 5e16361c5..502729228 100644
--- a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp
+++ b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp
@@ -29,8 +29,9 @@
#include <qwebengineview.h>
#include <qwebenginepage.h>
#include <qwebenginesettings.h>
-#include <qnetworkrequest.h>
+#include <qaction.h>
#include <qdiriterator.h>
+#include <qnetworkrequest.h>
#include <qstackedlayout.h>
#include <qtemporarydir.h>
#include <QClipboard>
@@ -45,7 +46,6 @@
#include <QTcpServer>
#include <QTcpSocket>
#include <QStyle>
-#include <QtWidgets/qaction.h>
#include <QWebEngineProfile>
#include <QtCore/qregularexpression.h>
@@ -60,7 +60,7 @@ do { \
QCOMPARE((__expr), __expected); \
} while (0)
-static QTouchDevice* s_touchDevice = nullptr;
+static QPointingDevice* s_touchDevice = nullptr;
static QPoint elementCenter(QWebEnginePage *page, const QString &id)
{
@@ -961,7 +961,7 @@ public:
private:
int m_eventCounter;
- QVector<QString> m_eventHistory;
+ QList<QString> m_eventHistory;
};
void tst_QWebEngineView::doNotSendMouseKeyboardEventsWhenDisabled()
diff --git a/tests/auto/widgets/spellchecking/tst_spellchecking.cpp b/tests/auto/widgets/spellchecking/tst_spellchecking.cpp
index 801e2a76c..62007840f 100644
--- a/tests/auto/widgets/spellchecking/tst_spellchecking.cpp
+++ b/tests/auto/widgets/spellchecking/tst_spellchecking.cpp
@@ -28,7 +28,6 @@
#include "util.h"
#include <QtTest/QtTest>
-#include <QtWebEngineWidgets/qwebenginecontextmenudata.h>
#include <QtWebEngineWidgets/qwebengineprofile.h>
#include <QtWebEngineWidgets/qwebenginepage.h>
#include <QtWebEngineWidgets/qwebengineview.h>
@@ -47,10 +46,7 @@ public:
QTest::mouseRelease(widget, Qt::RightButton, {}, position);
}
- const QWebEngineContextMenuData& data()
- {
- return m_data;
- }
+ QWebEngineContextMenuRequest *data() { return m_data; }
signals:
void menuReady();
@@ -58,11 +54,11 @@ signals:
protected:
void contextMenuEvent(QContextMenuEvent *)
{
- m_data = page()->contextMenuData();
+ m_data = lastContextMenuRequest();
emit menuReady();
}
private:
- QWebEngineContextMenuData m_data;
+ QWebEngineContextMenuRequest *m_data;
};
class tst_Spellchecking : public QObject
@@ -204,17 +200,17 @@ void tst_Spellchecking::spellcheck()
return false;
}
- if (!m_view->data().isValid()) {
+ if (!m_view->data()) {
detail = "invalid data";
return false;
}
- if (!m_view->data().isContentEditable()) {
+ if (!m_view->data()->isContentEditable()) {
detail = "content is not editable";
return false;
}
- if (m_view->data().misspelledWord().isEmpty()) {
+ if (m_view->data()->misspelledWord().isEmpty()) {
detail = "no misspelled word";
return false;
};
@@ -224,10 +220,10 @@ void tst_Spellchecking::spellcheck()
} (), qPrintable(QString("Context menu: %1").arg(detail)));
// check misspelled word
- QCOMPARE(m_view->data().misspelledWord(), QStringLiteral("lowe"));
+ QCOMPARE(m_view->data()->misspelledWord(), QStringLiteral("lowe"));
// check suggestions
- QCOMPARE(m_view->data().spellCheckerSuggestions(), suggestions);
+ QCOMPARE(m_view->data()->spellCheckerSuggestions(), suggestions);
// check replace word
m_view->page()->replaceMisspelledWord("love");
diff --git a/tests/auto/widgets/util.h b/tests/auto/widgets/util.h
index cb58f4243..a47532806 100644
--- a/tests/auto/widgets/util.h
+++ b/tests/auto/widgets/util.h
@@ -178,7 +178,7 @@ static inline bool loadSync(QWebEngineView *view, const QUrl &url, bool ok = tru
#define W_QTEST_MAIN(TestObject, params) \
int main(int argc, char *argv[]) \
{ \
- QVector<const char *> w_argv(argc); \
+ QList<const char *> w_argv(argc); \
for (int i = 0; i < argc; ++i) \
w_argv[i] = argv[i]; \
for (int i = 0; i < params.size(); ++i) \
diff --git a/tests/auto/widgets/widgets.pro b/tests/auto/widgets/widgets.pro
index 6d65eecb5..947587f5e 100644
--- a/tests/auto/widgets/widgets.pro
+++ b/tests/auto/widgets/widgets.pro
@@ -14,7 +14,7 @@ SUBDIRS += \
proxypac \
schemes \
shutdown \
- qwebenginedownloaditem \
+ qwebenginedownloadrequest \
qwebenginepage \
qwebenginehistory \
qwebengineprofile \
@@ -48,4 +48,4 @@ boot2qt: SUBDIRS -= accessibility defaultsurfaceformat devtools \
qwebengineprofile \
qwebengineview
-win32: SUBDIRS -= offscreen
+darwin|win32: SUBDIRS -= offscreen
diff --git a/tests/manual/quick/quick.pro b/tests/manual/quick/quick.pro
index 5251c4b42..8522763f8 100644
--- a/tests/manual/quick/quick.pro
+++ b/tests/manual/quick/quick.pro
@@ -1,4 +1,5 @@
TEMPLATE = subdirs
SUBDIRS += \
- faviconbrowser
+ faviconbrowser \
+ touchbrowser
diff --git a/tests/manual/quick/touchbrowser/AddressBar.qml b/tests/manual/quick/touchbrowser/AddressBar.qml
new file mode 100644
index 000000000..1daae6dbf
--- /dev/null
+++ b/tests/manual/quick/touchbrowser/AddressBar.qml
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.5
+import QtQuick.Controls 1.4
+import QtQuick.Controls.Styles 1.4
+
+Rectangle {
+ id: root
+
+ property int progress: 0
+ property url iconUrl: ""
+ property url pageUrl: ""
+
+ signal accepted(url addressUrl)
+
+ clip: true
+
+ onActiveFocusChanged: {
+ if (activeFocus)
+ addressField.forceActiveFocus();
+ }
+
+ Rectangle {
+ width: addressField.width / 100 * root.progress
+ height: root.height
+
+ visible: root.progress < 100
+
+ color: "#b6dca6"
+ radius: root.radius
+ }
+
+ TextField {
+ id: addressField
+ anchors.fill: parent
+
+ Image {
+ anchors.verticalCenter: addressField.verticalCenter
+ x: 5; z: parent.z + 1
+ width: 16; height: 16
+ sourceSize: Qt.size(width, height)
+ source: root.iconUrl
+ visible: root.progress == 100
+ }
+
+ Text {
+ text: root.progress < 0 ? "" : root.progress + "%"
+ x: 5; z: parent.z + 1
+ font.bold: true
+ anchors.verticalCenter: parent.verticalCenter
+
+ visible: root.progress < 100
+ }
+
+ style: TextFieldStyle {
+ padding.left: 30
+
+ background: Rectangle {
+ color: "transparent"
+ border.color: "black"
+ border.width: 1
+ radius: root.radius
+ }
+ }
+
+ onActiveFocusChanged: {
+ if (activeFocus)
+ selectAll();
+ else
+ deselect();
+ }
+
+ text: root.pageUrl
+ onAccepted: root.accepted(utils.fromUserInput(text))
+ }
+}
diff --git a/tests/manual/quick/touchbrowser/main.cpp b/tests/manual/quick/touchbrowser/main.cpp
new file mode 100644
index 000000000..5808fe167
--- /dev/null
+++ b/tests/manual/quick/touchbrowser/main.cpp
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#if defined(DESKTOP_BUILD)
+#include "touchmockingapplication.h"
+#endif
+#include "utils.h"
+
+#include <QtGui/QGuiApplication>
+#include <QtQml/QQmlApplicationEngine>
+#include <QtQml/QQmlContext>
+#include <QtQuick/QQuickView>
+#include <QtWebEngine/qtwebengineglobal.h>
+
+static QUrl startupUrl()
+{
+ QUrl ret;
+ QStringList args(qApp->arguments());
+ args.takeFirst();
+ for (const QString &arg : qAsConst(args)) {
+ if (arg.startsWith(QLatin1Char('-')))
+ continue;
+ ret = Utils::fromUserInput(arg);
+ if (ret.isValid())
+ return ret;
+ }
+ return QUrl(QStringLiteral("https://www.qt.io/"));
+}
+
+int main(int argc, char **argv)
+{
+ QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
+ QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
+
+ // We use touch mocking on desktop and apply all the mobile switches.
+ QByteArrayList args = QByteArrayList()
+ << QByteArrayLiteral("--enable-embedded-switches")
+ << QByteArrayLiteral("--log-level=0");
+ const int count = args.size() + argc;
+ QList<char*> qargv(count);
+
+ qargv[0] = argv[0];
+ for (int i = 0; i < args.size(); ++i)
+ qargv[i + 1] = args[i].data();
+ for (int i = args.size() + 1; i < count; ++i)
+ qargv[i] = argv[i - args.size()];
+
+ int qAppArgCount = qargv.size();
+
+ QtWebEngine::initialize();
+
+#if defined(DESKTOP_BUILD)
+ TouchMockingApplication app(qAppArgCount, qargv.data());
+#else
+ QGuiApplication app(qAppArgCount, qargv.data());
+#endif
+
+ QQuickView view;
+ Utils utils;
+ view.rootContext()->setContextProperty("utils", &utils);
+
+ view.setTitle("Touch Browser");
+ view.setFlags(Qt::Window | Qt::WindowTitleHint);
+ view.setResizeMode(QQuickView::SizeRootObjectToView);
+ view.setSource(QUrl("qrc:/main.qml"));
+
+ QObject::connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit()));
+
+ view.show();
+ if (view.size().isEmpty())
+ view.setGeometry(0, 0, 800, 600);
+ QMetaObject::invokeMethod(reinterpret_cast<QObject *>(view.rootObject()), "load", Q_ARG(QVariant, startupUrl()));
+
+ return app.exec();
+}
diff --git a/tests/manual/quick/touchbrowser/main.qml b/tests/manual/quick/touchbrowser/main.qml
new file mode 100644
index 000000000..926b3a941
--- /dev/null
+++ b/tests/manual/quick/touchbrowser/main.qml
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.5
+import QtQuick.Layouts 1.3
+import QtWebEngine 1.3
+
+Item {
+ function load(url) {
+ webEngineView.url = url;
+ }
+
+ ColumnLayout {
+ anchors.fill: parent
+
+ AddressBar {
+ id: addressBar
+
+ Layout.fillWidth: true
+ Layout.margins: 5
+ height: 25
+
+ color: "white"
+ radius: 4
+
+ progress: webEngineView && webEngineView.loadProgress
+ iconUrl: webEngineView && webEngineView.icon
+ pageUrl: webEngineView && webEngineView.url
+
+ onAccepted: webEngineView.url = addressUrl
+ }
+
+ WebEngineView {
+ id: webEngineView
+
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ }
+ }
+}
diff --git a/tests/manual/quick/touchbrowser/qml.qrc b/tests/manual/quick/touchbrowser/qml.qrc
new file mode 100644
index 000000000..45210fe36
--- /dev/null
+++ b/tests/manual/quick/touchbrowser/qml.qrc
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ <file>AddressBar.qml</file>
+ </qresource>
+</RCC>
diff --git a/tests/manual/quick/touchbrowser/touchbrowser.pro b/tests/manual/quick/touchbrowser/touchbrowser.pro
new file mode 100644
index 000000000..21e3d6f68
--- /dev/null
+++ b/tests/manual/quick/touchbrowser/touchbrowser.pro
@@ -0,0 +1,19 @@
+TEMPLATE = app
+
+QT += quick webengine
+CONFIG += c++11
+
+SOURCES += \
+ main.cpp
+
+HEADERS += \
+ utils.h
+
+RESOURCES += qml.qrc
+
+!cross_compile {
+ DEFINES += DESKTOP_BUILD
+ SOURCES += touchmockingapplication.cpp
+ HEADERS += touchmockingapplication.h
+ QT += gui-private
+}
diff --git a/tests/manual/quick/touchbrowser/touchmockingapplication.cpp b/tests/manual/quick/touchbrowser/touchmockingapplication.cpp
new file mode 100644
index 000000000..41b731a6a
--- /dev/null
+++ b/tests/manual/quick/touchbrowser/touchmockingapplication.cpp
@@ -0,0 +1,287 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "touchmockingapplication.h"
+
+#include <qpa/qwindowsysteminterface.h>
+#include <QtCore/QEvent>
+#include <QtGui/QMouseEvent>
+#include <QtGui/QTouchDevice>
+#include <QtGui/QTouchEvent>
+#include <QtQuick/QQuickItem>
+#include <QtQuick/QQuickView>
+
+static inline bool isTouchEvent(const QEvent* event)
+{
+ switch (event->type()) {
+ case QEvent::TouchBegin:
+ case QEvent::TouchUpdate:
+ case QEvent::TouchEnd:
+ return true;
+ default:
+ return false;
+ }
+}
+
+static inline bool isMouseEvent(const QEvent* event)
+{
+ switch (event->type()) {
+ case QEvent::MouseButtonPress:
+ case QEvent::MouseMove:
+ case QEvent::MouseButtonRelease:
+ case QEvent::MouseButtonDblClick:
+ return true;
+ default:
+ return false;
+ }
+}
+
+TouchMockingApplication::TouchMockingApplication(int& argc, char** argv)
+ : QGuiApplication(argc, argv)
+ , m_realTouchEventReceived(false)
+ , m_pendingFakeTouchEventCount(0)
+ , m_holdingControl(false)
+{
+}
+
+bool TouchMockingApplication::notify(QObject* target, QEvent* event)
+{
+ // We try to be smart, if we received real touch event, we are probably on a device
+ // with touch screen, and we should not have touch mocking.
+
+ if (!event->spontaneous() || m_realTouchEventReceived)
+ return QGuiApplication::notify(target, event);
+
+ if (isTouchEvent(event)) {
+ if (m_pendingFakeTouchEventCount)
+ --m_pendingFakeTouchEventCount;
+ else
+ m_realTouchEventReceived = true;
+ return QGuiApplication::notify(target, event);
+ }
+
+ QQuickView* window = qobject_cast<QQuickView*>(target);
+ if (!window)
+ return QGuiApplication::notify(target, event);
+
+ m_holdingControl = QGuiApplication::keyboardModifiers().testFlag(Qt::ControlModifier);
+
+ if (event->type() == QEvent::KeyRelease && static_cast<QKeyEvent*>(event)->key() == Qt::Key_Control) {
+ foreach (int id, m_heldTouchPoints)
+ if (m_touchPoints.contains(id) && !QGuiApplication::mouseButtons().testFlag(Qt::MouseButton(id))) {
+ m_touchPoints[id].setState(Qt::TouchPointReleased);
+ m_heldTouchPoints.remove(id);
+ } else
+ m_touchPoints[id].setState(Qt::TouchPointStationary);
+
+ sendTouchEvent(window, m_heldTouchPoints.isEmpty() ? QEvent::TouchEnd : QEvent::TouchUpdate, static_cast<QKeyEvent*>(event)->timestamp());
+ }
+
+ if (isMouseEvent(event)) {
+ const QMouseEvent* const mouseEvent = static_cast<QMouseEvent*>(event);
+
+ QTouchEvent::TouchPoint touchPoint;
+ touchPoint.setPressure(1);
+
+ QEvent::Type touchType = QEvent::None;
+
+ switch (mouseEvent->type()) {
+ case QEvent::MouseButtonPress:
+ touchPoint.setId(mouseEvent->button());
+ if (m_touchPoints.contains(touchPoint.id())) {
+ touchPoint.setState(Qt::TouchPointMoved);
+ touchType = QEvent::TouchUpdate;
+ } else {
+ touchPoint.setState(Qt::TouchPointPressed);
+ // Check if more buttons are held down than just the event triggering one.
+ if (mouseEvent->buttons() > mouseEvent->button())
+ touchType = QEvent::TouchUpdate;
+ else
+ touchType = QEvent::TouchBegin;
+ }
+ break;
+ case QEvent::MouseMove:
+ if (!mouseEvent->buttons()) {
+ // We have to swallow the event instead of propagating it,
+ // since we avoid sending the mouse release events and if the
+ // Flickable is the mouse grabber it would receive the event
+ // and would move the content.
+ event->accept();
+ return true;
+ }
+ touchType = QEvent::TouchUpdate;
+ touchPoint.setId(mouseEvent->buttons());
+ touchPoint.setState(Qt::TouchPointMoved);
+ break;
+ case QEvent::MouseButtonRelease:
+ // Check if any buttons are still held down after this event.
+ if (mouseEvent->buttons())
+ touchType = QEvent::TouchUpdate;
+ else
+ touchType = QEvent::TouchEnd;
+ touchPoint.setId(mouseEvent->button());
+ touchPoint.setState(Qt::TouchPointReleased);
+ break;
+ case QEvent::MouseButtonDblClick:
+ // Eat double-clicks, their accompanying press event is all we need.
+ event->accept();
+ return true;
+ default:
+ Q_ASSERT_X(false, "multi-touch mocking", "unhandled event type");
+ }
+
+ // A move can have resulted in multiple buttons, so we need check them individually.
+ if (touchPoint.id() & Qt::LeftButton)
+ updateTouchPoint(mouseEvent, touchPoint, Qt::LeftButton);
+ if (touchPoint.id() & Qt::MiddleButton)
+ updateTouchPoint(mouseEvent, touchPoint, Qt::MiddleButton);
+ if (touchPoint.id() & Qt::RightButton)
+ updateTouchPoint(mouseEvent, touchPoint, Qt::RightButton);
+
+ if (m_holdingControl && touchPoint.state() == Qt::TouchPointReleased) {
+ // We avoid sending the release event because the Flickable is
+ // listening to mouse events and would start a bounce-back
+ // animation if it received a mouse release.
+ event->accept();
+ return true;
+ }
+
+ // Update states for all other touch-points
+ for (QHash<int, QTouchEvent::TouchPoint>::iterator it = m_touchPoints.begin(), end = m_touchPoints.end(); it != end; ++it) {
+ if (!(it.value().id() & touchPoint.id()))
+ it.value().setState(Qt::TouchPointStationary);
+ }
+
+ Q_ASSERT(touchType != QEvent::None);
+
+ if (!sendTouchEvent(window, touchType, mouseEvent->timestamp()))
+ return QGuiApplication::notify(target, event);
+
+ event->accept();
+ return true;
+ }
+
+ return QGuiApplication::notify(target, event);
+}
+
+void TouchMockingApplication::updateTouchPoint(const QMouseEvent* mouseEvent, QTouchEvent::TouchPoint touchPoint, Qt::MouseButton mouseButton)
+{
+ // Ignore inserting additional touch points if Ctrl isn't held because it produces
+ // inconsistent touch events and results in assers in the gesture recognizers.
+ if (!m_holdingControl && m_touchPoints.size() && !m_touchPoints.contains(mouseButton))
+ return;
+
+ if (m_holdingControl && touchPoint.state() == Qt::TouchPointReleased) {
+ m_heldTouchPoints.insert(mouseButton);
+ return;
+ }
+
+ // Gesture recognition uses the screen position for the initial threshold
+ // but since the canvas translates touch events we actually need to pass
+ // the screen position as the scene position to deliver the appropriate
+ // coordinates to the target.
+ touchPoint.setPos(mouseEvent->localPos());
+ touchPoint.setScenePos(mouseEvent->screenPos());
+
+ if (touchPoint.state() == Qt::TouchPointPressed)
+ touchPoint.setStartScenePos(mouseEvent->screenPos());
+ else {
+ const QTouchEvent::TouchPoint& oldTouchPoint = m_touchPoints[mouseButton];
+ touchPoint.setStartScenePos(oldTouchPoint.startScenePos());
+ touchPoint.setLastPos(oldTouchPoint.pos());
+ touchPoint.setLastScenePos(oldTouchPoint.scenePos());
+ }
+
+ // Update current touch-point.
+ touchPoint.setId(mouseButton);
+ m_touchPoints.insert(mouseButton, touchPoint);
+}
+
+bool TouchMockingApplication::sendTouchEvent(QQuickView* window, QEvent::Type type, ulong timestamp)
+{
+ static QTouchDevice* device = 0;
+ if (!device) {
+ device = new QTouchDevice;
+ device->setType(QTouchDevice::TouchScreen);
+ QWindowSystemInterface::registerTouchDevice(device);
+ }
+
+ m_pendingFakeTouchEventCount++;
+
+ const QList<QTouchEvent::TouchPoint>& currentTouchPoints = m_touchPoints.values();
+ Qt::TouchPointStates touchPointStates = Qt::TouchPointState();
+ foreach (const QTouchEvent::TouchPoint& touchPoint, currentTouchPoints)
+ touchPointStates |= touchPoint.state();
+
+ QTouchEvent event(type, device, Qt::NoModifier, touchPointStates, currentTouchPoints);
+ event.setTimestamp(timestamp);
+ event.setAccepted(false);
+
+ QGuiApplication::notify(window, &event);
+
+ updateVisualMockTouchPoints(window,m_holdingControl ? currentTouchPoints : QList<QTouchEvent::TouchPoint>());
+
+ // Get rid of touch-points that are no longer valid
+ foreach (const QTouchEvent::TouchPoint& touchPoint, currentTouchPoints) {
+ if (touchPoint.state() == Qt::TouchPointReleased)
+ m_touchPoints.remove(touchPoint.id());
+ }
+
+ return event.isAccepted();
+}
+
+void TouchMockingApplication::updateVisualMockTouchPoints(QQuickView* window,const QList<QTouchEvent::TouchPoint>& touchPoints)
+{
+ if (touchPoints.isEmpty()) {
+ // Hide all touch indicator items.
+ foreach (QQuickItem* item, m_activeMockComponents.values())
+ item->setProperty("pressed", false);
+
+ return;
+ }
+
+ foreach (const QTouchEvent::TouchPoint& touchPoint, touchPoints) {
+ QQuickItem* mockTouchPointItem = m_activeMockComponents.value(touchPoint.id());
+
+ if (!mockTouchPointItem) {
+ QQmlComponent touchMockPointComponent(window->engine(), QUrl("qrc:///qml/MockTouchPoint.qml"));
+ mockTouchPointItem = qobject_cast<QQuickItem*>(touchMockPointComponent.create());
+ Q_ASSERT(mockTouchPointItem);
+ m_activeMockComponents.insert(touchPoint.id(), mockTouchPointItem);
+ mockTouchPointItem->setProperty("pointId", QVariant(touchPoint.id()));
+ mockTouchPointItem->setParent(window->rootObject());
+ mockTouchPointItem->setParentItem(window->rootObject());
+ }
+
+ mockTouchPointItem->setX(touchPoint.pos().x());
+ mockTouchPointItem->setY(touchPoint.pos().y());
+ mockTouchPointItem->setWidth(touchPoint.ellipseDiameters().width());
+ mockTouchPointItem->setHeight(touchPoint.ellipseDiameters().height());
+ mockTouchPointItem->setProperty("pressed", QVariant(touchPoint.state() != Qt::TouchPointReleased));
+ }
+}
diff --git a/tests/manual/quick/touchbrowser/touchmockingapplication.h b/tests/manual/quick/touchbrowser/touchmockingapplication.h
new file mode 100644
index 000000000..cdabe871f
--- /dev/null
+++ b/tests/manual/quick/touchbrowser/touchmockingapplication.h
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TOUCHMOCKINGAPPLICATION_H
+#define TOUCHMOCKINGAPPLICATION_H
+
+#include <QtCore/QHash>
+#include <QtCore/QSet>
+#include <QtCore/QUrl>
+#include <QtGui/QGuiApplication>
+#include <QtGui/QTouchEvent>
+
+QT_BEGIN_NAMESPACE
+class QQuickView;
+class QQuickItem;
+QT_END_NAMESPACE
+
+class TouchMockingApplication : public QGuiApplication
+{
+ Q_OBJECT
+
+public:
+ TouchMockingApplication(int &argc, char **argv);
+
+ virtual bool notify(QObject *, QEvent *) override;
+
+private:
+ void updateTouchPoint(const QMouseEvent *, QTouchEvent::TouchPoint, Qt::MouseButton);
+ bool sendTouchEvent(QQuickView *, QEvent::Type, ulong timestamp);
+ void updateVisualMockTouchPoints(QQuickView *,const QList<QTouchEvent::TouchPoint> &touchPoints);
+
+private:
+ bool m_realTouchEventReceived;
+ int m_pendingFakeTouchEventCount;
+
+ QPointF m_lastPos;
+ QPointF m_lastScreenPos;
+ QPointF m_startScreenPos;
+
+ QHash<int, QTouchEvent::TouchPoint> m_touchPoints;
+ QSet<int> m_heldTouchPoints;
+ QHash<int, QQuickItem*> m_activeMockComponents;
+
+ bool m_holdingControl;
+};
+
+#endif // TOUCHMOCKINGAPPLICATION_H
diff --git a/tests/manual/quick/touchbrowser/utils.h b/tests/manual/quick/touchbrowser/utils.h
new file mode 100644
index 000000000..b7aeefce0
--- /dev/null
+++ b/tests/manual/quick/touchbrowser/utils.h
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef UTILS_H
+#define UTILS_H
+
+#include <QtCore/QFileInfo>
+#include <QtCore/QUrl>
+
+class Utils : public QObject {
+ Q_OBJECT
+public:
+ Q_INVOKABLE static QUrl fromUserInput(const QString& userInput);
+};
+
+inline QUrl Utils::fromUserInput(const QString& userInput)
+{
+ QFileInfo fileInfo(userInput);
+ if (fileInfo.exists())
+ return QUrl::fromLocalFile(fileInfo.absoluteFilePath());
+ return QUrl::fromUserInput(userInput);
+}
+
+#endif // UTILS_H
diff --git a/tests/manual/widgets/inputmethods/colorpicker.cpp b/tests/manual/widgets/inputmethods/colorpicker.cpp
index f279eb418..ee2e2e43f 100644
--- a/tests/manual/widgets/inputmethods/colorpicker.cpp
+++ b/tests/manual/widgets/inputmethods/colorpicker.cpp
@@ -41,7 +41,6 @@ ColorPicker::ColorPicker(QWidget *parent)
m_chooseButton->setText(tr("Choose"));
QHBoxLayout *layout = new QHBoxLayout;
- layout->setMargin(0);
layout->addWidget(m_colorInput);
layout->addWidget(m_chooseButton);
setLayout(layout);