summaryrefslogtreecommitdiff
path: root/test/api
diff options
context:
space:
mode:
authorChris Loer <chris.loer@gmail.com>2018-08-14 11:35:39 -0700
committerChris Loer <chris.loer@mapbox.com>2018-08-14 12:35:50 -0700
commit20f880ebec82bbd7553fc382400227efc0105bce (patch)
tree91ee58f2b554bb1a884ced122abb848bf6e23636 /test/api
parent9ecb0997effb006e88c25d6fbca2570c8ab51adc (diff)
downloadqtlocation-mapboxgl-20f880ebec82bbd7553fc382400227efc0105bce.tar.gz
[core] Fix querying for annotations near tile boundaries at high zoom.
Fixes issue #12472. This commit doesn't address the underlying issues that come from symbolAnnotationTree using a slightly lower precision coordinate system than the annotations themselves. Instead, it just puts a small padding around each tile when it queries for tile data, so that symbols right at the tile boundary will be included in both tiles. The rendering/querying code will take care of only displaying one instance. The padding is in global coordinates, so at higher zoom the padding will be larger in tile units -- this is consistent with precision loss also being greater at higher zoom.
Diffstat (limited to 'test/api')
-rw-r--r--test/api/annotations.test.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/api/annotations.test.cpp b/test/api/annotations.test.cpp
index 07257851ac..fea1f87106 100644
--- a/test/api/annotations.test.cpp
+++ b/test/api/annotations.test.cpp
@@ -59,6 +59,18 @@ TEST(Annotations, SymbolAnnotation) {
// }
}
+TEST(Annotations, SymbolAnnotationTileBoundary) {
+ // Almost exactly the same as SymbolAnnotation test above, but offset my fractions of a degree
+ // tests precision issue from https://github.com/mapbox/mapbox-gl-native/issues/12472
+ AnnotationTest test;
+
+ test.map.getStyle().loadJSON(util::read_file("test/fixtures/api/empty.json"));
+ test.map.addAnnotationImage(namedMarker("default_marker"));
+ test.map.addAnnotation(SymbolAnnotation { Point<double>(0.000000000000001, 0.00000000000001), "default_marker" });
+ test.map.setZoom(10);
+ test.checkRendering("point_annotation");
+}
+
TEST(Annotations, LineAnnotation) {
AnnotationTest test;
@@ -475,3 +487,4 @@ TEST(Annotations, ChangeMaxZoom) {
test.map.setZoom(test.map.getMaxZoom());
test.checkRendering("line_annotation_max_zoom");
}
+