diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2015-09-01 15:07:17 +0300 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-04-14 13:44:08 -0700 |
commit | 204c7fee032bf8509747046b43a788366a189ae7 (patch) | |
tree | 8719b7ab8838bea52babd8bf42f2234ddc43dc9a /test/api/render_missing.cpp | |
parent | 18d8e80f52345a13236ae1da99b5866e7643f85b (diff) | |
download | qtlocation-mapboxgl-204c7fee032bf8509747046b43a788366a189ae7.tar.gz |
[core] Render from the main thread
Do not create a thread for the MapContext anymore.
Diffstat (limited to 'test/api/render_missing.cpp')
-rw-r--r-- | test/api/render_missing.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/test/api/render_missing.cpp b/test/api/render_missing.cpp index f29a0c2b9c..bb14416840 100644 --- a/test/api/render_missing.cpp +++ b/test/api/render_missing.cpp @@ -7,6 +7,7 @@ #include <mbgl/storage/default_file_source.hpp> #include <mbgl/util/image.hpp> #include <mbgl/util/io.hpp> +#include <mbgl/util/run_loop.hpp> #include <future> @@ -19,6 +20,8 @@ TEST(API, TEST_REQUIRES_SERVER(RenderMissingTile)) { using namespace mbgl; + util::RunLoop loop; + const auto style = util::read_file("test/fixtures/api/water_missing_tiles.json"); auto display = std::make_shared<mbgl::HeadlessDisplay>(); @@ -38,8 +41,7 @@ TEST(API, TEST_REQUIRES_SERVER(RenderMissingTile)) { // This host does not respond (== connection error). map.setStyleJSON(style, ""); - std::promise<void> promise; - map.renderStill([&promise, &message](std::exception_ptr err, PremultipliedImage&&) { + map.renderStill([&](std::exception_ptr err, PremultipliedImage&&) { ASSERT_TRUE(err.operator bool()); try { std::rethrow_exception(err); @@ -47,9 +49,10 @@ TEST(API, TEST_REQUIRES_SERVER(RenderMissingTile)) { message = ex.what(); EXPECT_TRUE(message.find("connect") != std::string::npos); } - promise.set_value(); + loop.stop(); }); - promise.get_future().get(); + + loop.run(); auto observer = Log::removeObserver(); auto flo = dynamic_cast<FixtureLogObserver*>(observer.get()); |