summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSudarsana Babu Nagineni <sudarsana.babu@mapbox.com>2019-03-26 00:00:37 +0200
committerSudarsana Babu Nagineni <sudarsana.babu@mapbox.com>2019-03-28 16:41:15 +0200
commit1cc1d4ea08ae02c3cc9b4dd1474845456c17d1bc (patch)
treed7de92e01ef1b1bf654ff8784534e534608a352f /test
parent11afef7825d622a237fa026e45e6d61b4de94068 (diff)
downloadqtlocation-mapboxgl-1cc1d4ea08ae02c3cc9b4dd1474845456c17d1bc.tar.gz
[core] Add setter/getter for size property in MapOptions
Diffstat (limited to 'test')
-rw-r--r--test/api/annotations.test.cpp4
-rw-r--r--test/api/api_misuse.test.cpp4
-rw-r--r--test/api/custom_geometry_source.test.cpp4
-rw-r--r--test/api/custom_layer.test.cpp4
-rw-r--r--test/api/query.test.cpp4
-rw-r--r--test/api/recycle_map.cpp4
-rw-r--r--test/gl/context.test.cpp4
-rw-r--r--test/map/map.test.cpp17
-rw-r--r--test/map/prefetch.test.cpp4
-rw-r--r--test/src/mbgl/test/map_adapter.hpp3
-rw-r--r--test/text/local_glyph_rasterizer.test.cpp4
-rw-r--r--test/util/memory.test.cpp12
12 files changed, 34 insertions, 34 deletions
diff --git a/test/api/annotations.test.cpp b/test/api/annotations.test.cpp
index 2a9737e10b..612c4f0ab8 100644
--- a/test/api/annotations.test.cpp
+++ b/test/api/annotations.test.cpp
@@ -32,8 +32,8 @@ public:
float pixelRatio { 1 };
HeadlessFrontend frontend { pixelRatio, threadPool };
- MapAdapter map { frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, std::make_shared<StubFileSource>(),
- threadPool, MapOptions().withMapMode(MapMode::Static)};
+ MapAdapter map { frontend, MapObserver::nullObserver(), pixelRatio, std::make_shared<StubFileSource>(),
+ threadPool, MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize())};
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 6fc04ab26f..17eb2de14b 100644
--- a/test/api/api_misuse.test.cpp
+++ b/test/api/api_misuse.test.cpp
@@ -25,9 +25,9 @@ TEST(API, RenderWithoutCallback) {
float pixelRatio { 1 };
HeadlessFrontend frontend { pixelRatio, threadPool };
- auto map = std::make_unique<MapAdapter>(frontend, MapObserver::nullObserver(), frontend.getSize(),
+ auto map = std::make_unique<MapAdapter>(frontend, MapObserver::nullObserver(),
pixelRatio, std::make_shared<StubFileSource>(), threadPool,
- MapOptions().withMapMode(MapMode::Static));
+ MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize()));
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 58af09c1ac..679291372d 100644
--- a/test/api/custom_geometry_source.test.cpp
+++ b/test/api/custom_geometry_source.test.cpp
@@ -23,8 +23,8 @@ TEST(CustomGeometrySource, Grid) {
auto threadPool = sharedThreadPool();
float pixelRatio { 1 };
HeadlessFrontend frontend { pixelRatio, *threadPool };
- Map map(frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, *threadPool,
- MapOptions().withMapMode(MapMode::Static),
+ Map map(frontend, MapObserver::nullObserver(), pixelRatio, *threadPool,
+ MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize()),
ResourceOptions().withCachePath(":memory:").withAssetPath("test/fixtures/api/assets"));
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 e16d2852ec..4f1429d637 100644
--- a/test/api/custom_layer.test.cpp
+++ b/test/api/custom_layer.test.cpp
@@ -93,8 +93,8 @@ TEST(CustomLayer, Basic) {
ThreadPool threadPool(4);
float pixelRatio { 1 };
HeadlessFrontend frontend { pixelRatio, threadPool };
- Map map(frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, threadPool,
- MapOptions().withMapMode(MapMode::Static),
+ Map map(frontend, MapObserver::nullObserver(), pixelRatio, threadPool,
+ MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize()),
ResourceOptions().withCachePath(":memory:").withAssetPath("test/fixtures/api/assets"));
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/query.test.cpp b/test/api/query.test.cpp
index b4297bfe82..0dd9882be2 100644
--- a/test/api/query.test.cpp
+++ b/test/api/query.test.cpp
@@ -38,8 +38,8 @@ public:
ThreadPool threadPool { 4 };
float pixelRatio { 1 };
HeadlessFrontend frontend { pixelRatio, threadPool };
- MapAdapter map { frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, fileSource,
- threadPool, MapOptions().withMapMode(MapMode::Static)};
+ MapAdapter map { frontend, MapObserver::nullObserver(), pixelRatio, fileSource,
+ threadPool, MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize())};
};
std::vector<Feature> getTopClusterFeature(QueryTest& test) {
diff --git a/test/api/recycle_map.cpp b/test/api/recycle_map.cpp
index 7d14bd14de..6f1560d463 100644
--- a/test/api/recycle_map.cpp
+++ b/test/api/recycle_map.cpp
@@ -27,9 +27,9 @@ TEST(API, RecycleMapUpdateImages) {
float pixelRatio { 1 };
HeadlessFrontend frontend { pixelRatio, threadPool };
- auto map = std::make_unique<MapAdapter>(frontend, MapObserver::nullObserver(), frontend.getSize(),
+ auto map = std::make_unique<MapAdapter>(frontend, MapObserver::nullObserver(),
pixelRatio, std::make_shared<StubFileSource>(), threadPool,
- MapOptions().withMapMode(MapMode::Static));
+ MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize()));
EXPECT_TRUE(map);
diff --git a/test/gl/context.test.cpp b/test/gl/context.test.cpp
index ff9b2ecac2..d9b2750a95 100644
--- a/test/gl/context.test.cpp
+++ b/test/gl/context.test.cpp
@@ -91,8 +91,8 @@ TEST(GLContextMode, Shared) {
HeadlessFrontend frontend { pixelRatio, threadPool, {}, GLContextMode::Shared };
- Map map(frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, threadPool,
- MapOptions().withMapMode(MapMode::Static),
+ Map map(frontend, MapObserver::nullObserver(), pixelRatio, threadPool,
+ MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize()),
ResourceOptions().withCachePath(":memory:").withAssetPath("test/fixtures/api/assets"));
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/map/map.test.cpp b/test/map/map.test.cpp
index fc8a7bffba..c50b66efaf 100644
--- a/test/map/map.test.cpp
+++ b/test/map/map.test.cpp
@@ -41,8 +41,8 @@ public:
MapTest(float pixelRatio = 1, MapMode mode = MapMode::Static)
: fileSource(std::make_shared<FileSource>())
, frontend(pixelRatio, threadPool)
- , map(frontend, observer, frontend.getSize(), pixelRatio,
- fileSource, threadPool, MapOptions().withMapMode(mode)) {}
+ , map(frontend, observer, pixelRatio,
+ fileSource, threadPool, MapOptions().withMapMode(mode).withSize(frontend.getSize())) {}
template <typename T = FileSource>
MapTest(const std::string& cachePath, const std::string& assetPath,
@@ -50,8 +50,8 @@ public:
typename std::enable_if<std::is_same<T, DefaultFileSource>::value>::type* = 0)
: fileSource(std::make_shared<T>(cachePath, assetPath))
, frontend(pixelRatio, threadPool)
- , map(frontend, observer, frontend.getSize(), pixelRatio,
- fileSource, threadPool, MapOptions().withMapMode(mode)) {}
+ , map(frontend, observer, pixelRatio,
+ fileSource, threadPool, MapOptions().withMapMode(mode).withSize(frontend.getSize())) {}
};
TEST(Map, RendererState) {
@@ -85,7 +85,7 @@ TEST(Map, RendererState) {
const ScreenCoordinate& point = test.frontend.pixelForLatLng(coordinate);
EXPECT_NEAR(coordinate.latitude(), latLng.latitude(), 1e-1);
EXPECT_NEAR(coordinate.longitude(), latLng.longitude(), 1e-1);
- const Size size = test.map.getSize();
+ const Size size = test.map.getMapOptions().size();
EXPECT_NEAR(point.x, size.width / 2.0, 1e-7);
EXPECT_NEAR(point.y, size.height / 2.0, 1e-7);
}
@@ -221,9 +221,10 @@ TEST(Map, CameraToLatLngBounds) {
test.map.jumpTo(CameraOptions().withCenter(LatLng { 45, 90 }).withZoom(16.0));
+ const Size size = test.map.getMapOptions().size();
LatLngBounds bounds = LatLngBounds::hull(
test.map.latLngForPixel({}),
- test.map.latLngForPixel({ double(test.map.getSize().width), double(test.map.getSize().height) }));
+ test.map.latLngForPixel({ double(size.width), double(size.height) }));
CameraOptions camera = test.map.getCameraOptions();
@@ -734,8 +735,8 @@ TEST(Map, TEST_DISABLED_ON_CI(ContinuousRendering)) {
});
};
- Map map(frontend, observer, frontend.getSize(), pixelRatio, threadPool,
- MapOptions().withMapMode(MapMode::Continuous),
+ Map map(frontend, observer, pixelRatio, threadPool,
+ MapOptions().withMapMode(MapMode::Continuous).withSize(frontend.getSize()),
ResourceOptions().withCachePath(":memory:").withAssetPath("test/fixtures/api/assets"));
map.getStyle().loadJSON(util::read_file("test/fixtures/api/water.json"));
diff --git a/test/map/prefetch.test.cpp b/test/map/prefetch.test.cpp
index 2830045983..520228e010 100644
--- a/test/map/prefetch.test.cpp
+++ b/test/map/prefetch.test.cpp
@@ -37,8 +37,8 @@ TEST(Map, PrefetchTiles) {
};
HeadlessFrontend frontend { { 512, 512 }, 1, threadPool };
- MapAdapter map(frontend, observer, frontend.getSize(), 1, fileSource, threadPool,
- MapOptions().withMapMode(MapMode::Continuous));
+ MapAdapter map(frontend, observer, 1, fileSource, threadPool,
+ MapOptions().withMapMode(MapMode::Continuous).withSize(frontend.getSize()));
std::vector<int> tiles;
diff --git a/test/src/mbgl/test/map_adapter.hpp b/test/src/mbgl/test/map_adapter.hpp
index e0fc449f48..67abea953d 100644
--- a/test/src/mbgl/test/map_adapter.hpp
+++ b/test/src/mbgl/test/map_adapter.hpp
@@ -12,12 +12,11 @@ class MapAdapter : public Map {
public:
explicit MapAdapter(RendererFrontend& frontend,
MapObserver& observer,
- Size size,
float ratio,
std::shared_ptr<FileSource> fileSource,
Scheduler& scheduler,
const MapOptions& options)
- : Map(std::make_unique<Map::Impl>(frontend, observer, scheduler, size, ratio, std::move(fileSource), options)) {}
+ : Map(std::make_unique<Map::Impl>(frontend, observer, scheduler, ratio, std::move(fileSource), options)) {}
};
} // namespace mbgl
diff --git a/test/text/local_glyph_rasterizer.test.cpp b/test/text/local_glyph_rasterizer.test.cpp
index a266021f25..ac272e2f9f 100644
--- a/test/text/local_glyph_rasterizer.test.cpp
+++ b/test/text/local_glyph_rasterizer.test.cpp
@@ -43,8 +43,8 @@ public:
ThreadPool threadPool { 4 };
float pixelRatio { 1 };
HeadlessFrontend frontend;
- MapAdapter map { frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, fileSource,
- threadPool, MapOptions().withMapMode(MapMode::Static)};
+ MapAdapter map { frontend, MapObserver::nullObserver(), pixelRatio, fileSource,
+ threadPool, MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize())};
void checkRendering(const char * name) {
test::checkImage(std::string("test/fixtures/local_glyphs/") + name,
diff --git a/test/util/memory.test.cpp b/test/util/memory.test.cpp
index c1ae597986..03545c648b 100644
--- a/test/util/memory.test.cpp
+++ b/test/util/memory.test.cpp
@@ -73,8 +73,8 @@ TEST(Memory, Vector) {
float ratio { 2 };
HeadlessFrontend frontend { { 256, 256 }, ratio, test.threadPool };
- MapAdapter map(frontend, MapObserver::nullObserver(), frontend.getSize(), ratio, test.fileSource,
- test.threadPool, MapOptions().withMapMode(MapMode::Static));
+ MapAdapter map(frontend, MapObserver::nullObserver(), ratio, test.fileSource,
+ test.threadPool, MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize()));
map.jumpTo(CameraOptions().withZoom(16));
map.getStyle().loadURL("mapbox://streets");
@@ -86,8 +86,8 @@ TEST(Memory, Raster) {
float ratio { 2 };
HeadlessFrontend frontend { { 256, 256 }, ratio, test.threadPool };
- MapAdapter map(frontend, MapObserver::nullObserver(), frontend.getSize(), ratio, test.fileSource,
- test.threadPool, MapOptions().withMapMode(MapMode::Static));
+ MapAdapter map(frontend, MapObserver::nullObserver(), ratio, test.fileSource,
+ test.threadPool, MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize()));
map.getStyle().loadURL("mapbox://satellite");
frontend.render(map);
@@ -124,8 +124,8 @@ TEST(Memory, Footprint) {
public:
FrontendAndMap(MemoryTest& test_, const char* style)
: frontend(Size{ 256, 256 }, 2, test_.threadPool)
- , map(frontend, MapObserver::nullObserver(), frontend.getSize(), 2, test_.fileSource
- , test_.threadPool, MapOptions().withMapMode(MapMode::Static)) {
+ , map(frontend, MapObserver::nullObserver(), 2, test_.fileSource
+ , test_.threadPool, MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize())) {
map.jumpTo(CameraOptions().withZoom(16));
map.getStyle().loadURL(style);
frontend.render(map);