-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deprecated apply_operation in favour of variant2::visit for any_image
- Loading branch information
1 parent
36a45e3
commit 89a0dad
Showing
11 changed files
with
397 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
test/extension/dynamic_image/algorithm/copy_and_convert_pixels.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
// | ||
// Copyright (c) 2022 Marco Langer <langer.m86 at gmail dot com> | ||
// | ||
// Distributed under the Boost Software License, Version 1.0 | ||
// See accompanying file LICENSE_1_0.txt or copy at | ||
// http://www.boost.org/LICENSE_1_0.txt | ||
// | ||
#include <boost/gil/extension/dynamic_image/any_image.hpp> | ||
#include <boost/gil/extension/dynamic_image/algorithm.hpp> | ||
|
||
#include <boost/core/lightweight_test.hpp> | ||
|
||
#include <utility> | ||
|
||
#include "core/image/test_fixture.hpp" | ||
#include "extension/dynamic_image/test_fixture.hpp" | ||
|
||
namespace gil = boost::gil; | ||
namespace fixture = boost::gil::test::fixture; | ||
|
||
struct test_copy_and_convert_pixels | ||
{ | ||
template <typename ImageLhs, typename ImageRhs> | ||
void operator()(std::pair<ImageLhs, ImageRhs> const&) | ||
{ | ||
using image_lhs_t = ImageLhs; | ||
using image_rhs_t = ImageRhs; | ||
|
||
gil::default_color_converter cc_default; | ||
|
||
{ | ||
// dynamic_image -> image | ||
fixture::dynamic_image dyn_image_lhs(fixture::create_image<image_lhs_t>(2, 2, 128)); | ||
image_lhs_t image_lhs1(2, 2); | ||
image_lhs_t image_lhs2(2, 2); | ||
image_rhs_t image_rhs1(2, 2); | ||
image_rhs_t image_rhs2(2, 2); | ||
|
||
BOOST_TEST_NO_THROW(gil::copy_and_convert_pixels(gil::const_view(dyn_image_lhs), gil::view(image_lhs1))); | ||
BOOST_TEST_NO_THROW(gil::copy_and_convert_pixels(gil::const_view(dyn_image_lhs), gil::view(image_lhs2), cc_default)); | ||
BOOST_TEST_NO_THROW(gil::copy_and_convert_pixels(gil::const_view(dyn_image_lhs), gil::view(image_rhs1))); | ||
BOOST_TEST_NO_THROW(gil::copy_and_convert_pixels(gil::const_view(dyn_image_lhs), gil::view(image_rhs2), cc_default)); | ||
} | ||
{ | ||
// image -> dynamic_image | ||
image_lhs_t image_lhs = fixture::create_image<image_lhs_t>(2, 2, 128); | ||
fixture::dynamic_image dyn_image_lhs1(image_lhs_t(2, 2)); | ||
fixture::dynamic_image dyn_image_lhs2(image_lhs_t(2, 2)); | ||
fixture::dynamic_image dyn_image_rhs1(image_rhs_t(2, 2)); | ||
fixture::dynamic_image dyn_image_rhs2(image_rhs_t(2, 2)); | ||
|
||
BOOST_TEST_NO_THROW(gil::copy_and_convert_pixels(gil::const_view(image_lhs), gil::view(dyn_image_lhs1))); | ||
BOOST_TEST_NO_THROW(gil::copy_and_convert_pixels(gil::const_view(image_lhs), gil::view(dyn_image_lhs2), cc_default)); | ||
BOOST_TEST_NO_THROW(gil::copy_and_convert_pixels(gil::const_view(image_lhs), gil::view(dyn_image_rhs1))); | ||
BOOST_TEST_NO_THROW(gil::copy_and_convert_pixels(gil::const_view(image_lhs), gil::view(dyn_image_rhs2), cc_default)); | ||
} | ||
{ | ||
// dynamic_image -> dynamic_image | ||
fixture::dynamic_image dyn_image_lhs1(fixture::create_image<image_lhs_t>(2, 2, 128)); | ||
fixture::dynamic_image dyn_image_lhs2(image_lhs_t(2, 2)); | ||
fixture::dynamic_image dyn_image_lhs3(image_lhs_t(2, 2)); | ||
fixture::dynamic_image dyn_image_rhs1(image_rhs_t(2, 2)); | ||
fixture::dynamic_image dyn_image_rhs2(image_rhs_t(2, 2)); | ||
|
||
BOOST_TEST_NO_THROW(gil::copy_and_convert_pixels(gil::const_view(dyn_image_lhs1), gil::view(dyn_image_lhs2))); | ||
BOOST_TEST_NO_THROW(gil::copy_and_convert_pixels(gil::const_view(dyn_image_lhs1), gil::view(dyn_image_lhs3), cc_default)); | ||
BOOST_TEST_NO_THROW(gil::copy_and_convert_pixels(gil::const_view(dyn_image_lhs1), gil::view(dyn_image_rhs1))); | ||
BOOST_TEST_NO_THROW(gil::copy_and_convert_pixels(gil::const_view(dyn_image_lhs1), gil::view(dyn_image_rhs2), cc_default)); | ||
} | ||
} | ||
|
||
static void run() | ||
{ | ||
boost::mp11::mp_for_each | ||
< | ||
boost::mp11::mp_pairwise_fold | ||
< | ||
fixture::image_types, std::pair | ||
> | ||
>(test_copy_and_convert_pixels{}); | ||
} | ||
}; | ||
|
||
int main() | ||
{ | ||
test_copy_and_convert_pixels::run(); | ||
|
||
return ::boost::report_errors(); | ||
} |
Oops, something went wrong.