GeoJSON IO test - ensure geometries round-trip.
This commit is contained in:
parent
69e5340ceb
commit
1be4696d52
1 changed files with 12 additions and 2 deletions
|
@ -29,9 +29,10 @@
|
|||
#include <mapnik/geometry.hpp>
|
||||
#include <mapnik/geometry/geometry_type.hpp>
|
||||
#include <mapnik/json/geometry_parser.hpp>
|
||||
#include <mapnik/util/geometry_to_geojson.hpp>
|
||||
#include <mapnik/util/fs.hpp>
|
||||
#include <cstdlib>
|
||||
|
||||
#include <algorithm>
|
||||
#include <boost/optional/optional_io.hpp>
|
||||
|
||||
/*
|
||||
|
@ -128,10 +129,19 @@ TEST_CASE("geojson") {
|
|||
"{ \"type\": \"MultiPolygon\", \"coordinates\": [[ []] ] }"
|
||||
};
|
||||
|
||||
for (auto const& json : valid_empty_geometries)
|
||||
for (auto const& in : valid_empty_geometries)
|
||||
{
|
||||
std::string json(in);
|
||||
mapnik::geometry::geometry<double> geom;
|
||||
CHECK(mapnik::json::from_geojson(json, geom));
|
||||
// round trip
|
||||
std::string json_out;
|
||||
CHECK(mapnik::util::to_geojson(json_out, geom));
|
||||
json.erase(std::remove_if(
|
||||
std::begin(json), std::end(json),
|
||||
[l = std::locale{}](auto ch) { return std::isspace(ch, l); }
|
||||
), std::end(json));
|
||||
REQUIRE(json == json_out);
|
||||
}
|
||||
|
||||
auto invalid_empty_geometries =
|
||||
|
|
Loading…
Reference in a new issue