summaryrefslogtreecommitdiff
path: root/test/map
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2016-10-26 15:22:31 -0700
committerKonstantin Käfer <mail@kkaefer.com>2016-10-27 18:30:58 -0700
commit62b56b799a7d4fcd1a8f151eed878054b862da5b (patch)
tree34d510a69f9dd1bca30e9b137feffbd1eb6495d0 /test/map
parentef8017198ce8f0bd79ba5a5ed31e35a16e3433bb (diff)
downloadqtlocation-mapboxgl-62b56b799a7d4fcd1a8f151eed878054b862da5b.tar.gz
[core] change std::array<uint16_t, 2> to mbgl::Size
Diffstat (limited to 'test/map')
-rw-r--r--test/map/map.test.cpp34
-rw-r--r--test/map/transform.test.cpp36
2 files changed, 35 insertions, 35 deletions
diff --git a/test/map/map.test.cpp b/test/map/map.test.cpp
index f6b37d6bc2..a62bd10b57 100644
--- a/test/map/map.test.cpp
+++ b/test/map/map.test.cpp
@@ -30,7 +30,7 @@ struct MapTest {
TEST(Map, LatLngBehavior) {
MapTest test;
- Map map(test.backend, test.view.getSize(), 1, test.fileSource, test.threadPool, MapMode::Still);
+ Map map(test.backend, test.view.size, 1, test.fileSource, test.threadPool, MapMode::Still);
map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
@@ -64,7 +64,7 @@ TEST(Map, Offline) {
fileSource.put(Resource::glyphs(prefix + "{fontstack}/{range}.pbf", {{"Helvetica"}}, {0, 255}), expiredItem("glyph.pbf"));
NetworkStatus::Set(NetworkStatus::Status::Offline);
- Map map(test.backend, test.view.getSize(), 1, fileSource, test.threadPool, MapMode::Still);
+ Map map(test.backend, test.view.size, 1, fileSource, test.threadPool, MapMode::Still);
map.setStyleURL(prefix + "style.json");
test::checkImage("test/fixtures/map/offline",
@@ -88,7 +88,7 @@ TEST(Map, SetStyleInvalidJSON) {
});
{
- Map map(test.backend, test.view.getSize(), 1, test.fileSource, test.threadPool,
+ Map map(test.backend, test.view.size, 1, test.fileSource, test.threadPool,
MapMode::Still);
map.setStyleJSON("invalid");
}
@@ -120,7 +120,7 @@ TEST(Map, SetStyleInvalidURL) {
}
});
- Map map(test.backend, test.view.getSize(), 1, test.fileSource, test.threadPool, MapMode::Still);
+ Map map(test.backend, test.view.size, 1, test.fileSource, test.threadPool, MapMode::Still);
map.setStyleURL("mapbox://bar");
test.runLoop.run();
@@ -129,7 +129,7 @@ TEST(Map, SetStyleInvalidURL) {
TEST(Map, DoubleStyleLoad) {
MapTest test;
- Map map(test.backend, test.view.getSize(), 1, test.fileSource, test.threadPool, MapMode::Still);
+ Map map(test.backend, test.view.size, 1, test.fileSource, test.threadPool, MapMode::Still);
map.setStyleJSON("");
map.setStyleJSON("");
}
@@ -140,7 +140,7 @@ TEST(Map, StyleFresh) {
MapTest test;
FakeFileSource fileSource;
- Map map(test.backend, test.view.getSize(), 1, fileSource, test.threadPool, MapMode::Still);
+ Map map(test.backend, test.view.size, 1, fileSource, test.threadPool, MapMode::Still);
map.setStyleURL("mapbox://styles/test");
EXPECT_EQ(1u, fileSource.requests.size());
@@ -160,7 +160,7 @@ TEST(Map, StyleExpired) {
MapTest test;
FakeFileSource fileSource;
- Map map(test.backend, test.view.getSize(), 1, fileSource, test.threadPool, MapMode::Still);
+ Map map(test.backend, test.view.size, 1, fileSource, test.threadPool, MapMode::Still);
map.setStyleURL("mapbox://styles/test");
EXPECT_EQ(1u, fileSource.requests.size());
@@ -187,7 +187,7 @@ TEST(Map, StyleExpiredWithAnnotations) {
MapTest test;
FakeFileSource fileSource;
- Map map(test.backend, test.view.getSize(), 1, fileSource, test.threadPool, MapMode::Still);
+ Map map(test.backend, test.view.size, 1, fileSource, test.threadPool, MapMode::Still);
map.setStyleURL("mapbox://styles/test");
EXPECT_EQ(1u, fileSource.requests.size());
@@ -211,7 +211,7 @@ TEST(Map, StyleEarlyMutation) {
MapTest test;
FakeFileSource fileSource;
- Map map(test.backend, test.view.getSize(), 1, fileSource, test.threadPool, MapMode::Still);
+ Map map(test.backend, test.view.size, 1, fileSource, test.threadPool, MapMode::Still);
map.setStyleURL("mapbox://styles/test");
map.addLayer(std::make_unique<style::BackgroundLayer>("bg"));
@@ -225,7 +225,7 @@ TEST(Map, StyleEarlyMutation) {
TEST(Map, StyleLoadedSignal) {
MapTest test;
- Map map(test.backend, test.view.getSize(), 1, test.fileSource, test.threadPool, MapMode::Still);
+ Map map(test.backend, test.view.size, 1, test.fileSource, test.threadPool, MapMode::Still);
// The map should emit a signal on style loaded
bool emitted = false;
@@ -246,7 +246,7 @@ TEST(Map, StyleLoadedSignal) {
TEST(Map, AddLayer) {
MapTest test;
- Map map(test.backend, test.view.getSize(), 1, test.fileSource, test.threadPool, MapMode::Still);
+ Map map(test.backend, test.view.size, 1, test.fileSource, test.threadPool, MapMode::Still);
map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
auto layer = std::make_unique<BackgroundLayer>("background");
@@ -259,7 +259,7 @@ TEST(Map, AddLayer) {
TEST(Map, RemoveLayer) {
MapTest test;
- Map map(test.backend, test.view.getSize(), 1, test.fileSource, test.threadPool, MapMode::Still);
+ Map map(test.backend, test.view.size, 1, test.fileSource, test.threadPool, MapMode::Still);
map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
auto layer = std::make_unique<BackgroundLayer>("background");
@@ -284,7 +284,7 @@ TEST(Map, DisabledSources) {
return {};
};
- Map map(test.backend, test.view.getSize(), 1, test.fileSource, test.threadPool, MapMode::Still);
+ Map map(test.backend, test.view.size, 1, test.fileSource, test.threadPool, MapMode::Still);
map.setZoom(1);
// This stylesheet has two raster layers, one that starts at zoom 1, the other at zoom 0.
@@ -334,7 +334,7 @@ TEST(Map, DisabledSources) {
TEST(Map, Classes) {
MapTest test;
- Map map(test.backend, test.view.getSize(), 1, test.fileSource, test.threadPool, MapMode::Still);
+ Map map(test.backend, test.view.size, 1, test.fileSource, test.threadPool, MapMode::Still);
map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
EXPECT_FALSE(map.getTransitionOptions().duration);
@@ -368,7 +368,7 @@ TEST(Map, Classes) {
TEST(Map, AddImage) {
MapTest test;
- Map map(test.backend, test.view.getSize(), 1, test.fileSource, test.threadPool, MapMode::Still);
+ Map map(test.backend, test.view.size, 1, test.fileSource, test.threadPool, MapMode::Still);
auto decoded1 = decodeImage(util::read_file("test/fixtures/sprites/default_marker.png"));
auto decoded2 = decodeImage(util::read_file("test/fixtures/sprites/default_marker.png"));
auto image1 = std::make_unique<SpriteImage>(std::move(decoded1), 1.0);
@@ -385,7 +385,7 @@ TEST(Map, AddImage) {
TEST(Map, RemoveImage) {
MapTest test;
- Map map(test.backend, test.view.getSize(), 1, test.fileSource, test.threadPool, MapMode::Still);
+ Map map(test.backend, test.view.size, 1, test.fileSource, test.threadPool, MapMode::Still);
auto decoded = decodeImage(util::read_file("test/fixtures/sprites/default_marker.png"));
auto image = std::make_unique<SpriteImage>(std::move(decoded), 1.0);
@@ -398,7 +398,7 @@ TEST(Map, RemoveImage) {
TEST(Map, DontLoadUnneededTiles) {
MapTest test;
- Map map(test.backend, test.view.getSize(), 1, test.fileSource, test.threadPool, MapMode::Still);
+ Map map(test.backend, test.view.size, 1, test.fileSource, test.threadPool, MapMode::Still);
map.setStyleJSON(R"STYLE({
"sources": {
"a": { "type": "vector", "tiles": [ "a/{z}/{x}/{y}" ] }
diff --git a/test/map/transform.test.cpp b/test/map/transform.test.cpp
index afb655abca..5c720d3f78 100644
--- a/test/map/transform.test.cpp
+++ b/test/map/transform.test.cpp
@@ -107,7 +107,7 @@ TEST(Transform, PerspectiveProjection) {
LatLng loc;
Transform transform;
- transform.resize({{ 1000, 1000 }});
+ transform.resize({ 1000, 1000 });
transform.setScale(2 << 9);
transform.setPitch(0.9);
transform.setLatLng(LatLng(38, -77));
@@ -137,7 +137,7 @@ TEST(Transform, PerspectiveProjection) {
TEST(Transform, UnwrappedLatLng) {
Transform transform;
- transform.resize({{ 1000, 1000 }});
+ transform.resize({ 1000, 1000 });
transform.setScale(2 << 9);
transform.setPitch(0.9);
transform.setLatLng(LatLng(38, -77));
@@ -169,7 +169,7 @@ TEST(Transform, ConstrainHeightOnly) {
LatLng loc;
Transform transform;
- transform.resize({{ 1000, 1000 }});
+ transform.resize({ 1000, 1000 });
transform.setScale(std::pow(2, util::MAX_ZOOM));
transform.setLatLng(LatLngBounds::world().southwest());
@@ -187,7 +187,7 @@ TEST(Transform, ConstrainWidthAndHeight) {
LatLng loc;
Transform transform(nullptr, ConstrainMode::WidthAndHeight);
- transform.resize({{ 1000, 1000 }});
+ transform.resize({ 1000, 1000 });
transform.setScale(std::pow(2, util::MAX_ZOOM));
transform.setLatLng(LatLngBounds::world().southwest());
@@ -203,7 +203,7 @@ TEST(Transform, ConstrainWidthAndHeight) {
TEST(Transform, Anchor) {
Transform transform;
- transform.resize({{ 1000, 1000 }});
+ transform.resize({ 1000, 1000 });
const LatLng latLng { 10, -100 };
transform.setLatLngZoom(latLng, 10);
@@ -303,7 +303,7 @@ TEST(Transform, Anchor) {
TEST(Transform, Padding) {
Transform transform;
- transform.resize({{ 1000, 1000 }});
+ transform.resize({ 1000, 1000 });
ASSERT_DOUBLE_EQ(0, transform.getLatLng().latitude);
ASSERT_DOUBLE_EQ(0, transform.getLatLng().longitude);
@@ -340,7 +340,7 @@ TEST(Transform, Padding) {
TEST(Transform, MoveBy) {
Transform transform;
- transform.resize({{ 1000, 1000 }});
+ transform.resize({ 1000, 1000 });
transform.setLatLngZoom({ 0, 0 }, 10);
LatLng trueCenter = transform.getLatLng();
@@ -367,7 +367,7 @@ TEST(Transform, MoveBy) {
TEST(Transform, Antimeridian) {
Transform transform;
- transform.resize({{ 1000, 1000 }});
+ transform.resize({ 1000, 1000 });
transform.setLatLngZoom({ 0, 0 }, 1);
const LatLng coordinateSanFrancisco { 37.7833, -122.4167 };
@@ -410,7 +410,7 @@ TEST(Transform, Antimeridian) {
TEST(Transform, Camera) {
Transform transform;
- transform.resize({{ 1000, 1000 }});
+ transform.resize({ 1000, 1000 });
const LatLng latLng1 { 45, 135 };
CameraOptions cameraOptions1;
@@ -481,8 +481,8 @@ TEST(Transform, DefaultTransform) {
LatLng nullIsland, latLng = {};
ScreenCoordinate center, point = {};
- const uint16_t min = std::numeric_limits<uint16_t>::min();
- const uint16_t max = std::numeric_limits<uint16_t>::max();
+ const uint32_t min = 0;
+ const uint32_t max = 65535;
auto testConversions = [&](const LatLng& coord, const ScreenCoordinate& screenCoord) {
latLng = state.screenCoordinateToLatLng(center);
@@ -496,21 +496,21 @@ TEST(Transform, DefaultTransform) {
testConversions(nullIsland, center);
// Cannot assign the current size.
- ASSERT_FALSE(transform.resize({{}}));
+ ASSERT_FALSE(transform.resize({}));
- ASSERT_TRUE(transform.resize({{ min, max }}));
+ ASSERT_TRUE(transform.resize({ min, max }));
testConversions(nullIsland, center);
- ASSERT_TRUE(transform.resize({{ max, min }}));
+ ASSERT_TRUE(transform.resize({ max, min }));
testConversions(nullIsland, center);
- ASSERT_TRUE(transform.resize({{ min, min }}));
+ ASSERT_TRUE(transform.resize({ min, min }));
testConversions(nullIsland, center);
center = { max / 2., max / 2. };
- // -1 evaluates to UINT_MAX.
- ASSERT_TRUE(transform.resize({{ static_cast<uint16_t>(-1), static_cast<uint16_t>(-1) }}));
- ASSERT_FALSE(transform.resize({{ max, max }}));
+ // Double resize
+ ASSERT_TRUE(transform.resize({ max, max }));
+ ASSERT_FALSE(transform.resize({ max, max }));
testConversions(nullIsland, center);
}