2 // Copyright 2013 Christian Henning
4 // Distributed under the Boost Software License, Version 1.0
5 // See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt
8 //#define BOOST_TEST_MODULE pnm_write_test_module
10 #include <boost/gil/extension/io/pnm.hpp>
12 #include <boost/test/unit_test.hpp>
14 #include "color_space_write_test.hpp"
15 #include "mandel_view.hpp"
19 using namespace boost::gil;
21 using tag_t = pnm_tag;
23 BOOST_AUTO_TEST_SUITE( gil_io_pnm_tests )
25 #ifdef BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
26 BOOST_AUTO_TEST_CASE( write_test )
28 mandel_view< rgb8_pixel_t >::type v = create_mandel_view( 200, 200
29 , rgb8_pixel_t( 0, 0, 255 )
30 , rgb8_pixel_t( 0, 255, 0 )
33 // test writing all supported image types
35 using gray1_image_t = bit_aligned_image1_type<1, gray_layout_t>::type;
36 gray1_image_t dst( 200, 200 );
38 copy_and_convert_pixels( v, view( dst ));
40 write_view( pnm_out + "p4_write_test.pnm"
47 gray8_image_t dst( 200, 200 );
49 copy_and_convert_pixels( v, view( dst ));
51 write_view( pnm_out + "p5_write_test.pnm"
58 write_view( pnm_out + "p6_write_test.pnm"
64 #endif // BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
66 BOOST_AUTO_TEST_CASE( rgb_color_space_write_test )
68 color_space_write_test< pnm_tag >( pnm_out + "rgb_color_space_test.pnm"
69 , pnm_out + "bgr_color_space_test.pnm"
73 BOOST_AUTO_TEST_SUITE_END()