diff options
author | Peter Varga <pvarga@inf.u-szeged.hu> | 2016-11-24 16:09:47 +0100 |
---|---|---|
committer | Peter Varga <pvarga@inf.u-szeged.hu> | 2016-11-25 13:10:46 +0000 |
commit | a79fd91391c489ea1cd7baf717778b75e4847b92 (patch) | |
tree | ab8613493d85d275d833254349e699d711c01a4f /tests | |
parent | 9894a46ced4e760a90b8e0508ca1452f5d2fd7ef (diff) |
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 <allan.jensen@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/quick/qmltests/BLACKLIST | 6 | ||||
-rw-r--r-- | tests/auto/quick/qmltests/data/tst_linkHovered.qml | 22 |
2 files changed, 22 insertions, 6 deletions
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) |