diff options
author | Mike Morris <mikemorris@users.noreply.github.com> | 2016-10-12 17:28:22 -0400 |
---|---|---|
committer | Mike Morris <mikemorris@users.noreply.github.com> | 2016-10-20 14:37:36 -0400 |
commit | 817c26111a0d6650e7ebae73e46621626106d0a7 (patch) | |
tree | 60a5206f2f7658b06b214d9b7435a65a243d6e83 /test/api | |
parent | ab85fdb4524788ce7279e8ac362a0c1edbd5d5df (diff) | |
download | qtlocation-mapboxgl-817c26111a0d6650e7ebae73e46621626106d0a7.tar.gz |
[core] [node] pass thread pool impl to Map constructor
Updates mbgl::Map constructor usage everywhere
Adds NodeThreadPool implementation using AsyncQueue to call
Nan::AsyncQueueWorker from main thread
Diffstat (limited to 'test/api')
-rw-r--r-- | test/api/annotations.test.cpp | 4 | ||||
-rw-r--r-- | test/api/api_misuse.test.cpp | 7 | ||||
-rw-r--r-- | test/api/custom_layer.test.cpp | 5 | ||||
-rw-r--r-- | test/api/query.test.cpp | 4 | ||||
-rw-r--r-- | test/api/render_missing.test.cpp | 7 | ||||
-rw-r--r-- | test/api/repeated_render.test.cpp | 8 |
6 files changed, 26 insertions, 9 deletions
diff --git a/test/api/annotations.test.cpp b/test/api/annotations.test.cpp index 6d6734a10f..c1716a5228 100644 --- a/test/api/annotations.test.cpp +++ b/test/api/annotations.test.cpp @@ -1,6 +1,7 @@ #include <mbgl/test/util.hpp> #include <mbgl/test/stub_file_source.hpp> +#include <mbgl/platform/default/thread_pool.hpp> #include <mbgl/annotation/annotation.hpp> #include <mbgl/sprite/sprite_image.hpp> #include <mbgl/map/map.hpp> @@ -25,7 +26,8 @@ public: std::shared_ptr<HeadlessDisplay> display { std::make_shared<HeadlessDisplay>() }; HeadlessView view { display, 1 }; StubFileSource fileSource; - Map map { view, fileSource, MapMode::Still }; + ThreadPool threadPool { 4 }; + Map map { view, fileSource, threadPool, MapMode::Still }; void checkRendering(const char * name) { test::checkImage(std::string("test/fixtures/annotations/") + name, diff --git a/test/api/api_misuse.test.cpp b/test/api/api_misuse.test.cpp index e9fe307718..2016e278da 100644 --- a/test/api/api_misuse.test.cpp +++ b/test/api/api_misuse.test.cpp @@ -5,6 +5,7 @@ #include <mbgl/map/map.hpp> #include <mbgl/platform/default/headless_display.hpp> #include <mbgl/storage/online_file_source.hpp> +#include <mbgl/platform/default/thread_pool.hpp> #include <mbgl/util/exception.hpp> #include <mbgl/util/run_loop.hpp> @@ -22,8 +23,9 @@ TEST(API, RenderWithoutCallback) { HeadlessView view(display, 1); view.resize(128, 512); StubFileSource fileSource; + ThreadPool threadPool(4); - std::unique_ptr<Map> map = std::make_unique<Map>(view, fileSource, MapMode::Still); + std::unique_ptr<Map> map = std::make_unique<Map>(view, fileSource, threadPool, MapMode::Still); map->renderStill(nullptr); // Force Map thread to join. @@ -46,8 +48,9 @@ TEST(API, RenderWithoutStyle) { HeadlessView view(display, 1); view.resize(128, 512); StubFileSource fileSource; + ThreadPool threadPool(4); - Map map(view, fileSource, MapMode::Still); + Map map(view, fileSource, threadPool, MapMode::Still); std::exception_ptr error; map.renderStill([&](std::exception_ptr error_, PremultipliedImage&&) { diff --git a/test/api/custom_layer.test.cpp b/test/api/custom_layer.test.cpp index 2dded19256..1342dfa50c 100644 --- a/test/api/custom_layer.test.cpp +++ b/test/api/custom_layer.test.cpp @@ -4,6 +4,7 @@ #include <mbgl/map/map.hpp> #include <mbgl/platform/default/headless_display.hpp> #include <mbgl/platform/default/headless_view.hpp> +#include <mbgl/platform/default/thread_pool.hpp> #include <mbgl/storage/default_file_source.hpp> #include <mbgl/style/layers/custom_layer.hpp> #include <mbgl/style/layers/fill_layer.hpp> @@ -94,7 +95,9 @@ TEST(CustomLayer, Basic) { DefaultFileSource fileSource(":memory:", "test/fixtures/api/assets"); #endif - Map map(view, fileSource, MapMode::Still); + ThreadPool threadPool(4); + + Map map(view, fileSource, threadPool, MapMode::Still); map.setStyleJSON(util::read_file("test/fixtures/api/water.json")); map.setLatLngZoom({ 37.8, -122.5 }, 10); map.addLayer(std::make_unique<CustomLayer>( diff --git a/test/api/query.test.cpp b/test/api/query.test.cpp index 7da0f4311c..da38dd0cb2 100644 --- a/test/api/query.test.cpp +++ b/test/api/query.test.cpp @@ -1,6 +1,7 @@ #include <mbgl/map/map.hpp> #include <mbgl/platform/default/headless_display.hpp> #include <mbgl/platform/default/headless_view.hpp> +#include <mbgl/platform/default/thread_pool.hpp> #include <mbgl/sprite/sprite_image.hpp> #include <mbgl/test/stub_file_source.hpp> #include <mbgl/test/util.hpp> @@ -28,7 +29,8 @@ public: std::shared_ptr<HeadlessDisplay> display { std::make_shared<HeadlessDisplay>() }; HeadlessView view { display, 1 }; StubFileSource fileSource; - Map map { view, fileSource, MapMode::Still }; + ThreadPool threadPool { 4 }; + Map map { view, fileSource, threadPool, MapMode::Still }; }; } // end namespace diff --git a/test/api/render_missing.test.cpp b/test/api/render_missing.test.cpp index 024ebd3729..d57a5a98bd 100644 --- a/test/api/render_missing.test.cpp +++ b/test/api/render_missing.test.cpp @@ -2,8 +2,9 @@ #include <mbgl/test/fixture_log_observer.hpp> #include <mbgl/map/map.hpp> -#include <mbgl/platform/default/headless_view.hpp> #include <mbgl/platform/default/headless_display.hpp> +#include <mbgl/platform/default/headless_view.hpp> +#include <mbgl/platform/default/thread_pool.hpp> #include <mbgl/storage/default_file_source.hpp> #include <mbgl/util/image.hpp> #include <mbgl/util/io.hpp> @@ -33,9 +34,11 @@ TEST(API, TEST_REQUIRES_SERVER(RenderMissingTile)) { DefaultFileSource fileSource(":memory:", "test/fixtures/api/assets"); #endif + ThreadPool threadPool(4); + Log::setObserver(std::make_unique<FixtureLogObserver>()); - Map map(view, fileSource, MapMode::Still); + Map map(view, fileSource, threadPool, MapMode::Still); std::string message; diff --git a/test/api/repeated_render.test.cpp b/test/api/repeated_render.test.cpp index cf71cb8416..4229f9d7ad 100644 --- a/test/api/repeated_render.test.cpp +++ b/test/api/repeated_render.test.cpp @@ -2,8 +2,9 @@ #include <mbgl/test/fixture_log_observer.hpp> #include <mbgl/map/map.hpp> -#include <mbgl/platform/default/headless_view.hpp> #include <mbgl/platform/default/headless_display.hpp> +#include <mbgl/platform/default/headless_view.hpp> +#include <mbgl/platform/default/thread_pool.hpp> #include <mbgl/storage/default_file_source.hpp> #include <mbgl/util/image.hpp> #include <mbgl/util/io.hpp> @@ -20,6 +21,7 @@ TEST(API, RepeatedRender) { auto display = std::make_shared<mbgl::HeadlessDisplay>(); HeadlessView view(display, 1, 256, 512); + #ifdef MBGL_ASSET_ZIP // Regenerate with `cd test/fixtures/api/ && zip -r assets.zip assets/` DefaultFileSource fileSource(":memory:", "test/fixtures/api/assets.zip"); @@ -27,9 +29,11 @@ TEST(API, RepeatedRender) { DefaultFileSource fileSource(":memory:", "test/fixtures/api/assets"); #endif + ThreadPool threadPool(4); + Log::setObserver(std::make_unique<FixtureLogObserver>()); - Map map(view, fileSource, MapMode::Still); + Map map(view, fileSource, threadPool, MapMode::Still); { map.setStyleJSON(style); |