diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2016-08-12 15:45:18 -0700 |
---|---|---|
committer | Jesse Bounds <jesse@rebounds.net> | 2016-08-12 15:45:18 -0700 |
commit | e147887e357f537a5c625fd3edda7b13d64142b3 (patch) | |
tree | b1dbb6be088d91bb785ec599a4f62112ae6a05ea /test | |
parent | 272ec0c30ba1b68db3b2b9ea76659ae0a489189f (diff) | |
download | qtlocation-mapboxgl-e147887e357f537a5c625fd3edda7b13d64142b3.tar.gz |
[core, android, ios, macos] Replaced getPointAnnotationsInBounds() w/ queryPointAnnotations() (#5165)
queryPointAnnotations() accepts a screen rectangle instead of a geographic bounding box, so marker hit testing works at the edges of a rotated, tilted map view.
Fixes #5151.
Diffstat (limited to 'test')
-rw-r--r-- | test/api/annotations.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/api/annotations.cpp b/test/api/annotations.cpp index a1e67b29c4..336e36ab99 100644 --- a/test/api/annotations.cpp +++ b/test/api/annotations.cpp @@ -217,9 +217,17 @@ TEST(Annotations, QueryRenderedFeatures) { test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json")); test.map.addAnnotationIcon("default_marker", namedMarker("default_marker.png")); test.map.addAnnotation(SymbolAnnotation { Point<double> { 0, 0 }, "default_marker" }); + test.map.addAnnotation(SymbolAnnotation { Point<double> { 0, 50 }, "default_marker" }); test::render(test.map); auto features = test.map.queryRenderedFeatures(test.map.pixelForLatLng({ 0, 0 })); EXPECT_EQ(features.size(), 1u); + EXPECT_TRUE(!!features[0].id); + EXPECT_EQ(*features[0].id, 0); + + auto features2 = test.map.queryRenderedFeatures(test.map.pixelForLatLng({ 50, 0 })); + EXPECT_EQ(features2.size(), 1); + EXPECT_TRUE(!!features2[0].id); + EXPECT_EQ(*features2[0].id, 1); } |