2 // Copyright 2019 Mateusz Loskot <mateusz at loskot dot net>
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/config.hpp>
9 #include <boost/core/ignore_unused.hpp>
11 #if defined(BOOST_CLANG)
12 #pragma clang diagnostic push
13 #pragma clang diagnostic ignored "-Wconversion"
14 #pragma clang diagnostic ignored "-Wfloat-equal"
15 #pragma clang diagnostic ignored "-Wsign-conversion"
16 #elif BOOST_GCC >= 40700
17 #pragma GCC diagnostic push
18 #pragma GCC diagnostic ignored "-Wconversion"
19 #pragma GCC diagnostic ignored "-Wfloat-equal"
20 #pragma GCC diagnostic ignored "-Wsign-conversion"
23 #include <boost/gil/channel.hpp>
28 #define BOOST_TEST_MODULE test_pixel_test_fixture
29 #include "unit_test.hpp"
30 #include "test_fixture.hpp"
32 namespace gil = boost::gil;
33 namespace fixture = boost::gil::test::fixture;
35 BOOST_AUTO_TEST_CASE_TEMPLATE(pixel_value_default_constructor, Pixel, fixture::pixel_types)
37 fixture::pixel_value<Pixel> fix;
38 Pixel const default_value{};
39 // FIXME: Default value of pixel/homogeneous_color_base is undermined
40 boost::ignore_unused(fix);
41 boost::ignore_unused(default_value);
42 //BOOST_TEST(fix.pixel_ == default_value);
45 BOOST_AUTO_TEST_CASE_TEMPLATE(pixel_value_parameterized_constructor, Pixel, fixture::pixel_types)
47 using channel_t = typename gil::channel_type<Pixel>::type;
48 // Sample channel value, simplified, could be min, max, random
49 channel_t const sample_channel = 2;
51 gil::static_fill(sample_pixel, sample_channel);
52 fixture::pixel_value<Pixel> fix{sample_pixel};
53 BOOST_TEST(fix.pixel_ == sample_pixel);
56 BOOST_AUTO_TEST_CASE_TEMPLATE(pixel_reference_default_constructor, Pixel, fixture::pixel_types)
58 fixture::pixel_reference<Pixel&> fix;
59 Pixel const default_value{};
60 // FIXME: Default value of pixel/homogeneous_color_base is undermined
61 boost::ignore_unused(fix);
62 boost::ignore_unused(default_value);
63 //BOOST_TEST(fix.pixel_ == Pixel{});
66 BOOST_AUTO_TEST_CASE_TEMPLATE(pixel_reference_parameterized_constructor, Pixel, fixture::pixel_types)
68 using channel_t = typename gil::channel_type<Pixel>::type;
69 // Sample channel value, simplified, could be min, max, random
70 channel_t const sample_channel = 3;
72 gil::static_fill(sample_pixel, sample_channel);
73 fixture::pixel_reference<Pixel&> fix{sample_pixel};
74 BOOST_TEST(fix.pixel_ == sample_pixel);