diff options
Diffstat (limited to 'test/api')
-rw-r--r-- | test/api/annotations.cpp | 9 | ||||
-rw-r--r-- | test/api/api_misuse.cpp | 3 | ||||
-rw-r--r-- | test/api/repeated_render.cpp | 27 |
3 files changed, 16 insertions, 23 deletions
diff --git a/test/api/annotations.cpp b/test/api/annotations.cpp index 55f5ca6749..b16ec71ef6 100644 --- a/test/api/annotations.cpp +++ b/test/api/annotations.cpp @@ -4,7 +4,6 @@ #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> #include <mbgl/platform/default/headless_view.hpp> #include <mbgl/storage/default_file_source.hpp> @@ -17,13 +16,11 @@ using namespace mbgl; std::string renderPNG(Map& map) { - std::promise<std::unique_ptr<const StillImage>> promise; - map.renderStill([&](std::exception_ptr, std::unique_ptr<const StillImage> image) { + std::promise<UnassociatedImage> promise; + map.renderStill([&](std::exception_ptr, UnassociatedImage&& image) { promise.set_value(std::move(image)); }); - - auto result = promise.get_future().get(); - return util::compress_png(result->width, result->height, result->pixels.get()); + return encodePNG(promise.get_future().get()); } TEST(Annotations, PointAnnotation) { diff --git a/test/api/api_misuse.cpp b/test/api/api_misuse.cpp index 1f54855323..4d5fe11042 100644 --- a/test/api/api_misuse.cpp +++ b/test/api/api_misuse.cpp @@ -2,7 +2,6 @@ #include "../fixtures/fixture_log_observer.hpp" #include <mbgl/map/map.hpp> -#include <mbgl/map/still_image.hpp> #include <mbgl/platform/default/headless_display.hpp> #include <mbgl/platform/default/headless_view.hpp> #include <mbgl/storage/default_file_source.hpp> @@ -46,7 +45,7 @@ TEST(API, RenderWithoutStyle) { Map map(view, fileSource, MapMode::Still); std::promise<std::exception_ptr> promise; - map.renderStill([&promise](std::exception_ptr error, std::unique_ptr<const StillImage>) { + map.renderStill([&promise](std::exception_ptr error, UnassociatedImage&&) { promise.set_value(error); }); diff --git a/test/api/repeated_render.cpp b/test/api/repeated_render.cpp index 3317b4e3a4..79349c67e7 100644 --- a/test/api/repeated_render.cpp +++ b/test/api/repeated_render.cpp @@ -2,7 +2,6 @@ #include "../fixtures/fixture_log_observer.hpp" #include <mbgl/map/map.hpp> -#include <mbgl/map/still_image.hpp> #include <mbgl/platform/default/headless_view.hpp> #include <mbgl/platform/default/headless_display.hpp> #include <mbgl/storage/default_file_source.hpp> @@ -26,28 +25,26 @@ TEST(API, RepeatedRender) { { map.setStyleJSON(style, ""); - std::promise<std::unique_ptr<const StillImage>> promise; - map.renderStill([&promise](std::exception_ptr, std::unique_ptr<const StillImage> image) { + std::promise<UnassociatedImage> promise; + map.renderStill([&promise](std::exception_ptr, UnassociatedImage&& image) { promise.set_value(std::move(image)); }); - auto result = promise.get_future().get(); - ASSERT_EQ(256, result->width); - ASSERT_EQ(512, result->height); - const std::string png = util::compress_png(result->width, result->height, result->pixels.get()); - util::write_file("test/fixtures/api/1.png", png); + auto result = std::move(promise.get_future().get()); + ASSERT_EQ(256, result.width); + ASSERT_EQ(512, result.height); + util::write_file("test/fixtures/api/1.png", encodePNG(result)); } { map.setStyleJSON(style, "TEST_DATA/suite"); - std::promise<std::unique_ptr<const StillImage>> promise; - map.renderStill([&promise](std::exception_ptr, std::unique_ptr<const StillImage> image) { + std::promise<UnassociatedImage> promise; + map.renderStill([&promise](std::exception_ptr, UnassociatedImage&& image) { promise.set_value(std::move(image)); }); - auto result = promise.get_future().get(); - ASSERT_EQ(256, result->width); - ASSERT_EQ(512, result->height); - const std::string png = util::compress_png(result->width, result->height, result->pixels.get()); - util::write_file("test/fixtures/api/2.png", png); + auto result = std::move(promise.get_future().get()); + ASSERT_EQ(256, result.width); + ASSERT_EQ(512, result.height); + util::write_file("test/fixtures/api/2.png", encodePNG(result)); } auto observer = Log::removeObserver(); |