diff options
author | Thiago Marcos P. Santos <thiago@mapbox.com> | 2015-05-15 13:05:58 +0300 |
---|---|---|
committer | Thiago Marcos P. Santos <thiago@mapbox.com> | 2015-05-15 13:06:23 +0300 |
commit | b162fb7c6f8eb863334d3f9488716c0b1cd9c623 (patch) | |
tree | 9a5cc929b91e09509d7465a4d43c5acda4a8a407 /test | |
parent | f3c2093502389da1feacd41bfd20f32d2e84fb66 (diff) | |
download | qtlocation-mapboxgl-b162fb7c6f8eb863334d3f9488716c0b1cd9c623.tar.gz |
Make the MapContext object run on its own thread on the tests
The MapContext can only run on its own thread because it is
registering a EnvironmentScope and it is making many assertions
on Debug mode if its methods are being called on the Map thread.
Diffstat (limited to 'test')
-rw-r--r-- | test/miscellaneous/map_context.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/test/miscellaneous/map_context.cpp b/test/miscellaneous/map_context.cpp index 0b465aa3ce..95fbf7b9a5 100644 --- a/test/miscellaneous/map_context.cpp +++ b/test/miscellaneous/map_context.cpp @@ -1,22 +1,24 @@ #include "../fixtures/util.hpp" -#include <mbgl/util/run_loop.hpp> #include <mbgl/map/map_data.hpp> #include <mbgl/map/map_context.hpp> #include <mbgl/platform/default/headless_view.hpp> #include <mbgl/platform/default/headless_display.hpp> #include <mbgl/storage/default_file_source.hpp> +#include <mbgl/util/thread.hpp> using namespace mbgl; TEST(MapContext, DoubleStyleLoad) { - util::RunLoop runLoop(uv_default_loop()); std::shared_ptr<HeadlessDisplay> display = std::make_shared<HeadlessDisplay>(); HeadlessView view(display, 512, 512, 1); DefaultFileSource fileSource(nullptr); MapData data(view, MapMode::Continuous); - MapContext context(uv_default_loop(), view, fileSource, data); - context.setStyleJSON("", ""); - context.setStyleJSON("", ""); + std::unique_ptr<util::Thread<MapContext>> context( + util::make_unique<util::Thread<MapContext>>( + "Map", util::ThreadPriority::Regular, view, fileSource, data)); + + context->invokeSync(&MapContext::setStyleJSON, "", ""); + context->invokeSync(&MapContext::setStyleJSON, "", ""); } |