summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2015-10-30 14:36:07 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2015-10-30 14:36:07 -0700
commita7219a77aaa4a0c60d7604c32cebfb017cde271a (patch)
tree2ee36fd8d2ac2e6c5c15160f48951a7325abe237 /test
parent557b8afb7c310a6330f741ca0f38fcec098f3156 (diff)
downloadqtlocation-mapboxgl-a7219a77aaa4a0c60d7604c32cebfb017cde271a.tar.gz
[core] Don't crash when removing a shape annotation whose layer was never created
Diffstat (limited to 'test')
-rw-r--r--test/api/annotations.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/api/annotations.cpp b/test/api/annotations.cpp
index a9667c4343..737c5314c6 100644
--- a/test/api/annotations.cpp
+++ b/test/api/annotations.cpp
@@ -164,6 +164,18 @@ TEST(Annotations, RemoveShape) {
util::write_file("test/output/remove_shape.png", renderPNG(map));
}
+TEST(Annotations, ImmediateRemoveShape) {
+ auto display = std::make_shared<mbgl::HeadlessDisplay>();
+ HeadlessView view(display, 1);
+ DefaultFileSource fileSource(nullptr);
+ Map map(view, fileSource, MapMode::Still);
+
+ map.removeAnnotation(map.addShapeAnnotation(ShapeAnnotation({}, {})));
+ map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"), "");
+
+ renderPNG(map);
+}
+
TEST(Annotations, SwitchStyle) {
auto display = std::make_shared<mbgl::HeadlessDisplay>();
HeadlessView view(display, 1);