From 79b64b6f972d83e37af33e722454ae8e55af12e5 Mon Sep 17 00:00:00 2001 From: Paolo Angelelli Date: Sun, 10 Mar 2019 18:53:06 +0100 Subject: Diagnose flaky coordinate animation test Add debug info to failing verify. Reviewed-by: Alex Blasche (cherry picked from commit 7e35bd3a31341b9593134808b08ee8dee6951c10) Change-Id: Ib0a01a31c6e5ae1ebd81cc48d73e995c06770826 Reviewed-by: Liang Qi --- tests/auto/declarative_core/tst_coordinate.qml | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'tests') 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 -- cgit v1.2.3