diff options
author | Ander Conselvan de Oliveira <ander.deoliveira@mapbox.com> | 2019-03-08 12:43:05 +0200 |
---|---|---|
committer | Ander Conselvan de Oliveira <ander.deoliveira@mapbox.com> | 2019-03-14 18:33:11 +0200 |
commit | 57334407473a31ff43baa645dafd2f5e1bd910fb (patch) | |
tree | e981f87c0040799a1ebc45f86d05b3ece6916aba /test/map | |
parent | 11de777628e9e2c4b219bae3f1a6eabd86f2a3c5 (diff) | |
download | qtlocation-mapboxgl-57334407473a31ff43baa645dafd2f5e1bd910fb.tar.gz |
[core] Group Map LatLngBounds, min and max zoom methods
Group bounds, minimum and maximum zoom related methods together using
the new BoundOptions.
v2: Document that getBounds() initializes all optional fields.
- Add test for getBounds() on a map with default values.
Diffstat (limited to 'test/map')
-rw-r--r-- | test/map/map.test.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/map/map.test.cpp b/test/map/map.test.cpp index 0197202a9d..410a7e76af 100644 --- a/test/map/map.test.cpp +++ b/test/map/map.test.cpp @@ -282,6 +282,32 @@ TEST(Map, ProjectionMode) { EXPECT_EQ(*options.ySkew, 0.0); } +TEST(Map, BoundOptions) { + MapTest<> test; + + LatLngBounds llb = LatLngBounds::hull({-10, -10}, {10, 10}); + test.map.setBounds(BoundOptions().withMinZoom(4).withMaxZoom(10).withLatLngBounds(llb)); + auto bounds = test.map.getBounds(); + + EXPECT_EQ(*bounds.minZoom, 4); + EXPECT_EQ(*bounds.maxZoom, 10); + EXPECT_EQ(*bounds.bounds, llb); +} + +TEST(Map, DefaultBoundOptions) { + MapTest<> test; + + auto bounds = test.map.getBounds(); + + EXPECT_TRUE(bounds.minZoom); + EXPECT_TRUE(bounds.maxZoom); + EXPECT_TRUE(bounds.bounds); + + EXPECT_EQ(*bounds.minZoom, util::MIN_ZOOM); + EXPECT_EQ(*bounds.maxZoom, util::DEFAULT_MAX_ZOOM); + EXPECT_EQ(*bounds.bounds, LatLngBounds::unbounded()); +} + TEST(Map, SetStyleInvalidJSON) { Log::setObserver(std::make_unique<FixtureLogObserver>()); |