summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2018-11-13 20:42:48 +0200
committerBruno de Oliveira Abinader <bruno@mapbox.com>2018-11-14 12:22:22 +0200
commitdb2e1b2e5fccd74ef8344ff70f04ea4e00b48d6b (patch)
tree38931822dff2458b420a3797c361ff6a8e6011c7 /test
parentd44be9a91bbb9d241eff72aa90beb4b12976c47f (diff)
downloadqtlocation-mapboxgl-db2e1b2e5fccd74ef8344ff70f04ea4e00b48d6b.tar.gz
[core] Add RendererState::{pixelForLatLng,latLngForPixel}
Diffstat (limited to 'test')
-rw-r--r--test/map/map.test.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/map/map.test.cpp b/test/map/map.test.cpp
index c57fe28ae5..690df6b3e9 100644
--- a/test/map/map.test.cpp
+++ b/test/map/map.test.cpp
@@ -79,6 +79,16 @@ TEST(Map, RendererState) {
ASSERT_DOUBLE_EQ(*options.pitch, pitchInDegrees);
EXPECT_NEAR(*options.angle, bearingInDegrees, 1e-7);
+ {
+ const LatLng& latLng = test.frontend.latLngForPixel(ScreenCoordinate { 0, 0 });
+ const ScreenCoordinate& point = test.frontend.pixelForLatLng(coordinate);
+ EXPECT_NEAR(coordinate.latitude(), latLng.latitude(), 1e-1);
+ EXPECT_NEAR(coordinate.longitude(), latLng.longitude(), 1e-1);
+ const Size size = test.map.getSize();
+ EXPECT_NEAR(point.x, size.width / 2.0, 1e-7);
+ EXPECT_NEAR(point.y, size.height / 2.0, 1e-7);
+ }
+
// RendererState::hasImage
test.map.getStyle().addImage(std::make_unique<style::Image>("default_marker", decodeImage(util::read_file("test/fixtures/sprites/default_marker.png")), 1.0));