[tests] also test when using static
This commit is contained in:
parent
0f0e06c6b8
commit
ee63a6f055
6 changed files with 73 additions and 81 deletions
|
@ -85,17 +85,15 @@ mapnik::datasource_ptr get_csv_ds(std::string const& file_name, bool strict = tr
|
|||
TEST_CASE("csv")
|
||||
{
|
||||
using mapnik::util::from_u8string;
|
||||
std::string csv_plugin("./plugins/input/csv.input");
|
||||
if (mapnik::util::exists(csv_plugin))
|
||||
|
||||
// check the CSV datasource is loaded
|
||||
const bool have_csv_plugin = mapnik::datasource_cache::instance().plugin_registered("csv");
|
||||
if (have_csv_plugin)
|
||||
{
|
||||
// make the tests silent since we intentionally test error conditions that are noisy
|
||||
auto const severity = mapnik::logger::instance().get_severity();
|
||||
mapnik::logger::instance().set_severity(mapnik::logger::none);
|
||||
|
||||
// check the CSV datasource is loaded
|
||||
const std::vector<std::string> plugin_names = mapnik::datasource_cache::instance().plugin_names();
|
||||
const bool have_csv_plugin = std::find(plugin_names.begin(), plugin_names.end(), "csv") != plugin_names.end();
|
||||
|
||||
SECTION("CSV I/O errors")
|
||||
{
|
||||
std::string filename = "does_not_exist.csv";
|
||||
|
@ -124,8 +122,6 @@ TEST_CASE("csv")
|
|||
SECTION("broken files")
|
||||
{
|
||||
for (auto create_index : {false, true})
|
||||
{
|
||||
if (have_csv_plugin)
|
||||
{
|
||||
std::vector<std::string> broken;
|
||||
add_csv_files("test/data/csv/fails", broken);
|
||||
|
@ -162,12 +158,9 @@ TEST_CASE("csv")
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // END SECTION
|
||||
|
||||
SECTION("good files")
|
||||
{
|
||||
if (have_csv_plugin)
|
||||
{
|
||||
std::vector<std::string> good;
|
||||
add_csv_files("test/data/csv", good);
|
||||
|
@ -204,7 +197,6 @@ TEST_CASE("csv")
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // END SECTION
|
||||
|
||||
SECTION("lon/lat detection")
|
||||
|
|
|
@ -31,8 +31,8 @@ namespace {
|
|||
|
||||
mapnik::datasource_ptr get_gdal_ds(std::string const& file_name, boost::optional<mapnik::value_integer> band)
|
||||
{
|
||||
std::string gdal_plugin("./plugins/input/gdal.input");
|
||||
if (!mapnik::util::exists(gdal_plugin))
|
||||
const bool have_gdal_plugin = mapnik::datasource_cache::instance().plugin_registered("gdal");
|
||||
if (!have_gdal_plugin)
|
||||
{
|
||||
return mapnik::datasource_ptr();
|
||||
}
|
||||
|
|
|
@ -37,8 +37,8 @@
|
|||
|
||||
TEST_CASE("Geobuf")
|
||||
{
|
||||
std::string geobuf_plugin("./plugins/input/geobuf.input");
|
||||
if (mapnik::util::exists(geobuf_plugin))
|
||||
const bool have_geobuf_plugin = mapnik::datasource_cache::instance().plugin_registered("geobuf");
|
||||
if (have_geobuf_plugin)
|
||||
{
|
||||
SECTION("Point")
|
||||
{
|
||||
|
|
|
@ -81,8 +81,8 @@ void iterate_over_features(mapnik::featureset_ptr features)
|
|||
|
||||
TEST_CASE("geojson")
|
||||
{
|
||||
std::string geojson_plugin("./plugins/input/geojson.input");
|
||||
if (mapnik::util::exists(geojson_plugin))
|
||||
const bool have_geojson_plugin = mapnik::datasource_cache::instance().plugin_registered("geojson");
|
||||
if (have_geojson_plugin)
|
||||
{
|
||||
SECTION("GeoJSON I/O errors")
|
||||
{
|
||||
|
|
|
@ -28,12 +28,12 @@
|
|||
#include <mapnik/image.hpp>
|
||||
#include <mapnik/image_reader.hpp>
|
||||
#include <mapnik/image_util.hpp>
|
||||
#include <mapnik/util/fs.hpp>
|
||||
#include <mapnik/datasource_cache.hpp>
|
||||
|
||||
TEST_CASE("ogr")
|
||||
{
|
||||
std::string geojson_plugin("./plugins/input/ogr.input");
|
||||
if (mapnik::util::exists(geojson_plugin))
|
||||
const bool have_ogr_plugin = mapnik::datasource_cache::instance().plugin_registered("ogr");
|
||||
if (have_ogr_plugin)
|
||||
{
|
||||
SECTION("ogr point feature")
|
||||
{
|
||||
|
|
|
@ -98,8 +98,8 @@ int create_shapefile_index(std::string const& filename, bool index_parts, bool s
|
|||
|
||||
TEST_CASE("invalid shapeindex")
|
||||
{
|
||||
std::string shape_plugin("./plugins/input/shape.input");
|
||||
if (mapnik::util::exists(shape_plugin))
|
||||
const bool have_shape_plugin = mapnik::datasource_cache::instance().plugin_registered("shape");
|
||||
if (have_shape_plugin)
|
||||
{
|
||||
SECTION("Invalid index")
|
||||
{
|
||||
|
@ -141,8 +141,8 @@ TEST_CASE("invalid shapeindex")
|
|||
|
||||
TEST_CASE("shapeindex")
|
||||
{
|
||||
std::string shape_plugin("./plugins/input/shape.input");
|
||||
if (mapnik::util::exists(shape_plugin))
|
||||
const bool have_shape_plugin = mapnik::datasource_cache::instance().plugin_registered("shape");
|
||||
if (have_shape_plugin)
|
||||
{
|
||||
SECTION("Index")
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue