summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2019-03-10 18:53:06 +0100
committerPaolo Angelelli <paolo.angelelli@qt.io>2019-03-11 12:10:40 +0000
commit7e35bd3a31341b9593134808b08ee8dee6951c10 (patch)
tree594ef1d0912e058c42d49a2deaf7d73e56f60be4 /tests
parent0a6cdbbd06cea3501e1d19c4e557ad30524093b0 (diff)
Diagnose flaky coordinate animation test
Add debug info to failing verify. Change-Id: Ic5e81a70a6ee0bc488edab1b63b7b16840fc9fe9 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative_core/tst_coordinate.qml21
1 files changed, 9 insertions, 12 deletions
diff --git a/tests/auto/declarative_core/tst_coordinate.qml b/tests/auto/declarative_core/tst_coordinate.qml
index 79ff8d0a..9cb37195 100644
--- a/tests/auto/declarative_core/tst_coordinate.qml
+++ b/tests/auto/declarative_core/tst_coordinate.qml
@@ -255,14 +255,9 @@ Item {
function toMercator(coord)
{
- var pi = Math.PI
- var lon = coord.longitude / 360.0 + 0.5;
-
- var lat = coord.latitude;
- lat = 0.5 - (Math.log(Math.tan((pi / 4.0) + (pi / 2.0) * lat / 180.0)) / pi) / 2.0;
- lat = Math.max(0.0, lat);
- lat = Math.min(1.0, lat);
-
+ var p = QtPositioning.coordToMercator(coord)
+ var lat = p.y
+ var lon = p.x
return {'latitude': lat, 'longitude': lon};
}
@@ -280,6 +275,7 @@ Item {
tryCompare(coordinateAnimationStopSpy,"count",1)
//check correct start position
+ verify(coordinateItem.coordinateList.length != 0)
compare(coordinateItem.coordinateList[0], from)
//check correct end position
compare(coordinateItem.coordinateList[coordinateItem.coordinateList.length - 1],to)
@@ -297,16 +293,17 @@ Item {
//check that each step has moved in the right direction
if (lastLongitude) {
+ var errorMessage = "movingEast: " + movingEast + "; From: " + from + "; To: " + to + "; i: " + i + "; crdList: " + coordinateItem.coordinateList
if (movingEast) {
if (coordinate.longitude > 0 && lastLongitude < 0)
- verify(coordinate.longitude < lastLongitude + 360)
+ verify(coordinate.longitude < lastLongitude + 360, errorMessage)
else
- verify(coordinate.longitude < lastLongitude)
+ verify(coordinate.longitude < lastLongitude, errorMessage)
} else {
if (coordinate.longitude < 0 && lastLongitude > 0)
- verify(coordinate.longitude + 360 > lastLongitude)
+ verify(coordinate.longitude + 360 > lastLongitude, errorMessage)
else
- verify(coordinate.longitude > lastLongitude)
+ verify(coordinate.longitude > lastLongitude, errorMessage)
}
}
lastLongitude = coordinate.longitude