Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/mbgl/map/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ void Map::moveBy(const ScreenCoordinate& point, const Duration& duration) {
}

void Map::setLatLng(const LatLng& latLng, const Duration& duration) {
setLatLng(latLng, ScreenCoordinate {}, duration);
setLatLng(latLng, optional<ScreenCoordinate> {}, duration);
}

void Map::setLatLng(const LatLng& latLng, optional<EdgeInsets> padding, const Duration& duration) {
Expand Down
16 changes: 16 additions & 0 deletions test/map/map.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:", ".");
Expand Down