summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2019-03-01 09:58:58 +0200
committerBruno de Oliveira Abinader <bruno@mapbox.com>2019-03-04 14:45:32 +0200
commitba7427b4acf116aca7451ad3a6067dc234d3fa70 (patch)
tree106462886345e60f47bdeeaaf46580c67987b064 /test
parent73ac3c784fe755650dc631e2e722a47890981248 (diff)
downloadqtlocation-mapboxgl-ba7427b4acf116aca7451ad3a6067dc234d3fa70.tar.gz
[core] Transform{State}: s/angle/bearing/
Diffstat (limited to 'test')
-rw-r--r--test/api/annotations.test.cpp4
-rw-r--r--test/map/map.test.cpp20
-rw-r--r--test/map/transform.test.cpp22
-rw-r--r--test/style/style.test.cpp4
-rw-r--r--test/util/tile_cover.test.cpp2
5 files changed, 26 insertions, 26 deletions
diff --git a/test/api/annotations.test.cpp b/test/api/annotations.test.cpp
index a4534825a5..8d2dae177b 100644
--- a/test/api/annotations.test.cpp
+++ b/test/api/annotations.test.cpp
@@ -418,7 +418,7 @@ TEST(Annotations, VisibleFeatures) {
}
// Change bearing *after* adding annotations causes them to be reordered.
- test.map.jumpTo(CameraOptions().withAngle(45.0));
+ test.map.jumpTo(CameraOptions().withBearing(45.0));
test.frontend.render(test.map);
auto features = test.frontend.getRenderer()->queryRenderedFeatures(box, {});
@@ -428,7 +428,7 @@ TEST(Annotations, VisibleFeatures) {
features.erase(std::unique(features.begin(), features.end(), sameID), features.end());
EXPECT_EQ(features.size(), ids.size());
- test.map.jumpTo(CameraOptions().withZoom(4.0).withAngle(0.0));
+ test.map.jumpTo(CameraOptions().withZoom(4.0).withBearing(0.0));
test.frontend.render(test.map);
features = test.frontend.getRenderer()->queryRenderedFeatures(box);
std::sort(features.begin(), features.end(), sortID);
diff --git a/test/map/map.test.cpp b/test/map/map.test.cpp
index da3abfcb24..1b64e48614 100644
--- a/test/map/map.test.cpp
+++ b/test/map/map.test.cpp
@@ -64,7 +64,7 @@ TEST(Map, RendererState) {
double bearingInDegrees = 30.0;
test.map.getStyle().loadJSON(util::read_file("test/fixtures/api/empty.json"));
- test.map.jumpTo(CameraOptions().withCenter(coordinate).withZoom(zoom).withPitch(pitchInDegrees).withAngle(bearingInDegrees));
+ test.map.jumpTo(CameraOptions().withCenter(coordinate).withZoom(zoom).withPitch(pitchInDegrees).withBearing(bearingInDegrees));
test.runLoop.runOnce();
test.frontend.render(test.map);
@@ -75,7 +75,7 @@ TEST(Map, RendererState) {
EXPECT_NEAR(options.center->longitude(), coordinate.longitude(), 1e-7);
ASSERT_DOUBLE_EQ(*options.zoom, zoom);
ASSERT_DOUBLE_EQ(*options.pitch, pitchInDegrees);
- EXPECT_NEAR(*options.angle, bearingInDegrees, 1e-7);
+ EXPECT_NEAR(*options.bearing, bearingInDegrees, 1e-7);
{
const LatLng& latLng = test.frontend.latLngForPixel(ScreenCoordinate { 0, 0 });
@@ -148,7 +148,7 @@ TEST(Map, LatLngBoundsToCamera) {
EXPECT_NEAR(*virtualCamera.zoom, 1.55467, 1e-5);
}
-TEST(Map, LatLngBoundsToCameraWithAngle) {
+TEST(Map, LatLngBoundsToCameraWithBearing) {
MapTest<> test;
test.map.jumpTo(CameraOptions().withCenter(LatLng { 40.712730, -74.005953 }).withZoom(16.0));
@@ -158,10 +158,10 @@ TEST(Map, LatLngBoundsToCameraWithAngle) {
CameraOptions virtualCamera = test.map.cameraForLatLngBounds(bounds, {}, 35.0);
ASSERT_TRUE(bounds.contains(*virtualCamera.center));
EXPECT_NEAR(*virtualCamera.zoom, 1.21385, 1e-5);
- EXPECT_NEAR(virtualCamera.angle.value_or(0), 35.0, 1e-5);
+ EXPECT_NEAR(virtualCamera.bearing.value_or(0), 35.0, 1e-5);
}
-TEST(Map, LatLngBoundsToCameraWithAngleAndPitch) {
+TEST(Map, LatLngBoundsToCameraWithBearingAndPitch) {
MapTest<> test;
test.map.jumpTo(CameraOptions().withCenter(LatLng { 40.712730, -74.005953 }).withZoom(16.0));
@@ -172,7 +172,7 @@ TEST(Map, LatLngBoundsToCameraWithAngleAndPitch) {
ASSERT_TRUE(bounds.contains(*virtualCamera.center));
EXPECT_NEAR(*virtualCamera.zoom, 13.66272, 1e-5);
ASSERT_DOUBLE_EQ(*virtualCamera.pitch, 20.0);
- EXPECT_NEAR(virtualCamera.angle.value_or(0), 35.0, 1e-5);
+ EXPECT_NEAR(virtualCamera.bearing.value_or(0), 35.0, 1e-5);
}
TEST(Map, LatLngsToCamera) {
@@ -181,19 +181,19 @@ TEST(Map, LatLngsToCamera) {
std::vector<LatLng> latLngs{{ 40.712730, 74.005953 }, {15.68169,73.499857}, {30.82678, 83.4082}};
CameraOptions virtualCamera = test.map.cameraForLatLngs(latLngs, {}, 23.0);
- EXPECT_NEAR(virtualCamera.angle.value_or(0), 23.0, 1e-5);
+ EXPECT_NEAR(virtualCamera.bearing.value_or(0), 23.0, 1e-5);
EXPECT_NEAR(virtualCamera.zoom.value_or(0), 2.75434, 1e-5);
EXPECT_NEAR(virtualCamera.center->latitude(), 28.49288, 1e-5);
EXPECT_NEAR(virtualCamera.center->longitude(), 74.97437, 1e-5);
}
-TEST(Map, LatLngsToCameraWithAngleAndPitch) {
+TEST(Map, LatLngsToCameraWithBearingAndPitch) {
MapTest<> test;
std::vector<LatLng> latLngs{{ 40.712730, 74.005953 }, {15.68169,73.499857}, {30.82678, 83.4082}};
CameraOptions virtualCamera = test.map.cameraForLatLngs(latLngs, {}, 23, 20);
- EXPECT_NEAR(virtualCamera.angle.value_or(0), 23.0, 1e-5);
+ EXPECT_NEAR(virtualCamera.bearing.value_or(0), 23.0, 1e-5);
EXPECT_NEAR(virtualCamera.zoom.value_or(0), 3.04378, 1e-5);
EXPECT_NEAR(virtualCamera.center->latitude(), 28.53718, 1e-5);
EXPECT_NEAR(virtualCamera.center->longitude(), 74.31746, 1e-5);
@@ -256,7 +256,7 @@ TEST(Map, SetStyleDefaultCamera) {
CameraOptions camera = test.map.getCameraOptions();
EXPECT_DOUBLE_EQ(*camera.zoom, 0.0);
EXPECT_DOUBLE_EQ(*camera.pitch, 0.0);
- EXPECT_DOUBLE_EQ(*camera.angle, 0.0);
+ EXPECT_DOUBLE_EQ(*camera.bearing, 0.0);
EXPECT_EQ(*camera.center, LatLng {});
test.map.getStyle().loadJSON(util::read_file("test/fixtures/api/empty-zoomed.json"));
diff --git a/test/map/transform.test.cpp b/test/map/transform.test.cpp
index 85f92ae52c..540761212a 100644
--- a/test/map/transform.test.cpp
+++ b/test/map/transform.test.cpp
@@ -61,19 +61,19 @@ TEST(Transform, InvalidBearing) {
ASSERT_DOUBLE_EQ(0, transform.getLatLng().longitude());
ASSERT_DOUBLE_EQ(0, transform.getZoom());
- transform.jumpTo(CameraOptions().withZoom(1.0).withAngle(2.0));
+ transform.jumpTo(CameraOptions().withZoom(1.0).withBearing(2.0));
ASSERT_DOUBLE_EQ(0, transform.getLatLng().latitude());
ASSERT_DOUBLE_EQ(0, transform.getLatLng().longitude());
ASSERT_DOUBLE_EQ(1, transform.getZoom());
- ASSERT_NEAR(-2.0 * util::DEG2RAD, transform.getAngle(), 1e-15);
+ ASSERT_NEAR(-2.0 * util::DEG2RAD, transform.getBearing(), 1e-15);
const double invalid = NAN;
- transform.jumpTo(CameraOptions().withAngle(invalid));
+ transform.jumpTo(CameraOptions().withBearing(invalid));
ASSERT_DOUBLE_EQ(0, transform.getLatLng().latitude());
ASSERT_DOUBLE_EQ(0, transform.getLatLng().longitude());
ASSERT_DOUBLE_EQ(1, transform.getZoom());
- ASSERT_NEAR(-2.0 * util::DEG2RAD, transform.getAngle(), 1e-15);
+ ASSERT_NEAR(-2.0 * util::DEG2RAD, transform.getBearing(), 1e-15);
}
TEST(Transform, IntegerZoom) {
@@ -196,7 +196,7 @@ TEST(Transform, Anchor) {
ASSERT_DOUBLE_EQ(latLng.latitude(), transform.getLatLng().latitude());
ASSERT_DOUBLE_EQ(latLng.longitude(), transform.getLatLng().longitude());
ASSERT_DOUBLE_EQ(10, transform.getZoom());
- ASSERT_DOUBLE_EQ(0, transform.getAngle());
+ ASSERT_DOUBLE_EQ(0, transform.getBearing());
const LatLng anchorLatLng = transform.getState().screenCoordinateToLatLng(anchorPoint);
ASSERT_NE(latLng.latitude(), anchorLatLng.latitude());
@@ -247,18 +247,18 @@ TEST(Transform, Anchor) {
ASSERT_NE(latLng.latitude(), transform.getLatLng().latitude());
ASSERT_NE(latLng.longitude(), transform.getLatLng().longitude());
- transform.jumpTo(CameraOptions().withCenter(latLng).withZoom(10.0).withAngle(-45.0));
- ASSERT_NEAR(M_PI_4, transform.getAngle(), 0.000001);
+ transform.jumpTo(CameraOptions().withCenter(latLng).withZoom(10.0).withBearing(-45.0));
+ ASSERT_NEAR(M_PI_4, transform.getBearing(), 0.000001);
ASSERT_DOUBLE_EQ(latLng.latitude(), transform.getLatLng().latitude());
ASSERT_DOUBLE_EQ(latLng.longitude(), transform.getLatLng().longitude());
- transform.jumpTo(CameraOptions().withAngle(0.0));
- ASSERT_DOUBLE_EQ(0, transform.getAngle());
+ transform.jumpTo(CameraOptions().withBearing(0.0));
+ ASSERT_DOUBLE_EQ(0, transform.getBearing());
ASSERT_DOUBLE_EQ(latLng.latitude(), transform.getLatLng().latitude());
ASSERT_DOUBLE_EQ(latLng.longitude(), transform.getLatLng().longitude());
- transform.jumpTo(CameraOptions().withAngle(45.0).withAnchor(anchorPoint));
- ASSERT_NEAR(-45.0 * util::DEG2RAD, transform.getAngle(), 0.000001);
+ transform.jumpTo(CameraOptions().withBearing(45.0).withAnchor(anchorPoint));
+ ASSERT_NEAR(-45.0 * util::DEG2RAD, transform.getBearing(), 0.000001);
ASSERT_NEAR(anchorLatLng.latitude(), transform.getLatLng().latitude(), 1);
ASSERT_NEAR(anchorLatLng.longitude(), transform.getLatLng().longitude(), 1);
diff --git a/test/style/style.test.cpp b/test/style/style.test.cpp
index 2371e91107..7f57651331 100644
--- a/test/style/style.test.cpp
+++ b/test/style/style.test.cpp
@@ -33,7 +33,7 @@ TEST(Style, Properties) {
style.loadJSON(R"STYLE({"bearing": 24})STYLE");
ASSERT_EQ("", style.getName());
ASSERT_EQ(LatLng {}, *style.getDefaultCamera().center);
- ASSERT_EQ(24, *style.getDefaultCamera().angle);
+ ASSERT_EQ(24, *style.getDefaultCamera().bearing);
style.loadJSON(R"STYLE({"zoom": 13.3})STYLE");
ASSERT_EQ("", style.getName());
@@ -55,7 +55,7 @@ TEST(Style, Properties) {
ASSERT_EQ("", style.getName());
ASSERT_EQ(LatLng {}, *style.getDefaultCamera().center);
ASSERT_EQ(0, *style.getDefaultCamera().zoom);
- ASSERT_EQ(0, *style.getDefaultCamera().angle);
+ ASSERT_EQ(0, *style.getDefaultCamera().bearing);
ASSERT_EQ(0, *style.getDefaultCamera().pitch);
}
diff --git a/test/util/tile_cover.test.cpp b/test/util/tile_cover.test.cpp
index 326e3da69a..7045305625 100644
--- a/test/util/tile_cover.test.cpp
+++ b/test/util/tile_cover.test.cpp
@@ -35,7 +35,7 @@ TEST(TileCover, Pitch) {
transform.resize({ 512, 512 });
// slightly offset center so that tile order is better defined
- transform.jumpTo(CameraOptions().withCenter(LatLng { 0.1, -0.1, }).withZoom(2.0).withAngle(5.0).withPitch(40.0));
+ transform.jumpTo(CameraOptions().withCenter(LatLng { 0.1, -0.1, }).withZoom(2.0).withBearing(5.0).withPitch(40.0));
EXPECT_EQ((std::vector<UnwrappedTileID>{
{ 2, 1, 1 }, { 2, 2, 1 }, { 2, 1, 2 }, { 2, 2, 2 }