summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2018-10-17 13:38:11 +0200
committerBruno de Oliveira Abinader <bruno@mapbox.com>2018-10-19 12:05:16 +0200
commitea51b11dccdc117c7dc43ffd3b3d0f969f59799f (patch)
treeb46c023ebe457cf0daebdd22abb42c1a4983c92f /test
parentb94be6e68f666410852aebd638782601162809d6 (diff)
downloadqtlocation-mapboxgl-ea51b11dccdc117c7dc43ffd3b3d0f969f59799f.tar.gz
[core] Introduce mbgl::RendererState
Diffstat (limited to 'test')
-rw-r--r--test/map/map.test.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/map/map.test.cpp b/test/map/map.test.cpp
index 88ddfa6cee..cd15c5c278 100644
--- a/test/map/map.test.cpp
+++ b/test/map/map.test.cpp
@@ -49,6 +49,34 @@ public:
}
};
+TEST(Map, RendererState) {
+ MapTest<> test;
+
+ // Map hasn't notified the frontend about an update yet.
+ CameraOptions nullOptions;
+ ASSERT_EQ(test.frontend.getCameraOptions(), nullOptions);
+
+ LatLng coordinate { 1, 1 };
+ double zoom = 12.0;
+ double pitchInDegrees = 45.0;
+ double bearingInDegrees = 30.0;
+
+ test.map.getStyle().loadJSON(util::read_file("test/fixtures/api/empty.json"));
+ test.map.setLatLngZoom(coordinate, zoom);
+ test.map.setPitch(pitchInDegrees);
+ test.map.setBearing(bearingInDegrees);
+
+ test.runLoop.runOnce();
+ test.frontend.render(test.map);
+
+ const CameraOptions& options = test.frontend.getCameraOptions();
+ EXPECT_NEAR(options.center->latitude(), coordinate.latitude(), 1e-7);
+ EXPECT_NEAR(options.center->longitude(), coordinate.longitude(), 1e-7);
+ ASSERT_DOUBLE_EQ(*options.zoom, zoom);
+ ASSERT_DOUBLE_EQ(*options.pitch, pitchInDegrees);
+ EXPECT_NEAR(*options.angle, bearingInDegrees, 1e-7);
+}
+
TEST(Map, LatLngBehavior) {
MapTest<> test;