diff --git a/test/api/annotations.test.cpp b/test/api/annotations.test.cpp index 9e85a74c5..4c27c871a 100644 --- a/test/api/annotations.test.cpp +++ b/test/api/annotations.test.cpp @@ -16,9 +16,12 @@ using namespace mbgl; namespace { +PremultipliedImage namedImage(const std::string& name) { + return decodeImage(util::read_file("test/fixtures/sprites/" + name + ".png")); +} + std::unique_ptr namedMarker(const std::string& name) { - PremultipliedImage image = decodeImage(util::read_file("test/fixtures/sprites/" + name + ".png")); - return std::make_unique(name, std::move(image), 1.0); + return std::make_unique(name, namedImage(name), 1.0); } class AnnotationTest { @@ -319,6 +322,19 @@ TEST(Annotations, SwitchStyle) { test.checkRendering("switch_style"); } +TEST(Annotations, ReaddImage) { + AnnotationTest test; + + test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json")); + test.map.addAnnotationImage(namedMarker("default_marker")); + test.map.addAnnotation(SymbolAnnotation { Point { 0, 0 }, "default_marker" }); + + test::render(test.map, test.view); + + test.map.addAnnotationImage(std::make_unique("default_marker", namedImage("flipped_marker"), 1.0)); + test.checkRendering("readd_image"); +} + TEST(Annotations, QueryRenderedFeatures) { AnnotationTest test; diff --git a/test/fixtures/annotations/readd_image/expected.png b/test/fixtures/annotations/readd_image/expected.png new file mode 100644 index 000000000..3c4847f3a Binary files /dev/null and b/test/fixtures/annotations/readd_image/expected.png differ