summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative_geoshape/tst_locationsingleton.qml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/declarative_geoshape/tst_locationsingleton.qml')
-rw-r--r--tests/auto/declarative_geoshape/tst_locationsingleton.qml39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/auto/declarative_geoshape/tst_locationsingleton.qml b/tests/auto/declarative_geoshape/tst_locationsingleton.qml
index 6ebee62a..645aedb6 100644
--- a/tests/auto/declarative_geoshape/tst_locationsingleton.qml
+++ b/tests/auto/declarative_geoshape/tst_locationsingleton.qml
@@ -228,6 +228,10 @@ Item {
]
}
+ MapPolyline {
+ id: mapPolylineGeopath
+ }
+
TestCase {
name: "MapPolyline path"
function test_path_operations() {
@@ -274,4 +278,39 @@ Item {
compare(mapPolyline.path.length, mapPolyline.pathLength())
}
}
+
+ TestCase {
+ name: "GeoPath path"
+ function test_qgeopath_path_operations() {
+ var geopath = QtPositioning.path()
+
+ geopath.path = trace2
+ compare(geopath.path.length, trace2.length)
+
+ geopath.path = mapPolyline.path
+ compare(geopath.path.length, mapPolyline.pathLength())
+ compare(geopath.boundingGeoRectangle(), mapPolyline.geoShape.boundingGeoRectangle())
+
+ mapPolylineGeopath.path = mapPolyline.path
+ compare(mapPolylineGeopath.pathLength(), mapPolyline.pathLength())
+ compare(mapPolylineGeopath.geoShape.boundingGeoRectangle(), mapPolyline.geoShape.boundingGeoRectangle())
+
+ try {
+ var err = false;
+ mapPolylineGeopath.geoShape = geopath
+ } catch (e) {
+ if (e.message != 'Cannot assign to read-only property "geoShape"')
+ fail('Expected Cannot assign to read-only property "geoShape", got: ' + e.message);
+ err = true;
+ } finally {
+ verify(err, 'should throw Cannot assign to read-only property "geoShape"');
+ }
+
+ geopath.path = trace2
+ geopath.path[0].longitude = 11.0
+ compare(geopath.path.length, trace2.length)
+ compare(geopath.coordinateAt(0).latitude, trace2[0].latitude)
+ compare(geopath.coordinateAt(0).longitude, 11) // This fails
+ }
+ }
}