From d407cfa456d93dfec50cc18c132e6dba93468975 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Fri, 23 Aug 2013 15:07:45 -0700 Subject: [PATCH] cpp tests: fix test to respect DEFINES --- tests/cpp_tests/image_io_test.cpp | 65 +++++++++++++++++-------------- 1 file changed, 36 insertions(+), 29 deletions(-) diff --git a/tests/cpp_tests/image_io_test.cpp b/tests/cpp_tests/image_io_test.cpp index 549378ba4..c4b374d72 100644 --- a/tests/cpp_tests/image_io_test.cpp +++ b/tests/cpp_tests/image_io_test.cpp @@ -25,6 +25,8 @@ int main(int argc, char** argv) { BOOST_TEST(set_working_dir(args)); + +#if defined(HAVE_JPEG) should_throw = "./tests/cpp_tests/data/blank.jpg"; BOOST_TEST( mapnik::util::exists( should_throw ) ); type = mapnik::type_from_filename(should_throw); @@ -38,7 +40,9 @@ int main(int argc, char** argv) { BOOST_TEST( true ); } +#endif +#if defined(HAVE_PNG) should_throw = "./tests/cpp_tests/data/blank.png"; BOOST_TEST( mapnik::util::exists( should_throw ) ); type = mapnik::type_from_filename(should_throw); @@ -52,35 +56,6 @@ int main(int argc, char** argv) { BOOST_TEST( true ); } - - 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 reader(mapnik::get_image_reader(should_throw,*type)); - if (reader.get()) BOOST_TEST( false ); - } - catch (std::exception const&) - { - BOOST_TEST( true ); - } - - should_throw = "./tests/cpp_tests/data/blank.webp"; - BOOST_TEST( mapnik::util::exists( should_throw ) ); - type = mapnik::type_from_filename(should_throw); - BOOST_TEST( type ); - try - { - std::auto_ptr reader(mapnik::get_image_reader(should_throw,*type)); - 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); @@ -94,7 +69,39 @@ int main(int argc, char** argv) { BOOST_TEST( true ); } +#endif +#if defined(HAVE_TIFF) + 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 reader(mapnik::get_image_reader(should_throw,*type)); + if (reader.get()) BOOST_TEST( false ); + } + catch (std::exception const&) + { + BOOST_TEST( true ); + } +#endif + +#if defined(HAVE_WEBP) + should_throw = "./tests/cpp_tests/data/blank.webp"; + BOOST_TEST( mapnik::util::exists( should_throw ) ); + type = mapnik::type_from_filename(should_throw); + BOOST_TEST( type ); + try + { + std::auto_ptr reader(mapnik::get_image_reader(should_throw,*type)); + BOOST_TEST( false ); + } + catch (std::exception const&) + { + BOOST_TEST( true ); + } +#endif } catch (std::exception const & ex) {