summaryrefslogtreecommitdiff
path: root/test/api
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-08-27 15:26:15 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-08-29 08:08:44 -0700
commite126dc3a5a3857b24246432153b0554d630b6234 (patch)
tree55cfde3bb7ed61dba029537f030a4d43f2d4c9c2 /test/api
parentd9f63c6d76ff33dfbefa57eb124efe10d5c7592a (diff)
downloadqtlocation-mapboxgl-e126dc3a5a3857b24246432153b0554d630b6234.tar.gz
[core] Fix updates of line and fill annotations
Diffstat (limited to 'test/api')
-rw-r--r--test/api/annotations.cpp68
1 files changed, 68 insertions, 0 deletions
diff --git a/test/api/annotations.cpp b/test/api/annotations.cpp
index b6f861f900..5b9fe7502e 100644
--- a/test/api/annotations.cpp
+++ b/test/api/annotations.cpp
@@ -201,6 +201,74 @@ TEST(Annotations, UpdateSymbolAnnotationIcon) {
test.checkRendering("update_icon");
}
+TEST(Annotations, UpdateLineAnnotationGeometry) {
+ AnnotationTest test;
+
+ LineAnnotation annotation { LineString<double> {{ { 0, 0 }, { 45, 45 }, { 30, 0 } }} };
+ annotation.color = { { 255, 0, 0, 1 } };
+ annotation.width = { 5 };
+
+ test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
+ AnnotationID line = test.map.addAnnotation(annotation);
+
+ test::render(test.map);
+
+ annotation.geometry = LineString<double> {{ { 0, 0 }, { -45, -45 } }};
+ test.map.updateAnnotation(line, annotation);
+ test.checkRendering("update_line_geometry");
+}
+
+TEST(Annotations, UpdateLineAnnotationStyle) {
+ AnnotationTest test;
+
+ LineAnnotation annotation { LineString<double> {{ { 0, 0 }, { 45, 45 }, { 30, 0 } }} };
+ annotation.color = { { 255, 0, 0, 1 } };
+ annotation.width = { 5 };
+
+ test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
+ AnnotationID line = test.map.addAnnotation(annotation);
+
+ test::render(test.map);
+
+ annotation.color = { { 0, 255, 0, 1 } };
+ annotation.width = { 2 };
+ test.map.updateAnnotation(line, annotation);
+ test.checkRendering("update_line_style");
+}
+
+TEST(Annotations, UpdateFillAnnotationGeometry) {
+ AnnotationTest test;
+
+ FillAnnotation annotation { Polygon<double> {{ {{ { 0, 0 }, { 0, 45 }, { 45, 45 }, { 45, 0 } }} }} };
+ annotation.color = { { 255, 0, 0, 1 } };
+
+ test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
+ AnnotationID fill = test.map.addAnnotation(annotation);
+
+ test::render(test.map);
+
+ annotation.geometry = Polygon<double> {{ {{ { 0, 0 }, { 0, 45 }, { 45, 0 } }} }};
+ test.map.updateAnnotation(fill, annotation);
+ test.checkRendering("update_fill_geometry");
+}
+
+TEST(Annotations, UpdateFillAnnotationStyle) {
+ AnnotationTest test;
+
+ Polygon<double> polygon = {{ {{ { 0, 0 }, { 0, 45 }, { 45, 45 }, { 45, 0 } }} }};
+ FillAnnotation annotation { polygon };
+ annotation.color = { { 255, 0, 0, 1 } };
+
+ test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
+ AnnotationID fill = test.map.addAnnotation(annotation);
+
+ test::render(test.map);
+
+ annotation.color = { { 0, 255, 0, 1 } };
+ test.map.updateAnnotation(fill, annotation);
+ test.checkRendering("update_fill_style");
+}
+
TEST(Annotations, RemovePoint) {
AnnotationTest test;