From a79fd91391c489ea1cd7baf717778b75e4847b92 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Thu, 24 Nov 2016 16:09:47 +0100 Subject: Fix DesktopWebEngineViewLinkHovered QML tests The linkHovered signal can be emitted only if the page is rendered. Waiting for rendering and for the UpdateTargetURL event may exceed the time limit so add wait for the rendering too. Task-number: QTBUG-55870 Change-Id: I3aa8e323a3bf8ff3f4a85c3de9efd3ab0f459f62 Reviewed-by: Allan Sandfeld Jensen --- tests/auto/quick/qmltests/BLACKLIST | 6 ------ tests/auto/quick/qmltests/data/tst_linkHovered.qml | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 6 deletions(-) (limited to 'tests') diff --git a/tests/auto/quick/qmltests/BLACKLIST b/tests/auto/quick/qmltests/BLACKLIST index d281020df..2673c7eb2 100644 --- a/tests/auto/quick/qmltests/BLACKLIST +++ b/tests/auto/quick/qmltests/BLACKLIST @@ -1,9 +1,3 @@ -[DesktopWebEngineViewLinkHovered::test_linkHovered] -* - -[DesktopWebEngineViewLinkHovered::test_linkHoveredDoesntEmitRepeated] -* - [WebViewGeopermission::test_deniedGeolocationByUser] osx diff --git a/tests/auto/quick/qmltests/data/tst_linkHovered.qml b/tests/auto/quick/qmltests/data/tst_linkHovered.qml index b049f07a3..0b99ffa7f 100644 --- a/tests/auto/quick/qmltests/data/tst_linkHovered.qml +++ b/tests/auto/quick/qmltests/data/tst_linkHovered.qml @@ -29,6 +29,7 @@ import QtQuick 2.0 import QtTest 1.0 import QtWebEngine 1.2 +import QtWebEngine.testsupport 1.0 TestWebEngineView { id: webEngineView @@ -38,6 +39,20 @@ TestWebEngineView { property string lastUrl + testSupport: WebEngineTestSupport { + property bool loadVisuallyCommittedSignalEmitted: false + + function waitForLoadVisuallyCommitted() { + return _waitFor(function() { + return testSupport.loadVisuallyCommittedSignalEmitted; + }); + } + + onLoadVisuallyCommitted: { + loadVisuallyCommittedSignalEmitted = true; + } + } + SignalSpy { id: spy target: webEngineView @@ -61,6 +76,7 @@ TestWebEngineView { } function init() { + webEngineView.testSupport.loadVisuallyCommittedSignalEmitted = false; webEngineView.lastUrl = "" spy.clear() } @@ -76,6 +92,9 @@ TestWebEngineView { compare(spy.count, 1) compare(webEngineView.lastUrl, "") + // Wait for the page to be rendered before trying to test based on input events + verify(webEngineView.testSupport.waitForLoadVisuallyCommitted()); + mouseMove(webEngineView, 100, 100) spy.wait() compare(spy.count, 2) @@ -96,6 +115,9 @@ TestWebEngineView { compare(spy.count, 1) compare(webEngineView.lastUrl, "") + // Wait for the page to be rendered before trying to test based on input events + verify(webEngineView.testSupport.waitForLoadVisuallyCommitted()); + for (var i = 0; i < 100; i += 10) mouseMove(webEngineView, 100, 100 + i) -- cgit v1.2.3