summaryrefslogtreecommitdiffstats
path: root/tests/auto/quick
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2021-02-11 10:03:24 +0100
committerMichal Klocek <michal.klocek@qt.io>2021-05-22 14:10:10 +0200
commit97dcbd4019456b9a1c567faddb0521b7505d80fc (patch)
tree9c77c5640b1563d853c79898cd64d87252fe8c41 /tests/auto/quick
parentdd523573f2981cc58d4da0ec6e2b061a6172a8eb (diff)
Add tests to the cmake build
Use QT_TESTCASE_SOURCEDIR instead of TESTS_SOURCE_DIR. Introduce Test::HttpServer and Test::Util targets. Query shared data location from server. Clean up "shared" resources. Note QT_TESTCASE_SOURCEDIR must be turned into the canonical form since the user can call on windows: "cmake \path\to\foo" instead of "cmake c:\path\to\foo" which will break all file:// urls. Note this patch breaks qmake builds. Task-number: QTBUG-91760 Change-Id: Ibc1f904ac9acd375d1ff70ff80f0c533497e3f20 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'tests/auto/quick')
-rw-r--r--tests/auto/quick/CMakeLists.txt15
-rw-r--r--tests/auto/quick/certificateerror/CMakeLists.txt26
-rw-r--r--tests/auto/quick/certificateerror/resources/cert.pem64
-rw-r--r--tests/auto/quick/certificateerror/resources/key.pem27
-rw-r--r--tests/auto/quick/certificateerror/tst_certificateerror.cpp4
-rw-r--r--tests/auto/quick/dialogs/CMakeLists.txt25
-rw-r--r--tests/auto/quick/dialogs/server.cpp79
-rw-r--r--tests/auto/quick/dialogs/server.h59
-rw-r--r--tests/auto/quick/dialogs/tst_dialogs.cpp18
-rw-r--r--tests/auto/quick/inspectorserver/CMakeLists.txt9
-rw-r--r--tests/auto/quick/inspectorserver/html/basic_page.html (renamed from tests/auto/quick/html/basic_page.html)0
-rw-r--r--tests/auto/quick/inspectorserver/tst_inspectorserver.cpp11
-rw-r--r--tests/auto/quick/publicapi/CMakeLists.txt8
-rw-r--r--tests/auto/quick/qmltests/CMakeLists.txt102
-rw-r--r--tests/auto/quick/qmltests/data/tst_notification.qml4
-rw-r--r--tests/auto/quick/qmltests/resources/cert.pem64
-rw-r--r--tests/auto/quick/qmltests/resources/key.pem27
-rw-r--r--tests/auto/quick/qmltests/tst_qmltests.cpp12
-rw-r--r--tests/auto/quick/qquickwebenginedefaultsurfaceformat/CMakeLists.txt10
-rw-r--r--tests/auto/quick/qquickwebenginedefaultsurfaceformat/html/basic_page.html6
-rw-r--r--tests/auto/quick/qquickwebenginedefaultsurfaceformat/tst_qquickwebenginedefaultsurfaceformat.cpp4
-rw-r--r--tests/auto/quick/qquickwebengineview/CMakeLists.txt13
-rw-r--r--tests/auto/quick/qquickwebengineview/html/basic_page.html6
-rw-r--r--tests/auto/quick/qquickwebengineview/html/basic_page2.html (renamed from tests/auto/quick/html/basic_page2.html)0
-rw-r--r--tests/auto/quick/qquickwebengineview/html/direct-image-compositing.html (renamed from tests/auto/quick/html/direct-image-compositing.html)0
-rw-r--r--tests/auto/quick/qquickwebengineview/html/inputmethod.html (renamed from tests/auto/quick/html/inputmethod.html)0
-rw-r--r--tests/auto/quick/qquickwebengineview/html/resources/simple_image.png (renamed from tests/auto/quick/html/resources/simple_image.png)bin10585 -> 10585 bytes
-rw-r--r--tests/auto/quick/qquickwebengineview/html/scroll.html (renamed from tests/auto/quick/html/scroll.html)0
-rw-r--r--tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp5
-rw-r--r--tests/auto/quick/qtbug-70248/CMakeLists.txt17
-rw-r--r--tests/auto/quick/shared/qt_webengine_quicktest.h57
-rw-r--r--tests/auto/quick/shared/testwindow.h68
-rw-r--r--tests/auto/quick/shared/util.h191
33 files changed, 452 insertions, 479 deletions
diff --git a/tests/auto/quick/CMakeLists.txt b/tests/auto/quick/CMakeLists.txt
new file mode 100644
index 000000000..32d58ec7f
--- /dev/null
+++ b/tests/auto/quick/CMakeLists.txt
@@ -0,0 +1,15 @@
+add_subdirectory(dialogs)
+add_subdirectory(publicapi)
+add_subdirectory(qquickwebenginedefaultsurfaceformat)
+add_subdirectory(qtbug-70248)
+if(QT_FEATURE_ssl)
+ add_subdirectory(certificateerror)
+endif()
+if(NOT boot2qt)
+ add_subdirectory(inspectorserver)
+ add_subdirectory(qmltests)
+ add_subdirectory(qquickwebengineview)
+endif()
+if(QT_FEATURE_webengine_testsupport)
+# add_subdirectory(qquickwebengineviewgraphics)
+endif()
diff --git a/tests/auto/quick/certificateerror/CMakeLists.txt b/tests/auto/quick/certificateerror/CMakeLists.txt
new file mode 100644
index 000000000..4fe350978
--- /dev/null
+++ b/tests/auto/quick/certificateerror/CMakeLists.txt
@@ -0,0 +1,26 @@
+include(../../httpserver/httpserver.cmake)
+include(../../util/util.cmake)
+
+qt_internal_add_test(tst_certificateerror_quick
+ SOURCES
+ testhandler.cpp testhandler.h
+ tst_certificateerror.cpp
+ LIBRARIES
+ Qt::CorePrivate
+ Qt::WebEngineQuickPrivate
+ Test::HttpServer
+ Test::Util
+)
+
+set(certificateerror_resource_files
+ "resources/cert.pem"
+ "resources/key.pem"
+ "WebView.qml"
+)
+
+qt_add_resource(tst_certificateerror_quick "certificateerror"
+ PREFIX
+ "/"
+ FILES
+ ${certificateerror_resource_files}
+)
diff --git a/tests/auto/quick/certificateerror/resources/cert.pem b/tests/auto/quick/certificateerror/resources/cert.pem
new file mode 100644
index 000000000..3aaaf289c
--- /dev/null
+++ b/tests/auto/quick/certificateerror/resources/cert.pem
@@ -0,0 +1,64 @@
+-----BEGIN CERTIFICATE-----
+MIIEpDCCAoygAwIBAgIUO90aty9AMjvBvzfUhr1WwdBrKkMwDQYJKoZIhvcNAQEL
+BQAwfzELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcM
+DVNhbiBGcmFuY2lzY28xDzANBgNVBAoMBkJhZFNTTDEyMDAGA1UEAwwpQmFkU1NM
+IEludGVybWVkaWF0ZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTkwODI2MTQ0
+NDIxWhcNMTkwODI3MTQ0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dkFGe1Q7F8gOxtlUL5owNL4uhRP8BbwOja2Gopn2+kA9CNqdwPI4Ipjlr
+yo61oCqzy3RAXOUct8WAvybacADmJODAxDq9O5fAZuYZScjjj1ASowmbyDH/Wb9z
++WfiKKH4BfgOIukzK3I1M9wiSDefIodCFfEVXbdNudZj8f9Gw4RrZwkUuxDLeRWG
+ReDtzAWq7G0Diw3uX40S4jaj3MeS6oHp2Nrj/VyjSRiYTeN/pnA9N0M5VuCYYvXD
+f50rrigjQfOgb4TmnyJAjXWVkXW7Fa+ooLsbvlfr8wP8f31y1cgWPHTVIv6Kmug7
+Bg88k3x5gLTXmutDjseORonhGMRdAxHgJVf5aKfzdRpwXZTDZJXhsAz9OdlOhNZd
+UrYo680QugA0V3H5D8Egbr2AUUSMDkn133COjeOIDknFxX3qDqeTzqLZCAEBIoKn
+Adpix0jvG1Ys4Ayq6K2wQFdGFjtl6LsiGC7pWWU=
+-----END CERTIFICATE-----
diff --git a/tests/auto/quick/certificateerror/resources/key.pem b/tests/auto/quick/certificateerror/resources/key.pem
new file mode 100644
index 000000000..89922679a
--- /dev/null
+++ b/tests/auto/quick/certificateerror/resources/key.pem
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEowIBAAKCAQEAkybT/L4zJCqefpd+eYT6aQ0PtobQfFgP+n+z5wWoUxIAJnjb
+5ZW47IJxka/2/ggzJOfrUBur54LkTfFQ+yX85eKYCuH0GLz+Rve50LDn0ya6qSgm
+EhDG0bend2tMZY+Nl3B+5Ane1vua8hdJjv3ZO3e5UgpQwysL54eYyhEWWlbFWF11
+LhEdMYp953UGLqoV4Mlw+Li8TmFwdKQx6icgBTuloXLzk9aUU+b6NbXdadNXkmzg
+09ICsb8pnMXiF2P9Xm5rK0IoiRkSHxVnU12nQXh65Ns/2Dj5DcbHmVdvallfr4wn
+LeFPUotysZnvFmE7FLMSr/eQfkTG+Jlb7ZhoGwIDAQABAoIBADRXy3BL98UVo+tD
+2ClBtBFKJBy5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pe5xrzY2DL8epVKb1qf6+8SE
+eX34cIcSaonEZ2g67MAeIG6jtmPwxWk4EYAsO1u4XiyziABkoNyLKVH4hZg61BsV
+jL7R5UrUvBbhKLFOwkcB4Kwdwu7COB/UKa5XJBTMbuw1UTyxlUeI
+-----END RSA PRIVATE KEY-----
diff --git a/tests/auto/quick/certificateerror/tst_certificateerror.cpp b/tests/auto/quick/certificateerror/tst_certificateerror.cpp
index 3e2dc85fb..dd7799919 100644
--- a/tests/auto/quick/certificateerror/tst_certificateerror.cpp
+++ b/tests/auto/quick/certificateerror/tst_certificateerror.cpp
@@ -27,7 +27,7 @@
****************************************************************************/
#include "testhandler.h"
#include <httpsserver.h>
-#include <util.h>
+#include <quickutil.h>
#include <QWebEngineCertificateError>
#include <QQuickWebEngineProfile>
#include <QQmlApplicationEngine>
@@ -75,7 +75,7 @@ void tst_CertificateError::handleError_data()
void tst_CertificateError::handleError()
{
- HttpsServer server;
+ HttpsServer server(":/resources/cert.pem",":/resources/key.pem");
server.setExpectError(true);
QVERIFY(server.start());
diff --git a/tests/auto/quick/dialogs/CMakeLists.txt b/tests/auto/quick/dialogs/CMakeLists.txt
new file mode 100644
index 000000000..b1fbfe3a3
--- /dev/null
+++ b/tests/auto/quick/dialogs/CMakeLists.txt
@@ -0,0 +1,25 @@
+include(../../httpserver/httpserver.cmake)
+include(../../util/util.cmake)
+
+qt_internal_add_test(tst_dialogs
+ SOURCES
+ testhandler.cpp testhandler.h
+ tst_dialogs.cpp
+ LIBRARIES
+ Qt::CorePrivate
+ Qt::WebEngineQuickPrivate
+ Test::HttpServer
+ Test::Util
+)
+
+set(dialogs_resource_files
+ "WebView.qml"
+ "index.html"
+)
+
+qt_add_resource(tst_dialogs "dialogs"
+ PREFIX
+ "/"
+ FILES
+ ${dialogs_resource_files}
+)
diff --git a/tests/auto/quick/dialogs/server.cpp b/tests/auto/quick/dialogs/server.cpp
deleted file mode 100644
index dfc7c97ad..000000000
--- a/tests/auto/quick/dialogs/server.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** 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 "server.h"
-#include <QDataStream>
-#include <QTcpSocket>
-#include <QDebug>
-
-Server::Server(QObject *parent) : QObject(parent)
-{
- connect(&m_server, &QTcpServer::newConnection, this, &Server::handleNewConnection);
-}
-
-bool Server::isListening()
-{
- return m_server.isListening();
-}
-
-void Server::setReply(const QByteArray &reply)
-{
- m_reply = reply;
-}
-
-void Server::run()
-{
- if (!m_server.listen(QHostAddress::LocalHost, 5555))
- qFatal("Could not start the test server");
-}
-
-void Server::handleNewConnection()
-{
- // do one connection at the time
- Q_ASSERT(m_data.isEmpty());
- QTcpSocket *socket = m_server.nextPendingConnection();
- Q_ASSERT(socket);
- connect(socket, &QAbstractSocket::disconnected, socket, &QObject::deleteLater);
- connect(socket, &QAbstractSocket::readyRead, this, &Server::handleReadReady);
-}
-
-void Server::handleReadReady()
-{
- QTcpSocket *socket = qobject_cast<QTcpSocket*>(sender());
- Q_ASSERT(socket);
-
- m_data.append(socket->readAll());
-
- //simply wait for whole request
- if (!m_data.endsWith("\r\n\r\n"))
- return;
-
- socket->write(m_reply);
- m_data.clear();
- socket->disconnectFromHost();
-}
diff --git a/tests/auto/quick/dialogs/server.h b/tests/auto/quick/dialogs/server.h
deleted file mode 100644
index fa9a73811..000000000
--- a/tests/auto/quick/dialogs/server.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/****************************************************************************
-**
-** 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 SERVER_H
-#define SERVER_H
-
-#include <QObject>
-#include <QTcpServer>
-
-class Server : public QObject
-{
- Q_OBJECT
-
-public:
- explicit Server(QObject *parent = nullptr);
-
- bool isListening();
- void setReply(const QByteArray &reply);
-
-public slots:
- void run();
-
-private slots:
- void handleNewConnection();
- void handleReadReady();
-
-private:
- QByteArray m_data;
- QByteArray m_reply;
- QTcpServer m_server;
-
-};
-
-#endif // SERVER_H
diff --git a/tests/auto/quick/dialogs/tst_dialogs.cpp b/tests/auto/quick/dialogs/tst_dialogs.cpp
index 97a39ed01..8543c47da 100644
--- a/tests/auto/quick/dialogs/tst_dialogs.cpp
+++ b/tests/auto/quick/dialogs/tst_dialogs.cpp
@@ -27,8 +27,8 @@
****************************************************************************/
#include "testhandler.h"
-#include "server.h"
-#include "util.h"
+#include <quickutil.h>
+#include <httpserver.h>
#include <QtWebEngineQuick/private/qquickwebenginedialogrequests_p.h>
#include <QtWebEngineCore/qwebenginecontextmenurequest.h>
@@ -147,7 +147,7 @@ void tst_Dialogs::authenticationDialogRequested_data()
QTest::addColumn<QUrl>("url");
QTest::addColumn<QQuickWebEngineAuthenticationDialogRequest::AuthenticationType>("type");
QTest::addColumn<QString>("realm");
- QTest::addColumn<QByteArray>("reply");
+ QTest::addColumn<QByteArray>("response");
QTest::newRow("Http Authentication Dialog") << QUrl("http://localhost:5555/")
<< QQuickWebEngineAuthenticationDialogRequest::AuthenticationTypeHTTP
<< QStringLiteral("Very Restricted Area")
@@ -167,12 +167,13 @@ void tst_Dialogs::authenticationDialogRequested()
QFETCH(QUrl, url);
QFETCH(QQuickWebEngineAuthenticationDialogRequest::AuthenticationType, type);
QFETCH(QString, realm);
+ QFETCH(QByteArray, response);
- QFETCH(QByteArray, reply);
- Server server;
- server.setReply(reply);
- server.run();
- QTRY_VERIFY2(server.isListening(), "Could not setup authentication server");
+ HttpServer server(QHostAddress::LocalHost, 5555);
+ connect(&server, &HttpServer::newRequest, [url, response](HttpReqRep *rr) {
+ rr->sendResponse(response);
+ });
+ QVERIFY(server.start());
QSignalSpy dialogSpy(m_listener, &TestHandler::requestChanged);
m_listener->load(url);
@@ -186,6 +187,7 @@ void tst_Dialogs::authenticationDialogRequested()
QCOMPARE(dialog->realm(),realm);
QCOMPARE(dialog->url(), url);
QCOMPARE(dialog->proxyHost(), QStringLiteral("localhost"));
+ QVERIFY(server.stop());
}
void tst_Dialogs::javaScriptDialogRequested_data()
diff --git a/tests/auto/quick/inspectorserver/CMakeLists.txt b/tests/auto/quick/inspectorserver/CMakeLists.txt
new file mode 100644
index 000000000..e2c3bb2ab
--- /dev/null
+++ b/tests/auto/quick/inspectorserver/CMakeLists.txt
@@ -0,0 +1,9 @@
+qt_internal_add_test(tst_inspectorserver
+ SOURCES
+ tst_inspectorserver.cpp
+ LIBRARIES
+ Qt::CorePrivate
+ Qt::WebEngineQuickPrivate
+)
+
+
diff --git a/tests/auto/quick/html/basic_page.html b/tests/auto/quick/inspectorserver/html/basic_page.html
index 53726e4a6..53726e4a6 100644
--- a/tests/auto/quick/html/basic_page.html
+++ b/tests/auto/quick/inspectorserver/html/basic_page.html
diff --git a/tests/auto/quick/inspectorserver/tst_inspectorserver.cpp b/tests/auto/quick/inspectorserver/tst_inspectorserver.cpp
index bc5aed9ef..de49f143c 100644
--- a/tests/auto/quick/inspectorserver/tst_inspectorserver.cpp
+++ b/tests/auto/quick/inspectorserver/tst_inspectorserver.cpp
@@ -70,8 +70,6 @@ tst_InspectorServer::tst_InspectorServer()
void tst_InspectorServer::prepareWebViewComponent()
{
static QQmlEngine* engine = new QQmlEngine(this);
- engine->addImportPath(QString::fromUtf8(IMPORT_DIR));
-
m_component.reset(new QQmlComponent(engine, this));
m_component->setData(QByteArrayLiteral("import QtQuick 2.0\n"
@@ -119,7 +117,8 @@ QJsonArray tst_InspectorServer::fetchPageList() const
void tst_InspectorServer::testPageList()
{
- const QUrl testPageUrl = QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html"));
+ const QUrl testPageUrl = QUrl::fromLocalFile(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + QLatin1String("/html/basic_page.html"));
QSignalSpy loadSpy(webView(), SIGNAL(loadingChanged(QWebEngineLoadRequest)));
webView()->setUrl(testPageUrl);
QTRY_VERIFY(loadSpy.size() && !webView()->isLoading());
@@ -132,7 +131,8 @@ void tst_InspectorServer::testPageList()
void tst_InspectorServer::testRemoteDebuggingMessage()
{
- const QUrl testPageUrl = QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html"));
+ const QUrl testPageUrl = QUrl::fromLocalFile(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + QLatin1String("/html/basic_page.html"));
QSignalSpy loadSpy(webView(), SIGNAL(loadingChanged(QWebEngineLoadRequest)));
webView()->setUrl(testPageUrl);
QTRY_VERIFY(loadSpy.size() && !webView()->isLoading());
@@ -166,7 +166,8 @@ void tst_InspectorServer::testRemoteDebuggingMessage()
void tst_InspectorServer::openRemoteDebuggingSession()
{
- const QUrl testPageUrl = QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html"));
+ const QUrl testPageUrl = QUrl::fromLocalFile(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + QLatin1String("/html/basic_page.html"));
QSignalSpy loadSpy(webView(), SIGNAL(loadingChanged(QWebEngineLoadRequest)));
webView()->setUrl(testPageUrl);
QTRY_VERIFY(loadSpy.size() && !webView()->isLoading());
diff --git a/tests/auto/quick/publicapi/CMakeLists.txt b/tests/auto/quick/publicapi/CMakeLists.txt
new file mode 100644
index 000000000..abed54a10
--- /dev/null
+++ b/tests/auto/quick/publicapi/CMakeLists.txt
@@ -0,0 +1,8 @@
+qt_internal_add_test(tst_publicapi
+ SOURCES
+ tst_publicapi.cpp
+ LIBRARIES
+ Qt::CorePrivate
+ Qt::WebEngineQuickPrivate
+ Qt::WebEngineWidgetsPrivate
+)
diff --git a/tests/auto/quick/qmltests/CMakeLists.txt b/tests/auto/quick/qmltests/CMakeLists.txt
new file mode 100644
index 000000000..9aa4ca76c
--- /dev/null
+++ b/tests/auto/quick/qmltests/CMakeLists.txt
@@ -0,0 +1,102 @@
+include(../../httpserver/httpserver.cmake)
+include(../../util/util.cmake)
+
+qt_internal_add_test(tst_qmltests
+ SOURCES
+ tst_qmltests.cpp
+ LIBRARIES
+ Qt::WebEngineQuick
+ Qt::QuickTest
+ Test::HttpServer
+ Test::Util
+)
+
+set(testList
+ tst_action.qml
+ tst_activeFocusOnPress.qml
+ tst_audioMuted.qml
+ tst_desktopBehaviorLoadHtml.qml
+ tst_findText.qml
+ tst_focusOnNavigation.qml
+ tst_fullScreenRequest.qml
+ tst_geopermission.qml
+ tst_getUserMedia.qml
+ tst_keyboardEvents.qml
+ tst_keyboardModifierMapping.qml
+ tst_loadHtml.qml
+ tst_loadProgress.qml
+ tst_loadRecursionCrash.qml
+ tst_loadUrl.qml
+ tst_mouseMove.qml
+ tst_navigationRequested.qml
+ tst_newViewRequest.qml
+ tst_notification.qml
+ tst_profile.qml
+ tst_properties.qml
+ tst_runJavaScript.qml
+ tst_scrollPosition.qml
+ tst_settings.qml
+ tst_titleChanged.qml
+ tst_unhandledKeyEventPropagation.qml
+ tst_userScripts.qml
+ tst_viewSource.qml
+)
+
+if(QT_FEATURE_webengine_webchannel)
+ list(APPEND testList tst_webchannel.qml)
+endif()
+
+if(QT_FEATURE_ssl)
+ list(APPEND testList tst_certificateError.qml)
+endif()
+
+if(QT_FEATURE_webengine_testsupport)
+ list(APPEND testList
+ tst_favicon.qml
+ tst_faviconDownload.qml
+ tst_inputMethod.qml
+ tst_linkHovered.qml
+ tst_loadFail.qml
+ tst_mouseClick.qml
+ tst_viewSoure.qml
+ )
+# if(TARGET Qt::QuickControls) #FIXME
+ list(APPEND testList tst_javaScriptDialogs.qml)
+# else()
+# message("\n!!! QuickControls target is missing, some tests are not executed !!! FIXME \n")
+# endif()
+endif()
+
+if(TARGET Qt::QuickControls) #FIXME
+ list(APPEND testList
+ tst_contextMenu.qml
+ tst_download.qml
+ tst_filePicker.qml
+ )
+else()
+ message("\n!!!! QuickControls target is missing, some tests are not executed !!! FIXME \n")
+endif()
+
+if(TARGET Qt::QuickControls2)
+ list(APPEND testList tst_navigationHistory.qml)
+else()
+ message("\n!!!! QuickControls2 target is missing, some tests are not executed !!! FIXME \n")
+endif()
+
+set(content "")
+foreach(test ${testList})
+ set(contents "${contents}${CMAKE_CURRENT_LIST_DIR}/data/${test}\n")
+endforeach()
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/webengine.qmltests ${contents})
+
+set(tst_qmltests_resource_files
+ "resources/cert.pem"
+ "resources/key.pem"
+)
+
+qt_internal_add_resource(tst_qmltests "tst_qmltests"
+ PREFIX
+ "/"
+ FILES
+ ${tst_qmltests_resource_files}
+)
diff --git a/tests/auto/quick/qmltests/data/tst_notification.qml b/tests/auto/quick/qmltests/data/tst_notification.qml
index 773bf4a8e..6f66256f2 100644
--- a/tests/auto/quick/qmltests/data/tst_notification.qml
+++ b/tests/auto/quick/qmltests/data/tst_notification.qml
@@ -29,6 +29,7 @@
import QtQuick 2.2
import QtTest 1.0
import QtWebEngine 1.9
+import Test.Shared 1.0 as Shared
TestWebEngineView {
id: view
@@ -60,7 +61,8 @@ TestWebEngineView {
when: windowShown
function resolverUrl(html) {
- return Qt.resolvedUrl('../../../shared/data/' + html)
+ console.log(Shared.HttpServer.sharedDataDir())
+ return Qt.resolvedUrl(Shared.HttpServer.sharedDataDir() + "/" + html)
}
function init() {
diff --git a/tests/auto/quick/qmltests/resources/cert.pem b/tests/auto/quick/qmltests/resources/cert.pem
new file mode 100644
index 000000000..3aaaf289c
--- /dev/null
+++ b/tests/auto/quick/qmltests/resources/cert.pem
@@ -0,0 +1,64 @@
+-----BEGIN CERTIFICATE-----
+MIIEpDCCAoygAwIBAgIUO90aty9AMjvBvzfUhr1WwdBrKkMwDQYJKoZIhvcNAQEL
+BQAwfzELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcM
+DVNhbiBGcmFuY2lzY28xDzANBgNVBAoMBkJhZFNTTDEyMDAGA1UEAwwpQmFkU1NM
+IEludGVybWVkaWF0ZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTkwODI2MTQ0
+NDIxWhcNMTkwODI3MTQ0NDIxWjBjMQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2Fs
+aWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzEPMA0GA1UECgwGQmFkU1NM
+MRYwFAYDVQQDDA0qLmJhZHNzbC50ZXN0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
+MIIBCgKCAQEAkybT/L4zJCqefpd+eYT6aQ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Hp2Nrj/VyjSRiYTeN/pnA9N0M5VuCYYvXD
+f50rrigjQfOgb4TmnyJAjXWVkXW7Fa+ooLsbvlfr8wP8f31y1cgWPHTVIv6Kmug7
+Bg88k3x5gLTXmutDjseORonhGMRdAxHgJVf5aKfzdRpwXZTDZJXhsAz9OdlOhNZd
+UrYo680QugA0V3H5D8Egbr2AUUSMDkn133COjeOIDknFxX3qDqeTzqLZCAEBIoKn
+Adpix0jvG1Ys4Ayq6K2wQFdGFjtl6LsiGC7pWWU=
+-----END CERTIFICATE-----
diff --git a/tests/auto/quick/qmltests/resources/key.pem b/tests/auto/quick/qmltests/resources/key.pem
new file mode 100644
index 000000000..89922679a
--- /dev/null
+++ b/tests/auto/quick/qmltests/resources/key.pem
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEowIBAAKCAQEAkybT/L4zJCqefpd+eYT6aQ0PtobQfFgP+n+z5wWoUxIAJnjb
+5ZW47IJxka/2/ggzJOfrUBur54LkTfFQ+yX85eKYCuH0GLz+Rve50LDn0ya6qSgm
+EhDG0bend2tMZY+Nl3B+5Ane1vua8hdJjv3ZO3e5UgpQwysL54eYyhEWWlbFWF11
+LhEdMYp953UGLqoV4Mlw+Li8TmFwdKQx6icgBTuloXLzk9aUU+b6NbXdadNXkmzg
+09ICsb8pnMXiF2P9Xm5rK0IoiRkSHxVnU12nQXh65Ns/2Dj5DcbHmVdvallfr4wn
+LeFPUotysZnvFmE7FLMSr/eQfkTG+Jlb7ZhoGwIDAQABAoIBADRXy3BL98UVo+tD
+2ClBtBFKJBy5N9ADQyvH4SZ8TLO/423L7+xqpaz7eYppHWKfaBHorTuBnFRtquhO
+vo+Xo63iPFMirMFf+NMlq2MgilYBoMQrE9+5N//BZECGWlaGCcekrH5RRIMUXLlg
+rzm98lfE7pbQNIo39bQV97NpAJqBWPuoIvCrbRCysGoA5j7ptZ/EhSlC00eA7ybD
+CeYHmh8NrsapKOTGb5u1v3paV8X/mH6vKmsVs7n6LC0opBxzM8eAHEAQ6h8rmz9H
+y99FWDYha3lOS4SLkTnuRnNHOMLJajPq3Isu+BgzLWuRGnKZ3rmuUFwPNkCZTvsV
+dTdBE4ECgYEAw6jBEil0e8Pc9sGqnz93e8qrYE9wSPso4q3BNJgTbN48kon6mqh7
+gQVgEP/75Th5YrJUrY9Pd/8H9uoMOxbDXgOXG/xNnhC0L+7aM8nhKlxCLndY1e56
+/YymYYH4+D9ZD2u526mK/nmCg2QGOkCVYYp7NXe/mA0g34drKjefmj8CgYEAwIhq
+rZhlfAvQThSOqQA9zA7NXPDh4KzIjr8htVu5YvVcv5W2uhsni9DXFaloPnhuLdJ7
+MnPF2WqzQ9YqFrGn/9/OTqeE23f60ed04qLGM4BApb45y5Kw6sCPnWu7dMYfny9i
+XeZA2A+ODmqVkrU+ZNVzqzS1krYyUP3exd1voyUCgYEAqPRARH6np3gqhqoVvA4C
+D1OjSTdPrrWzSIriG5h2rbv6ck/Tp1l1zKPnoMZrrjRmHWQA2x61cNk4926DwUKW
+0cgn5HKqU6P49Ks8oRvi48FnJNjKTXHxoqChy/GAHF4Xecl8ZMKy06v5l5v4BLVg
+SSpb2n/dYl9z05IMaBhAKeECgYBKB2n1S6ah1q0GiLL92mDoiDyAYwKG8AjBkk40
+vIsAuNUruTYkQvKmuOsqohO6CXZb2hWSpZ9KZNN+3ucaCL9PDE/4QEM+W9iuQu/X
+gLzy6npxAD6avtGVweq2ncjbMp7QB1ksP69pJDn74xGV8miGPuiVyNOUEMgyChtR
+Oz6EnQKBgEth0w80CBg6b3NKuASoc/vC08njZQvWpe5xrzY2DL8epVKb1qf6+8SE
+eX34cIcSaonEZ2g67MAeIG6jtmPwxWk4EYAsO1u4XiyziABkoNyLKVH4hZg61BsV
+jL7R5UrUvBbhKLFOwkcB4Kwdwu7COB/UKa5XJBTMbuw1UTyxlUeI
+-----END RSA PRIVATE KEY-----
diff --git a/tests/auto/quick/qmltests/tst_qmltests.cpp b/tests/auto/quick/qmltests/tst_qmltests.cpp
index 906de29ad..2cf811f91 100644
--- a/tests/auto/quick/qmltests/tst_qmltests.cpp
+++ b/tests/auto/quick/qmltests/tst_qmltests.cpp
@@ -36,8 +36,8 @@
#include <QTemporaryDir>
#include <QtQuickTest/quicktest.h>
#include <QtWebEngineQuick/QQuickWebEngineProfile>
-#include <QQmlEngine>
-#include "qt_webengine_quicktest.h"
+#include <QtQml/QQmlEngine>
+#include <qt_webengine_quicktest.h>
#if defined(Q_OS_LINUX) && defined(QT_DEBUG)
#include <fcntl.h>
@@ -151,17 +151,19 @@ int main(int argc, char **argv)
QTEST_SET_MAIN_SOURCE_PATH
qmlRegisterSingletonType<HttpServer>("Test.Shared", 1, 0, "HttpServer", [&] (QQmlEngine *, QJSEngine *) {
auto server = new HttpServer;
- server->setResourceDirs({ TESTS_SHARED_DATA_DIR, QUICK_TEST_SOURCE_DIR });
+ server->setResourceDirs(
+ { server->sharedDataDir(),
+ QDir(QT_TESTCASE_SOURCEDIR).canonicalPath() + QLatin1String("/data") });
return server;
});
#if QT_CONFIG(ssl)
qmlRegisterSingletonType<HttpsServer>(
"Test.Shared", 1, 0, "HttpsServer",
- [&](QQmlEngine *, QJSEngine *) { return new HttpsServer; });
+ [&](QQmlEngine *, QJSEngine *) { return new HttpsServer(":/resources/cert.pem",":/resources/key.pem"); });
#endif
- int i = quick_test_main(argc, argv, "qmltests", QUICK_TEST_SOURCE_DIR);
+ int i = quick_test_main(argc, argv, "qmltests", qPrintable(QT_TESTCASE_BUILDDIR + QLatin1String("/webengine.qmltests")));
return i;
}
diff --git a/tests/auto/quick/qquickwebenginedefaultsurfaceformat/CMakeLists.txt b/tests/auto/quick/qquickwebenginedefaultsurfaceformat/CMakeLists.txt
new file mode 100644
index 000000000..07b184b89
--- /dev/null
+++ b/tests/auto/quick/qquickwebenginedefaultsurfaceformat/CMakeLists.txt
@@ -0,0 +1,10 @@
+include(../../util/util.cmake)
+
+qt_internal_add_test(tst_qquickwebenginedefaultsurfaceformat
+ SOURCES
+ tst_qquickwebenginedefaultsurfaceformat.cpp
+ LIBRARIES
+ Qt::CorePrivate
+ Qt::WebEngineQuickPrivate
+ Test::Util
+)
diff --git a/tests/auto/quick/qquickwebenginedefaultsurfaceformat/html/basic_page.html b/tests/auto/quick/qquickwebenginedefaultsurfaceformat/html/basic_page.html
new file mode 100644
index 000000000..53726e4a6
--- /dev/null
+++ b/tests/auto/quick/qquickwebenginedefaultsurfaceformat/html/basic_page.html
@@ -0,0 +1,6 @@
+<html>
+<head>
+<title> Basic Page </title>
+</head>
+<h1>Basic page</h1>
+</html>
diff --git a/tests/auto/quick/qquickwebenginedefaultsurfaceformat/tst_qquickwebenginedefaultsurfaceformat.cpp b/tests/auto/quick/qquickwebenginedefaultsurfaceformat/tst_qquickwebenginedefaultsurfaceformat.cpp
index 016e8232f..4275ae971 100644
--- a/tests/auto/quick/qquickwebenginedefaultsurfaceformat/tst_qquickwebenginedefaultsurfaceformat.cpp
+++ b/tests/auto/quick/qquickwebenginedefaultsurfaceformat/tst_qquickwebenginedefaultsurfaceformat.cpp
@@ -27,7 +27,7 @@
****************************************************************************/
#include "testwindow.h"
-#include "util.h"
+#include "quickutil.h"
#include <QGuiApplication>
#include <QtQml/QQmlEngine>
@@ -93,7 +93,7 @@ inline QQuickWebEngineView *tst_QQuickWebEngineDefaultSurfaceFormat::webEngineVi
QUrl tst_QQuickWebEngineDefaultSurfaceFormat::urlFromTestPath(const char *localFilePath)
{
- QString testSourceDirPath = QString::fromLocal8Bit(TESTS_SOURCE_DIR);
+ QString testSourceDirPath = QDir(QT_TESTCASE_SOURCEDIR).canonicalPath();
if (!testSourceDirPath.endsWith(QLatin1Char('/')))
testSourceDirPath.append(QLatin1Char('/'));
diff --git a/tests/auto/quick/qquickwebengineview/CMakeLists.txt b/tests/auto/quick/qquickwebengineview/CMakeLists.txt
new file mode 100644
index 000000000..45c44034a
--- /dev/null
+++ b/tests/auto/quick/qquickwebengineview/CMakeLists.txt
@@ -0,0 +1,13 @@
+include(../../util/util.cmake)
+
+qt_internal_add_test(tst_qquickwebengineview
+ SOURCES
+ tst_qquickwebengineview.cpp
+ LIBRARIES
+ Qt::WebEngineCorePrivate
+ Qt::WebEngineWidgets
+ Qt::WebEngineQuick
+ Qt::GuiPrivate
+ Qt::WebEngineQuickPrivate
+ Test::Util
+)
diff --git a/tests/auto/quick/qquickwebengineview/html/basic_page.html b/tests/auto/quick/qquickwebengineview/html/basic_page.html
new file mode 100644
index 000000000..53726e4a6
--- /dev/null
+++ b/tests/auto/quick/qquickwebengineview/html/basic_page.html
@@ -0,0 +1,6 @@
+<html>
+<head>
+<title> Basic Page </title>
+</head>
+<h1>Basic page</h1>
+</html>
diff --git a/tests/auto/quick/html/basic_page2.html b/tests/auto/quick/qquickwebengineview/html/basic_page2.html
index f8cff2969..f8cff2969 100644
--- a/tests/auto/quick/html/basic_page2.html
+++ b/tests/auto/quick/qquickwebengineview/html/basic_page2.html
diff --git a/tests/auto/quick/html/direct-image-compositing.html b/tests/auto/quick/qquickwebengineview/html/direct-image-compositing.html
index 53a4ca137..53a4ca137 100644
--- a/tests/auto/quick/html/direct-image-compositing.html
+++ b/tests/auto/quick/qquickwebengineview/html/direct-image-compositing.html
diff --git a/tests/auto/quick/html/inputmethod.html b/tests/auto/quick/qquickwebengineview/html/inputmethod.html
index dc9140f9d..dc9140f9d 100644
--- a/tests/auto/quick/html/inputmethod.html
+++ b/tests/auto/quick/qquickwebengineview/html/inputmethod.html
diff --git a/tests/auto/quick/html/resources/simple_image.png b/tests/auto/quick/qquickwebengineview/html/resources/simple_image.png
index 4685399ca..4685399ca 100644
--- a/tests/auto/quick/html/resources/simple_image.png
+++ b/tests/auto/quick/qquickwebengineview/html/resources/simple_image.png
Binary files differ
diff --git a/tests/auto/quick/html/scroll.html b/tests/auto/quick/qquickwebengineview/html/scroll.html
index ce2193b6c..ce2193b6c 100644
--- a/tests/auto/quick/html/scroll.html
+++ b/tests/auto/quick/qquickwebengineview/html/scroll.html
diff --git a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp
index 30441ac11..d0df5ffe0 100644
--- a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp
+++ b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp
@@ -27,7 +27,7 @@
****************************************************************************/
#include "testwindow.h"
-#include "util.h"
+#include "quickutil.h"
#include <QScopedPointer>
#include <QtCore/qelapsedtimer.h>
@@ -111,7 +111,7 @@ tst_QQuickWebEngineView::tst_QQuickWebEngineView()
QtWebEngine::initialize();
QQuickWebEngineProfile::defaultProfile()->setOffTheRecord(true);
- m_testSourceDirPath = QString::fromLocal8Bit(TESTS_SOURCE_DIR);
+ m_testSourceDirPath = QDir(QT_TESTCASE_SOURCEDIR).canonicalPath();
if (!m_testSourceDirPath.endsWith(QLatin1Char('/')))
m_testSourceDirPath.append(QLatin1Char('/'));
@@ -1252,3 +1252,4 @@ static QByteArrayList params = QByteArrayList()
W_QTEST_MAIN(tst_QQuickWebEngineView, params)
#include "tst_qquickwebengineview.moc"
+#include "moc_quickutil.cpp"
diff --git a/tests/auto/quick/qtbug-70248/CMakeLists.txt b/tests/auto/quick/qtbug-70248/CMakeLists.txt
new file mode 100644
index 000000000..cc6f120b0
--- /dev/null
+++ b/tests/auto/quick/qtbug-70248/CMakeLists.txt
@@ -0,0 +1,17 @@
+qt_internal_add_test(tst_qtbug-70248
+ SOURCES
+ tst_qtbug-70248.cpp
+ LIBRARIES
+ Qt::WebEngineQuickPrivate
+)
+
+set(test_resource_files
+ "test.qml"
+)
+
+qt_add_resource(tst_qtbug-70248 "test"
+ PREFIX
+ "/"
+ FILES
+ ${test_resource_files}
+)
diff --git a/tests/auto/quick/shared/qt_webengine_quicktest.h b/tests/auto/quick/shared/qt_webengine_quicktest.h
deleted file mode 100644
index 3adc9d459..000000000
--- a/tests/auto/quick/shared/qt_webengine_quicktest.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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 QT_WEBENGINE_QUICKTEST_H
-#define QT_WEBENGINE_QUICKTEST_H
-
-#include <QtQuickTest/quicktestglobal.h>
-
-#ifdef QT_WIDGETS_LIB
-#include <QtWidgets/QApplication>
-#else
-#include <QtGui/QGuiApplication>
-#endif
-
-#include "qopenglcontext.h"
-#include <qtwebengineglobal.h>
-
-QT_BEGIN_NAMESPACE
-
-#ifndef QUICK_TEST_SOURCE_DIR
-#define QUICK_TEST_SOURCE_DIR 0
-#endif
-
-#ifdef QT_WIDGETS_LIB
-#define Application QApplication
-#else
-#define Application QGuiApplication
-#endif
-
-QT_END_NAMESPACE
-
-#endif // QT_WEBENGINE_QUICKTEST_H
diff --git a/tests/auto/quick/shared/testwindow.h b/tests/auto/quick/shared/testwindow.h
deleted file mode 100644
index b57443c69..000000000
--- a/tests/auto/quick/shared/testwindow.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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 TESTWINDOW_H
-#define TESTWINDOW_H
-
-#if 0
-#pragma qt_no_master_include
-#endif
-
-#include <QResizeEvent>
-#include <QScopedPointer>
-#include <QtQuick/qquickitem.h>
-#include <QtQuick/qquickview.h>
-
-// TestWindow: Utility class to ignore QQuickView details.
-class TestWindow : public QQuickView {
-public:
- inline TestWindow(QQuickItem *webEngineView);
- QScopedPointer<QQuickItem> webEngineView;
-
-protected:
- inline void resizeEvent(QResizeEvent*);
-};
-
-inline TestWindow::TestWindow(QQuickItem *webEngineView)
- : webEngineView(webEngineView)
-{
- Q_ASSERT(webEngineView);
- webEngineView->setParentItem(contentItem());
- resize(300, 400);
-}
-
-inline void TestWindow::resizeEvent(QResizeEvent *event)
-{
- QQuickView::resizeEvent(event);
- webEngineView->setX(0);
- webEngineView->setY(0);
- webEngineView->setWidth(event->size().width());
- webEngineView->setHeight(event->size().height());
-}
-
-#endif /* TESTWINDOW_H */
diff --git a/tests/auto/quick/shared/util.h b/tests/auto/quick/shared/util.h
deleted file mode 100644
index 34afbbb45..000000000
--- a/tests/auto/quick/shared/util.h
+++ /dev/null
@@ -1,191 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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 UTIL_H
-#define UTIL_H
-
-#include <QEventLoop>
-#include <QQmlEngine>
-#include <QSignalSpy>
-#include <QTimer>
-#include <QtTest/QtTest>
-#include <QtWebEngineQuick/private/qquickwebengineview_p.h>
-#include <QtWebEngineCore/QWebEngineLoadRequest>
-#include <QtWebEngineQuick/private/qquickwebengineview_p.h>
-#include <QGuiApplication>
-
-#if !defined(TESTS_SOURCE_DIR)
-#define TESTS_SOURCE_DIR ""
-#endif
-
-class LoadSpy : public QEventLoop {
- Q_OBJECT
-
-public:
- LoadSpy(QQuickWebEngineView *webEngineView)
- {
- connect(webEngineView, &QQuickWebEngineView::loadingChanged, this, &LoadSpy::onLoadingChanged);
- }
-
- ~LoadSpy() { }
-
-Q_SIGNALS:
- void loadSucceeded();
- void loadFailed();
-
-private Q_SLOTS:
- void onLoadingChanged(const QWebEngineLoadRequest &request)
- {
- if (request.status() == QWebEngineLoadRequest::LoadSucceededStatus)
- emit loadSucceeded();
- else if (request.status() == QWebEngineLoadRequest::LoadFailedStatus)
- emit loadFailed();
- }
-};
-
-class LoadStartedCatcher : public QObject {
- Q_OBJECT
-
-public:
- LoadStartedCatcher(QQuickWebEngineView *webEngineView)
- : m_webEngineView(webEngineView)
- {
- connect(m_webEngineView, &QQuickWebEngineView::loadingChanged, this, &LoadStartedCatcher::onLoadingChanged);
- }
-
- virtual ~LoadStartedCatcher() { }
-
-public Q_SLOTS:
- void onLoadingChanged(const QWebEngineLoadRequest &request)
- {
- if (request.status() == QWebEngineLoadRequest::LoadStartedStatus)
- QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection);
- }
-
-Q_SIGNALS:
- void finished();
-
-private:
- QQuickWebEngineView *m_webEngineView;
-};
-
-inline bool waitForLoadSucceeded(QQuickWebEngineView *webEngineView, int timeout = 10000)
-{
- LoadSpy loadSpy(webEngineView);
- QSignalSpy spy(&loadSpy, &LoadSpy::loadSucceeded);
- return spy.wait(timeout);
-}
-
-inline bool waitForLoadFailed(QQuickWebEngineView *webEngineView, int timeout = 20000)
-{
- LoadSpy loadSpy(webEngineView);
- QSignalSpy spy(&loadSpy, &LoadSpy::loadFailed);
- return spy.wait(timeout);
-}
-
-inline QVariant evaluateJavaScriptSync(QQuickWebEngineView *view, const QString &script)
-{
- QQmlEngine *engine = qmlEngine(view);
- engine->globalObject().setProperty("called", false);
- engine->globalObject().setProperty("result", QJSValue());
- QJSValue callback = engine->evaluate(
- "(function callback(r) {"
- " called = true;"
- " result = r;"
- "})"
- );
- view->runJavaScript(script, callback);
- QTRY_LOOP_IMPL(engine->globalObject().property("called").toBool(), 5000, 50);
- if (!engine->globalObject().property("called").toBool()) {
- qWarning("JavaScript wasn't evaluated");
- return QVariant();
- }
-
- return engine->globalObject().property("result").toVariant();
-}
-
-inline QPoint elementCenter(QQuickWebEngineView *view, const QString &id)
-{
- const QString jsCode(
- "(function(){"
- " var elem = document.getElementById('" + id + "');"
- " var rect = elem.getBoundingClientRect();"
- " return [(rect.left + rect.right) / 2, (rect.top + rect.bottom) / 2];"
- "})()");
- QVariantList rectList = evaluateJavaScriptSync(view, jsCode).toList();
-
- if (rectList.count() != 2) {
- qWarning("elementCenter failed.");
- return QPoint();
- }
-
- return QPoint(rectList.at(0).toInt(), rectList.at(1).toInt());
-}
-
-inline QString activeElementId(QQuickWebEngineView *webEngineView)
-{
- qRegisterMetaType<QQuickWebEngineView::JavaScriptConsoleMessageLevel>("JavaScriptConsoleMessageLevel");
- QSignalSpy consoleMessageSpy(webEngineView, &QQuickWebEngineView::javaScriptConsoleMessage);
-
- webEngineView->runJavaScript(
- "if (document.activeElement == null)"
- " console.log('');"
- "else"
- " console.log(document.activeElement.id);"
- );
-
- if (!consoleMessageSpy.wait())
- return QString();
-
- QList<QVariant> arguments = consoleMessageSpy.takeFirst();
- if (static_cast<QQuickWebEngineView::JavaScriptConsoleMessageLevel>(arguments.at(0).toInt()) != QQuickWebEngineView::InfoMessageLevel)
- return QString();
-
- return arguments.at(1).toString();
-}
-
-#define W_QTEST_MAIN(TestObject, params) \
-int main(int argc, char *argv[]) \
-{ \
- QtWebEngine::initialize(); \
- \
- 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) \
- w_argv.append(params[i].data()); \
- int w_argc = w_argv.size(); \
- \
- QGuiApplication app(w_argc, const_cast<char **>(w_argv.data())); \
- app.setAttribute(Qt::AA_Use96Dpi, true); \
- TestObject tc; \
- QTEST_SET_MAIN_SOURCE_PATH \
- return QTest::qExec(&tc, argc, argv); \
-}
-#endif /* UTIL_H */
-