From ce1d8561b49a913ff7a15f67747886f1cfc64440 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Fri, 12 Feb 2016 15:07:45 -0800 Subject: [tests] Add test for Map::updatePointAnnotation --- test/api/annotations.cpp | 24 ++++++++++++++++++--- test/fixtures/annotations/update_icon/expected.png | Bin 0 -> 2949 bytes .../fixtures/annotations/update_point/expected.png | Bin 2949 -> 2504 bytes 3 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 test/fixtures/annotations/update_icon/expected.png (limited to 'test') diff --git a/test/api/annotations.cpp b/test/api/annotations.cpp index 3e74d79d08..8e21b615a1 100644 --- a/test/api/annotations.cpp +++ b/test/api/annotations.cpp @@ -130,7 +130,7 @@ TEST(Annotations, NonImmediateAdd) { checkRendering(map, "non_immediate_add"); } -TEST(Annotations, UpdatePoint) { +TEST(Annotations, UpdateIcon) { auto display = std::make_shared(); HeadlessView view(display, 1); OnlineFileSource fileSource; @@ -146,6 +146,24 @@ TEST(Annotations, UpdatePoint) { map.addAnnotationIcon("flipped_marker", namedMarker("flipped_marker.png")); map.update(Update::Annotations); + checkRendering(map, "update_icon"); +} + +TEST(Annotations, UpdatePoint) { + auto display = std::make_shared(); + HeadlessView view(display, 1); + OnlineFileSource fileSource; + + Map map(view, fileSource, MapMode::Still); + map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"), ""); + map.addAnnotationIcon("default_marker", namedMarker("default_marker.png")); + map.addAnnotationIcon("flipped_marker", namedMarker("flipped_marker.png")); + AnnotationID point = map.addPointAnnotation(PointAnnotation({ 0, 0 }, "default_marker")); + + test::render(map); + + map.updatePointAnnotation(point, PointAnnotation({ 0, -10 }, "flipped_marker")); + checkRendering(map, "update_point"); } @@ -157,7 +175,7 @@ TEST(Annotations, RemovePoint) { Map map(view, fileSource, MapMode::Still); map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"), ""); map.addAnnotationIcon("default_marker", namedMarker("default_marker.png")); - uint32_t point = map.addPointAnnotation(PointAnnotation({ 0, 0 }, "default_marker")); + AnnotationID point = map.addPointAnnotation(PointAnnotation({ 0, 0 }, "default_marker")); test::render(map); @@ -179,7 +197,7 @@ TEST(Annotations, RemoveShape) { Map map(view, fileSource, MapMode::Still); map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"), ""); - uint32_t shape = map.addShapeAnnotation(ShapeAnnotation(segments, properties)); + AnnotationID shape = map.addShapeAnnotation(ShapeAnnotation(segments, properties)); test::render(map); diff --git a/test/fixtures/annotations/update_icon/expected.png b/test/fixtures/annotations/update_icon/expected.png new file mode 100644 index 0000000000..3b6ca22747 Binary files /dev/null and b/test/fixtures/annotations/update_icon/expected.png differ diff --git a/test/fixtures/annotations/update_point/expected.png b/test/fixtures/annotations/update_point/expected.png index 3b6ca22747..02cf77df8d 100644 Binary files a/test/fixtures/annotations/update_point/expected.png and b/test/fixtures/annotations/update_point/expected.png differ -- cgit v1.2.1