summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAsheem Mamoowala <asheem.mamoowala@mapbox.com>2018-05-16 17:37:57 -0700
committerAsheem Mamoowala <asheem.mamoowala@mapbox.com>2018-07-16 17:11:03 -0700
commitb2ff57c09c19c4364039673cffafd929c88a8b89 (patch)
tree82c8fcc0eec04240d064ebe5618b974dee3b82cf /test
parent77894f0586244049f62682945ed358ca738aa8e0 (diff)
downloadqtlocation-mapboxgl-b2ff57c09c19c4364039673cffafd929c88a8b89.tar.gz
Fix TileCover asserts. The create_bounds_towards_* methods were treating
all point arrays as rings. Simplify the logic to only compare against the next pt in the bound.
Diffstat (limited to 'test')
-rw-r--r--test/util/tile_cover.test.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/util/tile_cover.test.cpp b/test/util/tile_cover.test.cpp
index 7defa761af..eb65c6686a 100644
--- a/test/util/tile_cover.test.cpp
+++ b/test/util/tile_cover.test.cpp
@@ -137,6 +137,17 @@ TEST(TileCover, GeomLineZ10) {
}
+TEST(TileCover, GeomLineRegression11870) {
+ auto lineCover = util::tileCover(LineString<double>{
+ {-121.5063900000001,40.470099999999945},
+ {-121.5065300000001,40.470369999999946},
+ {-121.5065900000001,40.470519999999944},
+ }, 14);
+ EXPECT_EQ((std::vector<UnwrappedTileID>{ { 14, 2662, 6174 } }),
+ lineCover);
+
+}
+
TEST(TileCover, WrappedGeomLineZ10) {
auto lineCover = util::tileCover(LineString<double>{
{-179.93342914581299,38.892101707724315},
@@ -263,6 +274,9 @@ TEST(TileCover, GeomInvalid) {
auto point = Point<double>{ -122.5744, 97.6609 };
EXPECT_THROW(util::tileCover(point, 2), std::domain_error);
+ auto badLine = LineString<double>{ {1.0, 35.0} };
+ EXPECT_EQ((std::vector<UnwrappedTileID>{ }), util::tileCover(badLine, 16));
+
auto badPoly = Polygon<double> { { {1.0, 35.0} } };
EXPECT_EQ((std::vector<UnwrappedTileID>{ }), util::tileCover(badPoly, 16));