summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2017-08-10 16:14:37 +0300
committerBruno de Oliveira Abinader <bruno@mapbox.com>2017-08-11 22:04:52 +0300
commitbd4441503f364020af286e62bdeb86f4475d5d0a (patch)
treef09f97b1cc9b5f613828613493f2fcd16d5b5c31 /test
parent6179e0f9c05d178b2475e54a49568b57d66b68ae (diff)
downloadqtlocation-mapboxgl-bd4441503f364020af286e62bdeb86f4475d5d0a.tar.gz
[test] Added Map.SetStyleDefaultCamera test
Diffstat (limited to 'test')
-rw-r--r--test/fixtures/api/empty-zoomed.json6
-rw-r--r--test/map/map.test.cpp15
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>());