diff --git a/run_tests b/run_tests index 8e7121b5d..ccb045123 100755 --- a/run_tests +++ b/run_tests @@ -8,7 +8,7 @@ failures=$((failures+$?)) echo "*** Running C++ tests..." for FILE in tests/cpp_tests/*-bin; do - ${FILE} -q; + ${FILE} -q -d .; failures=$((failures+$?)) done diff --git a/tests/cpp_tests/clipping_test.cpp b/tests/cpp_tests/clipping_test.cpp index ada7f78c9..0bb257492 100644 --- a/tests/cpp_tests/clipping_test.cpp +++ b/tests/cpp_tests/clipping_test.cpp @@ -21,6 +21,7 @@ //#include "agg_path_storage.h" //#include "agg_conv_clipper.h" +#include "utils.hpp" template std::string dump_path(T & path) @@ -87,6 +88,9 @@ int main(int argc, char** argv) 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()) diff --git a/tests/cpp_tests/conversions_test.cpp b/tests/cpp_tests/conversions_test.cpp index ed116c581..687f2ba4a 100644 --- a/tests/cpp_tests/conversions_test.cpp +++ b/tests/cpp_tests/conversions_test.cpp @@ -261,6 +261,12 @@ int main(int argc, char** argv) 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); diff --git a/tests/cpp_tests/exceptions_test.cpp b/tests/cpp_tests/exceptions_test.cpp index d75b8e6cf..bd4b85188 100644 --- a/tests/cpp_tests/exceptions_test.cpp +++ b/tests/cpp_tests/exceptions_test.cpp @@ -22,6 +22,8 @@ #include #include +#include "utils.hpp" + int main(int argc, char** argv) { std::vector args; @@ -32,6 +34,7 @@ int main(int argc, char** argv) 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(); diff --git a/tests/cpp_tests/fontset_runtime_test.cpp b/tests/cpp_tests/fontset_runtime_test.cpp index 10cc4f0b1..436b1523d 100644 --- a/tests/cpp_tests/fontset_runtime_test.cpp +++ b/tests/cpp_tests/fontset_runtime_test.cpp @@ -20,6 +20,8 @@ #include #include +#include "utils.hpp" + int main(int argc, char** argv) { std::vector args; @@ -29,41 +31,43 @@ int main(int argc, char** argv) } bool quiet = std::find(args.begin(), args.end(), "-q")!=args.end(); - // 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(); - 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 *cache = dynamic_cast(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(-256,-256, - 256,256)); - mapnik::image_32 buf(m.width(),m.height()); - mapnik::agg_renderer ren(m,buf); 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(); + 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 *cache = dynamic_cast(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(-256,-256, + 256,256)); + mapnik::image_32 buf(m.width(),m.height()); + mapnik::agg_renderer 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'")); diff --git a/tests/cpp_tests/geometry_converters_test.cpp b/tests/cpp_tests/geometry_converters_test.cpp index 2cf29942b..fb6241cdc 100644 --- a/tests/cpp_tests/geometry_converters_test.cpp +++ b/tests/cpp_tests/geometry_converters_test.cpp @@ -20,6 +20,8 @@ #include #include +#include "utils.hpp" + struct output_geometry_backend { output_geometry_backend(boost::ptr_vector & paths, mapnik::eGeomType type) @@ -133,6 +135,8 @@ int main(int argc, char** argv) } bool quiet = std::find(args.begin(), args.end(), "-q")!=args.end(); + BOOST_TEST(set_working_dir(args)); + // LineString/bbox clipping { std::string wkt_in("LineString(0 0,200 200)");