mapnik/test/standalone/datasource_registration_test.cpp
Mathis Logemann 42f465f842 refactor datasource plugins
fix merge

remove old DATASOURCE_PLUGIN call

fix memory_datasource

wip

wip

fix temp return

fix install

wip before_unload

linux

remove docker

remove docker

comments

add windows error message if libmapnik=static and plugins=dynamic

fix false plugin macro

plugin default de/constructor to remove UB

simplyfy plugin targets - add fpic

fix makro

simplyfy

use unique_ptr for plugin handle

rename option static plugins

replace local init with fnc call

call setup everywhere

init datasource_static
2022-02-07 15:35:09 +01:00

53 lines
1.8 KiB
C++

#define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include <mapnik/mapnik.hpp>
#include <mapnik/datasource_cache.hpp>
#include <mapnik/debug.hpp>
#include <mapnik/util/fs.hpp>
#include <iostream>
#include <vector>
#include <algorithm>
TEST_CASE("datasource_cache")
{
mapnik::setup();
SECTION("registration")
{
try
{
mapnik::logger logger;
mapnik::logger::severity_type original_severity = logger.get_severity();
bool success = false;
auto& cache = mapnik::datasource_cache::instance();
// registering a directory without any plugins should return false
success = cache.register_datasources("test/data/vrt");
CHECK(success == false);
// use existence of shape.input as proxy for whether any datasource plugins are available
std::string shape_plugin("./plugins/input/shape.input");
if (mapnik::util::exists(shape_plugin))
{
// registering a directory for the first time should return true
success = cache.register_datasources("plugins/input");
REQUIRE(success == true);
// registering the same directory again should now return false
success = cache.register_datasources("plugins/input");
CHECK(success == false);
// registering the same directory again, but recursively should
// still return false - even though there are subdirectories, they
// do not contain any more plugins.
success = cache.register_datasources("plugins/input", true);
CHECK(success == false);
}
} catch (std::exception const& ex)
{
std::clog << ex.what() << "\n";
REQUIRE(false);
}
}
}