]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/gil/test/extension/toolbox/channel_type.cpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / gil / test / extension / toolbox / channel_type.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/extension/toolbox/metafunctions/channel_type.hpp>
9 #include <boost/gil/extension/toolbox/metafunctions/is_bit_aligned.hpp>
10
11 #include <boost/gil/channel.hpp>
12 #include <boost/gil/detail/is_channel_integral.hpp>
13
14 #include <boost/test/unit_test.hpp>
15
16 #include <type_traits>
17
18 namespace bg = boost::gil;
19
20 BOOST_AUTO_TEST_SUITE(toolbox_tests)
21
22 BOOST_AUTO_TEST_CASE(channel_type_test)
23 {
24 static_assert(std::is_same
25 <
26 unsigned char,
27 bg::channel_type<bg::rgb8_pixel_t>::type
28 >::value, "");
29
30 // float32_t is a scoped_channel_value object
31 static_assert(std::is_same
32 <
33 bg::float32_t,
34 bg::channel_type<bg::rgba32f_pixel_t>::type
35 >::value, "");
36
37 // channel_type for bit_aligned images doesn't work with standard gil.
38 using image_t = bg::bit_aligned_image4_type<4, 4, 4, 4, bg::rgb_layout_t>::type;
39 using channel_t = bg::channel_type<image_t::view_t::reference>::type;
40 static_assert(bg::detail::is_channel_integral<channel_t>::value, "");
41 }
42
43 BOOST_AUTO_TEST_SUITE_END()