summaryrefslogtreecommitdiff
path: root/test/map/map.test.cpp
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2016-09-30 16:47:20 +0300
committerBruno de Oliveira Abinader <bruno@mapbox.com>2016-10-07 17:23:17 +0300
commit3b8b68d028934761b3b3d6ab8129e7b637fd14fe (patch)
tree456025203f13a70debd3485182283225435d55df /test/map/map.test.cpp
parent79a80630fd31381e5b339d5b1939aac54a363ca7 (diff)
downloadqtlocation-mapboxgl-3b8b68d028934761b3b3d6ab8129e7b637fd14fe.tar.gz
[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.
Diffstat (limited to 'test/map/map.test.cpp')
-rw-r--r--test/map/map.test.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/map/map.test.cpp b/test/map/map.test.cpp
index 12d4ff2bcd..5b66d9b753 100644
--- a/test/map/map.test.cpp
+++ b/test/map/map.test.cpp
@@ -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:", ".");