summaryrefslogtreecommitdiff
path: root/test/map
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2017-06-28 14:23:39 +0300
committerBruno de Oliveira Abinader <bruno@mapbox.com>2017-06-28 20:59:56 +0300
commit433e54e636293eb3b6644c143866aa0d39198441 (patch)
treebb30e6d61d69880e4e3d723129f974ad00121750 /test/map
parenta35b268606b6becf218286036e4d1cfc22ddcaa3 (diff)
downloadqtlocation-mapboxgl-433e54e636293eb3b6644c143866aa0d39198441.tar.gz
[core] Clamp to scale boundaries in TransformState::setLatLngZoom
Diffstat (limited to 'test/map')
-rw-r--r--test/map/transform.test.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/map/transform.test.cpp b/test/map/transform.test.cpp
index aa49d250b6..6d41a868dc 100644
--- a/test/map/transform.test.cpp
+++ b/test/map/transform.test.cpp
@@ -28,6 +28,22 @@ TEST(Transform, InvalidZoom) {
ASSERT_DOUBLE_EQ(0, transform.getLatLng().latitude());
ASSERT_DOUBLE_EQ(0, transform.getLatLng().longitude());
ASSERT_DOUBLE_EQ(1, transform.getZoom());
+
+ transform.setZoom(transform.getState().getMaxZoom() + 0.1);
+ ASSERT_DOUBLE_EQ(transform.getZoom(), transform.getState().getMaxZoom());
+
+ CameraOptions cameraOptions;
+ cameraOptions.center = LatLng { util::LATITUDE_MAX, util::LONGITUDE_MAX };
+ cameraOptions.zoom = transform.getState().getMaxZoom();
+
+ // Executing flyTo with maximum zoom level to the same zoom level causes
+ // frameZoom to be bigger than maximum zoom.
+ transform.resize(Size { 100, 100 });
+ transform.flyTo(cameraOptions);
+ transform.updateTransitions(transform.getTransitionStart() + transform.getTransitionDuration());
+
+ ASSERT_TRUE(transform.getState().valid());
+ ASSERT_DOUBLE_EQ(transform.getState().getMaxZoom(), transform.getZoom());
}