GeoJSON test - add empty geometries tests.
This commit is contained in:
parent
a1084e0c09
commit
dbbf18c752
1 changed files with 21 additions and 2 deletions
|
@ -28,6 +28,7 @@
|
|||
#include <mapnik/datasource_cache.hpp>
|
||||
#include <mapnik/geometry.hpp>
|
||||
#include <mapnik/geometry_type.hpp>
|
||||
#include <mapnik/json/geometry_parser.hpp> // from_geojson
|
||||
#include <mapnik/util/fs.hpp>
|
||||
#include <cstdlib>
|
||||
|
||||
|
@ -115,6 +116,25 @@ TEST_CASE("geojson") {
|
|||
}
|
||||
}
|
||||
|
||||
SECTION("GeoJSON empty Geometries handling")
|
||||
{
|
||||
auto valid_empty_geometries =
|
||||
{
|
||||
"null", // Point can't be empty
|
||||
"{ \"type\": \"LineString\", \"coordinates\": [] }}",
|
||||
"{ \"type\": \"Polygon\", \"coordinates\": [ [ ] ] } }",
|
||||
"{ \"type\": \"MultiPoint\", \"coordinates\": [ ] }}",
|
||||
"{ \"type\": \"MultiLineString\", \"coordinates\": [ [] ] }}",
|
||||
"{ \"type\": \"MultiPolygon\", \"coordinates\": [[ []] ] }}"
|
||||
};
|
||||
|
||||
for (auto const& json : valid_empty_geometries)
|
||||
{
|
||||
mapnik::geometry::geometry<double> geom;
|
||||
CHECK(mapnik::json::from_geojson(json, geom));
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("GeoJSON num_features_to_query")
|
||||
{
|
||||
std::string filename = "./test/data/json/featurecollection-multipleprops.geojson";
|
||||
|
@ -557,8 +577,7 @@ TEST_CASE("geojson") {
|
|||
{
|
||||
mapnik::parameters params;
|
||||
params["type"] = "geojson";
|
||||
for (auto const& c_str : {"./test/data/json/featurecollection-malformed.json",
|
||||
"./test/data/json/featurecollection-malformed-2.json"})
|
||||
for (auto const& c_str : {"./test/data/json/featurecollection-malformed.json"})
|
||||
{
|
||||
std::string filename(c_str);
|
||||
params["file"] = filename;
|
||||
|
|
Loading…
Reference in a new issue