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 jpeg_write_test_module
9 #include <boost/gil.hpp>
10 #include <boost/gil/extension/io/jpeg.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
= jpeg_tag
;
23 BOOST_AUTO_TEST_SUITE( gil_io_jpeg_tests
)
25 #ifdef BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
26 BOOST_AUTO_TEST_CASE( write_test
)
28 // test writing all supported image types
31 write_view( jpeg_out
+ "gray8_test.jpg"
32 , create_mandel_view( 200, 200
34 , gray8_pixel_t( 255 )
41 write_view( jpeg_out
+ "rgb8_test.jpg"
42 , create_mandel_view( 200, 200
43 , rgb8_pixel_t( 0, 0, 255 )
44 , rgb8_pixel_t( 0, 255, 0 )
51 write_view( jpeg_out
+ "cmyk8_test.jpg"
52 , create_mandel_view( 200, 200
53 , cmyk8_pixel_t( 0, 0, 255, 127 )
54 , cmyk8_pixel_t( 0, 255, 0, 127 )
60 #endif // BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
62 #ifdef BOOST_GIL_IO_TEST_ALLOW_READING_IMAGES
64 BOOST_AUTO_TEST_CASE( dct_method_write_test
)
67 using image_t
= rgb8_image_t
;
70 read_image( jpeg_filename
75 image_write_info
< jpeg_tag
> info
;
76 info
._dct_method
= jpeg_dct_method::fast
;
78 #ifdef BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
79 write_view( jpeg_out
+ "fast_dct_write_test.jpg"
83 #endif // BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
88 #endif // BOOST_GIL_IO_TEST_ALLOW_READING_IMAGES
90 BOOST_AUTO_TEST_CASE( rgb_color_space_write_test
)
92 color_space_write_test
< jpeg_tag
>( jpeg_out
+ "rgb_color_space_test.jpg"
93 , jpeg_out
+ "bgr_color_space_test.jpg"
97 BOOST_AUTO_TEST_SUITE_END()