2 // Copyright 2013 Christian Henning
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
8 #include <boost/gil.hpp>
9 #include <boost/gil/extension/toolbox/metafunctions/channel_view.hpp>
11 #include <boost/test/unit_test.hpp>
13 #include <type_traits>
15 namespace bg = boost::gil;
17 BOOST_AUTO_TEST_SUITE(toolbox_tests)
19 BOOST_AUTO_TEST_CASE(channel_view_test)
21 using image_t = bg::rgb8_image_t;
22 image_t img(100, 100);
24 using kth_channel_view_t
25 = bg::kth_channel_view_type<0, bg::rgb8_view_t::const_t>::type;
27 = bg::channel_view_type<bg::red_t, bg::rgb8_view_t::const_t>::type;
29 static_assert(std::is_same
36 kth_channel_view_t const kth0 = bg::kth_channel_view<0>(bg::const_view(img));
37 BOOST_TEST(kth0.num_channels() == 1u);
39 channel_view_t const red = bg::channel_view<bg::red_t>(bg::const_view(img));
40 BOOST_TEST(red.num_channels() == 1u);
43 BOOST_AUTO_TEST_SUITE_END()