From 00a1c2343abcdcfc222d26c9a579fc081fffff6a Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Mon, 19 Oct 2015 12:13:15 -0700 Subject: [core] Remove shape layers from the style (fixes #2405) --- test/api/annotations.cpp | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'test/api') 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(); 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(); + 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); + + 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) { -- cgit v1.2.1