Merge branch 'master' into geometry-refactor
This commit is contained in:
commit
8e0e344b72
11 changed files with 193 additions and 39 deletions
17
.travis.yml
17
.travis.yml
|
@ -1,4 +1,4 @@
|
||||||
language: cpp
|
language: generic
|
||||||
|
|
||||||
git:
|
git:
|
||||||
depth: 10
|
depth: 10
|
||||||
|
@ -25,7 +25,7 @@ matrix:
|
||||||
- os: linux
|
- os: linux
|
||||||
sudo: false
|
sudo: false
|
||||||
compiler: ": clang"
|
compiler: ": clang"
|
||||||
env: JOBS=8 MASON_PUBLISH=true _CXX="ccache clang++-3.8 -Qunused-arguments" _CC="clang-3.8" TRIGGER=true
|
env: JOBS=8 MASON_PUBLISH=true CXX="ccache clang++-3.8 -Qunused-arguments" CC="clang-3.8" TRIGGER=true
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources: [ 'ubuntu-toolchain-r-test']
|
sources: [ 'ubuntu-toolchain-r-test']
|
||||||
|
@ -33,7 +33,7 @@ matrix:
|
||||||
- os: linux
|
- os: linux
|
||||||
sudo: false
|
sudo: false
|
||||||
compiler: ": clang-coverage"
|
compiler: ": clang-coverage"
|
||||||
env: JOBS=8 COVERAGE=true _CXX="ccache clang++-3.8 -Qunused-arguments" _CC="clang-3.8"
|
env: JOBS=8 COVERAGE=true CXX="ccache clang++-3.8 -Qunused-arguments" CC="clang-3.8"
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources: [ 'ubuntu-toolchain-r-test']
|
sources: [ 'ubuntu-toolchain-r-test']
|
||||||
|
@ -42,7 +42,7 @@ matrix:
|
||||||
compiler: ": clang-osx"
|
compiler: ": clang-osx"
|
||||||
# https://docs.travis-ci.com/user/languages/objective-c/#Supported-OS-X-iOS-SDK-versions
|
# https://docs.travis-ci.com/user/languages/objective-c/#Supported-OS-X-iOS-SDK-versions
|
||||||
osx_image: xcode7.3 # upgrades clang from 6 -> 7
|
osx_image: xcode7.3 # upgrades clang from 6 -> 7
|
||||||
env: JOBS=4 MASON_PUBLISH=true _CXX="ccache clang++ -Qunused-arguments"
|
env: JOBS=4 MASON_PUBLISH=true CXX="ccache clang++ -Qunused-arguments"
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
# workaround travis rvm bug
|
# workaround travis rvm bug
|
||||||
|
@ -51,8 +51,6 @@ before_install:
|
||||||
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
|
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
|
||||||
rvm get head || true
|
rvm get head || true
|
||||||
fi
|
fi
|
||||||
- if [[ ${_CXX:-false} != false ]]; then export CXX=${_CXX}; fi
|
|
||||||
- if [[ ${_CC:-false} != false ]]; then export CC=${_CC}; fi
|
|
||||||
- source scripts/travis-common.sh
|
- source scripts/travis-common.sh
|
||||||
- export PYTHONUSERBASE=$(pwd)/mason_packages/.link
|
- export PYTHONUSERBASE=$(pwd)/mason_packages/.link
|
||||||
- export PATH=${PREFIX}/bin:$(pwd)/mason_packages/.link/bin:${PYTHONUSERBASE}/bin:${PATH}
|
- export PATH=${PREFIX}/bin:$(pwd)/mason_packages/.link/bin:${PYTHONUSERBASE}/bin:${PATH}
|
||||||
|
@ -94,7 +92,12 @@ script:
|
||||||
- export SCONSFLAGS='--debug=time'
|
- export SCONSFLAGS='--debug=time'
|
||||||
- configure BENCHMARK=${BENCH}
|
- configure BENCHMARK=${BENCH}
|
||||||
- cat config.log
|
- cat config.log
|
||||||
- make
|
# we limit the `make` to 35 min
|
||||||
|
# to ensure that slow builds still upload their
|
||||||
|
# ccache results and therefore should be faster
|
||||||
|
# (and might work) for the next build
|
||||||
|
- DURATION=2100
|
||||||
|
- scripts/travis-command-wrapper.py -s "date" -i 120 --deadline=$(( $(date +%s) + ${DURATION} )) make
|
||||||
- make test
|
- make test
|
||||||
- enabled ${COVERAGE} coverage
|
- enabled ${COVERAGE} coverage
|
||||||
- enabled ${BENCH} make bench
|
- enabled ${BENCH} make bench
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
environment:
|
environment:
|
||||||
msvs_toolset: 14
|
msvs_toolset: 14
|
||||||
BOOST_VERSION: 60
|
BOOST_VERSION: 61
|
||||||
FASTBUILD: 1
|
FASTBUILD: 1
|
||||||
matrix:
|
matrix:
|
||||||
- platform: x64
|
- platform: x64
|
||||||
|
@ -24,7 +24,7 @@ build_script:
|
||||||
- scripts\build-appveyor.bat
|
- scripts\build-appveyor.bat
|
||||||
|
|
||||||
after_build:
|
after_build:
|
||||||
- 7z a mapnik-visual-images.zip C:\tmp\mapnik-visual-images
|
- 7z a visual-test-results.zip C:\tmp\mapnik-visual-images\visual-test-results
|
||||||
|
|
||||||
artifacts:
|
artifacts:
|
||||||
- path: mapnik-gyp\msbuild-summary.txt
|
- path: mapnik-gyp\msbuild-summary.txt
|
||||||
|
@ -33,8 +33,8 @@ artifacts:
|
||||||
name: msbuild-errors.txt
|
name: msbuild-errors.txt
|
||||||
- path: mapnik-gyp\msbuild-warnings.txt
|
- path: mapnik-gyp\msbuild-warnings.txt
|
||||||
name: msbuild-warnings.txt
|
name: msbuild-warnings.txt
|
||||||
- path: mapnik-visual-images.zip
|
- path: visual-test-results.zip
|
||||||
name: mapnik-visual-images.zip
|
name: visual-test-results.zip
|
||||||
|
|
||||||
test: off
|
test: off
|
||||||
deploy: off
|
deploy: off
|
||||||
|
|
|
@ -48,7 +48,8 @@ ICU_VERSION="55.1"
|
||||||
|
|
||||||
function install_mason_deps() {
|
function install_mason_deps() {
|
||||||
FAIL=0
|
FAIL=0
|
||||||
install ccache 3.2.4 &
|
install ccache 3.3.0 &
|
||||||
|
install zlib system &
|
||||||
install jpeg_turbo 1.5.0 libjpeg &
|
install jpeg_turbo 1.5.0 libjpeg &
|
||||||
install libpng 1.6.24 libpng &
|
install libpng 1.6.24 libpng &
|
||||||
install libtiff 4.0.6 libtiff &
|
install libtiff 4.0.6 libtiff &
|
||||||
|
|
|
@ -47,9 +47,9 @@ struct MAPNIK_DECL image_view_any : image_view_base
|
||||||
image_view_any() = default;
|
image_view_any() = default;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
image_view_any(T && data)
|
image_view_any(T && _data)
|
||||||
noexcept(std::is_nothrow_constructible<image_view_base, T && >::value)
|
noexcept(std::is_nothrow_constructible<image_view_base, T && >::value)
|
||||||
: image_view_base(std::forward<T>(data)) {}
|
: image_view_base(std::forward<T>(_data)) {}
|
||||||
|
|
||||||
std::size_t width() const;
|
std::size_t width() const;
|
||||||
std::size_t height() const;
|
std::size_t height() const;
|
||||||
|
|
|
@ -28,7 +28,8 @@
|
||||||
#pragma GCC diagnostic ignored "-Wunused-function"
|
#pragma GCC diagnostic ignored "-Wunused-function"
|
||||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||||
#pragma GCC diagnostic ignored "-Wredeclared-class-member"
|
#pragma GCC diagnostic ignored "-Wredeclared-class-member"
|
||||||
#pragma GCC diagnostic ignored "-Wunused-local-typedef"
|
#pragma GCC diagnostic ignored "-Wunused-local-typedef"
|
||||||
|
#pragma GCC diagnostic ignored "-Wunused-local-typedefs" // gcc5
|
||||||
#pragma GCC diagnostic ignored "-Wshadow"
|
#pragma GCC diagnostic ignored "-Wshadow"
|
||||||
#pragma GCC diagnostic ignored "-Wc++11-narrowing"
|
#pragma GCC diagnostic ignored "-Wc++11-narrowing"
|
||||||
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||||
|
|
|
@ -53,11 +53,11 @@ function mason_compile {
|
||||||
}
|
}
|
||||||
|
|
||||||
function mason_cflags {
|
function mason_cflags {
|
||||||
""
|
:
|
||||||
}
|
}
|
||||||
|
|
||||||
function mason_ldflags {
|
function mason_ldflags {
|
||||||
""
|
:
|
||||||
}
|
}
|
||||||
|
|
||||||
function mason_clean {
|
function mason_clean {
|
||||||
|
|
|
@ -113,18 +113,14 @@ geojson_datasource::geojson_datasource(parameters const& params)
|
||||||
desc_(geojson_datasource::name(),
|
desc_(geojson_datasource::name(),
|
||||||
*params.get<std::string>("encoding","utf-8")),
|
*params.get<std::string>("encoding","utf-8")),
|
||||||
filename_(),
|
filename_(),
|
||||||
inline_string_(),
|
from_inline_string_(false),
|
||||||
extent_(),
|
extent_(),
|
||||||
features_(),
|
features_(),
|
||||||
tree_(nullptr),
|
tree_(nullptr),
|
||||||
num_features_to_query_(*params.get<mapnik::value_integer>("num_features_to_query",5))
|
num_features_to_query_(*params.get<mapnik::value_integer>("num_features_to_query",5))
|
||||||
{
|
{
|
||||||
boost::optional<std::string> inline_string = params.get<std::string>("inline");
|
boost::optional<std::string> inline_string = params.get<std::string>("inline");
|
||||||
if (inline_string)
|
if (!inline_string)
|
||||||
{
|
|
||||||
inline_string_ = *inline_string;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
boost::optional<std::string> file = params.get<std::string>("file");
|
boost::optional<std::string> file = params.get<std::string>("file");
|
||||||
if (!file) throw mapnik::datasource_exception("GeoJSON Plugin: missing <file> parameter");
|
if (!file) throw mapnik::datasource_exception("GeoJSON Plugin: missing <file> parameter");
|
||||||
|
@ -137,10 +133,11 @@ geojson_datasource::geojson_datasource(parameters const& params)
|
||||||
has_disk_index_ = mapnik::util::exists(filename_ + ".index");
|
has_disk_index_ = mapnik::util::exists(filename_ + ".index");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!inline_string_.empty())
|
if (inline_string)
|
||||||
{
|
{
|
||||||
char const* start = inline_string_.c_str();
|
from_inline_string_ = true;
|
||||||
char const* end = start + inline_string_.size();
|
char const* start = inline_string->c_str();
|
||||||
|
char const* end = start + inline_string->size();
|
||||||
parse_geojson(start, end);
|
parse_geojson(start, end);
|
||||||
}
|
}
|
||||||
else if (has_disk_index_)
|
else if (has_disk_index_)
|
||||||
|
@ -162,14 +159,6 @@ geojson_datasource::geojson_datasource(parameters const& params)
|
||||||
std::fread(&file_buffer[0], file.size(), 1, file.get());
|
std::fread(&file_buffer[0], file.size(), 1, file.get());
|
||||||
char const* start = file_buffer.c_str();
|
char const* start = file_buffer.c_str();
|
||||||
char const* end = start + file_buffer.length();
|
char const* end = start + file_buffer.length();
|
||||||
if (cache_features_)
|
|
||||||
{
|
|
||||||
parse_geojson(start, end);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
initialise_index(start, end);
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
boost::optional<mapnik::mapped_region_ptr> mapped_region =
|
boost::optional<mapnik::mapped_region_ptr> mapped_region =
|
||||||
mapnik::mapped_memory_cache::instance().find(filename_, false);
|
mapnik::mapped_memory_cache::instance().find(filename_, false);
|
||||||
|
@ -180,6 +169,7 @@ geojson_datasource::geojson_datasource(parameters const& params)
|
||||||
|
|
||||||
char const* start = reinterpret_cast<char const*>((*mapped_region)->get_address());
|
char const* start = reinterpret_cast<char const*>((*mapped_region)->get_address());
|
||||||
char const* end = start + (*mapped_region)->get_size();
|
char const* end = start + (*mapped_region)->get_size();
|
||||||
|
#endif
|
||||||
if (cache_features_)
|
if (cache_features_)
|
||||||
{
|
{
|
||||||
parse_geojson(start, end);
|
parse_geojson(start, end);
|
||||||
|
@ -188,7 +178,6 @@ geojson_datasource::geojson_datasource(parameters const& params)
|
||||||
{
|
{
|
||||||
initialise_index(start, end);
|
initialise_index(start, end);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,7 +265,7 @@ void geojson_datasource::initialise_index(Iterator start, Iterator end)
|
||||||
space);
|
space);
|
||||||
if (!result || itr != end)
|
if (!result || itr != end)
|
||||||
{
|
{
|
||||||
if (!inline_string_.empty()) throw mapnik::datasource_exception("geojson_datasource: Failed to parse GeoJSON file from in-memory string");
|
if (from_inline_string_) throw mapnik::datasource_exception("geojson_datasource: Failed to parse GeoJSON file from in-memory string");
|
||||||
else throw mapnik::datasource_exception("geojson_datasource: Failed to parse GeoJSON file '" + filename_ + "'");
|
else throw mapnik::datasource_exception("geojson_datasource: Failed to parse GeoJSON file '" + filename_ + "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -368,7 +357,7 @@ void geojson_datasource::parse_geojson(Iterator start, Iterator end)
|
||||||
space);
|
space);
|
||||||
if (!result || itr != end)
|
if (!result || itr != end)
|
||||||
{
|
{
|
||||||
if (!inline_string_.empty()) throw mapnik::datasource_exception("geojson_datasource: Failed parse GeoJSON file from in-memory string");
|
if (from_inline_string_) throw mapnik::datasource_exception("geojson_datasource: Failed parse GeoJSON file from in-memory string");
|
||||||
else throw mapnik::datasource_exception("geojson_datasource: Failed parse GeoJSON file '" + filename_ + "'");
|
else throw mapnik::datasource_exception("geojson_datasource: Failed parse GeoJSON file '" + filename_ + "'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -382,7 +371,7 @@ void geojson_datasource::parse_geojson(Iterator start, Iterator end)
|
||||||
space);
|
space);
|
||||||
if (!result || itr != end)
|
if (!result || itr != end)
|
||||||
{
|
{
|
||||||
if (!inline_string_.empty()) throw mapnik::datasource_exception("geojson_datasource: Failed parse GeoJSON file from in-memory string");
|
if (from_inline_string_) throw mapnik::datasource_exception("geojson_datasource: Failed parse GeoJSON file from in-memory string");
|
||||||
else throw mapnik::datasource_exception("geojson_datasource: Failed parse GeoJSON file '" + filename_ + "'");
|
else throw mapnik::datasource_exception("geojson_datasource: Failed parse GeoJSON file '" + filename_ + "'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ private:
|
||||||
mapnik::datasource::datasource_t type_;
|
mapnik::datasource::datasource_t type_;
|
||||||
mapnik::layer_descriptor desc_;
|
mapnik::layer_descriptor desc_;
|
||||||
std::string filename_;
|
std::string filename_;
|
||||||
std::string inline_string_;
|
bool from_inline_string_;
|
||||||
mapnik::box2d<double> extent_;
|
mapnik::box2d<double> extent_;
|
||||||
std::vector<mapnik::feature_ptr> features_;
|
std::vector<mapnik::feature_ptr> features_;
|
||||||
std::unique_ptr<spatial_index_type> tree_;
|
std::unique_ptr<spatial_index_type> tree_;
|
||||||
|
|
106
scripts/travis-command-wrapper.py
Executable file
106
scripts/travis-command-wrapper.py
Executable file
|
@ -0,0 +1,106 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
#
|
||||||
|
# Author: Patrick Ohly <patrick.ohly@intel.com>
|
||||||
|
# Copyright: Copyright (C) 2015 Intel Corporation
|
||||||
|
#
|
||||||
|
# This file is licensed under the MIT license, see COPYING.MIT in
|
||||||
|
# this source distribution for the terms.
|
||||||
|
|
||||||
|
# Runs a command, pipes its output to stdout, and injects status
|
||||||
|
# reports at regular time interval.
|
||||||
|
#
|
||||||
|
# This ensures that TravisCI does not abort the command just because
|
||||||
|
# it is silent for more than 10 minutes, as it can happen with bitbake
|
||||||
|
# when working on a single complex task, like "bitbake linux-yocto".
|
||||||
|
#
|
||||||
|
# Piping bitbake stdout has the advantage that bitbake enters
|
||||||
|
# non-interactive output mode, which it would do when run by TravisCI
|
||||||
|
# directly.
|
||||||
|
#
|
||||||
|
# Finally, the default status messages give some sense of memory
|
||||||
|
# and disk usage, which is critical in the rather constrained
|
||||||
|
# TravisCI environments.
|
||||||
|
|
||||||
|
import errno
|
||||||
|
import optparse
|
||||||
|
import signal
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
|
||||||
|
parser = optparse.OptionParser()
|
||||||
|
parser.add_option("-s", "--status",
|
||||||
|
help="invoked in a shell when it is time for a status report",
|
||||||
|
# 200 columns is readable in the TravisCI Web UI without wrapping.
|
||||||
|
# Depends of course on screen and font size. Resizing top output
|
||||||
|
# only works (and is needed) on the more recent Trusty TravisCI
|
||||||
|
# environment.
|
||||||
|
default="date; free; df -h .; COLUMNS=200 LINES=30 top -w -b -n 1 2>/dev/null || top -n 1; ps x --cols 200 --forest",
|
||||||
|
metavar="SHELL-CMD")
|
||||||
|
parser.add_option("-i", "--interval",
|
||||||
|
help="repeat status at intervals of this amount of seconds, 0 to disable",
|
||||||
|
default=300,
|
||||||
|
metavar="SECONDS", type="int")
|
||||||
|
parser.add_option("-d", "--deadline",
|
||||||
|
help="stop execution when reaching the given time",
|
||||||
|
default=time.time,
|
||||||
|
metavar="SECONDS-SINCE-EPOCH", type="int")
|
||||||
|
|
||||||
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
|
def check_deadline(now):
|
||||||
|
if options.deadline > 0 and options.deadline < now:
|
||||||
|
print "\n\n*** travis-cmd-wrapper: deadline reached, shutting down ***\n\n"
|
||||||
|
sys.exit(1)
|
||||||
|
else:
|
||||||
|
print "deadline not reached: %s > %s" % (options.deadline,now)
|
||||||
|
|
||||||
|
# Set up status alarm. When we have a deadline, we need to check more often
|
||||||
|
# and/or sooner. Sending a SIGALRM manually will also trigger a status report
|
||||||
|
# (not really possible in TravisCI, but may be useful elsewhere).
|
||||||
|
now = time.time()
|
||||||
|
next_status = now + options.interval
|
||||||
|
alarm_interval = max(options.interval, 0)
|
||||||
|
if options.deadline:
|
||||||
|
check_deadline(now)
|
||||||
|
if options.deadline < now + 60:
|
||||||
|
# Wake up a little too late, to be sure that we trigger the if check.
|
||||||
|
deadline_alarm_interval = max(int(options.deadline + 2 - now), 1)
|
||||||
|
elif next_status > 60:
|
||||||
|
deadline_alarm_interval = 60
|
||||||
|
if deadline_alarm_interval < alarm_interval:
|
||||||
|
alarm_interval = deadline_alarm_interval
|
||||||
|
|
||||||
|
def status(signum, frame):
|
||||||
|
global next_status
|
||||||
|
now = time.time()
|
||||||
|
if options.interval < 0 or now >= next_status:
|
||||||
|
subprocess.call(options.status, shell=True)
|
||||||
|
next_status = now + options.interval
|
||||||
|
check_deadline(now)
|
||||||
|
if alarm_interval > 0:
|
||||||
|
signal.alarm(alarm_interval)
|
||||||
|
|
||||||
|
# Run command.
|
||||||
|
try:
|
||||||
|
cmd = subprocess.Popen(args, stdout=subprocess.PIPE)
|
||||||
|
|
||||||
|
# Arm timer and handler.
|
||||||
|
signal.signal(signal.SIGALRM, status)
|
||||||
|
if alarm_interval > 0:
|
||||||
|
signal.alarm(alarm_interval)
|
||||||
|
|
||||||
|
while cmd.poll() is None:
|
||||||
|
try:
|
||||||
|
line = cmd.stdout.readline()
|
||||||
|
sys.stdout.write(line)
|
||||||
|
sys.stdout.flush()
|
||||||
|
except IOError, ex:
|
||||||
|
if ex.errno != errno.EINTR:
|
||||||
|
raise
|
||||||
|
finally:
|
||||||
|
# If we go down, so must our child...
|
||||||
|
if cmd.poll() is None:
|
||||||
|
cmd.kill()
|
||||||
|
|
||||||
|
exit(1 if cmd.returncode else 0)
|
|
@ -117,12 +117,20 @@ datasource::datasource_t memory_datasource::type() const
|
||||||
|
|
||||||
featureset_ptr memory_datasource::features(const query& q) const
|
featureset_ptr memory_datasource::features(const query& q) const
|
||||||
{
|
{
|
||||||
|
if (features_.empty())
|
||||||
|
{
|
||||||
|
return mapnik::make_invalid_featureset();
|
||||||
|
}
|
||||||
return std::make_shared<memory_featureset>(q.get_bbox(),*this,bbox_check_);
|
return std::make_shared<memory_featureset>(q.get_bbox(),*this,bbox_check_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
featureset_ptr memory_datasource::features_at_point(coord2d const& pt, double tol) const
|
featureset_ptr memory_datasource::features_at_point(coord2d const& pt, double tol) const
|
||||||
{
|
{
|
||||||
|
if (features_.empty())
|
||||||
|
{
|
||||||
|
return mapnik::make_invalid_featureset();
|
||||||
|
}
|
||||||
box2d<double> box = box2d<double>(pt.x, pt.y, pt.x, pt.y);
|
box2d<double> box = box2d<double>(pt.x, pt.y, pt.x, pt.y);
|
||||||
box.pad(tol);
|
box.pad(tol);
|
||||||
MAPNIK_LOG_DEBUG(memory_datasource) << "memory_datasource: Box=" << box << ", Point x=" << pt.x << ",y=" << pt.y;
|
MAPNIK_LOG_DEBUG(memory_datasource) << "memory_datasource: Box=" << box << ", Point x=" << pt.x << ",y=" << pt.y;
|
||||||
|
|
46
test/unit/datasource/memory.cpp
Normal file
46
test/unit/datasource/memory.cpp
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
|
*
|
||||||
|
* Copyright (C) 2015 Artem Pavlenko
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include "catch.hpp"
|
||||||
|
#include "ds_test_util.hpp"
|
||||||
|
|
||||||
|
#include <mapnik/unicode.hpp>
|
||||||
|
#include <mapnik/datasource.hpp>
|
||||||
|
#include <mapnik/memory_datasource.hpp>
|
||||||
|
#include <mapnik/datasource_cache.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
TEST_CASE("memory datasource") {
|
||||||
|
|
||||||
|
SECTION("empty featureset")
|
||||||
|
{
|
||||||
|
mapnik::parameters params;
|
||||||
|
mapnik::datasource_ptr ds = std::make_shared<mapnik::memory_datasource>(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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue