diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-04-30 17:15:57 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-06-03 02:40:25 +0200 |
commit | 82fe139dae5205a1683fb2b344c5dc867597c443 (patch) | |
tree | eeae61e1f34ebbc8536ebc2681d43de8dfb6e475 /tests/auto/quick/qmltests | |
parent | 5a0b312214ac182749040dac7ca09610c2124fbd (diff) |
Move createWindow to a signal
Ports QQuickWebEngineNewViewRequest to QtWebEngineCore.
[ChangeLog][QtWebEngineQuick][WebEngineView]
WebEngineView::NewViewRequested is now handled with
WebEngineView::acceptAsNewView() instead of with
WebEngineNewViewRequest::openIn().
Task-number: QTBUG-74587
Change-Id: I9b27128948076e13f2c228458e1e7491df12153d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'tests/auto/quick/qmltests')
-rw-r--r-- | tests/auto/quick/qmltests/data/tst_newViewRequest.qml | 16 | ||||
-rw-r--r-- | tests/auto/quick/qmltests/data/tst_viewSource.qml | 6 |
2 files changed, 10 insertions, 12 deletions
diff --git a/tests/auto/quick/qmltests/data/tst_newViewRequest.qml b/tests/auto/quick/qmltests/data/tst_newViewRequest.qml index fd720befe..c79a3aee8 100644 --- a/tests/auto/quick/qmltests/data/tst_newViewRequest.qml +++ b/tests/auto/quick/qmltests/data/tst_newViewRequest.qml @@ -52,7 +52,7 @@ TestWebEngineView { signalName: "newViewRequested" } - onNewViewRequested: { + onNewViewRequested: function(request) { newViewRequest = { "destination": request.destination, "userInitiated": request.userInitiated, @@ -69,11 +69,9 @@ TestWebEngineView { "}", webEngineView); if (viewType === "dialog") - request.openIn(dialog.webEngineView); - else if (viewType === "null") - request.openIn(0); + dialog.webEngineView.acceptAsNewView(request); else if (viewType === "webEngineView") - request.openIn(webEngineView); + webEngineView.acceptAsNewView(request); } TestCase { @@ -118,7 +116,7 @@ TestWebEngineView { verify(webEngineView.waitForLoadSucceeded()); tryCompare(newViewRequestedSpy, "count", 1); - compare(newViewRequest.destination, WebEngineView.NewViewInTab); + compare(newViewRequest.destination, WebEngineNewViewRequest.InNewTab); verify(!newViewRequest.userInitiated); if (viewType === "dialog") { @@ -139,7 +137,7 @@ TestWebEngineView { verify(webEngineView.waitForLoadSucceeded()); tryCompare(newViewRequestedSpy, "count", 1); - compare(newViewRequest.destination, WebEngineView.NewViewInDialog); + compare(newViewRequest.destination, WebEngineNewViewRequest.InNewDialog); compare(newViewRequest.requestedUrl, url); verify(!newViewRequest.userInitiated); if (viewType === "dialog") { @@ -163,7 +161,7 @@ TestWebEngineView { tryCompare(newViewRequestedSpy, "count", 1); compare(newViewRequest.requestedUrl, url); - compare(newViewRequest.destination, WebEngineView.NewViewInDialog); + compare(newViewRequest.destination, WebEngineNewViewRequest.InNewDialog); verify(newViewRequest.userInitiated); if (viewType === "dialog") { verify(dialog.webEngineView.waitForLoadSucceeded()); @@ -180,7 +178,7 @@ TestWebEngineView { mouseClick(webEngineView, center.x, center.y, Qt.LeftButton, Qt.ControlModifier); tryCompare(newViewRequestedSpy, "count", 1); compare(newViewRequest.requestedUrl, Qt.resolvedUrl("test1.html")); - compare(newViewRequest.destination, WebEngineView.NewViewInBackgroundTab); + compare(newViewRequest.destination, WebEngineNewViewRequest.InNewBackgroundTab); verify(newViewRequest.userInitiated); if (viewType === "" || viewType === "null") { compare(loadRequestArray[0].status, WebEngineView.LoadStartedStatus); diff --git a/tests/auto/quick/qmltests/data/tst_viewSource.qml b/tests/auto/quick/qmltests/data/tst_viewSource.qml index 22c340c2b..0b5f6a7ab 100644 --- a/tests/auto/quick/qmltests/data/tst_viewSource.qml +++ b/tests/auto/quick/qmltests/data/tst_viewSource.qml @@ -55,7 +55,7 @@ TestWebEngineView { "userInitiated": request.userInitiated }; - request.openIn(webEngineView); + webEngineView.acceptAsNewView(request); } TestCase { @@ -86,7 +86,7 @@ TestWebEngineView { // The first titleChanged signal is emitted by adoptWebContents() tryVerify(function() { return titleChangedSpy.count >= 2; }); - compare(viewRequest.destination, WebEngineView.NewViewInTab); + compare(viewRequest.destination, WebEngineNewViewRequest.InNewTab); verify(viewRequest.userInitiated); verify(!webEngineView.action(WebEngineView.ViewSource).enabled); @@ -115,7 +115,7 @@ TestWebEngineView { // The first titleChanged signal is emitted by adoptWebContents() tryVerify(function() { return titleChangedSpy.count >= 2; }); - compare(viewRequest.destination, WebEngineView.NewViewInTab); + compare(viewRequest.destination, WebEngineNewViewRequest.InNewTab); verify(viewRequest.userInitiated); tryCompare(webEngineView, "url", "view-source:" + url.replace("user:passwd@", "")); |