diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2017-05-05 16:31:03 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-05-08 13:48:57 -0700 |
commit | baaae99a03202641ae5b8024e57b691fe61a6688 (patch) | |
tree | 459045e56197696aa1312594f1e452b03931775d /test/style | |
parent | e34d8b5c802186008e49364668e4a7bd5668d0fd (diff) | |
download | qtlocation-mapboxgl-baaae99a03202641ae5b8024e57b691fe61a6688.tar.gz |
[core, android] Factor JSON string conversions
This adds a `convertJSON` template, to be used like:
Error error
optional<Foo> foo = convertJSON<Foo>(string, error);
Internally, it parses the string with RapidJSON and then calls `convert<Foo>(parsed, error)`.
While here, rationalize GeoJSON converters and fix error handling for Tileset conversion in OfflineDownload.
Diffstat (limited to 'test/style')
-rw-r--r-- | test/style/tile_source.test.cpp | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/test/style/tile_source.test.cpp b/test/style/tile_source.test.cpp deleted file mode 100644 index 35d037a049..0000000000 --- a/test/style/tile_source.test.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#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]); -} |