Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / gil / test / extension / io / bmp_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 bmp_write_test_module
9 #include <boost/gil.hpp>
10 #include <boost/gil/io/typedefs.hpp>
11 #include <boost/gil/extension/io/bmp.hpp>
12
13 #include <boost/test/unit_test.hpp>
14
15 #include "cmp_view.hpp"
16 #include "color_space_write_test.hpp"
17 #include "mandel_view.hpp"
18 #include "paths.hpp"
19
20 using namespace std;
21 using namespace boost::gil;
22
23 using tag_t = bmp_tag;
24
25 BOOST_AUTO_TEST_SUITE( gil_io_bmp_tests )
26
27 #ifdef BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
28 BOOST_AUTO_TEST_CASE( write_test )
29 {
30
31     // test writing all supported image types
32     {
33         write_view( bmp_out + "rgb8_test.bmp"
34                   , create_mandel_view( 200, 200
35                                       , rgb8_pixel_t( 0,   0, 255 )
36                                       , rgb8_pixel_t( 0, 255,   0 )
37                                       )
38                   , tag_t()
39                   );
40     }
41
42     {
43         write_view( bmp_out + "rgba8_test.bmp"
44                   , create_mandel_view( 200, 200
45                                       , rgba8_pixel_t( 0,   0, 255, 0 )
46                                       , rgba8_pixel_t( 0, 255,   0, 0 )
47                                       )
48                   , tag_t()
49                   );
50     }
51 }
52 #endif // BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
53
54 BOOST_AUTO_TEST_CASE( rgb_color_space_write_test )
55 {
56     color_space_write_test< bmp_tag >( bmp_out + "rgb_color_space_test.bmp"
57                                      , bmp_out + "bgr_color_space_test.bmp"
58                                      );
59 }
60
61 BOOST_AUTO_TEST_SUITE_END()