diff options
author | Łukasz Paczos <lukas.paczos@gmail.com> | 2019-03-25 14:22:35 +0100 |
---|---|---|
committer | Łukasz Paczos <lukasz.paczos@mapbox.com> | 2019-03-25 17:53:55 +0100 |
commit | 419bfbe0eb12db8144bc5361bcc90b419e28f429 (patch) | |
tree | e56aa357e26d5f22f660aeac1a6b9f0db1554159 /test | |
parent | 10114c85bba9c2c0e62aa6361b887717f9f05921 (diff) | |
download | qtlocation-mapboxgl-419bfbe0eb12db8144bc5361bcc90b419e28f429.tar.gz |
[core] harden fetching camera for bounds when padding is excessive
Diffstat (limited to 'test')
-rw-r--r-- | test/map/map.test.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/map/map.test.cpp b/test/map/map.test.cpp index c06fa53744..fc8a7bffba 100644 --- a/test/map/map.test.cpp +++ b/test/map/map.test.cpp @@ -151,6 +151,18 @@ TEST(Map, LatLngBoundsToCamera) { EXPECT_NEAR(*virtualCamera.zoom, 1.55467, 1e-5); } +TEST(Map, LatLngBoundsToCameraWithExcessivePadding) { + MapTest<> test; + + test.map.jumpTo(CameraOptions().withCenter(LatLng { 40.712730, -74.005953 }).withZoom(16.0)); + + LatLngBounds bounds = LatLngBounds::hull({15.68169,73.499857}, {53.560711, 134.77281}); + + CameraOptions virtualCamera = test.map.cameraForLatLngBounds(bounds, {500, 0, 1200, 0}); + ASSERT_TRUE(bounds.contains(*virtualCamera.center)); + EXPECT_NEAR(*virtualCamera.zoom, 16.0, 1e-5); +} + TEST(Map, LatLngBoundsToCameraWithBearing) { MapTest<> test; |