test reversed point geojson

This commit is contained in:
Dane Springmeyer 2015-02-23 23:52:54 -08:00
parent 6c57c08a53
commit 2818ff96e8
2 changed files with 29 additions and 17 deletions

View file

@ -11,13 +11,13 @@
TEST_CASE("geometry") { TEST_CASE("geometry") {
SECTION("json") { SECTION("json point") {
mapnik::util::file input("./tests/data/json/fixtures/point1.json"); mapnik::util::file input("./tests/data/json/fixtures/point1.json");
auto json = input.data(); auto json = input.data();
mapnik::new_geometry::geometry geom; mapnik::new_geometry::geometry geom;
std::string json_string(json.get()); std::string json_string(json.get());
REQUIRE( mapnik::json::from_geojson(json_string,geom) ); REQUIRE( mapnik::json::from_geojson(json_string,geom) );
if (geom.is<mapnik::new_geometry::point>()) { REQUIRE( geom.is<mapnik::new_geometry::point>() );
auto const& point = mapnik::util::get<mapnik::new_geometry::point>(geom); auto const& point = mapnik::util::get<mapnik::new_geometry::point>(geom);
REQUIRE( point.x == 30 ); REQUIRE( point.x == 30 );
REQUIRE( point.y == 10 ); REQUIRE( point.y == 10 );
@ -33,6 +33,17 @@ SECTION("json") {
*/ */
//REQUIRE( mapnik::util::to_geojson(new_json,va) ); //REQUIRE( mapnik::util::to_geojson(new_json,va) );
} }
SECTION("json point reversed") {
mapnik::util::file input("./tests/data/json/fixtures/point2.json");
auto json = input.data();
mapnik::new_geometry::geometry geom;
std::string json_string(json.get());
REQUIRE( mapnik::json::from_geojson(json_string,geom) );
REQUIRE( geom.is<mapnik::new_geometry::point>() );
auto const& point = mapnik::util::get<mapnik::new_geometry::point>(geom);
REQUIRE( point.x == 30 );
REQUIRE( point.y == 10 );
} }
} }

View file

@ -0,0 +1 @@
{"coordinates":[30,10],"type":"Point"}