]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/gil/test/extension/toolbox/channel_view.cpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / gil / test / extension / toolbox / channel_view.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/toolbox/metafunctions/channel_view.hpp>
10
11 #include <boost/test/unit_test.hpp>
12
13 #include <type_traits>
14
15 namespace bg = boost::gil;
16
17 BOOST_AUTO_TEST_SUITE(toolbox_tests)
18
19 BOOST_AUTO_TEST_CASE(channel_view_test)
20 {
21 using image_t = bg::rgb8_image_t;
22 image_t img(100, 100);
23
24 using kth_channel_view_t
25 = bg::kth_channel_view_type<0, bg::rgb8_view_t::const_t>::type;
26 using channel_view_t
27 = bg::channel_view_type<bg::red_t, bg::rgb8_view_t::const_t>::type;
28
29 static_assert(std::is_same
30 <
31 kth_channel_view_t,
32 channel_view_t
33 >::value,
34 "");
35
36 kth_channel_view_t const kth0 = bg::kth_channel_view<0>(bg::const_view(img));
37 BOOST_TEST(kth0.num_channels() == 1u);
38
39 channel_view_t const red = bg::channel_view<bg::red_t>(bg::const_view(img));
40 BOOST_TEST(red.num_channels() == 1u);
41 }
42
43 BOOST_AUTO_TEST_SUITE_END()