return error code when no feature can be read from shapefile + update unit test (ref #3198)
This commit is contained in:
parent
9f19fa8943
commit
9940193c0b
2 changed files with 9 additions and 4 deletions
|
@ -162,9 +162,13 @@ TEST_CASE("shapeindex")
|
||||||
// count features
|
// count features
|
||||||
std::size_t feature_count = count_shapefile_features(path);
|
std::size_t feature_count = count_shapefile_features(path);
|
||||||
// create *.index
|
// create *.index
|
||||||
REQUIRE(create_shapefile_index(path, index_parts) == 0);
|
if (feature_count > 0)
|
||||||
if (feature_count == 0)
|
|
||||||
{
|
{
|
||||||
|
REQUIRE(create_shapefile_index(path, index_parts) == EXIT_SUCCESS);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
REQUIRE(create_shapefile_index(path, index_parts) != EXIT_SUCCESS);
|
||||||
REQUIRE(!mapnik::util::exists(index_path)); // index won't be created if there's no features
|
REQUIRE(!mapnik::util::exists(index_path)); // index won't be created if there's no features
|
||||||
}
|
}
|
||||||
// count features
|
// count features
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
const int DEFAULT_DEPTH = 8;
|
const int DEFAULT_DEPTH = 8;
|
||||||
const double DEFAULT_RATIO=0.55;
|
const double DEFAULT_RATIO = 0.55;
|
||||||
|
|
||||||
int main (int argc,char** argv)
|
int main (int argc,char** argv)
|
||||||
{
|
{
|
||||||
|
@ -278,7 +278,8 @@ int main (int argc,char** argv)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::clog << "No non-empty geometries in shapefile" << std::endl;
|
std::clog << "Failed to read any features from \"" << filename << "\"" << std::endl;
|
||||||
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue