summaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qmltests/data
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-05-31 09:51:04 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2016-05-31 08:53:58 +0000
commit71916012ea9434247c31e361a3033ae69c4781c6 (patch)
treecb4d453c4fdd5f342ac66680dbc355f23d86fead /tests/auto/quick/qmltests/data
parent9da1716d05770f6deb3af654f28024234d711eb7 (diff)
Fix QML geolocation test
The test had a race condition and never waited for success or failure. In addition it didn't handle the case where there is no location service available. Change-Id: Icac02d0cc6396f31fed83b8b77b691ba872ac2f0 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'tests/auto/quick/qmltests/data')
-rw-r--r--tests/auto/quick/qmltests/data/geolocation.html1
-rw-r--r--tests/auto/quick/qmltests/data/tst_geopermission.qml5
2 files changed, 4 insertions, 2 deletions
diff --git a/tests/auto/quick/qmltests/data/geolocation.html b/tests/auto/quick/qmltests/data/geolocation.html
index c095a6b9e..8b116c8ee 100644
--- a/tests/auto/quick/qmltests/data/geolocation.html
+++ b/tests/auto/quick/qmltests/data/geolocation.html
@@ -8,6 +8,7 @@ function successHandler(location) {
message.innerHTML = "Latitude: " + location.coords.latitude +
"<br>Longitude: " + location.coords.longitude;
+ console.error("Success");
}
function errorHandler(error) {
diff --git a/tests/auto/quick/qmltests/data/tst_geopermission.qml b/tests/auto/quick/qmltests/data/tst_geopermission.qml
index a08ec155c..642cf2016 100644
--- a/tests/auto/quick/qmltests/data/tst_geopermission.qml
+++ b/tests/auto/quick/qmltests/data/tst_geopermission.qml
@@ -83,8 +83,9 @@ TestWebEngineView {
featurePermissionSpy.wait()
verify(geoPermissionRequested)
compare(featurePermissionSpy.count, 1)
- if (consoleErrorMessageSpy.count) // Print the error message if it fails to get user's location
- fail(consoleErrorMessageSpy.signalArguments[0][0])
+ consoleErrorMessageSpy.wait()
+ verify(consoleErrorMessageSpy.signalArguments[0][0] === "Success" ||
+ consoleErrorMessageSpy.signalArguments[0][0] === "")
}
function test_deniedGeolocationByUser() {