diff options
-rw-r--r-- | test/fixtures/api/empty-zoomed.json | 6 | ||||
-rw-r--r-- | test/map/map.test.cpp | 15 |
2 files changed, 21 insertions, 0 deletions
diff --git a/test/fixtures/api/empty-zoomed.json b/test/fixtures/api/empty-zoomed.json new file mode 100644 index 0000000000..02d8fca99e --- /dev/null +++ b/test/fixtures/api/empty-zoomed.json @@ -0,0 +1,6 @@ +{ + "version": 8, + "zoom": 0.5, + "sources": {}, + "layers": [] +} diff --git a/test/map/map.test.cpp b/test/map/map.test.cpp index 95d652f2af..98f8402706 100644 --- a/test/map/map.test.cpp +++ b/test/map/map.test.cpp @@ -160,6 +160,21 @@ TEST(Map, Offline) { NetworkStatus::Set(NetworkStatus::Status::Online); } +TEST(Map, SetStyleDefaultCamera) { + MapTest<> test; + test.map.getStyle().loadJSON(util::read_file("test/fixtures/api/empty.json")); + EXPECT_DOUBLE_EQ(test.map.getZoom(), 0.0); + EXPECT_DOUBLE_EQ(test.map.getPitch(), 0.0); + EXPECT_DOUBLE_EQ(test.map.getBearing(), 0.0); + EXPECT_EQ(test.map.getLatLng(), LatLng {}); + + test.map.getStyle().loadJSON(util::read_file("test/fixtures/api/empty-zoomed.json")); + EXPECT_DOUBLE_EQ(test.map.getZoom(), 0.0); + + test.map.jumpTo(test.map.getStyle().getDefaultCamera()); + EXPECT_DOUBLE_EQ(test.map.getZoom(), 0.5); +} + TEST(Map, SetStyleInvalidJSON) { Log::setObserver(std::make_unique<FixtureLogObserver>()); |