diff options
author | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2018-10-16 15:53:27 +0200 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2018-10-19 12:05:16 +0200 |
commit | 98c36fc06edb99b2db20d474c4c3ec6bf51e219d (patch) | |
tree | 81512310f121366eb84c00e39e9faba9fea72181 /test/map | |
parent | 0c6b1629efb85386c0197868b2764c14f3fba940 (diff) | |
download | qtlocation-mapboxgl-98c36fc06edb99b2db20d474c4c3ec6bf51e219d.tar.gz |
[core] CameraOptions receives and outputs angle and pitch as degrees, not radians
Diffstat (limited to 'test/map')
-rw-r--r-- | test/map/map.test.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/test/map/map.test.cpp b/test/map/map.test.cpp index cb45c2900b..88ddfa6cee 100644 --- a/test/map/map.test.cpp +++ b/test/map/map.test.cpp @@ -81,10 +81,10 @@ TEST(Map, LatLngBoundsToCameraWithAngle) { LatLngBounds bounds = LatLngBounds::hull({15.68169,73.499857}, {53.560711, 134.77281}); - CameraOptions virtualCamera = test.map.cameraForLatLngBounds(bounds, {}, 35); + 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 * util::DEG2RAD, 1e-5); + EXPECT_NEAR(virtualCamera.angle.value_or(0), 35.0, 1e-5); } TEST(Map, LatLngBoundsToCameraWithAngleAndPitch) { @@ -97,8 +97,8 @@ TEST(Map, LatLngBoundsToCameraWithAngleAndPitch) { CameraOptions virtualCamera = test.map.cameraForLatLngBounds(bounds, {}, 35, 20); ASSERT_TRUE(bounds.contains(*virtualCamera.center)); EXPECT_NEAR(*virtualCamera.zoom, 13.66272, 1e-5); - ASSERT_DOUBLE_EQ(*virtualCamera.pitch, 20 * util::DEG2RAD); - EXPECT_NEAR(virtualCamera.angle.value_or(0), -35 * util::DEG2RAD, 1e-5); + ASSERT_DOUBLE_EQ(*virtualCamera.pitch, 20.0); + EXPECT_NEAR(virtualCamera.angle.value_or(0), 35.0, 1e-5); } TEST(Map, LatLngsToCamera) { @@ -106,8 +106,8 @@ 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); - EXPECT_NEAR(virtualCamera.angle.value_or(0), -23 * util::DEG2RAD, 1e-5); + CameraOptions virtualCamera = test.map.cameraForLatLngs(latLngs, {}, 23.0); + EXPECT_NEAR(virtualCamera.angle.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); @@ -119,11 +119,11 @@ TEST(Map, LatLngsToCameraWithAngleAndPitch) { 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 * util::DEG2RAD, 1e-5); + EXPECT_NEAR(virtualCamera.angle.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); - ASSERT_DOUBLE_EQ(*virtualCamera.pitch, 20 * util::DEG2RAD); + ASSERT_DOUBLE_EQ(*virtualCamera.pitch, 20.0); } |