diff --git a/test/data b/test/data index ca5716fcef..14eabf8f40 160000 --- a/test/data +++ b/test/data @@ -1 +1 @@ -Subproject commit ca5716fcef3ed33b319d3047f7d8190bf6ed6081 +Subproject commit 14eabf8f407294e71636cddfce68297a4f4e0303 diff --git a/test/unit/datasource/geojson.cpp b/test/unit/datasource/geojson.cpp index 60052db8b3..cf32148622 100644 --- a/test/unit/datasource/geojson.cpp +++ b/test/unit/datasource/geojson.cpp @@ -96,6 +96,25 @@ TEST_CASE("geojson") { } } + SECTION("GeoJSON an empty FeatureCollection") + { + for (auto cache_features : {true, false}) + { + mapnik::parameters params; + params["type"] = "geojson"; + params["file"] = "./test/data/json/empty_featurecollection.json"; + params["cache_features"] = cache_features; + auto ds = mapnik::datasource_cache::instance().create(params); + CHECK(ds != nullptr); + auto fs = all_features(ds); + REQUIRE(mapnik::is_valid(fs)); + while (auto f = fs->next()) + { + CHECK(false); // shouldn't get here + } + } + } + SECTION("GeoJSON invalid Point") { for (auto cache_features : {true, false}) @@ -285,8 +304,6 @@ TEST_CASE("geojson") { } auto features = ds->features(query); auto features2 = ds->features_at_point(ds->envelope().center(),0); - REQUIRE(features != nullptr); - REQUIRE(features2 != nullptr); auto feature = features->next(); auto feature2 = features2->next(); REQUIRE(feature != nullptr); @@ -404,7 +421,6 @@ TEST_CASE("geojson") { query.add_property_name(field.get_name()); } auto features = ds->features(query); - REQUIRE(features != nullptr); auto feature = features->next(); REQUIRE(feature != nullptr); REQUIRE(feature->envelope() == mapnik::box2d(123,456,123,456)); @@ -693,7 +709,6 @@ TEST_CASE("geojson") { REQUIRE_FIELD_NAMES(fields, names); auto fs = all_features(ds); - REQUIRE(bool(fs)); std::initializer_list attrs = { attr{"name", tr.transcode("Test")}, attr{"NOM_FR", tr.transcode("Québec")},