diff options
author | Sudarsana Babu Nagineni <sudarsana.babu@mapbox.com> | 2019-03-07 14:29:19 +0200 |
---|---|---|
committer | Sudarsana Babu Nagineni <sudarsana.babu@mapbox.com> | 2019-03-08 18:20:55 +0200 |
commit | 5e2b6bf636472a4464e6ab3ae0d9d01c68de041b (patch) | |
tree | d4a924f2ac4174a034448388fb65b033b801a83d /test/api | |
parent | c4115f0539be1834db40b318eb4ebb9e27d1eafb (diff) | |
download | qtlocation-mapboxgl-5e2b6bf636472a4464e6ab3ae0d9d01c68de041b.tar.gz |
[core] Add MapOptions to define properties of Map
To simplify the Map constructor, introduce MapOptions
interface to define the properties that can be set on
a Map.
Diffstat (limited to 'test/api')
-rw-r--r-- | test/api/annotations.test.cpp | 4 | ||||
-rw-r--r-- | test/api/api_misuse.test.cpp | 4 | ||||
-rw-r--r-- | test/api/custom_geometry_source.test.cpp | 3 | ||||
-rw-r--r-- | test/api/custom_layer.test.cpp | 3 | ||||
-rw-r--r-- | test/api/query.test.cpp | 3 | ||||
-rw-r--r-- | test/api/recycle_map.cpp | 4 |
6 files changed, 15 insertions, 6 deletions
diff --git a/test/api/annotations.test.cpp b/test/api/annotations.test.cpp index 8d2dae177b..a81d9ff990 100644 --- a/test/api/annotations.test.cpp +++ b/test/api/annotations.test.cpp @@ -6,6 +6,7 @@ #include <mbgl/style/style.hpp> #include <mbgl/style/image.hpp> #include <mbgl/map/map.hpp> +#include <mbgl/map/map_options.hpp> #include <mbgl/util/io.hpp> #include <mbgl/util/run_loop.hpp> #include <mbgl/util/color.hpp> @@ -31,8 +32,9 @@ public: ThreadPool threadPool { 4 }; float pixelRatio { 1 }; HeadlessFrontend frontend { pixelRatio, fileSource, threadPool }; + Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, fileSource, - threadPool, MapMode::Static}; + threadPool, MapOptions().withMapMode(MapMode::Static)}; 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 363958451b..8899173071 100644 --- a/test/api/api_misuse.test.cpp +++ b/test/api/api_misuse.test.cpp @@ -3,6 +3,7 @@ #include <mbgl/test/fixture_log_observer.hpp> #include <mbgl/map/map.hpp> +#include <mbgl/map/map_options.hpp> #include <mbgl/renderer/backend_scope.hpp> #include <mbgl/gl/headless_frontend.hpp> #include <mbgl/storage/online_file_source.hpp> @@ -27,7 +28,8 @@ TEST(API, RenderWithoutCallback) { HeadlessFrontend frontend { pixelRatio, fileSource, threadPool }; auto map = std::make_unique<Map>(frontend, MapObserver::nullObserver(), frontend.getSize(), - pixelRatio, fileSource, threadPool, MapMode::Static); + pixelRatio, fileSource, threadPool, + MapOptions().withMapMode(MapMode::Static)); map->renderStill(nullptr); // Force Map thread to join. diff --git a/test/api/custom_geometry_source.test.cpp b/test/api/custom_geometry_source.test.cpp index 3e18cca01a..4eeca9104b 100644 --- a/test/api/custom_geometry_source.test.cpp +++ b/test/api/custom_geometry_source.test.cpp @@ -1,6 +1,7 @@ #include <mbgl/test/util.hpp> #include <mbgl/map/map.hpp> +#include <mbgl/map/map_options.hpp> #include <mbgl/util/shared_thread_pool.hpp> #include <mbgl/storage/default_file_source.hpp> #include <mbgl/gl/headless_frontend.hpp> @@ -24,7 +25,7 @@ TEST(CustomGeometrySource, Grid) { float pixelRatio { 1 }; HeadlessFrontend frontend { pixelRatio, fileSource, *threadPool }; Map map(frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, fileSource, - *threadPool, MapMode::Static); + *threadPool, MapOptions().withMapMode(MapMode::Static)); map.getStyle().loadJSON(util::read_file("test/fixtures/api/water.json")); map.jumpTo(CameraOptions().withCenter(LatLng { 37.8, -122.5 }).withZoom(10.0)); diff --git a/test/api/custom_layer.test.cpp b/test/api/custom_layer.test.cpp index 114b88398a..d840925206 100644 --- a/test/api/custom_layer.test.cpp +++ b/test/api/custom_layer.test.cpp @@ -2,6 +2,7 @@ #include <mbgl/platform/gl_functions.hpp> #include <mbgl/map/map.hpp> +#include <mbgl/map/map_options.hpp> #include <mbgl/util/default_thread_pool.hpp> #include <mbgl/storage/default_file_source.hpp> #include <mbgl/gl/defines.hpp> @@ -94,7 +95,7 @@ TEST(CustomLayer, Basic) { float pixelRatio { 1 }; HeadlessFrontend frontend { pixelRatio, fileSource, threadPool }; Map map(frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, fileSource, - threadPool, MapMode::Static); + threadPool, MapOptions().withMapMode(MapMode::Static)); map.getStyle().loadJSON(util::read_file("test/fixtures/api/water.json")); map.jumpTo(CameraOptions().withCenter(LatLng { 37.8, -122.5 }).withZoom(10.0)); map.getStyle().addLayer(std::make_unique<CustomLayer>( diff --git a/test/api/query.test.cpp b/test/api/query.test.cpp index efda84baa9..b9fc3a4a62 100644 --- a/test/api/query.test.cpp +++ b/test/api/query.test.cpp @@ -1,4 +1,5 @@ #include <mbgl/map/map.hpp> +#include <mbgl/map/map_options.hpp> #include <mbgl/util/default_thread_pool.hpp> #include <mbgl/test/stub_file_source.hpp> #include <mbgl/test/util.hpp> @@ -37,7 +38,7 @@ public: float pixelRatio { 1 }; HeadlessFrontend frontend { pixelRatio, fileSource, threadPool }; Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, fileSource, - threadPool, MapMode::Static}; + threadPool, MapOptions().withMapMode(MapMode::Static)}; }; std::vector<Feature> getTopClusterFeature(QueryTest& test) { diff --git a/test/api/recycle_map.cpp b/test/api/recycle_map.cpp index fc7e5223ec..0883241274 100644 --- a/test/api/recycle_map.cpp +++ b/test/api/recycle_map.cpp @@ -3,6 +3,7 @@ #include <mbgl/gl/headless_frontend.hpp> #include <mbgl/map/map.hpp> +#include <mbgl/map/map_options.hpp> #include <mbgl/renderer/backend_scope.hpp> #include <mbgl/storage/online_file_source.hpp> #include <mbgl/style/layers/symbol_layer.hpp> @@ -29,7 +30,8 @@ TEST(API, RecycleMapUpdateImages) { HeadlessFrontend frontend { pixelRatio, fileSource, threadPool }; auto map = std::make_unique<Map>(frontend, MapObserver::nullObserver(), frontend.getSize(), - pixelRatio, fileSource, threadPool, MapMode::Static); + pixelRatio, fileSource, threadPool, + MapOptions().withMapMode(MapMode::Static)); EXPECT_TRUE(map); |