summaryrefslogtreecommitdiff
path: root/test/style/tile_source.test.cpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2016-09-28 11:45:33 +0200
committerKonstantin Käfer <mail@kkaefer.com>2016-09-28 16:34:22 +0200
commit3f3fc7b7723698e44427e2a14a2f4906832800bf (patch)
tree5acadfa4d77817c41f612c89c93925a149cbcfc0 /test/style/tile_source.test.cpp
parenta8b007daa0e85ea4b1a4898fd591d55d0117cc85 (diff)
downloadqtlocation-mapboxgl-3f3fc7b7723698e44427e2a14a2f4906832800bf.tar.gz
[test] add .test.cpp suffix to test case files
Diffstat (limited to 'test/style/tile_source.test.cpp')
-rw-r--r--test/style/tile_source.test.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/style/tile_source.test.cpp b/test/style/tile_source.test.cpp
new file mode 100644
index 0000000000..35d037a049
--- /dev/null
+++ b/test/style/tile_source.test.cpp
@@ -0,0 +1,37 @@
+#include <mbgl/test/util.hpp>
+
+#include <mbgl/style/tile_source_impl.hpp>
+#include <mbgl/util/io.hpp>
+
+using namespace mbgl;
+using namespace mbgl::style;
+
+TEST(TileSourceImpl, ParseTileJSONRaster) {
+ auto result = TileSourceImpl::parseTileJSON(
+ util::read_file("test/fixtures/style_parser/tilejson.raster.json"),
+ "mapbox://mapbox.satellite",
+ SourceType::Raster,
+ 256);
+
+ EXPECT_EQ(0, result.zoomRange.min);
+ EXPECT_EQ(15, result.zoomRange.max);
+ EXPECT_EQ("attribution", result.attribution);
+#if !defined(__ANDROID__) && !defined(__APPLE__)
+ EXPECT_EQ("mapbox://tiles/mapbox.satellite/{z}/{x}/{y}{ratio}.webp", result.tiles[0]);
+#else
+ EXPECT_EQ("mapbox://tiles/mapbox.satellite/{z}/{x}/{y}{ratio}.png", result.tiles[0]);
+#endif
+}
+
+TEST(TileSourceImpl, ParseTileJSONVector) {
+ auto result = TileSourceImpl::parseTileJSON(
+ util::read_file("test/fixtures/style_parser/tilejson.vector.json"),
+ "mapbox://mapbox.streets",
+ SourceType::Vector,
+ 256);
+
+ EXPECT_EQ(0, result.zoomRange.min);
+ EXPECT_EQ(15, result.zoomRange.max);
+ EXPECT_EQ("attribution", result.attribution);
+ EXPECT_EQ("mapbox://tiles/mapbox.streets/{z}/{x}/{y}.vector.pbf", result.tiles[0]);
+}