Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / gil / test / core / pixel / bit_aligned_pixel_reference.cpp
1 //
2 // Copyright 2019 Mateusz Loskot <mateusz at loskot dot net>
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/bit_aligned_pixel_reference.hpp>
9 #include <boost/gil/packed_pixel.hpp>
10 #include <boost/gil/rgb.hpp>
11 #include <boost/mp11.hpp>
12 namespace gil = boost::gil;
13 namespace mp11 = boost::mp11;
14
15 int main()
16 {
17     using bgr121_ref_t = gil::bit_aligned_pixel_reference
18         <
19             std::uint8_t, mp11::mp_list_c<int, 1, 2, 1>, gil::bgr_layout_t, true
20         >;
21
22     static_assert(bgr121_ref_t::bit_size == 4,
23         "bit size should be 4");
24
25     static_assert(std::is_same<bgr121_ref_t::bitfield_t, std::uint8_t>::value,
26         "bit field type should be std::uint8_t");
27
28     static_assert(std::is_same<bgr121_ref_t::layout_t, gil::bgr_layout_t>::value,
29         "layout type should be bgr");
30
31     static_assert(std::is_same<decltype(bgr121_ref_t::is_mutable), bool const>::value &&
32         bgr121_ref_t::is_mutable,
33         "is_mutable should be boolean");
34
35     using packed_pixel_t = gil::packed_pixel
36         <
37             std::uint8_t,
38             typename gil::detail::packed_channel_references_vector_type
39             <
40                 std::uint8_t, mp11::mp_list_c<int, 1, 2, 1>
41             >::type,
42             gil::bgr_layout_t
43         >;
44     static_assert(std::is_same<bgr121_ref_t::value_type, packed_pixel_t>::value,
45         "value_type should be specialization of packed_pixel");
46 }