diff options
author | Paolo Angelelli <paolo.angelelli@qt.io> | 2018-08-11 15:28:20 +0200 |
---|---|---|
committer | Paolo Angelelli <paolo.angelelli@qt.io> | 2018-08-20 10:52:50 +0000 |
commit | 367c49e91366aa9b13bc7d64209321168680841e (patch) | |
tree | 3c6dacaa42a0d97a2c651598bbb34c54eff073eb /tests/auto | |
parent | 0a9ef37972aed19ec4451d0a0e24bfacc56bded3 (diff) | |
download | qtlocation-367c49e91366aa9b13bc7d64209321168680841e.tar.gz |
Move management of QDeclarativeGeoMap camera data into QGeoMap
This patch makes QDeclarativeGeoMap always refer to QGeoMap
when it comes to setting and getting camera data properties.
The signal emission for each of these properties is also deferred
to the reception of QGeoMap::cameraDataChanged.
This patch also enable plugins to enforce tilt ranges per zoom,
updating the tilt value (as well as any other camera data value)
on their own.
Change-Id: Icc16645ea53fa2b53b33530f802ce390a2479d39
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/declarative_ui/tst_map.qml | 15 | ||||
-rw-r--r-- | tests/auto/geotestplugin/qgeotiledmap_test.cpp | 3 |
2 files changed, 10 insertions, 8 deletions
diff --git a/tests/auto/declarative_ui/tst_map.qml b/tests/auto/declarative_ui/tst_map.qml index 2d35fce0..6051a48e 100644 --- a/tests/auto/declarative_ui/tst_map.qml +++ b/tests/auto/declarative_ui/tst_map.qml @@ -239,6 +239,7 @@ Item { compare(mapPar.mapParameters.length, 1) + // Using toCoordinate, below, to verify the actual value of the center, and not what is in the map.center property center = mapPar.toCoordinate(Qt.point((mapPar.width - 1) / 2.0, (mapPar.height - 1) / 2.0)) fuzzyCompare(center.latitude, -33, 0.1) fuzzyCompare(center.longitude, -47, 0.1) @@ -253,19 +254,21 @@ Item { fuzzyCompare(center.latitude, -33, 0.1) fuzzyCompare(center.longitude, -47, 0.1) - testParameter.center = mapPar.center // map.center has not been affected as it lives in the Declarative Map + testParameter.center = mapPar.center // map.center has been affected as the Declarative Map has received the QGeoMap::cameraDataChanged signal mapPar.addMapParameter(testParameter) compare(mapPar.mapParameters.length, 1) center = mapPar.toCoordinate(Qt.point((mapPar.width - 1) / 2.0, (mapPar.height - 1) / 2.0)) - fuzzyCompare(center.latitude, 10, 0.1) - fuzzyCompare(center.longitude, 11, 0.1) + fuzzyCompare(center.latitude, -33, 0.1) + fuzzyCompare(center.longitude, -47, 0.1) - testParameter.center = QtPositioning.coordinate(-33.0, -47.0) + testParameter.center = QtPositioning.coordinate(-30.0, -40.0) center = mapPar.toCoordinate(Qt.point((mapPar.width - 1) / 2.0, (mapPar.height - 1) / 2.0)) - fuzzyCompare(center.latitude, -33, 0.1) - fuzzyCompare(center.longitude, -47, 0.1) + fuzzyCompare(center.latitude, -30, 0.1) + fuzzyCompare(center.longitude, -40, 0.1) + fuzzyCompare(mapPar.center.latitude, -30, 0.1) + fuzzyCompare(mapPar.center.longitude, -40, 0.1) mapPar.removeMapParameter(testParameter) compare(mapPar.mapParameters.length, 0) diff --git a/tests/auto/geotestplugin/qgeotiledmap_test.cpp b/tests/auto/geotestplugin/qgeotiledmap_test.cpp index 62abb313..c3d466ea 100644 --- a/tests/auto/geotestplugin/qgeotiledmap_test.cpp +++ b/tests/auto/geotestplugin/qgeotiledmap_test.cpp @@ -98,9 +98,8 @@ QGeoTiledMapTest::QGeoTiledMapTest(QGeoTiledMappingManagerEngine *engine, void QGeoTiledMapTest::onCameraCenter_testChanged(QGeoMapParameter *param, const char *propertyName) { - Q_D(QGeoTiledMapTest); if (strcmp(propertyName, "center") == 0) { - QGeoCameraData cameraData = d->m_cameraData; + QGeoCameraData cameraData = this->cameraData(); // Not testing for propertyName as this param has only one allowed property QGeoCoordinate newCenter = param->property(propertyName).value<QGeoCoordinate>(); cameraData.setCenter(newCenter); |