update cpp_tests from master
This commit is contained in:
parent
b7a9d29dbc
commit
b45d3f984d
16 changed files with 309 additions and 184 deletions
|
@ -4,6 +4,8 @@
|
|||
#include <cstdio>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include "agg_color_rgba.h"
|
||||
#include "agg_pixfmt_rgba.h"
|
||||
#include "agg_rendering_buffer.h"
|
||||
|
@ -130,8 +132,15 @@ template<class ColorT, class Order> struct comp_op_rgba_src_over2
|
|||
|
||||
}
|
||||
|
||||
int main( int, char*[] )
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
std::vector<std::string> args;
|
||||
for (int i=1;i<argc;++i)
|
||||
{
|
||||
args.push_back(argv[i]);
|
||||
}
|
||||
bool quiet = std::find(args.begin(), args.end(), "-q")!=args.end();
|
||||
|
||||
typedef agg::comp_op_rgba_src_over2<color, agg::order_rgba> source_over_old_agg;
|
||||
typedef agg::comp_op_rgba_src_over<color, agg::order_rgba> source_over;
|
||||
|
||||
|
@ -194,7 +203,8 @@ int main( int, char*[] )
|
|||
*/
|
||||
|
||||
if (!::boost::detail::test_errors()) {
|
||||
std::clog << "C++ AGG blending: \x1b[1;32m✓ \x1b[0m\n";
|
||||
if (quiet) std::clog << "\x1b[1;32m.\x1b[0m";
|
||||
else std::clog << "C++ AGG blending: \x1b[1;32m✓ \x1b[0m\n";
|
||||
#if BOOST_VERSION >= 104600
|
||||
::boost::detail::report_errors_remind().called_report_errors_function = true;
|
||||
#endif
|
||||
|
|
|
@ -6,38 +6,40 @@ Import ('env')
|
|||
|
||||
test_env = env.Clone()
|
||||
|
||||
test_env['LIBS'] = copy(env['LIBMAPNIK_LIBS'])
|
||||
test_env.AppendUnique(LIBS='mapnik')
|
||||
test_env.AppendUnique(LIBS='sqlite3')
|
||||
test_env.AppendUnique(CXXFLAGS='-g')
|
||||
|
||||
test_env['CXXFLAGS'] = copy(test_env['LIBMAPNIK_CXXFLAGS'])
|
||||
|
||||
if test_env['HAS_CAIRO']:
|
||||
test_env.PrependUnique(CPPPATH=test_env['CAIRO_CPPPATHS'])
|
||||
test_env.Append(CPPDEFINES = '-DHAVE_CAIRO')
|
||||
|
||||
for cpp_test in glob.glob('*_test.cpp'):
|
||||
name = cpp_test.replace('.cpp','-bin')
|
||||
source_files = [cpp_test]
|
||||
test_program = None
|
||||
if 'agg_blend_src_over_test' in cpp_test:
|
||||
# customization here for faster compile
|
||||
agg_env = Environment(ENV=os.environ)
|
||||
agg_env['CXX'] = env['CXX']
|
||||
agg_env['CXXFLAGS'] = env['CXXFLAGS']
|
||||
if 'agg' in test_env['LIBS']:
|
||||
agg_env.AppendUnique(LIBS='agg')
|
||||
agg_env.Append(CPPPATH = '#deps/agg/include')
|
||||
agg_env.Append(LIBPATH = '#deps/agg')
|
||||
agg_env['CPPPATH'] = ['#deps/agg/include',env['BOOST_INCLUDES']]
|
||||
test_program = agg_env.Program(name, source=source_files, LINKFLAGS=env['CUSTOM_LDFLAGS'])
|
||||
else:
|
||||
test_env_local = test_env.Clone()
|
||||
if 'csv_parse' in cpp_test:
|
||||
source_files += glob.glob('../../plugins/input/csv/' + '*.cpp')
|
||||
test_program = test_env_local.Program(name, source=source_files, LINKFLAGS=env['CUSTOM_LDFLAGS'])
|
||||
Depends(test_program, env.subst('../../src/%s' % env['MAPNIK_LIB_NAME']))
|
||||
# build locally if installing
|
||||
if 'install' in COMMAND_LINE_TARGETS:
|
||||
env.Alias('install',test_program)
|
||||
if not env['CPP_TESTS']:
|
||||
for cpp_test_bin in glob.glob('*-bin'):
|
||||
os.unlink(cpp_test_bin)
|
||||
else:
|
||||
test_env['LIBS'] = copy(env['LIBMAPNIK_LIBS'])
|
||||
test_env.AppendUnique(LIBS='mapnik')
|
||||
test_env.AppendUnique(CXXFLAGS='-g')
|
||||
test_env['CXXFLAGS'] = copy(test_env['LIBMAPNIK_CXXFLAGS'])
|
||||
if test_env['HAS_CAIRO']:
|
||||
test_env.PrependUnique(CPPPATH=test_env['CAIRO_CPPPATHS'])
|
||||
test_env.Append(CPPDEFINES = '-DHAVE_CAIRO')
|
||||
for cpp_test in glob.glob('*_test.cpp'):
|
||||
name = cpp_test.replace('.cpp','-bin')
|
||||
source_files = [cpp_test]
|
||||
test_program = None
|
||||
# enable for faster compile while developing just this test
|
||||
#if 'agg_blend_src_over_test' in cpp_test:
|
||||
if False:
|
||||
# customization here for faster compile
|
||||
agg_env = Environment(ENV=os.environ)
|
||||
agg_env['CXX'] = env['CXX']
|
||||
agg_env['CXXFLAGS'] = env['CXXFLAGS']
|
||||
if 'agg' in test_env['LIBS']:
|
||||
agg_env.AppendUnique(LIBS='agg')
|
||||
agg_env.Append(CPPPATH = '#deps/agg/include')
|
||||
agg_env.Append(LIBPATH = '#deps/agg')
|
||||
agg_env['CPPPATH'] = ['#deps/agg/include',env['BOOST_INCLUDES']]
|
||||
test_program = agg_env.Program(name, source=source_files, LINKFLAGS=env['CUSTOM_LDFLAGS'])
|
||||
else:
|
||||
test_env_local = test_env.Clone()
|
||||
if 'csv_parse' in cpp_test:
|
||||
source_files += glob.glob('../../plugins/input/csv/' + '*.cpp')
|
||||
test_program = test_env_local.Program(name, source=source_files, LINKFLAGS=env['CUSTOM_LDFLAGS'])
|
||||
Depends(test_program, env.subst('../../src/%s' % env['MAPNIK_LIB_NAME']))
|
||||
# build locally if installing
|
||||
if 'install' in COMMAND_LINE_TARGETS:
|
||||
env.Alias('install',test_program)
|
||||
|
|
|
@ -9,10 +9,11 @@
|
|||
#include <boost/foreach.hpp>
|
||||
|
||||
// stl
|
||||
#include <exception>
|
||||
#include <stdexcept>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
// agg
|
||||
#include "agg_conv_clip_polygon.h"
|
||||
|
@ -20,6 +21,7 @@
|
|||
//#include "agg_path_storage.h"
|
||||
//#include "agg_conv_clipper.h"
|
||||
|
||||
#include "utils.hpp"
|
||||
|
||||
template <typename T>
|
||||
std::string dump_path(T & path)
|
||||
|
@ -76,9 +78,19 @@ void parse_geom(mapnik::geometry_type & geom,
|
|||
}
|
||||
}
|
||||
|
||||
int main( int, char*[] )
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
std::vector<std::string> args;
|
||||
for (int i=1;i<argc;++i)
|
||||
{
|
||||
args.push_back(argv[i]);
|
||||
}
|
||||
bool quiet = std::find(args.begin(), args.end(), "-q")!=args.end();
|
||||
|
||||
try {
|
||||
|
||||
BOOST_TEST(set_working_dir(args));
|
||||
|
||||
std::string filename("tests/cpp_tests/data/cases.txt");
|
||||
std::ifstream stream(filename.c_str(),std::ios_base::in | std::ios_base::binary);
|
||||
if (!stream.is_open())
|
||||
|
@ -111,7 +123,8 @@ int main( int, char*[] )
|
|||
|
||||
if (!::boost::detail::test_errors())
|
||||
{
|
||||
std::clog << "C++ clipping: \x1b[1;32m✓ \x1b[0m\n";
|
||||
if (quiet) std::clog << "\x1b[1;32m.\x1b[0m";
|
||||
else std::clog << "C++ clipping: \x1b[1;32m✓ \x1b[0m\n";
|
||||
#if BOOST_VERSION >= 104600
|
||||
::boost::detail::report_errors_remind().called_report_errors_function = true;
|
||||
#endif
|
||||
|
|
|
@ -3,9 +3,25 @@
|
|||
#include <mapnik/util/conversions.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
int main( int, char*[] )
|
||||
#if defined(_MSC_VER)
|
||||
#include <cstdio>
|
||||
#endif
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
#if defined(_MSC_VER)
|
||||
unsigned int old = _set_output_format(_TWO_DIGIT_EXPONENT);
|
||||
#endif
|
||||
std::vector<std::string> args;
|
||||
for (int i=1;i<argc;++i)
|
||||
{
|
||||
args.push_back(argv[i]);
|
||||
}
|
||||
bool quiet = std::find(args.begin(), args.end(), "-q")!=args.end();
|
||||
|
||||
using mapnik::util::to_string;
|
||||
|
||||
try
|
||||
|
@ -186,6 +202,14 @@ int main( int, char*[] )
|
|||
BOOST_TEST_EQ( out, "1.00001" );
|
||||
out.clear();
|
||||
|
||||
to_string(out, double(67.65));
|
||||
BOOST_TEST_EQ( out, "67.65" );
|
||||
out.clear();
|
||||
|
||||
to_string(out, double(67.35));
|
||||
BOOST_TEST_EQ( out, "67.35" );
|
||||
out.clear();
|
||||
|
||||
to_string(out, double(1234000000000000));
|
||||
BOOST_TEST_EQ( out, "1.234e+15" );
|
||||
out.clear();
|
||||
|
@ -237,6 +261,12 @@ int main( int, char*[] )
|
|||
to_string(out,mapnik::value_integer(9223372036854775807));
|
||||
BOOST_TEST_EQ( out, "9223372036854775807" );
|
||||
out.clear();
|
||||
#else
|
||||
#ifdef _MSC_VER
|
||||
#pragma NOTE("BIGINT not defined so skipping large number conversion tests")
|
||||
#else
|
||||
#warning BIGINT not defined so skipping large number conversion tests
|
||||
#endif
|
||||
#endif
|
||||
// bool
|
||||
to_string(out, true);
|
||||
|
@ -254,7 +284,8 @@ int main( int, char*[] )
|
|||
}
|
||||
|
||||
if (!::boost::detail::test_errors()) {
|
||||
std::clog << "C++ type conversions: \x1b[1;32m✓ \x1b[0m\n";
|
||||
if (quiet) std::clog << "\x1b[1;32m.\x1b[0m";
|
||||
else std::clog << "C++ type conversions: \x1b[1;32m✓ \x1b[0m\n";
|
||||
#if BOOST_VERSION >= 104600
|
||||
::boost::detail::report_errors_remind().called_report_errors_function = true;
|
||||
#endif
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
#include <boost/version.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <iostream>
|
||||
#include "plugins/input/csv/csv_datasource.hpp"
|
||||
#include <mapnik/params.hpp>
|
||||
|
||||
|
||||
int main( int, char*[] )
|
||||
{
|
||||
// test of directly instanciating a datasource
|
||||
try {
|
||||
mapnik::parameters params;
|
||||
params["type"]="csv";
|
||||
params["file"]="./tests/data/csv/wkt.csv";
|
||||
csv_datasource ds(params);
|
||||
BOOST_TEST(true);
|
||||
} catch (std::exception const& ex) {
|
||||
BOOST_TEST(false);
|
||||
std::clog << "threw: " << ex.what() << "\n";
|
||||
}
|
||||
|
||||
if (!::boost::detail::test_errors()) {
|
||||
std::clog << "C++ CSV parse: \x1b[1;32m✓ \x1b[0m\n";
|
||||
#if BOOST_VERSION >= 104600
|
||||
::boost::detail::report_errors_remind().called_report_errors_function = true;
|
||||
#endif
|
||||
} else {
|
||||
return ::boost::report_errors();
|
||||
}
|
||||
}
|
|
@ -3,5 +3,7 @@
|
|||
# SEG_END=0 SEG_MOVETO = 1 SEG_LINETO = 2 SEG_CLOSE = (0x40 | 0x0f)
|
||||
50,50,150,150;0 0 1,200 200 2;50 50 1,150 150 2
|
||||
50,50,150,150;50 50 1,150 50 2,150 150 2,50 150 2,50 50 2;50 50 1,150 50 2,150 150 2,50 150 2,50 50 2
|
||||
# points are dropped by line clipper
|
||||
50,50,150,150;75 75 1;
|
||||
# TODO - should the close path be kept after clipping?
|
||||
# 50,50,150,150;50 50 1,150 50 2,150 150 2,50 150 2,50 50 2,0 0 79;50 50 1,150 50 2,150 150 2,50 150 2,50 50 2
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include <boost/version.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/filesystem/convenience.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <iostream>
|
||||
#include <mapnik/projection.hpp>
|
||||
|
@ -19,14 +18,23 @@
|
|||
#include <mapnik/config_error.hpp>
|
||||
#include <mapnik/datasource_cache.hpp>
|
||||
#include <mapnik/params.hpp>
|
||||
#include <mapnik/util/fs.hpp>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
extern "C" {
|
||||
#include <sqlite3.h>
|
||||
}
|
||||
#include "utils.hpp"
|
||||
|
||||
int main( int, char*[] )
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
std::vector<std::string> args;
|
||||
for (int i=1;i<argc;++i)
|
||||
{
|
||||
args.push_back(argv[i]);
|
||||
}
|
||||
bool quiet = std::find(args.begin(), args.end(), "-q")!=args.end();
|
||||
|
||||
try {
|
||||
BOOST_TEST(set_working_dir(args));
|
||||
mapnik::projection srs("foo");
|
||||
// to avoid unused variable warning
|
||||
srs.params();
|
||||
|
@ -44,7 +52,7 @@ int main( int, char*[] )
|
|||
map.insert_style("style",style);
|
||||
|
||||
std::string csv_plugin("./plugins/input/csv.input");
|
||||
if (boost::filesystem::exists(csv_plugin)) {
|
||||
if (mapnik::util::exists(csv_plugin)) {
|
||||
try {
|
||||
mapnik::datasource_cache::instance().register_datasource(csv_plugin);
|
||||
mapnik::parameters p;
|
||||
|
@ -70,7 +78,7 @@ int main( int, char*[] )
|
|||
}
|
||||
|
||||
std::string shape_plugin("./plugins/input/shape.input");
|
||||
if (boost::filesystem::exists(shape_plugin)) {
|
||||
if (mapnik::util::exists(shape_plugin)) {
|
||||
try {
|
||||
mapnik::datasource_cache::instance().register_datasource(shape_plugin);
|
||||
mapnik::parameters p2;
|
||||
|
@ -83,27 +91,9 @@ int main( int, char*[] )
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
// not working, oddly segfaults valgrind
|
||||
try {
|
||||
sqlite3_initialize();
|
||||
// http://stackoverflow.com/questions/11107703/sqlite3-sigsegvs-with-valgrind
|
||||
sqlite3_config(SQLITE_CONFIG_HEAP, malloc (1024*1024), 1024*1024, 64);
|
||||
mapnik::datasource_cache::instance().register_datasource("./plugins/input/sqlite.input");
|
||||
mapnik::parameters p;
|
||||
p["type"]="sqlite";
|
||||
p["file"]="tests/data/sqlite/world.sqlite";
|
||||
p["table"]="world_merc";
|
||||
mapnik::datasource_cache::instance().create(p);
|
||||
sqlite3_shutdown();
|
||||
BOOST_TEST(true);
|
||||
} catch (...) {
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
*/
|
||||
|
||||
if (!::boost::detail::test_errors()) {
|
||||
std::clog << "C++ exceptions: \x1b[1;32m✓ \x1b[0m\n";
|
||||
if (quiet) std::clog << "\x1b[1;32m.\x1b[0m";
|
||||
else std::clog << "C++ exceptions: \x1b[1;32m✓ \x1b[0m\n";
|
||||
#if BOOST_VERSION >= 104600
|
||||
::boost::detail::report_errors_remind().called_report_errors_function = true;
|
||||
#endif
|
||||
|
|
|
@ -1,21 +1,36 @@
|
|||
#include <boost/version.hpp>
|
||||
#include <boost/filesystem/convenience.hpp>
|
||||
namespace fs = boost::filesystem;
|
||||
using fs::path;
|
||||
namespace sys = boost::system;
|
||||
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <iostream>
|
||||
#include <mapnik/font_engine_freetype.hpp>
|
||||
#include <mapnik/util/fs.hpp>
|
||||
#include <mapnik/debug.hpp>
|
||||
|
||||
int main( int, char*[] )
|
||||
#include <boost/version.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
#include "utils.hpp"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
std::vector<std::string> args;
|
||||
for (int i=1;i<argc;++i)
|
||||
{
|
||||
args.push_back(argv[i]);
|
||||
}
|
||||
bool quiet = std::find(args.begin(), args.end(), "-q")!=args.end();
|
||||
|
||||
try
|
||||
{
|
||||
mapnik::logger logger;
|
||||
logger.set_severity(mapnik::logger::none);
|
||||
|
||||
BOOST_TEST(set_working_dir(args));
|
||||
|
||||
std::string fontdir("fonts/");
|
||||
|
||||
BOOST_TEST( fs::exists( fontdir ) );
|
||||
BOOST_TEST( fs::is_directory( fontdir ) );
|
||||
BOOST_TEST( mapnik::util::exists( fontdir ) );
|
||||
BOOST_TEST( mapnik::util::is_directory( fontdir ) );
|
||||
|
||||
std::vector<std::string> face_names;
|
||||
|
||||
|
@ -80,7 +95,8 @@ int main( int, char*[] )
|
|||
}
|
||||
|
||||
if (!::boost::detail::test_errors()) {
|
||||
std::clog << "C++ fonts registration: \x1b[1;32m✓ \x1b[0m\n";
|
||||
if (quiet) std::clog << "\x1b[1;32m.\x1b[0m";
|
||||
else std::clog << "C++ fonts registration: \x1b[1;32m✓ \x1b[0m\n";
|
||||
#if BOOST_VERSION >= 104600
|
||||
::boost::detail::report_errors_remind().called_report_errors_function = true;
|
||||
#endif
|
||||
|
|
|
@ -17,51 +17,63 @@
|
|||
#include <mapnik/image_util.hpp>
|
||||
#include <mapnik/color_factory.hpp>
|
||||
#include <mapnik/save_map.hpp>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
#include "utils.hpp"
|
||||
|
||||
int main( int, char*[] )
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
// create a renderable map with a fontset and a text symbolizer
|
||||
// and do not register any fonts, to ensure the error thrown is reasonable
|
||||
mapnik::context_ptr ctx = boost::make_shared<mapnik::context_type>();
|
||||
ctx->push("name");
|
||||
mapnik::feature_ptr feature(mapnik::feature_factory::create(ctx,1));
|
||||
mapnik::transcoder tr("utf-8");
|
||||
UnicodeString ustr = tr.transcode("hello world!");
|
||||
feature->put("name",ustr);
|
||||
mapnik::geometry_type * pt = new mapnik::geometry_type(mapnik::Point);
|
||||
pt->move_to(128,128);
|
||||
feature->add_geometry(pt);
|
||||
mapnik::datasource_ptr memory_ds = boost::make_shared<mapnik::memory_datasource>();
|
||||
mapnik::memory_datasource *cache = dynamic_cast<mapnik::memory_datasource *>(memory_ds.get());
|
||||
cache->push(feature);
|
||||
mapnik::Map m(256,256);
|
||||
mapnik::font_set fontset("fontset");
|
||||
// NOTE: this is a valid font, but will fail because none are registered
|
||||
fontset.add_face_name("DejaVu Sans Book");
|
||||
m.insert_fontset("fontset", fontset);
|
||||
mapnik::layer lyr("layer");
|
||||
lyr.set_datasource(memory_ds);
|
||||
lyr.add_style("style");
|
||||
m.addLayer(lyr);
|
||||
mapnik::feature_type_style the_style;
|
||||
mapnik::rule the_rule;
|
||||
mapnik::text_symbolizer text_sym(mapnik::parse_expression("[name]"),10,mapnik::color(0,0,0));
|
||||
text_sym.set_fontset(fontset);
|
||||
the_rule.append(text_sym);
|
||||
the_style.add_rule(the_rule);
|
||||
m.insert_style("style",the_style );
|
||||
m.zoom_to_box(mapnik::box2d<double>(-256,-256,
|
||||
256,256));
|
||||
mapnik::image_32 buf(m.width(),m.height());
|
||||
mapnik::agg_renderer<mapnik::image_32> ren(m,buf);
|
||||
std::vector<std::string> args;
|
||||
for (int i=1;i<argc;++i)
|
||||
{
|
||||
args.push_back(argv[i]);
|
||||
}
|
||||
bool quiet = std::find(args.begin(), args.end(), "-q")!=args.end();
|
||||
|
||||
try {
|
||||
BOOST_TEST(set_working_dir(args));
|
||||
|
||||
// create a renderable map with a fontset and a text symbolizer
|
||||
// and do not register any fonts, to ensure the error thrown is reasonable
|
||||
mapnik::context_ptr ctx = boost::make_shared<mapnik::context_type>();
|
||||
ctx->push("name");
|
||||
mapnik::feature_ptr feature(mapnik::feature_factory::create(ctx,1));
|
||||
mapnik::transcoder tr("utf-8");
|
||||
UnicodeString ustr = tr.transcode("hello world!");
|
||||
feature->put("name",ustr);
|
||||
mapnik::geometry_type * pt = new mapnik::geometry_type(mapnik::Point);
|
||||
pt->move_to(128,128);
|
||||
feature->add_geometry(pt);
|
||||
boost::shared_ptr<mapnik::memory_datasource> ds = boost::make_shared<mapnik::memory_datasource>();
|
||||
ds->push(feature);
|
||||
mapnik::Map m(256,256);
|
||||
mapnik::font_set fontset("fontset");
|
||||
// NOTE: this is a valid font, but will fail because none are registered
|
||||
fontset.add_face_name("DejaVu Sans Book");
|
||||
m.insert_fontset("fontset", fontset);
|
||||
mapnik::layer lyr("layer");
|
||||
lyr.set_datasource(ds);
|
||||
lyr.add_style("style");
|
||||
m.addLayer(lyr);
|
||||
mapnik::feature_type_style the_style;
|
||||
mapnik::rule the_rule;
|
||||
mapnik::text_symbolizer text_sym(mapnik::parse_expression("[name]"),10,mapnik::color(0,0,0));
|
||||
text_sym.set_fontset(fontset);
|
||||
the_rule.append(text_sym);
|
||||
the_style.add_rule(the_rule);
|
||||
m.insert_style("style",the_style );
|
||||
m.zoom_to_box(mapnik::box2d<double>(-256,-256,
|
||||
256,256));
|
||||
mapnik::image_32 buf(m.width(),m.height());
|
||||
mapnik::agg_renderer<mapnik::image_32> ren(m,buf);
|
||||
ren.apply();
|
||||
} catch (std::exception const& ex) {
|
||||
BOOST_TEST_EQ(std::string(ex.what()),std::string("No valid font face could be loaded for font set: 'fontset'"));
|
||||
}
|
||||
if (!::boost::detail::test_errors()) {
|
||||
std::clog << "C++ fontset runtime: \x1b[1;32m✓ \x1b[0m\n";
|
||||
if (quiet) std::clog << "\x1b[1;32m.\x1b[0m";
|
||||
else std::clog << "C++ fontset runtime: \x1b[1;32m✓ \x1b[0m\n";
|
||||
#if BOOST_VERSION >= 104600
|
||||
::boost::detail::report_errors_remind().called_report_errors_function = true;
|
||||
#endif
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
#include <boost/version.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include "utils.hpp"
|
||||
|
||||
#if BOOST_VERSION >= 104700
|
||||
#include <mapnik/layer.hpp>
|
||||
#include <mapnik/feature_type_style.hpp>
|
||||
#include <mapnik/debug.hpp>
|
||||
|
@ -8,15 +14,12 @@
|
|||
#include <mapnik/geometry.hpp>
|
||||
#include <mapnik/wkt/wkt_factory.hpp>
|
||||
#include <mapnik/well_known_srs.hpp>
|
||||
|
||||
#if BOOST_VERSION >= 104700
|
||||
#include <mapnik/util/geometry_to_wkb.hpp>
|
||||
#include <mapnik/util/geometry_to_wkt.hpp>
|
||||
#include <mapnik/util/geometry_to_svg.hpp>
|
||||
#endif
|
||||
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <iostream>
|
||||
// stl
|
||||
#include <stdexcept>
|
||||
|
||||
struct output_geometry_backend
|
||||
{
|
||||
|
@ -121,9 +124,21 @@ boost::optional<std::string> polygon_bbox_clipping(mapnik::box2d<double> bbox,
|
|||
|
||||
return boost::optional<std::string>();
|
||||
}
|
||||
#endif
|
||||
|
||||
int main( int, char*[] )
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
std::vector<std::string> args;
|
||||
for (int i=1;i<argc;++i)
|
||||
{
|
||||
args.push_back(argv[i]);
|
||||
}
|
||||
bool quiet = std::find(args.begin(), args.end(), "-q")!=args.end();
|
||||
|
||||
BOOST_TEST(set_working_dir(args));
|
||||
|
||||
#if BOOST_VERSION >= 104700
|
||||
|
||||
// LineString/bbox clipping
|
||||
{
|
||||
std::string wkt_in("LineString(0 0,200 200)");
|
||||
|
@ -161,9 +176,13 @@ int main( int, char*[] )
|
|||
BOOST_TEST_EQ(*result,std::string("Polygon((50 50,50 100,75 150,125 150,150 100,150 50,50 50))"));
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
if (!::boost::detail::test_errors())
|
||||
{
|
||||
std::clog << "C++ geometry conversions: \x1b[1;32m✓ \x1b[0m\n";
|
||||
if (quiet) std::clog << "\x1b[1;32m.\x1b[0m";
|
||||
else std::clog << "C++ geometry conversions: \x1b[1;32m✓ \x1b[0m\n";
|
||||
#if BOOST_VERSION >= 104600
|
||||
::boost::detail::report_errors_remind().called_report_errors_function = true;
|
||||
#endif
|
||||
|
|
|
@ -1,62 +1,86 @@
|
|||
#include <boost/version.hpp>
|
||||
#include <boost/filesystem/convenience.hpp>
|
||||
namespace fs = boost::filesystem;
|
||||
using fs::path;
|
||||
namespace sys = boost::system;
|
||||
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <iostream>
|
||||
#include <mapnik/image_reader.hpp>
|
||||
#include <mapnik/image_util.hpp>
|
||||
#include <mapnik/util/fs.hpp>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
#include "utils.hpp"
|
||||
|
||||
int main( int, char*[] )
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
std::string blank;
|
||||
std::vector<std::string> args;
|
||||
for (int i=1;i<argc;++i)
|
||||
{
|
||||
args.push_back(argv[i]);
|
||||
}
|
||||
bool quiet = std::find(args.begin(), args.end(), "-q")!=args.end();
|
||||
|
||||
std::string should_throw;
|
||||
boost::optional<std::string> type;
|
||||
try
|
||||
{
|
||||
blank = "./tests/cpp_tests/data/blank.jpg";
|
||||
BOOST_TEST( fs::exists( blank ) );
|
||||
type = mapnik::type_from_filename(blank);
|
||||
BOOST_TEST(set_working_dir(args));
|
||||
|
||||
should_throw = "./tests/cpp_tests/data/blank.jpg";
|
||||
BOOST_TEST( mapnik::util::exists( should_throw ) );
|
||||
type = mapnik::type_from_filename(should_throw);
|
||||
BOOST_TEST( type );
|
||||
try
|
||||
{
|
||||
std::auto_ptr<mapnik::image_reader> reader(mapnik::get_image_reader(blank,*type));
|
||||
BOOST_TEST( false );
|
||||
std::auto_ptr<mapnik::image_reader> reader(mapnik::get_image_reader(should_throw,*type));
|
||||
if (reader.get()) BOOST_TEST( false );
|
||||
}
|
||||
catch (std::exception const&)
|
||||
{
|
||||
BOOST_TEST( true );
|
||||
}
|
||||
|
||||
blank = "./tests/cpp_tests/data/blank.png";
|
||||
BOOST_TEST( fs::exists( blank ) );
|
||||
type = mapnik::type_from_filename(blank);
|
||||
should_throw = "./tests/cpp_tests/data/blank.png";
|
||||
BOOST_TEST( mapnik::util::exists( should_throw ) );
|
||||
type = mapnik::type_from_filename(should_throw);
|
||||
BOOST_TEST( type );
|
||||
try
|
||||
{
|
||||
std::auto_ptr<mapnik::image_reader> reader(mapnik::get_image_reader(blank,*type));
|
||||
BOOST_TEST( false );
|
||||
std::auto_ptr<mapnik::image_reader> reader(mapnik::get_image_reader(should_throw,*type));
|
||||
if (reader.get()) BOOST_TEST( false );
|
||||
}
|
||||
catch (std::exception const&)
|
||||
{
|
||||
BOOST_TEST( true );
|
||||
}
|
||||
|
||||
blank = "./tests/cpp_tests/data/blank.tiff";
|
||||
BOOST_TEST( fs::exists( blank ) );
|
||||
type = mapnik::type_from_filename(blank);
|
||||
should_throw = "./tests/cpp_tests/data/blank.tiff";
|
||||
BOOST_TEST( mapnik::util::exists( should_throw ) );
|
||||
type = mapnik::type_from_filename(should_throw);
|
||||
BOOST_TEST( type );
|
||||
try
|
||||
{
|
||||
std::auto_ptr<mapnik::image_reader> reader(mapnik::get_image_reader(blank,*type));
|
||||
BOOST_TEST( false );
|
||||
std::auto_ptr<mapnik::image_reader> reader(mapnik::get_image_reader(should_throw,*type));
|
||||
if (reader.get()) BOOST_TEST( false );
|
||||
}
|
||||
catch (std::exception const&)
|
||||
{
|
||||
BOOST_TEST( true );
|
||||
}
|
||||
|
||||
should_throw = "./tests/data/images/xcode-CgBI.png";
|
||||
BOOST_TEST( mapnik::util::exists( should_throw ) );
|
||||
type = mapnik::type_from_filename(should_throw);
|
||||
BOOST_TEST( type );
|
||||
try
|
||||
{
|
||||
std::auto_ptr<mapnik::image_reader> reader(mapnik::get_image_reader(should_throw,*type));
|
||||
if (reader.get()) BOOST_TEST( false );
|
||||
}
|
||||
catch (std::exception const&)
|
||||
{
|
||||
BOOST_TEST( true );
|
||||
}
|
||||
|
||||
}
|
||||
catch (std::exception const & ex)
|
||||
{
|
||||
|
@ -65,7 +89,8 @@ int main( int, char*[] )
|
|||
}
|
||||
|
||||
if (!::boost::detail::test_errors()) {
|
||||
std::clog << "C++ image i/o: \x1b[1;32m✓ \x1b[0m\n";
|
||||
if (quiet) std::clog << "\x1b[1;32m.\x1b[0m";
|
||||
else std::clog << "C++ image i/o: \x1b[1;32m✓ \x1b[0m\n";
|
||||
#if BOOST_VERSION >= 104600
|
||||
::boost::detail::report_errors_remind().called_report_errors_function = true;
|
||||
#endif
|
||||
|
|
|
@ -3,10 +3,18 @@
|
|||
#include <iostream>
|
||||
#include <mapnik/geometry.hpp>
|
||||
#include <mapnik/geom_util.hpp>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
int main( int, char*[] )
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
std::vector<std::string> args;
|
||||
for (int i=1;i<argc;++i)
|
||||
{
|
||||
args.push_back(argv[i]);
|
||||
}
|
||||
bool quiet = std::find(args.begin(), args.end(), "-q")!=args.end();
|
||||
|
||||
// reused these for simplicity
|
||||
double x,y;
|
||||
|
||||
|
@ -35,7 +43,8 @@ int main( int, char*[] )
|
|||
// MULTIPOLYGON(((-52 40,-60 32,-68 40,-60 48,-52 40)),((-60 50,-80 30,-100 49.9999999999999,-80.0000000000001 70,-60 50)),((-52 60,-60 52,-68 60,-60 68,-52 60)))
|
||||
|
||||
if (!::boost::detail::test_errors()) {
|
||||
std::clog << "C++ label algorithms: \x1b[1;32m✓ \x1b[0m\n";
|
||||
if (quiet) std::clog << "\x1b[1;32m.\x1b[0m";
|
||||
else std::clog << "C++ label algorithms: \x1b[1;32m✓ \x1b[0m\n";
|
||||
#if BOOST_VERSION >= 104600
|
||||
::boost::detail::report_errors_remind().called_report_errors_function = true;
|
||||
#endif
|
||||
|
|
|
@ -18,6 +18,10 @@
|
|||
#include <mapnik/scale_denominator.hpp>
|
||||
#include <mapnik/feature_style_processor.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
#include "utils.hpp"
|
||||
|
||||
bool compare_images(std::string const& src_fn,std::string const& dest_fn)
|
||||
{
|
||||
|
@ -56,11 +60,23 @@ bool compare_images(std::string const& src_fn,std::string const& dest_fn)
|
|||
return true;
|
||||
}
|
||||
|
||||
int main( int, char*[] )
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
std::vector<std::string> args;
|
||||
for (int i=1;i<argc;++i)
|
||||
{
|
||||
args.push_back(argv[i]);
|
||||
}
|
||||
bool quiet = std::find(args.begin(), args.end(), "-q")!=args.end();
|
||||
// TODO - re-enable if we can control the freetype/cairo versions used
|
||||
// https://github.com/mapnik/mapnik/issues/1868
|
||||
/*
|
||||
std::string expected("./tests/cpp_tests/support/map-request-marker-text-line-expected.png");
|
||||
std::string expected_cairo("./tests/cpp_tests/support/map-request-marker-text-line-expected-cairo.png");
|
||||
try {
|
||||
|
||||
BOOST_TEST(set_working_dir(args));
|
||||
|
||||
mapnik::datasource_cache::instance().register_datasources("./plugins/input/");
|
||||
mapnik::freetype_engine::register_fonts("./fonts", true );
|
||||
mapnik::Map m(256,256);
|
||||
|
@ -141,8 +157,10 @@ int main( int, char*[] )
|
|||
} catch (std::exception const& ex) {
|
||||
std::clog << ex.what() << "\n";
|
||||
}
|
||||
*/
|
||||
if (!::boost::detail::test_errors()) {
|
||||
std::clog << "C++ Map Request rendering hook: \x1b[1;32m✓ \x1b[0m\n";
|
||||
if (quiet) std::clog << "\x1b[1;32m.\x1b[0m";
|
||||
else std::clog << "C++ Map Request rendering hook: \x1b[1;32m✓ \x1b[0m\n";
|
||||
#if BOOST_VERSION >= 104600
|
||||
::boost::detail::report_errors_remind().called_report_errors_function = true;
|
||||
#endif
|
||||
|
|
|
@ -4,11 +4,18 @@
|
|||
#include <mapnik/value_types.hpp>
|
||||
#include <mapnik/params.hpp>
|
||||
#include <mapnik/boolean.hpp>
|
||||
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <boost/variant.hpp>
|
||||
|
||||
int main( int, char*[] )
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
std::vector<std::string> args;
|
||||
for (int i=1;i<argc;++i)
|
||||
{
|
||||
args.push_back(argv[i]);
|
||||
}
|
||||
bool quiet = std::find(args.begin(), args.end(), "-q")!=args.end();
|
||||
|
||||
mapnik::parameters params;
|
||||
|
||||
|
@ -73,7 +80,8 @@ int main( int, char*[] )
|
|||
//BOOST_TEST( (params.get<mapnik::value_null>("null")/* && *params.get<mapnik::value_null>("null") == mapnik::value_null()*/) );
|
||||
|
||||
if (!::boost::detail::test_errors()) {
|
||||
std::clog << "C++ parameters: \x1b[1;32m✓ \x1b[0m\n";
|
||||
if (quiet) std::clog << "\x1b[1;32m.\x1b[0m";
|
||||
else std::clog << "C++ parameters: \x1b[1;32m✓ \x1b[0m\n";
|
||||
#if BOOST_VERSION >= 104600
|
||||
::boost::detail::report_errors_remind().called_report_errors_function = true;
|
||||
#endif
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
Binary file not shown.
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Loading…
Reference in a new issue