summaryrefslogtreecommitdiff
path: root/test/api
diff options
context:
space:
mode:
Diffstat (limited to 'test/api')
-rw-r--r--test/api/annotations.test.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/api/annotations.test.cpp b/test/api/annotations.test.cpp
index b82a7adaca..dbe538024f 100644
--- a/test/api/annotations.test.cpp
+++ b/test/api/annotations.test.cpp
@@ -366,3 +366,35 @@ TEST(Annotations, QueryFractionalZoomLevels) {
EXPECT_EQ(features.size(), ids.size());
}
}
+
+TEST(Annotations, VisibleFeatures) {
+ AnnotationTest test;
+
+ auto viewSize = test.view.getSize();
+ auto box = ScreenBox { {}, { double(viewSize[0]), double(viewSize[1]) } };
+
+ test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
+ test.map.addAnnotationIcon("default_marker", namedMarker("default_marker.png"));
+ test.map.setZoom(3);
+
+ std::vector<mbgl::AnnotationID> ids;
+ for (int longitude = -5; longitude <= 5; ++longitude) {
+ for (int latitude = -5; latitude <= 5; ++latitude) {
+ ids.push_back(test.map.addAnnotation(SymbolAnnotation { { double(latitude), double(longitude) }, "default_marker" }));
+ }
+ }
+
+ // Change bearing *after* adding annotations cause them to be reordered,
+ // and some annotations become occluded by others.
+ test.map.setBearing(45);
+ test::render(test.map);
+
+ auto features = test.map.queryRenderedFeatures(box);
+ EXPECT_EQ(features.size(), ids.size());
+
+ test.map.setBearing(0);
+ test.map.setZoom(4);
+ test::render(test.map);
+ features = test.map.queryRenderedFeatures(box);
+ EXPECT_EQ(features.size(), ids.size());
+}