summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2017-06-06 16:01:17 +0200
committerPaolo Angelelli <paolo.angelelli@qt.io>2017-08-03 10:33:14 +0000
commite92bf21dfb0de4595a39e172fdbdc16b8ae8579c (patch)
treec777804dd0918825127a323fe68bb8fc3187e886 /tests
parent61776400fe4b18a62fd9b4880fc1e799cf0f2cde (diff)
downloadqtlocation-e92bf21dfb0de4595a39e172fdbdc16b8ae8579c.tar.gz
Add alignCoordinateToPoint method
This method effectively extends the functionalities offered by the center qml property, allowing to set a coordinate to an item position other than the center of the item. This is useful in those applications where the center of the scene (e.g., a cursor) is not to be place exactly in the center of the map. [ChangeLog][QtLocation][QDeclarativeGeoMap] Added alignCoordinateToPoint method to QDeclarativeGeoMap. Change-Id: I68a3d12e8376b83c4c1775a3af5e2125d3e71d63 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative_ui/tst_map.qml26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/declarative_ui/tst_map.qml b/tests/auto/declarative_ui/tst_map.qml
index 18d7c2d3..755da268 100644
--- a/tests/auto/declarative_ui/tst_map.qml
+++ b/tests/auto/declarative_ui/tst_map.qml
@@ -542,6 +542,32 @@ Item {
mapTiltBearing.tilt = 25.0
}
+ function test_map_align_coordinate_to_point()
+ {
+ var zeroCoord = QtPositioning.coordinate(0,0)
+ mapTiltBearing.bearing = 0.0
+ mapTiltBearing.tilt = 0.0
+ mapTiltBearing.zoomLevel = 3
+ mapTiltBearing.center = zeroCoord
+ compare(mapTiltBearing.bearing, 0.0)
+ compare(mapTiltBearing.tilt, 0.0)
+ compare(mapTiltBearing.zoomLevel, 3)
+ compare(mapTiltBearing.center, zeroCoord)
+
+ var coord = QtPositioning.coordinate(20,-20)
+ var point = Qt.point(400, 400)
+ mapTiltBearing.alignCoordinateToPoint(coord, point)
+ var coordAfter = mapTiltBearing.toCoordinate(point)
+ compare(coord.latitude, coordAfter.latitude)
+ compare(coord.longitude, coordAfter.longitude)
+
+ // resetting
+ mapTiltBearing.center = coordinate1
+ mapTiltBearing.zoomLevel = 4
+ mapTiltBearing.bearing = 45.0
+ mapTiltBearing.tilt = 25.0
+ }
+
function test_coordinate_conversion()
{
wait(1000)