summaryrefslogtreecommitdiff
path: root/test/map
diff options
context:
space:
mode:
authorSudarsana Babu Nagineni <sudarsana.babu@mapbox.com>2019-03-27 19:17:04 +0200
committerSudarsana Babu Nagineni <sudarsana.babu@mapbox.com>2019-03-28 16:41:15 +0200
commit7af00a404f22742fed4a83e9a36d023d7515025f (patch)
treeac050d12346d81030969f88607dbfd59ca33be11 /test/map
parentf5064e710884d5b822e59d05e51c127c8b3e852b (diff)
downloadqtlocation-mapboxgl-7af00a404f22742fed4a83e9a36d023d7515025f.tar.gz
[core] Include pixelRatio property in MapOptions
Move pixelRatio property from Map constructor to MapOptions.
Diffstat (limited to 'test/map')
-rw-r--r--test/map/map.test.cpp18
-rw-r--r--test/map/prefetch.test.cpp2
2 files changed, 11 insertions, 9 deletions
diff --git a/test/map/map.test.cpp b/test/map/map.test.cpp
index d443b5eacc..be92890b07 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, pixelRatio,
- fileSource, threadPool, MapOptions().withMapMode(mode).withSize(frontend.getSize())) {}
+ , map(frontend, observer, fileSource, threadPool,
+ MapOptions().withMapMode(mode).withSize(frontend.getSize()).withPixelRatio(pixelRatio)) {}
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, pixelRatio,
- fileSource, threadPool, MapOptions().withMapMode(mode).withSize(frontend.getSize())) {}
+ , map(frontend, observer, fileSource, threadPool,
+ MapOptions().withMapMode(mode).withSize(frontend.getSize()).withPixelRatio(pixelRatio)) {}
};
TEST(Map, RendererState) {
@@ -322,7 +322,8 @@ TEST(Map, DefaultBoundOptions) {
}
TEST(Map, MapOptions) {
- MapTest<> test { 1, MapMode::Continuous };
+ float pixelRatio { 2 };
+ MapTest<> test { pixelRatio, MapMode::Continuous };
test.map.setNorthOrientation(NorthOrientation::Rightwards);
test.map.setConstrainMode(ConstrainMode::None);
@@ -336,6 +337,7 @@ TEST(Map, MapOptions) {
EXPECT_EQ(options.constrainMode(), ConstrainMode::None);
EXPECT_EQ(options.northOrientation(), NorthOrientation::Rightwards);
EXPECT_EQ(options.size(), size);
+ EXPECT_EQ(options.pixelRatio(), pixelRatio);
}
TEST(Map, DefaultMapOptions) {
@@ -349,6 +351,7 @@ TEST(Map, DefaultMapOptions) {
EXPECT_TRUE(options.crossSourceCollisions());
EXPECT_EQ(options.size().width, 256);
EXPECT_EQ(options.size().height, 256);
+ EXPECT_EQ(options.pixelRatio(), 1);
}
TEST(Map, SetStyleInvalidJSON) {
@@ -741,7 +744,6 @@ TEST(Map, DontLoadUnneededTiles) {
TEST(Map, TEST_DISABLED_ON_CI(ContinuousRendering)) {
util::RunLoop runLoop;
ThreadPool threadPool { 4 };
- float pixelRatio { 1 };
using namespace std::chrono_literals;
@@ -753,7 +755,7 @@ TEST(Map, TEST_DISABLED_ON_CI(ContinuousRendering)) {
util::Timer timer;
- HeadlessFrontend frontend(pixelRatio, threadPool);
+ HeadlessFrontend frontend(1, threadPool);
StubMapObserver observer;
observer.didFinishRenderingFrameCallback = [&] (MapObserver::RenderMode) {
@@ -765,7 +767,7 @@ TEST(Map, TEST_DISABLED_ON_CI(ContinuousRendering)) {
});
};
- Map map(frontend, observer, pixelRatio, threadPool,
+ Map map(frontend, observer, 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 520228e010..3232c99a22 100644
--- a/test/map/prefetch.test.cpp
+++ b/test/map/prefetch.test.cpp
@@ -37,7 +37,7 @@ TEST(Map, PrefetchTiles) {
};
HeadlessFrontend frontend { { 512, 512 }, 1, threadPool };
- MapAdapter map(frontend, observer, 1, fileSource, threadPool,
+ MapAdapter map(frontend, observer, fileSource, threadPool,
MapOptions().withMapMode(MapMode::Continuous).withSize(frontend.getSize()));
std::vector<int> tiles;