[core] Fix Map::setLatLng behavior

We were erroneously assigning a value to optional<ScreenCoordinate>
(null island), causing it to be a valid anchor for Transform::easeTo.
This commit is contained in:
Bruno de Oliveira Abinader
2016-09-30 16:47:20 +03:00
parent 79a80630fd
commit 3b8b68d028
2 changed files with 17 additions and 1 deletions

View File

@@ -26,6 +26,22 @@ struct MapTest {
StubFileSource fileSource;
};
TEST(Map, LatLngBehavior) {
MapTest test;
Map map(test.view, test.fileSource, MapMode::Still);
map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
map.setLatLngZoom({ 1, 1 }, 0);
auto latLng1 = map.getLatLng();
map.setLatLng({ 1, 1 });
auto latLng2 = map.getLatLng();
ASSERT_DOUBLE_EQ(latLng1.latitude, latLng2.latitude);
ASSERT_DOUBLE_EQ(latLng1.longitude, latLng2.longitude);
}
TEST(Map, Offline) {
MapTest test;
DefaultFileSource fileSource(":memory:", ".");