diff --git a/test/api/annotations.cpp b/test/api/annotations.cpp index a044d2f36..55f5ca674 100644 --- a/test/api/annotations.cpp +++ b/test/api/annotations.cpp @@ -2,6 +2,7 @@ #include #include +#include #include #include #include @@ -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(); + 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(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)); +} diff --git a/test/fixtures/headless/pois.json b/test/fixtures/headless/pois.json deleted file mode 100644 index a7fcfdb9d..000000000 --- a/test/fixtures/headless/pois.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "version": 8, - "name": "POIs", - "sources": { - "mapbox": { - "type": "vector", - "url": "asset://TEST_DATA/fixtures/tiles/streets.json" - } - }, - "layers": [{ - "id": "background", - "type": "background", - "paint": { - "background-color": "#CCCCCC" - } - }, { - "id": "pois", - "type": "symbol", - "source": "mapbox", - "source-layer": "poi_label", - "filter": ["in", "maki", "cafe", "bakery"], - "layout": { - "icon-image": "{maki}" - } - }] -} diff --git a/test/sprite/custom_sprites.cpp b/test/sprite/custom_sprites.cpp deleted file mode 100644 index 98d173ea2..000000000 --- a/test/sprite/custom_sprites.cpp +++ /dev/null @@ -1,61 +0,0 @@ -#include "../fixtures/util.hpp" -#include "../fixtures/fixture_log_observer.hpp" - -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include - -using namespace mbgl; - -TEST(Sprite, CustomSpriteImages) { - FixtureLog log; - - auto display = std::make_shared(); - HeadlessView view(display, 1); - view.resize(256, 256); - DefaultFileSource fileSource(nullptr); - - const auto style = util::read_file("test/fixtures/headless/pois.json"); - - Map map(view, fileSource, MapMode::Still); - - map.setLatLngZoom(LatLng{ 52.499167, 13.418056 }, 15); - - map.setStyleJSON(style, ""); - map.setSprite("cafe", - std::make_shared(12, 12, 1, std::string(12 * 12 * 4, '\xFF'))); - std::promise> promise; - map.renderStill([&promise](std::exception_ptr error, std::unique_ptr image) { - if (error) { - promise.set_exception(error); - } else { - promise.set_value(std::move(image)); - } - }); - auto result = promise.get_future().get(); - ASSERT_EQ(256, result->width); - ASSERT_EQ(256, result->height); - - EXPECT_EQ( - 21u, - log.count({ - EventSeverity::Info, Event::Sprite, int64_t(-1), "Can't find sprite named 'bakery'", - })); - - // const size_t bytes = result->width * result->height * 4; - // const auto hash = test::crc64(reinterpret_cast(result->pixels.get()), bytes); - // EXPECT_EQ(0xC40A4BCD76AEC564u, hash) << std::hex << hash; - - // const std::string png = util::compress_png(result->width, result->height, - // result->pixels.get()); - // util::write_file("test/fixtures/headless/1.actual.png", png); -} diff --git a/test/test.gypi b/test/test.gypi index 0d66b4c37..366326a3a 100644 --- a/test/test.gypi +++ b/test/test.gypi @@ -90,7 +90,6 @@ 'sprite/sprite_image.cpp', 'sprite/sprite_parser.cpp', 'sprite/sprite_store.cpp', - 'sprite/custom_sprites.cpp', ], 'libraries': [ '<@(gtest_static_libs)',