summaryrefslogtreecommitdiff
path: root/test/storage
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2016-07-12 10:57:18 -0700
committerGitHub <noreply@github.com>2016-07-12 10:57:18 -0700
commit08d0a9a0e2e771b87018bcb3d4d124c52fed1689 (patch)
tree98432ab1ef18401c7988c9d133181c3b6131e88f /test/storage
parent63298066b1508a9546dbf61b86de718c5cbf57cf (diff)
downloadqtlocation-mapboxgl-08d0a9a0e2e771b87018bcb3d4d124c52fed1689.tar.gz
Quadkey tokens in tile URL templates, limited WMS support (#5628)
* [core] Quadkey tokens in tile URL templates Fixes #5485. * [core] WMS tokens in tile URL templates Fixes #822. * [macos] Added WMS debug style Added a style to the macosapp resource bundle that can be used to test WMS support. To use it, zoom in to somewhere in New Jersey, then go to View ‣ Custom Style and enter “wms.json”.
Diffstat (limited to 'test/storage')
-rw-r--r--test/storage/resource.cpp56
1 files changed, 56 insertions, 0 deletions
diff --git a/test/storage/resource.cpp b/test/storage/resource.cpp
index 5d6c3bcbf2..02559f3e84 100644
--- a/test/storage/resource.cpp
+++ b/test/storage/resource.cpp
@@ -36,6 +36,62 @@ TEST(Resource, Tile) {
EXPECT_EQ(1, vectorTile.tileData->x);
EXPECT_EQ(2, vectorTile.tileData->y);
EXPECT_EQ(3, vectorTile.tileData->z);
+
+ Resource quadTile = Resource::tile("http://example.com/{quadkey}.png", 2.0, 0, 0, 1);
+ EXPECT_EQ(Resource::Kind::Tile, quadTile.kind);
+ EXPECT_EQ("http://example.com/0.png", quadTile.url);
+ EXPECT_EQ("http://example.com/{quadkey}.png", quadTile.tileData->urlTemplate);
+ EXPECT_EQ(1, quadTile.tileData->pixelRatio);
+ EXPECT_EQ(0, quadTile.tileData->x);
+ EXPECT_EQ(0, quadTile.tileData->y);
+ EXPECT_EQ(1, quadTile.tileData->z);
+
+ quadTile = Resource::tile("http://example.com/{quadkey}.png", 2.0, 0, 0, 2);
+ EXPECT_EQ(Resource::Kind::Tile, quadTile.kind);
+ EXPECT_EQ("http://example.com/00.png", quadTile.url);
+ EXPECT_EQ("http://example.com/{quadkey}.png", quadTile.tileData->urlTemplate);
+ EXPECT_EQ(1, quadTile.tileData->pixelRatio);
+ EXPECT_EQ(0, quadTile.tileData->x);
+ EXPECT_EQ(0, quadTile.tileData->y);
+ EXPECT_EQ(2, quadTile.tileData->z);
+
+ quadTile = Resource::tile("http://example.com/{quadkey}.png", 2.0, 1, 1, 2);
+ EXPECT_EQ(Resource::Kind::Tile, quadTile.kind);
+ EXPECT_EQ("http://example.com/03.png", quadTile.url);
+ EXPECT_EQ("http://example.com/{quadkey}.png", quadTile.tileData->urlTemplate);
+ EXPECT_EQ(1, quadTile.tileData->pixelRatio);
+ EXPECT_EQ(1, quadTile.tileData->x);
+ EXPECT_EQ(1, quadTile.tileData->y);
+ EXPECT_EQ(2, quadTile.tileData->z);
+
+ quadTile = Resource::tile("http://example.com/{quadkey}.png", 2.0, 22914, 52870, 17);
+ EXPECT_EQ(Resource::Kind::Tile, quadTile.kind);
+ EXPECT_EQ("http://example.com/02301322130000230.png", quadTile.url);
+ EXPECT_EQ("http://example.com/{quadkey}.png", quadTile.tileData->urlTemplate);
+ EXPECT_EQ(1, quadTile.tileData->pixelRatio);
+ EXPECT_EQ(22914, quadTile.tileData->x);
+ EXPECT_EQ(52870, quadTile.tileData->y);
+ EXPECT_EQ(17, quadTile.tileData->z);
+
+ // Test case confirmed by quadkeytools package
+ // https://bitbucket.org/steele/quadkeytools/src/master/test/quadkey.js?fileviewer=file-view-default#quadkey.js-57
+ quadTile = Resource::tile("http://example.com/{quadkey}.png", 2.0, 29, 3, 6);
+ EXPECT_EQ(Resource::Kind::Tile, quadTile.kind);
+ EXPECT_EQ("http://example.com/011123.png", quadTile.url);
+ EXPECT_EQ("http://example.com/{quadkey}.png", quadTile.tileData->urlTemplate);
+ EXPECT_EQ(1, quadTile.tileData->pixelRatio);
+ EXPECT_EQ(29, quadTile.tileData->x);
+ EXPECT_EQ(3, quadTile.tileData->y);
+ EXPECT_EQ(6, quadTile.tileData->z);
+
+ Resource wmsTile = Resource::tile("http://example.com/?bbox={bbox-epsg-3857}", 2.0, 0, 0, 1);
+ EXPECT_EQ(Resource::Kind::Tile, wmsTile.kind);
+ EXPECT_EQ("http://example.com/?bbox=-20037508.342789245,0,0,20037508.342789245", wmsTile.url);
+ EXPECT_EQ("http://example.com/?bbox={bbox-epsg-3857}", wmsTile.tileData->urlTemplate);
+ EXPECT_EQ(1, wmsTile.tileData->pixelRatio);
+ EXPECT_EQ(0, wmsTile.tileData->x);
+ EXPECT_EQ(0, wmsTile.tileData->y);
+ EXPECT_EQ(1, wmsTile.tileData->z);
}
TEST(Resource, Glyphs) {