Imported Upstream version 1.71.0
[platform/upstream/boost.git] / libs / gil / test / extension / io / targa_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 targa_write_test_module
9
10 #include <boost/gil.hpp>
11 #include <boost/gil/io/typedefs.hpp>
12 #include <boost/gil/extension/io/targa.hpp>
13
14 #include <boost/test/unit_test.hpp>
15
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 = targa_tag;
24
25 BOOST_AUTO_TEST_SUITE( gil_io_targa_tests )
26
27 #ifdef BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
28 BOOST_AUTO_TEST_CASE( write_test )
29 {
30     // test writing all supported image types
31     {
32         write_view( targa_out + "rgb8_test.tga"
33                   , create_mandel_view( 200, 200
34                                       , rgb8_pixel_t( 0,   0, 255 )
35                                       , rgb8_pixel_t( 0, 255,   0 )
36                                       )
37                   , tag_t()
38                   );
39     }
40
41     {
42         write_view( targa_out + "rgba8_test.tga"
43                   , create_mandel_view( 200, 200
44                                       , rgba8_pixel_t( 0,   0, 255, 0 )
45                                       , rgba8_pixel_t( 0, 255,   0, 0 )
46                                       )
47                   , tag_t()
48                   );
49     }
50 }
51 #endif // BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
52
53 BOOST_AUTO_TEST_CASE( rgb_color_space_write_test )
54 {
55     color_space_write_test< tag_t >( targa_out + "rgb_color_space_test.tga"
56                                    , targa_out + "bgr_color_space_test.tga"
57                                    );
58 }
59
60 BOOST_AUTO_TEST_SUITE_END()