diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2015-11-19 16:07:15 -0800 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2015-11-30 12:40:09 -0800 |
commit | 12fc9490065e1ddc2fada269a045cd2725a257f5 (patch) | |
tree | 17a91e9e04bf0f8b5241911ca776a17d9ae74b88 /test | |
parent | 48504baa9134020c57bb899f290557b4249a2d6d (diff) | |
download | qtlocation-mapboxgl-12fc9490065e1ddc2fada269a045cd2725a257f5.tar.gz |
[tests] Don't use icons from the style for annotations
Diffstat (limited to 'test')
-rw-r--r-- | test/api/annotations.cpp | 30 | ||||
-rw-r--r-- | test/fixtures/annotations/add_multiple/expected.png | bin | 4589 -> 2771 bytes | |||
-rw-r--r-- | test/fixtures/annotations/fill_annotation/expected.png | bin | 1543 -> 1538 bytes | |||
-rw-r--r-- | test/fixtures/annotations/line_annotation/expected.png | bin | 2412 -> 2088 bytes | |||
-rw-r--r-- | test/fixtures/annotations/non_immediate_add/expected.png | bin | 1543 -> 1538 bytes | |||
-rw-r--r-- | test/fixtures/annotations/point_annotation/expected.png | bin | 4273 -> 2594 bytes | |||
-rw-r--r-- | test/fixtures/annotations/switch_style/expected.png | bin | 4273 -> 2594 bytes | |||
-rw-r--r-- | test/fixtures/api/empty.json | 3 | ||||
-rw-r--r-- | test/fixtures/sprites/default_marker.png | bin | 0 -> 1010 bytes |
9 files changed, 14 insertions, 19 deletions
diff --git a/test/api/annotations.cpp b/test/api/annotations.cpp index ae9c804730..4c06b39e43 100644 --- a/test/api/annotations.cpp +++ b/test/api/annotations.cpp @@ -14,6 +14,11 @@ using namespace mbgl; +std::shared_ptr<SpriteImage> defaultMarker() { + PremultipliedImage image = decodeImage(util::read_file("test/fixtures/sprites/default_marker.png")); + return std::make_shared<SpriteImage>(image.width, image.height, 1.0, std::string(reinterpret_cast<char*>(image.data.get()), image.size())); +} + PremultipliedImage render(Map& map) { std::promise<PremultipliedImage> promise; map.renderStill([&](std::exception_ptr, PremultipliedImage&& image) { @@ -35,7 +40,8 @@ TEST(Annotations, PointAnnotation) { Map map(view, fileSource, MapMode::Still); map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"), ""); - map.addPointAnnotation(PointAnnotation({ 0, -20 }, "default_marker")); + map.setSprite("default_marker", defaultMarker()); + map.addPointAnnotation(PointAnnotation({ 0, 0 }, "default_marker")); checkRendering(map, "point_annotation"); } @@ -99,11 +105,12 @@ TEST(Annotations, AddMultiple) { Map map(view, fileSource, MapMode::Still); map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"), ""); - map.addPointAnnotation(PointAnnotation({ 0, -20 }, "default_marker")); + map.setSprite("default_marker", defaultMarker()); + map.addPointAnnotation(PointAnnotation({ 0, -10 }, "default_marker")); render(map); - map.addPointAnnotation(PointAnnotation({ 0, 20 }, "default_marker")); + map.addPointAnnotation(PointAnnotation({ 0, 10 }, "default_marker")); checkRendering(map, "add_multiple"); } @@ -135,6 +142,7 @@ TEST(Annotations, RemovePoint) { Map map(view, fileSource, MapMode::Still); map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"), ""); + map.setSprite("default_marker", defaultMarker()); uint32_t point = map.addPointAnnotation(PointAnnotation({ 0, 0 }, "default_marker")); render(map); @@ -185,7 +193,8 @@ TEST(Annotations, SwitchStyle) { Map map(view, fileSource, MapMode::Still); map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"), ""); - map.addPointAnnotation(PointAnnotation({ 0, -20 }, "default_marker")); + map.setSprite("default_marker", defaultMarker()); + map.addPointAnnotation(PointAnnotation({ 0, 0 }, "default_marker")); render(map); @@ -193,16 +202,3 @@ TEST(Annotations, SwitchStyle) { checkRendering(map, "switch_style"); } - -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")); - - checkRendering(map, "custom_icon"); -} diff --git a/test/fixtures/annotations/add_multiple/expected.png b/test/fixtures/annotations/add_multiple/expected.png Binary files differindex deedf84330..f77ddb0792 100644 --- a/test/fixtures/annotations/add_multiple/expected.png +++ b/test/fixtures/annotations/add_multiple/expected.png diff --git a/test/fixtures/annotations/fill_annotation/expected.png b/test/fixtures/annotations/fill_annotation/expected.png Binary files differindex 30f6f1eb59..09f48081a8 100644 --- a/test/fixtures/annotations/fill_annotation/expected.png +++ b/test/fixtures/annotations/fill_annotation/expected.png diff --git a/test/fixtures/annotations/line_annotation/expected.png b/test/fixtures/annotations/line_annotation/expected.png Binary files differindex 067027f1d1..b86570f990 100644 --- a/test/fixtures/annotations/line_annotation/expected.png +++ b/test/fixtures/annotations/line_annotation/expected.png diff --git a/test/fixtures/annotations/non_immediate_add/expected.png b/test/fixtures/annotations/non_immediate_add/expected.png Binary files differindex 30f6f1eb59..09f48081a8 100644 --- a/test/fixtures/annotations/non_immediate_add/expected.png +++ b/test/fixtures/annotations/non_immediate_add/expected.png diff --git a/test/fixtures/annotations/point_annotation/expected.png b/test/fixtures/annotations/point_annotation/expected.png Binary files differindex 33299a2d6a..21d38b2073 100644 --- a/test/fixtures/annotations/point_annotation/expected.png +++ b/test/fixtures/annotations/point_annotation/expected.png diff --git a/test/fixtures/annotations/switch_style/expected.png b/test/fixtures/annotations/switch_style/expected.png Binary files differindex 33299a2d6a..21d38b2073 100644 --- a/test/fixtures/annotations/switch_style/expected.png +++ b/test/fixtures/annotations/switch_style/expected.png diff --git a/test/fixtures/api/empty.json b/test/fixtures/api/empty.json index acc8a630ca..61a8fadcdb 100644 --- a/test/fixtures/api/empty.json +++ b/test/fixtures/api/empty.json @@ -1,6 +1,5 @@ { "version": 8, "sources": {}, - "layers": [], - "sprite": "asset://TEST_DATA/fixtures/resources/sprite" + "layers": [] } diff --git a/test/fixtures/sprites/default_marker.png b/test/fixtures/sprites/default_marker.png Binary files differnew file mode 100644 index 0000000000..b112096c18 --- /dev/null +++ b/test/fixtures/sprites/default_marker.png |