summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2017-09-18 11:43:29 +0200
committerPaolo Angelelli <paolo.angelelli@qt.io>2017-09-21 14:47:50 +0000
commit6ba14c6d2a6b7eb325cd975393306c4fe6809acd (patch)
tree7b8dfe8188eed611b746a0357a1ef4fb2e07942f /tests
parenteb3812884d63ffc014f4ac76214e65a6497ae827 (diff)
downloadqtlocation-6ba14c6d2a6b7eb325cd975393306c4fe6809acd.tar.gz
Fix Map.fromCoordinate returning wrong values during tilting
Task-number: QTBUG-63251 Change-Id: I7ceeeebb30007c5d97d61e057c8ec6e827177b19 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative_ui/tst_map.qml22
1 files changed, 22 insertions, 0 deletions
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))
}
}
}