diff options
author | Paolo Angelelli <paolo.angelelli@qt.io> | 2019-03-10 18:53:06 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2019-04-10 11:51:33 +0000 |
commit | 79b64b6f972d83e37af33e722454ae8e55af12e5 (patch) | |
tree | 4175e773fecad5329f6724d408759a6843a397d1 /tests/auto/declarative_core/tst_coordinate.qml | |
parent | 01dca9ef9887109be8dfc550f8fa881e208535bf (diff) | |
download | qtlocation-79b64b6f972d83e37af33e722454ae8e55af12e5.tar.gz |
Diagnose flaky coordinate animation test
Add debug info to failing verify.
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit 7e35bd3a31341b9593134808b08ee8dee6951c10)
Change-Id: Ib0a01a31c6e5ae1ebd81cc48d73e995c06770826
Reviewed-by: Liang Qi <liang.qi@qt.io>
Diffstat (limited to 'tests/auto/declarative_core/tst_coordinate.qml')
-rw-r--r-- | tests/auto/declarative_core/tst_coordinate.qml | 21 |
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 |