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.hpp>
10
11 #include <boost/core/lightweight_test.hpp>
12
13 #include <string>
14
15 #include "tiff_tiled_write_macros.hpp"
16
17 namespace gil = boost::gil;
18
19 #ifdef BOOST_GIL_IO_USE_TIFF_GRAPHICSMAGICK_TEST_SUITE_IMAGES
20
21 BOOST_PP_REPEAT_FROM_TO(1, 8, GENERATE_WRITE_TILE_BIT_ALIGNED_RGB, rgb)
22 BOOST_PP_REPEAT_FROM_TO(9, 11, GENERATE_WRITE_TILE_BIT_ALIGNED_RGB, rgb)
23
test_write_tile_and_compare_with_rgb_strip_contig_8()24 void test_write_tile_and_compare_with_rgb_strip_contig_8()
25 {
26 std::string filename_strip(tiff_in_GM + "tiger-rgb-strip-contig-08.tif");
27
28 gil::rgb8_image_t img_strip, img_saved;
29
30 gil::read_image(filename_strip, img_strip, gil::tiff_tag());
31
32 gil::image_write_info<gil::tiff_tag> info;
33 info._is_tiled = true;
34 info._tile_width = info._tile_length = 16;
35
36 #ifdef BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
37 gil::write_view(
38 tiff_out + "write_tile_and_compare_with_rgb_strip_contig_8.tif", gil::view(img_strip),
39 info);
40 gil::read_image(
41 tiff_out + "write_tile_and_compare_with_rgb_strip_contig_8.tif", img_saved,
42 gil::tiff_tag());
43
44 BOOST_TEST_EQ(gil::equal_pixels(gil::const_view(img_strip), gil::const_view(img_saved)), true);
45 #endif // BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
46 }
47
main()48 int main()
49 {
50 test_write_tile_and_compare_with_rgb_strip_contig_8();
51
52 // TODO: Make sure generated test cases are executed. See tiff_subimage_test.cpp. ~mloskot
53
54 return boost::report_errors();
55 }
56
57 #else
main()58 int main() {}
59 #endif // BOOST_GIL_IO_USE_TIFF_GRAPHICSMAGICK_TEST_SUITE_IMAGES
60