From 6ba14c6d2a6b7eb325cd975393306c4fe6809acd Mon Sep 17 00:00:00 2001 From: Paolo Angelelli Date: Mon, 18 Sep 2017 11:43:29 +0200 Subject: Fix Map.fromCoordinate returning wrong values during tilting Task-number: QTBUG-63251 Change-Id: I7ceeeebb30007c5d97d61e057c8ec6e827177b19 Reviewed-by: Eskil Abrahamsen Blomfeldt --- tests/auto/declarative_ui/tst_map.qml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'tests') diff --git a/tests/auto/declarative_ui/tst_map.qml b/tests/auto/declarative_ui/tst_map.qml index c36ebc0e..8821f55e 100644 --- a/tests/auto/declarative_ui/tst_map.qml +++ b/tests/auto/declarative_ui/tst_map.qml @@ -72,6 +72,7 @@ Item { && coordinateMap.mapReady && mapTiltBearing.mapReady && mapTiltBearingHere.mapReady + && mapTestProjection.mapReady Map { id: mapZoomOnCompleted; width: 200; height: 200; zoomLevel: 3; center: coordinate1; plugin: testPlugin; @@ -113,6 +114,13 @@ Item { plugin: testPluginLazyParameter } + Map { + id: mapTestProjection + plugin: testPlugin + width: 200 + height: 200 + } + MapParameter { id: testParameter type: "cameraCenter_test" @@ -593,6 +601,20 @@ Item { coord = coordinateMap.toCoordinate(Qt.point(-5, -6)) verify(isNaN(coord.latitude)) verify(isNaN(coord.longitde)) + + // test with tilting + coord = QtPositioning.coordinate(45.6, 17.67) + var pos = mapTestProjection.fromCoordinate(coord, false) + compare(Math.floor(pos.x), 3339) + compare(Math.floor(pos.y), 1727) + mapTestProjection.tilt = 6 + pos = mapTestProjection.fromCoordinate(coord, false) + compare(Math.floor(pos.x), 11066) + compare(Math.floor(pos.y), 5577) + mapTestProjection.tilt = 12 + pos = mapTestProjection.fromCoordinate(coord, false) + verify(isNaN(pos.latitude)) + verify(isNaN(pos.longitde)) } } } -- cgit v1.2.1