summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPeter Varga <pvarga@inf.u-szeged.hu>2016-11-29 09:24:41 +0100
committerPeter Varga <pvarga@inf.u-szeged.hu>2016-11-29 19:49:35 +0000
commita40688a63d131bb024e46d817a388011ccab3ca2 (patch)
tree384f160d64e96b26c7550c4e5a20c8498cab2fbc /tests
parentc0950098f3a7d4994ff07b06b8ff32e2a60ee7bf (diff)
Wait for loadVisuallyCommitted signal with SignalSpy
Change-Id: Ic200807246c5feb8e1f33215cbc6194b03765359 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/quick/qmltests/data/tst_linkHovered.qml56
1 files changed, 25 insertions, 31 deletions
diff --git a/tests/auto/quick/qmltests/data/tst_linkHovered.qml b/tests/auto/quick/qmltests/data/tst_linkHovered.qml
index 0b99ffa7f..362130bab 100644
--- a/tests/auto/quick/qmltests/data/tst_linkHovered.qml
+++ b/tests/auto/quick/qmltests/data/tst_linkHovered.qml
@@ -39,22 +39,16 @@ TestWebEngineView {
property string lastUrl
- testSupport: WebEngineTestSupport {
- property bool loadVisuallyCommittedSignalEmitted: false
+ testSupport: WebEngineTestSupport { }
- function waitForLoadVisuallyCommitted() {
- return _waitFor(function() {
- return testSupport.loadVisuallyCommittedSignalEmitted;
- });
- }
-
- onLoadVisuallyCommitted: {
- loadVisuallyCommittedSignalEmitted = true;
- }
+ SignalSpy {
+ id: loadVisuallyCommittedSpy
+ target: webEngineView.testSupport
+ signalName: "loadVisuallyCommitted"
}
SignalSpy {
- id: spy
+ id: linkHoveredSpy
target: webEngineView
signalName: "linkHovered"
}
@@ -76,60 +70,60 @@ TestWebEngineView {
}
function init() {
- webEngineView.testSupport.loadVisuallyCommittedSignalEmitted = false;
- webEngineView.lastUrl = ""
- spy.clear()
+ webEngineView.lastUrl = "";
+ loadVisuallyCommittedSpy.clear();
+ linkHoveredSpy.clear();
}
function test_linkHovered() {
- compare(spy.count, 0)
+ compare(linkHoveredSpy.count, 0);
mouseMove(webEngineView, 100, 300)
webEngineView.url = Qt.resolvedUrl("test2.html")
verify(webEngineView.waitForLoadSucceeded())
// We get a linkHovered signal with empty hoveredUrl after page load
- spy.wait()
- compare(spy.count, 1)
+ linkHoveredSpy.wait();
+ compare(linkHoveredSpy.count, 1);
compare(webEngineView.lastUrl, "")
// Wait for the page to be rendered before trying to test based on input events
- verify(webEngineView.testSupport.waitForLoadVisuallyCommitted());
+ loadVisuallyCommittedSpy.wait();
mouseMove(webEngineView, 100, 100)
- spy.wait()
- compare(spy.count, 2)
+ linkHoveredSpy.wait();
+ compare(linkHoveredSpy.count, 2);
compare(webEngineView.lastUrl, Qt.resolvedUrl("test1.html"))
mouseMove(webEngineView, 100, 300)
- spy.wait()
- compare(spy.count, 3)
+ linkHoveredSpy.wait();
+ compare(linkHoveredSpy.count, 3);
compare(webEngineView.lastUrl, "")
}
function test_linkHoveredDoesntEmitRepeated() {
- compare(spy.count, 0)
+ compare(linkHoveredSpy.count, 0);
webEngineView.url = Qt.resolvedUrl("test2.html")
verify(webEngineView.waitForLoadSucceeded())
// We get a linkHovered signal with empty hoveredUrl after page load
- spy.wait()
- compare(spy.count, 1)
+ linkHoveredSpy.wait();
+ compare(linkHoveredSpy.count, 1);
compare(webEngineView.lastUrl, "")
// Wait for the page to be rendered before trying to test based on input events
- verify(webEngineView.testSupport.waitForLoadVisuallyCommitted());
+ loadVisuallyCommittedSpy.wait();
for (var i = 0; i < 100; i += 10)
mouseMove(webEngineView, 100, 100 + i)
- spy.wait()
- compare(spy.count, 2)
+ linkHoveredSpy.wait();
+ compare(linkHoveredSpy.count, 2);
compare(webEngineView.lastUrl, Qt.resolvedUrl("test1.html"))
for (var i = 0; i < 100; i += 10)
mouseMove(webEngineView, 100, 300 + i)
- spy.wait()
- compare(spy.count, 3)
+ linkHoveredSpy.wait();
+ compare(linkHoveredSpy.count, 3);
compare(webEngineView.lastUrl, "")
}
}