diff options
Diffstat (limited to 'tests/auto/quick/qmltests/data/tst_loadUrl.qml')
-rw-r--r-- | tests/auto/quick/qmltests/data/tst_loadUrl.qml | 80 |
1 files changed, 29 insertions, 51 deletions
diff --git a/tests/auto/quick/qmltests/data/tst_loadUrl.qml b/tests/auto/quick/qmltests/data/tst_loadUrl.qml index 872c46641..25a62c878 100644 --- a/tests/auto/quick/qmltests/data/tst_loadUrl.qml +++ b/tests/auto/quick/qmltests/data/tst_loadUrl.qml @@ -1,34 +1,9 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtTest 1.0 -import QtWebEngine 1.2 +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +import QtQuick +import QtTest +import QtWebEngine TestWebEngineView { id: webEngineView @@ -37,10 +12,10 @@ TestWebEngineView { property var loadRequestArray: [] - onLoadingChanged: { + onLoadingChanged: function(load) { loadRequestArray.push({ - "status": loadRequest.status, - "url": loadRequest.url, + "status": load.status, + "url": load.url, "activeUrl": webEngineView.url }); } @@ -52,6 +27,7 @@ TestWebEngineView { } TestCase { + id: testCase name: "WebEngineViewLoadUrl" when: windowShown @@ -79,8 +55,8 @@ TestWebEngineView { var aboutBlank = "about:blank"; webEngineView.url = aboutBlank; verify(webEngineView.waitForLoadSucceeded()); - compare(loadRequestArray[0].status, WebEngineView.LoadStartedStatus); - compare(loadRequestArray[1].status, WebEngineView.LoadSucceededStatus); + compare(loadRequestArray[0].status, WebEngineLoadingInfo.LoadStartedStatus); + compare(loadRequestArray[1].status, WebEngineLoadingInfo.LoadSucceededStatus); compare(loadRequestArray.length, 2); compare(webEngineView.url, aboutBlank); webEngineView.clear(); @@ -133,6 +109,7 @@ TestWebEngineView { compare(loadRequest.activeUrl, bogusSite); loadRequest = loadRequestArray[1]; compare(loadRequest.status, WebEngineView.LoadFailedStatus); + compare(loadRequest.status, WebEngineLoadingInfo.LoadFailedStatus); compare(loadRequest.activeUrl, url); webEngineView.clear(); @@ -148,10 +125,10 @@ TestWebEngineView { compare(loadRequest.status, WebEngineView.LoadSucceededStatus); compare(loadRequest.activeUrl, redirectUrl); loadRequest = loadRequestArray[2]; - compare(loadRequest.status, WebEngineView.LoadStartedStatus); + compare(loadRequest.status, WebEngineLoadingInfo.LoadStartedStatus); compare(loadRequest.activeUrl, redirectUrl); loadRequest = loadRequestArray[3]; - compare(loadRequest.status, WebEngineView.LoadSucceededStatus); + compare(loadRequest.status, WebEngineLoadingInfo.LoadSucceededStatus); compare(loadRequest.activeUrl, url); webEngineView.clear(); @@ -173,11 +150,11 @@ TestWebEngineView { tryCompare(loadRequestArray, "length", 2); loadRequest = loadRequestArray[0]; - compare(loadRequest.status, WebEngineView.LoadStartedStatus); + compare(loadRequest.status, WebEngineLoadingInfo.LoadStartedStatus); compare(loadRequest.url, url); compare(loadRequest.activeUrl, lastUrl); loadRequest = loadRequestArray[1]; - compare(loadRequest.status, WebEngineView.LoadSucceededStatus); + compare(loadRequest.status, WebEngineLoadingInfo.LoadSucceededStatus); compare(loadRequest.url, url); compare(loadRequest.activeUrl, url); webEngineView.clear(); @@ -225,15 +202,16 @@ TestWebEngineView { compare(loadRequest.activeUrl, bogusSite); loadRequest = loadRequestArray[1]; compare(loadRequest.status, WebEngineView.LoadFailedStatus); + compare(loadRequest.status, WebEngineLoadingInfo.LoadFailedStatus); // Since the load did not succeed the active url is the // URL of the previous successful load. compare(loadRequest.activeUrl, aboutBlank); loadRequest = loadRequestArray[2]; - compare(loadRequest.status, WebEngineView.LoadStartedStatus); + compare(loadRequest.status, WebEngineLoadingInfo.LoadStartedStatus); compare(loadRequest.activeUrl, bogusSite); compare(loadRequest.url, "data:text/html;charset=UTF-8,load failed") loadRequest = loadRequestArray[3]; - compare(loadRequest.status, WebEngineView.LoadSucceededStatus); + compare(loadRequest.status, WebEngineLoadingInfo.LoadSucceededStatus); compare(loadRequest.activeUrl, bogusSite); compare(loadRequest.url, bogusSite) webEngineView.clear(); @@ -285,6 +263,7 @@ TestWebEngineView { compare(loadRequest.activeUrl, stoppedUrl); loadRequest = loadRequestArray[1]; compare(loadRequest.status, WebEngineView.LoadStoppedStatus); + compare(loadRequest.status, WebEngineLoadingInfo.LoadStoppedStatus); compare(loadRequest.url, stoppedUrl); compare(loadRequest.activeUrl, initialUrl); webEngineView.clear(); @@ -298,20 +277,19 @@ TestWebEngineView { compare(loadRequestArray[0].status, WebEngineView.LoadStartedStatus); compare(loadRequestArray[1].status, WebEngineView.LoadSucceededStatus); - // In-page navigation. - webEngineView.url = Qt.resolvedUrl("test4.html#content"); - // In-page navigation doesn't trigger load succeeded, wait for load progress instead. - tryCompare(webEngineView, "loadProgress", 100); - compare(loadRequestArray.length, 3); - compare(loadRequestArray[2].status, WebEngineView.LoadStartedStatus); + // In-page navigation shouldn't trigger load + let anchorUrl = Qt.resolvedUrl("test4.html#anchor"); + let c = webEngineView.getElementCenter('anchor') + mouseClick(webEngineView, c.x, c.y) + tryCompare(webEngineView, 'url', anchorUrl) // Load after in-page navigation. webEngineView.url = Qt.resolvedUrl("test4.html"); verify(webEngineView.waitForLoadSucceeded()); compare(webEngineView.loadProgress, 100); - compare(loadRequestArray.length, 5); - compare(loadRequestArray[3].status, WebEngineView.LoadStartedStatus); - compare(loadRequestArray[4].status, WebEngineView.LoadSucceededStatus); + compare(loadRequestArray.length, 4); + compare(loadRequestArray[2].status, WebEngineView.LoadStartedStatus); + compare(loadRequestArray[3].status, WebEngineView.LoadSucceededStatus); webEngineView.clear(); } |