summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2015-03-06 12:14:21 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2015-03-06 13:51:20 -0800
commit8804c47d2736e284bb3d6272a38ecc90797d01f0 (patch)
treefb7318497abd43cf4f95a533a519ad527dadce90 /test
parenta3d76dad1064d3020f8b972ed5e7427966f30983 (diff)
downloadqtlocation-mapboxgl-8804c47d2736e284bb3d6272a38ecc90797d01f0.tar.gz
Only add {ratio} to raster tile URLs
Thanks to @mb12 for the suggestion.
Diffstat (limited to 'test')
-rw-r--r--test/miscellaneous/mapbox.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/test/miscellaneous/mapbox.cpp b/test/miscellaneous/mapbox.cpp
index 62344e016b..e82478874b 100644
--- a/test/miscellaneous/mapbox.cpp
+++ b/test/miscellaneous/mapbox.cpp
@@ -19,12 +19,15 @@ TEST(Mapbox, GlyphsURL) {
TEST(Mapbox, TileURL) {
try {
- EXPECT_EQ(mbgl::util::mapbox::normalizeTileURL("http://path.png/tile.png", "mapbox://user.map"), "http://path.png/tile{ratio}.png");
- EXPECT_EQ(mbgl::util::mapbox::normalizeTileURL("http://path.png/tile.png32", "mapbox://user.map"), "http://path.png/tile{ratio}.png32");
- EXPECT_EQ(mbgl::util::mapbox::normalizeTileURL("http://path.png/tile.png70", "mapbox://user.map"), "http://path.png/tile{ratio}.png70");
- EXPECT_EQ(mbgl::util::mapbox::normalizeTileURL("http://path.png/tile.png?access_token=foo", "mapbox://user.map"), "http://path.png/tile{ratio}.png?access_token=foo");
- EXPECT_EQ(mbgl::util::mapbox::normalizeTileURL("http://path.png", "http://path"), "http://path.png");
- EXPECT_EQ(mbgl::util::mapbox::normalizeTileURL("http://path.png", ""), "http://path.png");
+ EXPECT_EQ(mbgl::util::mapbox::normalizeTileURL("http://path.png/tile.png", "mapbox://user.map", SourceType::Raster), "http://path.png/tile{ratio}.png");
+ EXPECT_EQ(mbgl::util::mapbox::normalizeTileURL("http://path.png/tile.png32", "mapbox://user.map", SourceType::Raster), "http://path.png/tile{ratio}.png32");
+ EXPECT_EQ(mbgl::util::mapbox::normalizeTileURL("http://path.png/tile.png70", "mapbox://user.map", SourceType::Raster), "http://path.png/tile{ratio}.png70");
+ EXPECT_EQ(mbgl::util::mapbox::normalizeTileURL("http://path.png/tile.png?access_token=foo", "mapbox://user.map", SourceType::Raster), "http://path.png/tile{ratio}.png?access_token=foo");
+ EXPECT_EQ(mbgl::util::mapbox::normalizeTileURL("http://path.png", "http://path", SourceType::Raster), "http://path.png");
+ EXPECT_EQ(mbgl::util::mapbox::normalizeTileURL("http://path.png", "", SourceType::Raster), "http://path.png");
+ EXPECT_EQ(mbgl::util::mapbox::normalizeTileURL("http://path.png/tile.png", "mapbox://user.map", SourceType::Vector), "http://path.png/tile.png");
+ EXPECT_EQ(mbgl::util::mapbox::normalizeTileURL("http://path.png/tile.pbf", "mapbox://user.map", SourceType::Raster), "http://path.png/tile{ratio}.pbf");
+ EXPECT_EQ(mbgl::util::mapbox::normalizeTileURL("http://path.png/tile.pbf", "mapbox://user.map", SourceType::Vector), "http://path.png/tile.pbf");
} catch (const std::regex_error& e) {
std::cout << "regex_error caught: " << e.what() << '\n';
std::cout << e.code() << '\n';
@@ -57,5 +60,6 @@ TEST(Mapbox, TileURL) {
default:
break;
}
+ throw e;
}
}