]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/gil/test/extension/io/tiff/tiff_old_test.cpp
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / boost / libs / gil / test / extension / io / tiff / tiff_old_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 #include <boost/gil.hpp>
9 #include <boost/gil/extension/io/tiff/old.hpp>
10
11 #include <boost/mp11.hpp>
12 #include <boost/core/lightweight_test.hpp>
13
14 #include "paths.hpp"
15
16 namespace gil = boost::gil;
17 namespace mp11 = boost::mp11;
18
19 // This test file will only test the old library's interface.
20 // It's more of a compile time test than a runtime test.
21
22 #ifdef BOOST_GIL_IO_TEST_ALLOW_READING_IMAGES
23
24 void test_old_read_dimensions()
25 {
26 boost::gil::point_t dim = gil::tiff_read_dimensions(tiff_filename);
27 BOOST_TEST_EQ(dim.x, 1000);
28 BOOST_TEST_EQ(dim.y, 600);
29 }
30
31 void test_old_read_image()
32 {
33 gil::rgba8_image_t img;
34 gil::tiff_read_image(tiff_filename, img);
35
36 BOOST_TEST_EQ(img.width(), 1000);
37 BOOST_TEST_EQ(img.height(), 600);
38 }
39
40 void test_old_read_and_convert_image()
41 {
42 gil::rgb8_image_t img;
43 gil::tiff_read_and_convert_image(tiff_filename, img);
44
45 BOOST_TEST_EQ(img.width(), 1000);
46 BOOST_TEST_EQ(img.height(), 600);
47 }
48
49 void test_old_read_view()
50 {
51 gil::rgba8_image_t img(1000, 600);
52 gil::tiff_read_view(tiff_filename, gil::view(img));
53 }
54
55 void test_old_read_and_convert_view()
56 {
57 gil::rgb8_image_t img(1000, 600);
58 gil::tiff_read_and_convert_view(tiff_filename, gil::view(img));
59 }
60
61 void test_old_dynamic_image()
62 {
63 using my_img_types = mp11::mp_list
64 <
65 gil::gray8_image_t,
66 gil::gray16_image_t,
67 gil::rgba8_image_t,
68 gil::gray1_image_t
69 >;
70 gil::any_image<my_img_types> image;
71
72 gil::tiff_read_image(tiff_filename.c_str(), image);
73
74 #ifdef BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
75 gil::tiff_write_view(tiff_out + "old_dynamic_image_test.tif", gil::view(image));
76 #endif // BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
77 }
78
79 int main()
80 {
81 test_old_read_dimensions();
82 test_old_read_image();
83 test_old_read_and_convert_image();
84 test_old_read_view();
85 test_old_read_and_convert_view();
86 test_old_dynamic_image();
87
88 return boost::report_errors();
89 }
90
91 #else
92 int main() {}
93 #endif // BOOST_GIL_IO_TEST_ALLOW_READING_IMAGES