summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-06-16 17:31:52 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-06-17 11:38:04 -0700
commit2921127bdbe6cb7583c097675fe67416c8dff38e (patch)
treefc1243f56ab93eabaddfb3a979ddee31ebffc4a7 /test
parente2f52a1dd8020e8665c55650c75d4e5a5e1423a6 (diff)
downloadqtlocation-mapboxgl-2921127bdbe6cb7583c097675fe67416c8dff38e.tar.gz
[core] Avoid unnecessary work when a symbol annotation is updated
In particular, if only the geometry changes, don't cascade and recalculate the style.
Diffstat (limited to 'test')
-rw-r--r--test/api/annotations.cpp20
-rw-r--r--test/fixtures/annotations/update_icon/expected.pngbin2949 -> 2545 bytes
-rw-r--r--test/fixtures/annotations/update_point/expected.pngbin2504 -> 2554 bytes
3 files changed, 9 insertions, 11 deletions
diff --git a/test/api/annotations.cpp b/test/api/annotations.cpp
index abe3862f4e..5b588a9e5c 100644
--- a/test/api/annotations.cpp
+++ b/test/api/annotations.cpp
@@ -106,23 +106,21 @@ TEST(Annotations, NonImmediateAdd) {
test.checkRendering("non_immediate_add");
}
-TEST(Annotations, UpdateIcon) {
+TEST(Annotations, UpdateSymbolAnnotationGeometry) {
AnnotationTest test;
test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
- test.map.addAnnotationIcon("flipped_marker", namedMarker("default_marker.png"));
- test.map.addAnnotation(SymbolAnnotation { Point<double> { 0, 0 }, "flipped_marker" });
+ test.map.addAnnotationIcon("default_marker", namedMarker("default_marker.png"));
+ test.map.addAnnotationIcon("flipped_marker", namedMarker("flipped_marker.png"));
+ AnnotationID point = test.map.addAnnotation(SymbolAnnotation { Point<double> { 0, 0 }, "default_marker" });
test::render(test.map);
- test.map.removeAnnotationIcon("flipped_marker");
- test.map.addAnnotationIcon("flipped_marker", namedMarker("flipped_marker.png"));
- test.map.update(Update::Annotations);
-
- test.checkRendering("update_icon");
+ test.map.updateAnnotation(point, SymbolAnnotation { Point<double> { -10, 0 }, "default_marker" });
+ test.checkRendering("update_point");
}
-TEST(Annotations, UpdatePoint) {
+TEST(Annotations, UpdateSymbolAnnotationIcon) {
AnnotationTest test;
test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
@@ -132,8 +130,8 @@ TEST(Annotations, UpdatePoint) {
test::render(test.map);
- test.map.updateAnnotation(point, SymbolAnnotation { Point<double> { -10, 0 }, "flipped_marker" });
- test.checkRendering("update_point");
+ test.map.updateAnnotation(point, SymbolAnnotation { Point<double> { 0, 0 }, "flipped_marker" });
+ test.checkRendering("update_icon");
}
TEST(Annotations, RemovePoint) {
diff --git a/test/fixtures/annotations/update_icon/expected.png b/test/fixtures/annotations/update_icon/expected.png
index 3b6ca22747..408d681ede 100644
--- a/test/fixtures/annotations/update_icon/expected.png
+++ b/test/fixtures/annotations/update_icon/expected.png
Binary files differ
diff --git a/test/fixtures/annotations/update_point/expected.png b/test/fixtures/annotations/update_point/expected.png
index 02cf77df8d..30aa39e380 100644
--- a/test/fixtures/annotations/update_point/expected.png
+++ b/test/fixtures/annotations/update_point/expected.png
Binary files differ