centralize plugin registration for unit tests
This commit is contained in:
parent
871a881634
commit
e82de0109d
5 changed files with 8 additions and 8 deletions
|
@ -23,7 +23,6 @@ SECTION("layers") {
|
|||
std::string shape_plugin("./plugins/input/shape.input");
|
||||
if (mapnik::util::exists(shape_plugin))
|
||||
{
|
||||
mapnik::datasource_cache::instance().register_datasources("plugins/input/shape.input");
|
||||
mapnik::parameters p;
|
||||
p["type"]="shape";
|
||||
p["file"]="demo/data/boundaries";
|
||||
|
|
|
@ -62,7 +62,6 @@ SECTION("handling") {
|
|||
std::string csv_plugin("./plugins/input/csv.input");
|
||||
if (mapnik::util::exists(csv_plugin)) {
|
||||
try {
|
||||
mapnik::datasource_cache::instance().register_datasource(csv_plugin);
|
||||
mapnik::parameters p;
|
||||
p["type"]="csv";
|
||||
p["inline"]="x,y\n0,0";
|
||||
|
@ -88,7 +87,6 @@ SECTION("handling") {
|
|||
std::string shape_plugin("./plugins/input/shape.input");
|
||||
if (mapnik::util::exists(shape_plugin)) {
|
||||
try {
|
||||
mapnik::datasource_cache::instance().register_datasource(shape_plugin);
|
||||
mapnik::parameters p2;
|
||||
p2["type"]="shape";
|
||||
p2["file"]="foo";
|
||||
|
|
|
@ -33,7 +33,6 @@ TEST_CASE("geojson") {
|
|||
std::string geojson_plugin("./plugins/input/geojson.input");
|
||||
if (mapnik::util::exists(geojson_plugin))
|
||||
{
|
||||
mapnik::datasource_cache::instance().register_datasources("plugins/input/geojson.input");
|
||||
SECTION("json feature cache-feature=\"true\"")
|
||||
{
|
||||
// Create datasource
|
||||
|
@ -50,6 +49,7 @@ 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);
|
||||
}
|
||||
|
@ -69,11 +69,11 @@ 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);
|
||||
}
|
||||
|
||||
mapnik::datasource_cache::instance().register_datasources("plugins/input/geojson.input");
|
||||
SECTION("json extra properties cache-feature=\"true\"")
|
||||
{
|
||||
// Create datasource
|
||||
|
@ -90,12 +90,12 @@ 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<double>(123,456,123,456));
|
||||
}
|
||||
|
||||
mapnik::datasource_cache::instance().register_datasources("plugins/input/geojson.input");
|
||||
SECTION("json extra properties cache-feature=\"false\"")
|
||||
{
|
||||
// Create datasource
|
||||
|
@ -112,6 +112,7 @@ 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<double>(123,456,123,456));
|
||||
|
|
|
@ -21,8 +21,6 @@ SECTION("painting") {
|
|||
std::string csv_plugin("./plugins/input/csv.input");
|
||||
if (mapnik::util::exists(csv_plugin))
|
||||
{
|
||||
datasource_cache::instance().register_datasources(csv_plugin);
|
||||
|
||||
Map m(256, 256);
|
||||
|
||||
feature_type_style lines_style;
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
#define CATCH_CONFIG_RUNNER
|
||||
#include "catch.hpp"
|
||||
|
||||
#include <mapnik/datasource_cache.hpp>
|
||||
|
||||
#include "cleanup.hpp" // run_cleanup()
|
||||
|
||||
int main (int argc, char* const argv[])
|
||||
{
|
||||
mapnik::datasource_cache::instance().register_datasources("plugins/input/");
|
||||
|
||||
int result = Catch::Session().run( argc, argv );
|
||||
|
||||
testing::run_cleanup();
|
||||
|
|
Loading…
Reference in a new issue