summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2015-10-19 12:13:15 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2015-10-20 13:54:20 -0700
commit00a1c2343abcdcfc222d26c9a579fc081fffff6a (patch)
tree3074fdd9e974904b20b899ab01e477b4f0b138c8 /test
parentc5b95032a5cb9d3c7c39a7a74656f33de1c68d6e (diff)
downloadqtlocation-mapboxgl-00a1c2343abcdcfc222d26c9a579fc081fffff6a.tar.gz
[core] Remove shape layers from the style (fixes #2405)
Diffstat (limited to 'test')
-rw-r--r--test/api/annotations.cpp29
1 files changed, 27 insertions, 2 deletions
diff --git a/test/api/annotations.cpp b/test/api/annotations.cpp
index 84cf259b03..0918d78931 100644
--- a/test/api/annotations.cpp
+++ b/test/api/annotations.cpp
@@ -120,7 +120,7 @@ TEST(Annotations, NonImmediateAdd) {
util::write_file("test/output/non_immediate_add.png", renderPNG(map));
}
-TEST(Annotations, Remove) {
+TEST(Annotations, RemovePoint) {
auto display = std::make_shared<mbgl::HeadlessDisplay>();
HeadlessView view(display, 1);
DefaultFileSource fileSource(nullptr);
@@ -133,7 +133,32 @@ TEST(Annotations, Remove) {
map.removeAnnotation(point);
- util::write_file("test/output/remove.png", renderPNG(map));
+ util::write_file("test/output/remove_point.png", renderPNG(map));
+}
+
+TEST(Annotations, RemoveShape) {
+ auto display = std::make_shared<mbgl::HeadlessDisplay>();
+ HeadlessView view(display, 1);
+ DefaultFileSource fileSource(nullptr);
+
+ AnnotationSegments segments = {{ {{ { 0, 0 }, { 45, 45 } }} }};
+
+ LineProperties lineProperties;
+ lineProperties.color = {{ 255, 0, 0, 1 }};
+ lineProperties.width = 5;
+
+ StyleProperties styleProperties;
+ styleProperties.set<LineProperties>(lineProperties);
+
+ Map map(view, fileSource, MapMode::Still);
+ map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"), "");
+ uint32_t shape = map.addShapeAnnotation(ShapeAnnotation(segments, styleProperties));
+
+ renderPNG(map);
+
+ map.removeAnnotation(shape);
+
+ util::write_file("test/output/remove_shape.png", renderPNG(map));
}
TEST(Annotations, SwitchStyle) {