summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSudarsana Babu Nagineni <sudarsana.babu@mapbox.com>2019-03-27 11:43:40 +0200
committerSudarsana Babu Nagineni <sudarsana.babu@mapbox.com>2019-03-28 16:41:15 +0200
commitf5064e710884d5b822e59d05e51c127c8b3e852b (patch)
treecd7687f05c305a4d42fb96b426f904ea8151acf0 /test
parent1cc1d4ea08ae02c3cc9b4dd1474845456c17d1bc (diff)
downloadqtlocation-mapboxgl-f5064e710884d5b822e59d05e51c127c8b3e852b.tar.gz
[test] Add unit tests for MapOptions
Diffstat (limited to 'test')
-rw-r--r--test/map/map.test.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/map/map.test.cpp b/test/map/map.test.cpp
index c50b66efaf..d443b5eacc 100644
--- a/test/map/map.test.cpp
+++ b/test/map/map.test.cpp
@@ -321,6 +321,36 @@ TEST(Map, DefaultBoundOptions) {
EXPECT_EQ(*bounds.bounds, LatLngBounds::unbounded());
}
+TEST(Map, MapOptions) {
+ MapTest<> test { 1, MapMode::Continuous };
+
+ test.map.setNorthOrientation(NorthOrientation::Rightwards);
+ test.map.setConstrainMode(ConstrainMode::None);
+ test.map.setViewportMode(ViewportMode::FlippedY);
+ Size size = { 512, 512 };
+ test.map.setSize(size);
+
+ auto options = test.map.getMapOptions();
+ EXPECT_EQ(options.mapMode(), MapMode::Continuous);
+ EXPECT_EQ(options.viewportMode(), ViewportMode::FlippedY);
+ EXPECT_EQ(options.constrainMode(), ConstrainMode::None);
+ EXPECT_EQ(options.northOrientation(), NorthOrientation::Rightwards);
+ EXPECT_EQ(options.size(), size);
+}
+
+TEST(Map, DefaultMapOptions) {
+ MapTest<> test;
+
+ auto options = test.map.getMapOptions();
+ EXPECT_EQ(options.mapMode(), MapMode::Static);
+ EXPECT_EQ(options.viewportMode(), ViewportMode::Default);
+ EXPECT_EQ(options.constrainMode(), ConstrainMode::HeightOnly);
+ EXPECT_EQ(options.northOrientation(), NorthOrientation::Upwards);
+ EXPECT_TRUE(options.crossSourceCollisions());
+ EXPECT_EQ(options.size().width, 256);
+ EXPECT_EQ(options.size().height, 256);
+}
+
TEST(Map, SetStyleInvalidJSON) {
Log::setObserver(std::make_unique<FixtureLogObserver>());