summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-02-12 15:07:45 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-02-12 16:47:24 -0800
commitce1d8561b49a913ff7a15f67747886f1cfc64440 (patch)
treec434c863e6701bf7757dd96466e465e8f91b7a8e /test
parentd742c2d3eb3b8f669f0df9c6e5f6596eaf8fb616 (diff)
downloadqtlocation-mapboxgl-ce1d8561b49a913ff7a15f67747886f1cfc64440.tar.gz
[tests] Add test for Map::updatePointAnnotation
Diffstat (limited to 'test')
-rw-r--r--test/api/annotations.cpp24
-rw-r--r--test/fixtures/annotations/update_icon/expected.pngbin0 -> 2949 bytes
-rw-r--r--test/fixtures/annotations/update_point/expected.pngbin2949 -> 2504 bytes
3 files changed, 21 insertions, 3 deletions
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<mbgl::HeadlessDisplay>();
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<mbgl::HeadlessDisplay>();
+ 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
--- /dev/null
+++ b/test/fixtures/annotations/update_icon/expected.png
Binary files differ
diff --git a/test/fixtures/annotations/update_point/expected.png b/test/fixtures/annotations/update_point/expected.png
index 3b6ca22747..02cf77df8d 100644
--- a/test/fixtures/annotations/update_point/expected.png
+++ b/test/fixtures/annotations/update_point/expected.png
Binary files differ