summaryrefslogtreecommitdiff
path: root/test/api
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2015-11-18 15:16:57 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2015-11-18 16:29:18 -0800
commitf2772309feb394b7caeaea436e13ef45ba86a4e7 (patch)
tree985799a23214551ff9d5454c9ae4b2ce58ec67f0 /test/api
parentdb1c4f2cc2f57b5ea790cac09bd9923b5d86a0ce (diff)
downloadqtlocation-mapboxgl-f2772309feb394b7caeaea436e13ef45ba86a4e7.tar.gz
Rewrite CustomSpriteImages test
Previous test was invalid; Map::setSprite is only for annotations.
Diffstat (limited to 'test/api')
-rw-r--r--test/api/annotations.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/api/annotations.cpp b/test/api/annotations.cpp
index a044d2f36d..55f5ca6749 100644
--- a/test/api/annotations.cpp
+++ b/test/api/annotations.cpp
@@ -2,6 +2,7 @@
#include <mbgl/annotation/point_annotation.hpp>
#include <mbgl/annotation/shape_annotation.hpp>
+#include <mbgl/sprite/sprite_image.hpp>
#include <mbgl/map/map.hpp>
#include <mbgl/map/still_image.hpp>
#include <mbgl/platform/default/headless_display.hpp>
@@ -190,3 +191,16 @@ TEST(Annotations, SwitchStyle) {
util::write_file("test/output/switch_style.png", renderPNG(map));
}
+
+TEST(Annotations, CustomIcon) {
+ auto display = std::make_shared<mbgl::HeadlessDisplay>();
+ HeadlessView view(display, 1);
+ DefaultFileSource fileSource(nullptr);
+
+ Map map(view, fileSource, MapMode::Still);
+ map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"), "");
+ map.setSprite("cafe", std::make_shared<SpriteImage>(12, 12, 1, std::string(12 * 12 * 4, '\xFF')));
+ map.addPointAnnotation(PointAnnotation({ 0, 0 }, "cafe"));
+
+ util::write_file("test/output/custom_icon.png", renderPNG(map));
+}