summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAsheem Mamoowala <asheem.mamoowala@mapbox.com>2017-09-01 16:33:35 -0700
committerAsheem Mamoowala <asheem.mamoowala@mapbox.com>2017-09-08 17:38:42 -0700
commit50fd9175109e01c5286d3363df21aeba6e89087b (patch)
tree2f3dfada2896159f3eef64aa3f02ac231742d8a7 /test
parentaa4dff1095e8f5e8ad584f5f7dcab3e61d8cf8ee (diff)
downloadqtlocation-mapboxgl-50fd9175109e01c5286d3363df21aeba6e89087b.tar.gz
Fast tileCount with help from @mapbox/sphericalmercator module
Diffstat (limited to 'test')
-rw-r--r--test/storage/offline.test.cpp8
-rw-r--r--test/util/tile_cover.test.cpp9
2 files changed, 17 insertions, 0 deletions
diff --git a/test/storage/offline.test.cpp b/test/storage/offline.test.cpp
index 0faaabc298..e7ebe5199f 100644
--- a/test/storage/offline.test.cpp
+++ b/test/storage/offline.test.cpp
@@ -52,3 +52,11 @@ TEST(OfflineTilePyramidRegionDefinition, TileCoverWrapped) {
EXPECT_EQ((std::vector<CanonicalTileID>{ { 0, 0, 0 } }),
region.tileCover(SourceType::Vector, 512, { 0, 22 }));
}
+
+TEST(OfflineTilePyramidRegionDefinition, TileCount) {
+ OfflineTilePyramidRegionDefinition region("", sanFranciscoWrapped, 0, 22, 1.0);
+
+ //These numbers match the count from tileCover().size().
+ EXPECT_EQ(38424u, region.tileCount(SourceType::Vector, 512, { 10, 18 }));
+ EXPECT_EQ(9675240u, region.tileCount(SourceType::Vector, 512, { 3, 22 }));
+}
diff --git a/test/util/tile_cover.test.cpp b/test/util/tile_cover.test.cpp
index c746e6dab5..933c18b5ea 100644
--- a/test/util/tile_cover.test.cpp
+++ b/test/util/tile_cover.test.cpp
@@ -84,3 +84,12 @@ TEST(TileCover, SanFranciscoZ0Wrapped) {
EXPECT_EQ((std::vector<UnwrappedTileID>{ { 0, 1, 0 } }),
util::tileCover(sanFranciscoWrapped, 0));
}
+
+TEST(TileCount, SanFranciscoZ10) {
+ EXPECT_EQ(4u, util::tileCount(sanFrancisco, 10, util::tileSize));
+}
+
+TEST(TileCount, SanFranciscoZ22) {
+ EXPECT_EQ(7254450u, util::tileCount(sanFrancisco, 22, util::tileSize));
+}
+