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 "unit_test_utility.hpp"
31 #include "test_fixture.hpp"
33 namespace gil = boost::gil;
34 namespace fixture = boost::gil::test::fixture;
36 BOOST_AUTO_TEST_CASE_TEMPLATE(pixel_value_default_constructor, Pixel, fixture::pixel_types)
38 fixture::pixel_value<Pixel> fix;
39 Pixel const default_value{};
40 // FIXME: Default value of pixel/homogeneous_color_base is undermined
41 boost::ignore_unused(fix);
42 boost::ignore_unused(default_value);
43 //BOOST_TEST(fix.pixel_ == default_value);
46 BOOST_AUTO_TEST_CASE_TEMPLATE(pixel_value_parameterized_constructor, Pixel, fixture::pixel_types)
48 using channel_t = typename gil::channel_type<Pixel>::type;
49 // Sample channel value, simplified, could be min, max, random
50 channel_t const sample_channel = 2;
52 gil::static_fill(sample_pixel, sample_channel);
53 fixture::pixel_value<Pixel> fix{sample_pixel};
54 BOOST_TEST(fix.pixel_ == sample_pixel);
57 BOOST_AUTO_TEST_CASE_TEMPLATE(pixel_reference_default_constructor, Pixel, fixture::pixel_types)
59 fixture::pixel_reference<Pixel&> fix;
60 Pixel const default_value{};
61 // FIXME: Default value of pixel/homogeneous_color_base is undermined
62 boost::ignore_unused(fix);
63 boost::ignore_unused(default_value);
64 //BOOST_TEST(fix.pixel_ == Pixel{});
67 BOOST_AUTO_TEST_CASE_TEMPLATE(pixel_reference_parameterized_constructor, Pixel, fixture::pixel_types)
69 using channel_t = typename gil::channel_type<Pixel>::type;
70 // Sample channel value, simplified, could be min, max, random
71 channel_t const sample_channel = 3;
73 gil::static_fill(sample_pixel, sample_channel);
74 fixture::pixel_reference<Pixel&> fix{sample_pixel};
75 BOOST_TEST(fix.pixel_ == sample_pixel);