diff options
author | Sudarsana Babu Nagineni <sudarsana.babu@mapbox.com> | 2019-03-26 00:00:37 +0200 |
---|---|---|
committer | Sudarsana Babu Nagineni <sudarsana.babu@mapbox.com> | 2019-03-28 16:41:15 +0200 |
commit | 1cc1d4ea08ae02c3cc9b4dd1474845456c17d1bc (patch) | |
tree | d7de92e01ef1b1bf654ff8784534e534608a352f /test/map | |
parent | 11afef7825d622a237fa026e45e6d61b4de94068 (diff) | |
download | qtlocation-mapboxgl-1cc1d4ea08ae02c3cc9b4dd1474845456c17d1bc.tar.gz |
[core] Add setter/getter for size property in MapOptions
Diffstat (limited to 'test/map')
-rw-r--r-- | test/map/map.test.cpp | 17 | ||||
-rw-r--r-- | test/map/prefetch.test.cpp | 4 |
2 files changed, 11 insertions, 10 deletions
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; |