[core] Introduce mbgl::RendererState

This commit is contained in:
Bruno de Oliveira Abinader
2018-10-17 13:38:11 +02:00
parent b94be6e68f
commit ea51b11dcc
6 changed files with 64 additions and 0 deletions

View File

@@ -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;