summaryrefslogtreecommitdiff
path: root/test/api
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2019-02-27 19:01:29 +0200
committerBruno de Oliveira Abinader <bruno@mapbox.com>2019-03-04 14:45:32 +0200
commitf5f10ec11989ccb403c2cd4261db74c44b263558 (patch)
tree8c88ee24819281609206e36c719eef617acb52b6 /test/api
parent491fce68790e05cd0a876815751dc5cb72a2761e (diff)
downloadqtlocation-mapboxgl-f5f10ec11989ccb403c2cd4261db74c44b263558.tar.gz
[core] Remove map zoom setters/getters
Diffstat (limited to 'test/api')
-rw-r--r--test/api/annotations.test.cpp27
-rw-r--r--test/api/custom_geometry_source.test.cpp2
-rw-r--r--test/api/custom_layer.test.cpp2
-rw-r--r--test/api/query.test.cpp2
4 files changed, 16 insertions, 17 deletions
diff --git a/test/api/annotations.test.cpp b/test/api/annotations.test.cpp
index d13bc15ea7..c0c4f38cf9 100644
--- a/test/api/annotations.test.cpp
+++ b/test/api/annotations.test.cpp
@@ -53,7 +53,7 @@ TEST(Annotations, SymbolAnnotation) {
// auto size = test.frontend.getSize();
// auto screenBox = ScreenBox { {}, { double(size.width), double(size.height) } };
// for (uint8_t zoom = test.map.getMinZoom(); zoom <= test.map.getMaxZoom(); ++zoom) {
-// test.map.setZoom(zoom);
+// test.map.jumpTo(CameraOptions().withZoom(zoom));
// test.checkRendering("point_annotation");
// EXPECT_EQ(test.map.queryPointAnnotations(screenBox).size(), 1u);
// }
@@ -67,7 +67,7 @@ TEST(Annotations, SymbolAnnotationTileBoundary) {
test.map.getStyle().loadJSON(util::read_file("test/fixtures/api/empty.json"));
test.map.addAnnotationImage(namedMarker("default_marker"));
test.map.addAnnotation(SymbolAnnotation { Point<double>(0.000000000000001, 0.00000000000001), "default_marker" });
- test.map.setZoom(10);
+ test.map.jumpTo(CameraOptions().withZoom(10));
test.checkRendering("point_annotation");
}
@@ -83,7 +83,7 @@ TEST(Annotations, LineAnnotation) {
test.map.addAnnotation(annotation);
test.checkRendering("line_annotation");
- test.map.setZoom(test.map.getMaxZoom());
+ test.map.jumpTo(CameraOptions().withZoom(test.map.getMaxZoom()));
test.checkRendering("line_annotation_max_zoom");
}
@@ -98,7 +98,7 @@ TEST(Annotations, FillAnnotation) {
test.map.addAnnotation(annotation);
test.checkRendering("fill_annotation");
- test.map.setZoom(test.map.getMaxZoom());
+ test.map.jumpTo(CameraOptions().withZoom(test.map.getMaxZoom()));
test.checkRendering("fill_annotation_max_zoom");
}
@@ -106,7 +106,7 @@ TEST(Annotations, AntimeridianAnnotationSmall) {
AnnotationTest test;
double antimeridian = 180;
- test.map.setLatLngZoom(mbgl::LatLng(0, antimeridian), 0);
+ test.map.jumpTo(CameraOptions().withCenter(LatLng { 0, antimeridian }).withZoom(0.0));
test.map.getStyle().loadJSON(util::read_file("test/fixtures/api/empty.json"));
LineString<double> line = {{ { antimeridian, 20 }, { antimeridian, -20 } }};
@@ -127,7 +127,7 @@ TEST(Annotations, AntimeridianAnnotationLarge) {
AnnotationTest test;
double antimeridian = 180;
- test.map.setLatLngZoom(mbgl::LatLng(0, antimeridian), 0);
+ test.map.jumpTo(CameraOptions().withCenter(mbgl::LatLng(0.0, antimeridian)).withZoom(0.0));
test.map.getStyle().loadJSON(util::read_file("test/fixtures/api/empty.json"));
LineString<double> line = {{ { antimeridian, 20 }, { antimeridian, -20 } }};
@@ -384,9 +384,9 @@ TEST(Annotations, QueryFractionalZoomLevels) {
}
}
- test.map.setLatLngZoom({ 5, 5 }, 0);
+ test.map.jumpTo(CameraOptions().withCenter(mbgl::LatLng(5.0, 5.0)).withZoom(0.0));
for (uint16_t zoomSteps = 10; zoomSteps <= 20; ++zoomSteps) {
- test.map.setZoom(zoomSteps / 10.0);
+ test.map.jumpTo(CameraOptions().withZoom(zoomSteps / 10.0));
test.frontend.render(test.map);
auto features = test.frontend.getRenderer()->queryRenderedFeatures(box);
@@ -408,7 +408,7 @@ TEST(Annotations, VisibleFeatures) {
test.map.getStyle().loadJSON(util::read_file("test/fixtures/api/empty.json"));
test.map.addAnnotationImage(namedMarker("default_marker"));
- test.map.setLatLngZoom({ 5, 5 }, 3);
+ test.map.jumpTo(CameraOptions().withCenter(mbgl::LatLng(5.0, 5.0)).withZoom(3.0));
std::vector<mbgl::AnnotationID> ids;
for (int longitude = 0; longitude < 10; longitude += 2) {
@@ -428,8 +428,7 @@ TEST(Annotations, VisibleFeatures) {
features.erase(std::unique(features.begin(), features.end(), sameID), features.end());
EXPECT_EQ(features.size(), ids.size());
- test.map.setBearing(0);
- test.map.setZoom(4);
+ test.map.jumpTo(CameraOptions().withZoom(4.0).withAngle(0.0));
test.frontend.render(test.map);
features = test.frontend.getRenderer()->queryRenderedFeatures(box);
std::sort(features.begin(), features.end(), sortID);
@@ -452,7 +451,7 @@ TEST(Annotations, DebugEmpty) {
test.map.getStyle().loadJSON(util::read_file("test/fixtures/api/empty.json"));
test.map.setDebug(MapDebugOptions::TileBorders);
- test.map.setZoom(1);
+ test.map.jumpTo(CameraOptions().withZoom(1.0));
test.checkRendering("debug_empty");
}
@@ -465,7 +464,7 @@ TEST(Annotations, DebugSparse) {
test.map.getStyle().loadJSON(util::read_file("test/fixtures/api/empty.json"));
test.map.setDebug(MapDebugOptions::TileBorders);
- test.map.setZoom(1);
+ test.map.jumpTo(CameraOptions().withZoom(1.0));
test.map.addAnnotationImage(namedMarker("default_marker"));
test.map.addAnnotation(SymbolAnnotation { Point<double>(10, 10), "default_marker" });
@@ -484,7 +483,7 @@ TEST(Annotations, ChangeMaxZoom) {
test.map.getStyle().loadJSON(util::read_file("test/fixtures/api/empty.json"));
test.map.addAnnotation(annotation);
test.map.setMaxZoom(14);
- test.map.setZoom(test.map.getMaxZoom());
+ test.map.jumpTo(CameraOptions().withZoom(test.map.getMaxZoom()));
test.checkRendering("line_annotation_max_zoom");
}
diff --git a/test/api/custom_geometry_source.test.cpp b/test/api/custom_geometry_source.test.cpp
index 51d026e30d..3e18cca01a 100644
--- a/test/api/custom_geometry_source.test.cpp
+++ b/test/api/custom_geometry_source.test.cpp
@@ -26,7 +26,7 @@ TEST(CustomGeometrySource, Grid) {
Map map(frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, fileSource,
*threadPool, MapMode::Static);
map.getStyle().loadJSON(util::read_file("test/fixtures/api/water.json"));
- map.setLatLngZoom({ 37.8, -122.5 }, 10);
+ map.jumpTo(CameraOptions().withCenter(LatLng { 37.8, -122.5 }).withZoom(10.0));
CustomGeometrySource::Options options;
options.fetchTileFunction = [&map](const mbgl::CanonicalTileID& tileID) {
diff --git a/test/api/custom_layer.test.cpp b/test/api/custom_layer.test.cpp
index c2a0797483..114b88398a 100644
--- a/test/api/custom_layer.test.cpp
+++ b/test/api/custom_layer.test.cpp
@@ -96,7 +96,7 @@ TEST(CustomLayer, Basic) {
Map map(frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, fileSource,
threadPool, MapMode::Static);
map.getStyle().loadJSON(util::read_file("test/fixtures/api/water.json"));
- map.setLatLngZoom({ 37.8, -122.5 }, 10);
+ map.jumpTo(CameraOptions().withCenter(LatLng { 37.8, -122.5 }).withZoom(10.0));
map.getStyle().addLayer(std::make_unique<CustomLayer>(
"custom",
std::make_unique<TestLayer>()));
diff --git a/test/api/query.test.cpp b/test/api/query.test.cpp
index f5eb32788d..efda84baa9 100644
--- a/test/api/query.test.cpp
+++ b/test/api/query.test.cpp
@@ -59,7 +59,7 @@ std::vector<Feature> getTopClusterFeature(QueryTest& test) {
clusterLayer->setIconImage("test-icon"s);
clusterLayer->setIconSize(12.0f);
- test.map.setLatLngZoom(coordinate, 0);
+ test.map.jumpTo(CameraOptions().withCenter(coordinate).withZoom(0.0));
test.map.getStyle().addSource(std::move(source));
test.map.getStyle().addLayer(std::move(clusterLayer));
test.loop.runOnce();