2 // Copyright 2005-2007 Adobe Systems Incorporated
3 // Copyright 2018 Mateusz Loskot <mateusz at loskot dot net>
5 // Distributed under the Boost Software License, Version 1.0
6 // See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt
9 #include <boost/gil/channel_algorithm.hpp>
11 #define BOOST_TEST_MODULE test_algorithm_channel_invert
12 #include "unit_test.hpp"
13 #include "test_fixture.hpp"
15 namespace gil = boost::gil;
16 namespace fixture = boost::gil::test::fixture;
18 template <typename ChannelFixtureBase>
19 void test_channel_invert()
21 fixture::channel<ChannelFixtureBase> f;
22 BOOST_TEST(gil::channel_invert(f.min_v_) == f.max_v_);
23 BOOST_TEST(gil::channel_invert(f.max_v_) == f.min_v_);
26 BOOST_AUTO_TEST_CASE_TEMPLATE(channel_value, Channel, fixture::channel_byte_types)
28 using fixture_t = fixture::channel_value<Channel>;
29 test_channel_invert<fixture_t>();
32 BOOST_AUTO_TEST_CASE_TEMPLATE(channel_reference, Channel, fixture::channel_byte_types)
34 using fixture_t = fixture::channel_reference<Channel&>;
35 test_channel_invert<fixture_t>();
38 BOOST_AUTO_TEST_CASE_TEMPLATE(
39 channel_reference_const, Channel, fixture::channel_byte_types)
41 using fixture_t = fixture::channel_reference<Channel const&>;
42 test_channel_invert<fixture_t>();
45 BOOST_AUTO_TEST_CASE_TEMPLATE(
46 packed_channel_reference, BitField, fixture::channel_bitfield_types)
48 using channels565_t = fixture::packed_channels565<BitField>;
49 test_channel_invert<typename channels565_t::fixture_0_5_t>();
50 test_channel_invert<typename channels565_t::fixture_5_6_t >();
51 test_channel_invert<typename channels565_t::fixture_11_5_t>();
54 BOOST_AUTO_TEST_CASE_TEMPLATE(
55 packed_dynamic_channel_reference, BitField, fixture::channel_bitfield_types)
57 using channels565_t = fixture::packed_dynamic_channels565<BitField>;
58 test_channel_invert<typename channels565_t::fixture_5_t>();
59 test_channel_invert<typename channels565_t::fixture_6_t>();
62 // TODO: packed_channel_reference_const ?
63 // TODO: packed_dynamic_channel_reference_const ?