summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAsheem Mamoowala <asheem.mamoowala@mapbox.com>2018-02-16 12:38:23 -0800
committerAsheem Mamoowala <asheem.mamoowala@mapbox.com>2018-02-19 11:07:54 -0800
commit2cef23e3ff532faf3ddff10c26e1495b30f11c4a (patch)
treee5cc6474a378e777f60bb0cf331e3ee2c32cb522 /test
parentd0f66b132f263fda9c0ca40053253fae20cb06ec (diff)
downloadqtlocation-mapboxgl-2cef23e3ff532faf3ddff10c26e1495b30f11c4a.tar.gz
[core] Support a range of zooms in TileRange. Accounts for TilePyramid requesting parent tiles of ideal zoom tiles.
Diffstat (limited to 'test')
-rw-r--r--test/util/tile_range.test.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/test/util/tile_range.test.cpp b/test/util/tile_range.test.cpp
index dc8ae28705..c4c37c74d7 100644
--- a/test/util/tile_range.test.cpp
+++ b/test/util/tile_range.test.cpp
@@ -1,4 +1,3 @@
-
#include <mbgl/util/tile_range.hpp>
#include <mbgl/util/geo.hpp>
#include <mbgl/map/transform.hpp>
@@ -25,6 +24,18 @@ TEST(TileRange, ContainsBoundsFromTile) {
EXPECT_TRUE(range.contains(CanonicalTileID(10, 162, 395)));
}
}
+
+TEST(TileRange, ContainsMultiZoom) {
+ auto wrappedBounds = LatLngBounds::hull({ 37.6609, -122.5744 }, { 37.8271, -122.3204 });
+ auto range = util::TileRange::fromLatLngBounds(wrappedBounds, 5, 13);
+ EXPECT_FALSE(range.contains(CanonicalTileID(0, 0, 0)));
+ EXPECT_FALSE(range.contains(CanonicalTileID(5, 3, 11)));
+ EXPECT_FALSE(range.contains(CanonicalTileID(6, 9, 22)));
+ EXPECT_TRUE(range.contains(CanonicalTileID(5, 5, 12)));
+ EXPECT_TRUE(range.contains(CanonicalTileID(6, 10, 24)));
+ EXPECT_TRUE(range.contains(CanonicalTileID(13, 1310, 3166)));
+}
+
TEST(TileRange, ContainsIntersectingTiles) {
auto bounds = LatLngBounds::hull({ 37.6609, -122.5744 }, { 37.8271, -122.3204 });
auto range = util::TileRange::fromLatLngBounds(bounds, 13);