summaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qmltests/data/tst_linkHovered.qml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/quick/qmltests/data/tst_linkHovered.qml')
-rw-r--r--tests/auto/quick/qmltests/data/tst_linkHovered.qml67
1 files changed, 22 insertions, 45 deletions
diff --git a/tests/auto/quick/qmltests/data/tst_linkHovered.qml b/tests/auto/quick/qmltests/data/tst_linkHovered.qml
index faf943c55..a11bd2450 100644
--- a/tests/auto/quick/qmltests/data/tst_linkHovered.qml
+++ b/tests/auto/quick/qmltests/data/tst_linkHovered.qml
@@ -1,36 +1,10 @@
-/****************************************************************************
-**
-** 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
-import QtWebEngine.testsupport 1.0
-import "../../qmltests/data" 1.0
+// 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
+import "../../qmltests/data"
TestWebEngineView {
id: webEngineView
@@ -40,25 +14,29 @@ TestWebEngineView {
property string lastUrl
- testSupport: WebEngineTestSupport { }
-
- SignalSpy {
- id: loadVisuallyCommittedSpy
- target: webEngineView.testSupport
- signalName: "loadVisuallyCommitted"
- }
-
SignalSpy {
id: linkHoveredSpy
target: webEngineView
signalName: "linkHovered"
}
- onLinkHovered: {
+ onLinkHovered: function(hoveredUrl) {
webEngineView.lastUrl = hoveredUrl
}
+ function isViewRendered() {
+ var pixel = getItemPixel(webEngineView);
+
+ // The center pixel is expected to be red.
+ if (pixel[0] !== 255) return false;
+ if (pixel[1] !== 0) return false;
+ if (pixel[2] !== 0) return false;
+
+ return true;
+ }
+
TestCase {
+ id: testCase
name: "DesktopWebEngineViewLinkHovered"
// Delayed windowShown to workaround problems with Qt5 in debug mode.
@@ -72,7 +50,6 @@ TestWebEngineView {
function init() {
webEngineView.lastUrl = "";
- loadVisuallyCommittedSpy.clear();
linkHoveredSpy.clear();
}
@@ -88,7 +65,7 @@ TestWebEngineView {
compare(webEngineView.lastUrl, "")
// Wait for the page to be rendered before trying to test based on input events
- loadVisuallyCommittedSpy.wait();
+ tryVerify(isViewRendered);
mouseMove(webEngineView, 100, 100)
linkHoveredSpy.wait(12000);
@@ -111,7 +88,7 @@ TestWebEngineView {
compare(webEngineView.lastUrl, "")
// Wait for the page to be rendered before trying to test based on input events
- loadVisuallyCommittedSpy.wait();
+ tryVerify(isViewRendered);
for (var i = 0; i < 100; i += 10)
mouseMove(webEngineView, 100, 100 + i)