]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/gil/test/extension/io/jpeg_write_test.cpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / gil / test / extension / io / jpeg_write_test.cpp
1 //
2 // Copyright 2013 Christian Henning
3 //
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
7 //
8 //#define BOOST_TEST_MODULE jpeg_write_test_module
9 #include <boost/gil.hpp>
10 #include <boost/gil/extension/io/jpeg.hpp>
11
12 #include <boost/test/unit_test.hpp>
13
14 #include "color_space_write_test.hpp"
15 #include "mandel_view.hpp"
16 #include "paths.hpp"
17
18 using namespace std;
19 using namespace boost::gil;
20
21 using tag_t = jpeg_tag;
22
23 BOOST_AUTO_TEST_SUITE( gil_io_jpeg_tests )
24
25 #ifdef BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
26 BOOST_AUTO_TEST_CASE( write_test )
27 {
28 // test writing all supported image types
29
30 {
31 write_view( jpeg_out + "gray8_test.jpg"
32 , create_mandel_view( 200, 200
33 , gray8_pixel_t( 0 )
34 , gray8_pixel_t( 255 )
35 )
36 , tag_t()
37 );
38 }
39
40 {
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 )
45 )
46 , tag_t()
47 );
48 }
49
50 {
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 )
55 )
56 , tag_t()
57 );
58 }
59 }
60 #endif // BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
61
62 #ifdef BOOST_GIL_IO_TEST_ALLOW_READING_IMAGES
63
64 BOOST_AUTO_TEST_CASE( dct_method_write_test )
65 {
66 {
67 using image_t = rgb8_image_t;
68 image_t img;
69
70 read_image( jpeg_filename
71 , img
72 , tag_t()
73 );
74
75 image_write_info< jpeg_tag > info;
76 info._dct_method = jpeg_dct_method::fast;
77
78 #ifdef BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
79 write_view( jpeg_out + "fast_dct_write_test.jpg"
80 , view( img )
81 , info
82 );
83 #endif // BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
84
85 }
86 }
87
88 #endif // BOOST_GIL_IO_TEST_ALLOW_READING_IMAGES
89
90 BOOST_AUTO_TEST_CASE( rgb_color_space_write_test )
91 {
92 color_space_write_test< jpeg_tag >( jpeg_out + "rgb_color_space_test.jpg"
93 , jpeg_out + "bgr_color_space_test.jpg"
94 );
95 }
96
97 BOOST_AUTO_TEST_SUITE_END()