diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2015-09-28 15:06:41 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2015-09-28 15:06:41 +0200 |
commit | a84cf6242442626d9205231f6855a4c2a981293f (patch) | |
tree | 9f4777ab22cef5eb5db72fafa5f43fe4f425493e /test/miscellaneous | |
parent | 81fde4261f2430a428f7dea98cdc524e4a3e31f5 (diff) | |
download | qtlocation-mapboxgl-a84cf6242442626d9205231f6855a4c2a981293f.tar.gz |
[core] include api.mapbox.com in canonicalization
and move the canonicalization to mapbox.cpp since it's not specific to the SQLiteCache
Diffstat (limited to 'test/miscellaneous')
-rw-r--r-- | test/miscellaneous/mapbox.cpp | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/test/miscellaneous/mapbox.cpp b/test/miscellaneous/mapbox.cpp index a0f9208298..1ec48a4196 100644 --- a/test/miscellaneous/mapbox.cpp +++ b/test/miscellaneous/mapbox.cpp @@ -81,3 +81,59 @@ TEST(Mapbox, TileURL) { throw e; } } + +TEST(Mapbox, CanonicalURL) { + using mbgl::util::mapbox::canonicalURL; + EXPECT_EQ( + canonicalURL("https://a.tiles.mapbox.com/v4/" + "mapbox.mapbox-terrain-v2,mapbox.mapbox-streets-v6/15/17599/" + "10744.vector.pbf?access_token=pk.kAeslEm93Sjf3mXk." + "vbiF02XnvkPkzlFhGSn2iIm6De3Cxsk5tmips2tvkG8sF"), + "mapbox://v4/mapbox.mapbox-terrain-v2,mapbox.mapbox-streets-v6/15/17599/10744.vector.pbf"); + + EXPECT_EQ( + canonicalURL("http://a.tiles.mapbox.com/v4/" + "mapbox.mapbox-terrain-v2,mapbox.mapbox-streets-v6/15/17599/" + "10744.vector.pbf?access_token=pk.kAeslEm93Sjf3mXk." + "vbiF02XnvkPkzlFhGSn2iIm6De3Cxsk5tmips2tvkG8sF"), + "mapbox://v4/mapbox.mapbox-terrain-v2,mapbox.mapbox-streets-v6/15/17599/10744.vector.pbf"); + + EXPECT_EQ( + canonicalURL("https://b.tiles.mapbox.com/v4/" + "mapbox.mapbox-terrain-v2,mapbox.mapbox-streets-v6/15/17599/" + "10744.vector.pbf?access_token=pk.kAeslEm93Sjf3mXk." + "vbiF02XnvkPkzlFhGSn2iIm6De3Cxsk5tmips2tvkG8sF"), + "mapbox://v4/mapbox.mapbox-terrain-v2,mapbox.mapbox-streets-v6/15/17599/10744.vector.pbf"); + + EXPECT_EQ( + canonicalURL("http://c.tiles.mapbox.com/v4/" + "mapbox.mapbox-terrain-v2,mapbox.mapbox-streets-v6/15/17599/" + "10744.vector.pbf?access_token=pk.kAeslEm93Sjf3mXk." + "vbiF02XnvkPkzlFhGSn2iIm6De3Cxsk5tmips2tvkG8sF"), + "mapbox://v4/mapbox.mapbox-terrain-v2,mapbox.mapbox-streets-v6/15/17599/10744.vector.pbf"); + + EXPECT_EQ( + canonicalURL("https://api.mapbox.com/v4/" + "mapbox.mapbox-terrain-v2,mapbox.mapbox-streets-v6/15/17599/" + "10744.vector.pbf?access_token=pk.kAeslEm93Sjf3mXk." + "vbiF02XnvkPkzlFhGSn2iIm6De3Cxsk5tmips2tvkG8sF"), + "mapbox://v4/mapbox.mapbox-terrain-v2,mapbox.mapbox-streets-v6/15/17599/10744.vector.pbf"); + + EXPECT_EQ( + canonicalURL("http://api.mapbox.com/v4/" + "mapbox.mapbox-terrain-v2,mapbox.mapbox-streets-v6/15/17599/" + "10744.vector.pbf"), + "mapbox://v4/mapbox.mapbox-terrain-v2,mapbox.mapbox-streets-v6/15/17599/10744.vector.pbf"); + + EXPECT_EQ(canonicalURL("https://api.mapbox.com/fonts/v1/mapbox/" + "DIN%20Offc%20Pro%20Italic%2cArial%20Unicode%20MS%20Regular/" + "0-255.pbf?access_token=pk.kAeslEm93Sjf3mXk." + "vbiF02XnvkPkzlFhGSn2iIm6De3Cxsk5tmips2tvkG8sF"), + "mapbox://fonts/v1/mapbox/DIN%20Offc%20Pro%20Italic%2cArial%20Unicode%20MS%20Regular/" + "0-255.pbf"); + + EXPECT_EQ(canonicalURL("https://api.mapbox.com/styles/v1/mapbox/streets-v8/" + "sprite.json?access_token=pk.kAeslEm93Sjf3mXk." + "vbiF02XnvkPkzlFhGSn2iIm6De3Cxsk5tmips2tvkG8sF"), + "mapbox://styles/v1/mapbox/streets-v8/sprite.json"); +} |