test geojson - add empty featurecollection test
This commit is contained in:
parent
31814b32d0
commit
008a6eb4cf
2 changed files with 20 additions and 5 deletions
|
@ -1 +1 @@
|
||||||
Subproject commit ca5716fcef3ed33b319d3047f7d8190bf6ed6081
|
Subproject commit 14eabf8f407294e71636cddfce68297a4f4e0303
|
|
@ -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")
|
SECTION("GeoJSON invalid Point")
|
||||||
{
|
{
|
||||||
for (auto cache_features : {true, false})
|
for (auto cache_features : {true, false})
|
||||||
|
@ -285,8 +304,6 @@ TEST_CASE("geojson") {
|
||||||
}
|
}
|
||||||
auto features = ds->features(query);
|
auto features = ds->features(query);
|
||||||
auto features2 = ds->features_at_point(ds->envelope().center(),0);
|
auto features2 = ds->features_at_point(ds->envelope().center(),0);
|
||||||
REQUIRE(features != nullptr);
|
|
||||||
REQUIRE(features2 != nullptr);
|
|
||||||
auto feature = features->next();
|
auto feature = features->next();
|
||||||
auto feature2 = features2->next();
|
auto feature2 = features2->next();
|
||||||
REQUIRE(feature != nullptr);
|
REQUIRE(feature != nullptr);
|
||||||
|
@ -404,7 +421,6 @@ TEST_CASE("geojson") {
|
||||||
query.add_property_name(field.get_name());
|
query.add_property_name(field.get_name());
|
||||||
}
|
}
|
||||||
auto features = ds->features(query);
|
auto features = ds->features(query);
|
||||||
REQUIRE(features != nullptr);
|
|
||||||
auto feature = features->next();
|
auto feature = features->next();
|
||||||
REQUIRE(feature != nullptr);
|
REQUIRE(feature != nullptr);
|
||||||
REQUIRE(feature->envelope() == mapnik::box2d<double>(123,456,123,456));
|
REQUIRE(feature->envelope() == mapnik::box2d<double>(123,456,123,456));
|
||||||
|
@ -693,7 +709,6 @@ TEST_CASE("geojson") {
|
||||||
REQUIRE_FIELD_NAMES(fields, names);
|
REQUIRE_FIELD_NAMES(fields, names);
|
||||||
|
|
||||||
auto fs = all_features(ds);
|
auto fs = all_features(ds);
|
||||||
REQUIRE(bool(fs));
|
|
||||||
std::initializer_list<attr> attrs = {
|
std::initializer_list<attr> attrs = {
|
||||||
attr{"name", tr.transcode("Test")},
|
attr{"name", tr.transcode("Test")},
|
||||||
attr{"NOM_FR", tr.transcode("Québec")},
|
attr{"NOM_FR", tr.transcode("Québec")},
|
||||||
|
|
Loading…
Reference in a new issue