diff options
Diffstat (limited to 'test/src')
-rw-r--r-- | test/src/mbgl/test/mock_view.hpp | 3 | ||||
-rw-r--r-- | test/src/mbgl/test/util.cpp | 14 |
2 files changed, 10 insertions, 7 deletions
diff --git a/test/src/mbgl/test/mock_view.hpp b/test/src/mbgl/test/mock_view.hpp index e608545da5..50ae466d19 100644 --- a/test/src/mbgl/test/mock_view.hpp +++ b/test/src/mbgl/test/mock_view.hpp @@ -18,10 +18,7 @@ public: void activate() override {}; void deactivate() override {}; - void notify() override {}; void invalidate() override {} - void beforeRender() override {} - void afterRender() override {} }; } diff --git a/test/src/mbgl/test/util.cpp b/test/src/mbgl/test/util.cpp index ca2282a4b5..4021fd89b1 100644 --- a/test/src/mbgl/test/util.cpp +++ b/test/src/mbgl/test/util.cpp @@ -5,6 +5,7 @@ #include <mbgl/util/image.hpp> #include <mbgl/util/io.hpp> #include <mbgl/util/chrono.hpp> +#include <mbgl/util/run_loop.hpp> #include <mapbox/pixelmatch.hpp> @@ -86,11 +87,16 @@ Server::~Server() { } PremultipliedImage render(Map& map) { - std::promise<PremultipliedImage> promise; - map.renderStill([&](std::exception_ptr, PremultipliedImage&& image) { - promise.set_value(std::move(image)); + PremultipliedImage result; + map.renderStill([&result](std::exception_ptr, PremultipliedImage&& image) { + result = std::move(image); }); - return promise.get_future().get(); + + while (!result.size()) { + util::RunLoop::Get()->runOnce(); + } + + return result; } void checkImage(const std::string& base, |