Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / gil / test / extension / io / subimage_test.hpp
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 #ifndef BOOST_GIL_IO_TEST_SUBIMAGE_TEST_HPP
9 #define BOOST_GIL_IO_TEST_SUBIMAGE_TEST_HPP
10
11 #include <boost/gil.hpp>
12
13 using namespace std;
14 using namespace boost;
15 using namespace gil;
16
17 template< typename Image
18         , typename Format
19         >
20 void run_subimage_test( string filename
21                       , const point_t& top_left
22                       , const point_t& dimension
23                       )
24 {
25     Image original, subimage;
26
27     read_image( filename
28               , original
29               , Format()
30               );
31
32     image_read_settings< Format > settings( top_left
33                                            , dimension
34                                            );
35
36
37     read_image( filename
38               , subimage
39               , settings
40               );
41
42     BOOST_CHECK( equal_pixels( const_view( subimage )
43                              , subimage_view( const_view( original )
44                                             , top_left
45                                             , dimension
46                                             )
47                              )
48                );
49 }
50
51 #endif // BOOST_GIL_IO_TEST_SUBIMAGE_TEST_HPP