diff options
Diffstat (limited to 'test/style/conversion/geojson_options.test.cpp')
-rw-r--r-- | test/style/conversion/geojson_options.test.cpp | 39 |
1 files changed, 14 insertions, 25 deletions
diff --git a/test/style/conversion/geojson_options.test.cpp b/test/style/conversion/geojson_options.test.cpp index a798ad6559..4c5a0c9aa4 100644 --- a/test/style/conversion/geojson_options.test.cpp +++ b/test/style/conversion/geojson_options.test.cpp @@ -1,8 +1,7 @@ #include <mbgl/test/util.hpp> -#include <mbgl/style/conversion.hpp> +#include <mbgl/style/conversion/json.hpp> #include <mbgl/style/conversion/geojson_options.hpp> -#include <mbgl/test/conversion_stubs.hpp> #include <mbgl/util/logging.hpp> @@ -10,26 +9,22 @@ using namespace mbgl::style; using namespace mbgl::style::conversion; TEST(GeoJSONOptions, Basic) { - ValueMap map; - Value raw(map); Error error; - mbgl::optional<GeoJSONOptions> converted = convert<GeoJSONOptions>(raw, error); + mbgl::optional<GeoJSONOptions> converted = convertJSON<GeoJSONOptions>("{}", error); ASSERT_TRUE((bool) converted); } TEST(GeoJSONOptions, ErrorHandling) { - ValueMap map {{"maxzoom", std::string{"should not be a string"}}}; - Value raw(map); Error error; - mbgl::optional<GeoJSONOptions> converted = convert<GeoJSONOptions>(raw, error); + mbgl::optional<GeoJSONOptions> converted = convertJSON<GeoJSONOptions>(R"JSON({ + "maxzoom": "should not be a string" + })JSON", error); ASSERT_FALSE((bool) converted); } TEST(GeoJSONOptions, RetainsDefaults) { - ValueMap map; - Value raw(map); Error error; - GeoJSONOptions converted = *convert<GeoJSONOptions>(raw, error); + GeoJSONOptions converted = *convertJSON<GeoJSONOptions>("{}", error); GeoJSONOptions defaults; // GeoJSON-VT @@ -44,22 +39,16 @@ TEST(GeoJSONOptions, RetainsDefaults) { ASSERT_EQ(converted.clusterMaxZoom, defaults.clusterMaxZoom); } - TEST(GeoJSONOptions, FullConversion) { - ValueMap map { - // GeoJSON-VT - {"maxzoom", 1.0f}, - {"buffer", 2.0f}, - {"tolerance", 3.0f}, - - // Supercluster - {"cluster", true}, - {"clusterRadius", 4.0f}, - {"clusterMaxZoom", 5.0f} - }; - Value raw(map); Error error; - GeoJSONOptions converted = *convert<GeoJSONOptions>(raw, error); + GeoJSONOptions converted = *convertJSON<GeoJSONOptions>(R"JSON({ + "maxzoom": 1, + "buffer": 2, + "tolerance": 3, + "cluster": true, + "clusterRadius": 4, + "clusterMaxZoom": 5 + })JSON", error); // GeoJSON-VT ASSERT_EQ(converted.minzoom, 0); |