diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-03-16 17:45:00 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-04-06 09:22:51 -0700 |
commit | 0314a46ee411b97810d49908ab110bbef049e7b7 (patch) | |
tree | 8f9d902cc09a245dd2d41eab1ff16c4cdf8e7680 /test/util | |
parent | 56ea87357aa9f4df48183ae1582c827f47547f83 (diff) | |
download | qtlocation-mapboxgl-0314a46ee411b97810d49908ab110bbef049e7b7.tar.gz |
[core] Tighten LatLng and other geo.hpp classes
* Remove LatLng::null and enforce invariants
* Remove unnecessary operator bool()
Diffstat (limited to 'test/util')
-rw-r--r-- | test/util/projection.test.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/test/util/projection.test.cpp b/test/util/projection.test.cpp index 5efba380b3..260d12edfe 100644 --- a/test/util/projection.test.cpp +++ b/test/util/projection.test.cpp @@ -36,25 +36,20 @@ TEST(Projection, MetersPerPixelAtLatitude) { } TEST(Projection, ProjectedMeters) { - const auto southWest = LatLng { -util::LATITUDE_MAX, -util::LONGITUDE_MAX }; - const auto northEast = LatLng { util::LATITUDE_MAX, util::LONGITUDE_MAX }; - auto latLng = LatLng {}; auto projectedMeters = Projection::projectedMetersForLatLng(latLng); EXPECT_EQ(projectedMeters.northing, projectedMeters.easting); EXPECT_EQ(latLng, Projection::latLngForProjectedMeters(projectedMeters)); - latLng = LatLng { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::lowest() }; - projectedMeters = Projection::projectedMetersForLatLng(latLng); - EXPECT_EQ(projectedMeters, Projection::projectedMetersForLatLng(southWest)); + const auto southWest = LatLng { -util::LATITUDE_MAX, -util::LONGITUDE_MAX }; + projectedMeters = Projection::projectedMetersForLatLng(southWest); EXPECT_DOUBLE_EQ(projectedMeters.northing, -20037508.342789274); EXPECT_DOUBLE_EQ(projectedMeters.easting, -20037508.342789244); - latLng = LatLng { std::numeric_limits<double>::max(), std::numeric_limits<double>::max() }; - projectedMeters = Projection::projectedMetersForLatLng(latLng); - EXPECT_EQ(projectedMeters, Projection::projectedMetersForLatLng(northEast)); - EXPECT_DOUBLE_EQ(projectedMeters.northing, -Projection::projectedMetersForLatLng(southWest).northing); - EXPECT_DOUBLE_EQ(projectedMeters.easting, -Projection::projectedMetersForLatLng(southWest).easting); + const auto northEast = LatLng { util::LATITUDE_MAX, util::LONGITUDE_MAX }; + projectedMeters = Projection::projectedMetersForLatLng(northEast); + EXPECT_DOUBLE_EQ(projectedMeters.northing, 20037508.342789274); + EXPECT_DOUBLE_EQ(projectedMeters.easting, 20037508.342789244); projectedMeters = ProjectedMeters { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::lowest() }; latLng = Projection::latLngForProjectedMeters(projectedMeters); |