Commit 79b64b6f authored by Paolo Angelelli's avatar Paolo Angelelli Committed by Liang Qi
Browse files

Diagnose flaky coordinate animation test


Add debug info to failing verify.

Reviewed-by: default avatarAlex Blasche <alexander.blasche@qt.io>
(cherry picked from commit 7e35bd3a

)
Change-Id: Ib0a01a31c6e5ae1ebd81cc48d73e995c06770826
Reviewed-by: default avatarLiang Qi <liang.qi@qt.io>
Showing with 9 additions and 12 deletions
...@@ -255,14 +255,9 @@ Item { ...@@ -255,14 +255,9 @@ Item {
function toMercator(coord) function toMercator(coord)
{ {
var pi = Math.PI var p = QtPositioning.coordToMercator(coord)
var lon = coord.longitude / 360.0 + 0.5; var lat = p.y
var lon = p.x
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);
return {'latitude': lat, 'longitude': lon}; return {'latitude': lat, 'longitude': lon};
} }
...@@ -280,6 +275,7 @@ Item { ...@@ -280,6 +275,7 @@ Item {
tryCompare(coordinateAnimationStopSpy,"count",1) tryCompare(coordinateAnimationStopSpy,"count",1)
//check correct start position //check correct start position
verify(coordinateItem.coordinateList.length != 0)
compare(coordinateItem.coordinateList[0], from) compare(coordinateItem.coordinateList[0], from)
//check correct end position //check correct end position
compare(coordinateItem.coordinateList[coordinateItem.coordinateList.length - 1],to) compare(coordinateItem.coordinateList[coordinateItem.coordinateList.length - 1],to)
...@@ -297,16 +293,17 @@ Item { ...@@ -297,16 +293,17 @@ Item {
//check that each step has moved in the right direction //check that each step has moved in the right direction
if (lastLongitude) { if (lastLongitude) {
var errorMessage = "movingEast: " + movingEast + "; From: " + from + "; To: " + to + "; i: " + i + "; crdList: " + coordinateItem.coordinateList
if (movingEast) { if (movingEast) {
if (coordinate.longitude > 0 && lastLongitude < 0) if (coordinate.longitude > 0 && lastLongitude < 0)
verify(coordinate.longitude < lastLongitude + 360) verify(coordinate.longitude < lastLongitude + 360, errorMessage)
else else
verify(coordinate.longitude < lastLongitude) verify(coordinate.longitude < lastLongitude, errorMessage)
} else { } else {
if (coordinate.longitude < 0 && lastLongitude > 0) if (coordinate.longitude < 0 && lastLongitude > 0)
verify(coordinate.longitude + 360 > lastLongitude) verify(coordinate.longitude + 360 > lastLongitude, errorMessage)
else else
verify(coordinate.longitude > lastLongitude) verify(coordinate.longitude > lastLongitude, errorMessage)
} }
} }
lastLongitude = coordinate.longitude lastLongitude = coordinate.longitude
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment