diff options
Diffstat (limited to 'test/fixtures/util.cpp')
-rw-r--r-- | test/fixtures/util.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/fixtures/util.cpp b/test/fixtures/util.cpp index c3ce1b7efb..8c46338817 100644 --- a/test/fixtures/util.cpp +++ b/test/fixtures/util.cpp @@ -1,5 +1,6 @@ #include "util.hpp" +#include <mbgl/map/map.hpp> #include <mbgl/platform/log.hpp> #include <mbgl/util/image.hpp> #include <mbgl/util/io.hpp> @@ -12,12 +13,21 @@ #pragma GCC diagnostic pop #include <csignal> +#include <future> #include <unistd.h> namespace mbgl { namespace test { +std::string getFileSourceRoot() { +#ifdef MBGL_ASSET_ZIP + return "test/fixtures/annotations/assets.zip"; +#else + return ""; +#endif +} + pid_t startServer(const char *executable) { int pipefd[2]; @@ -85,6 +95,14 @@ uint64_t crc64(const std::string& str) { return crc64(str.data(), str.size()); } +PremultipliedImage render(Map& map) { + std::promise<PremultipliedImage> promise; + map.renderStill([&](std::exception_ptr, PremultipliedImage&& image) { + promise.set_value(std::move(image)); + }); + return promise.get_future().get(); +} + void checkImage(const std::string& base, const PremultipliedImage& actual, double imageThreshold, |