2016-03-03 18:53:58 +00:00
|
|
|
|
2015-06-12 07:12:28 +00:00
|
|
|
#include "catch.hpp"
|
|
|
|
|
|
|
|
// mapnik
|
2015-10-29 15:35:45 +00:00
|
|
|
#include <mapnik/image.hpp>
|
2015-06-12 07:12:28 +00:00
|
|
|
#include <mapnik/image_util.hpp>
|
|
|
|
|
2022-01-26 22:25:53 +00:00
|
|
|
TEST_CASE("image set_pixel")
|
|
|
|
{
|
|
|
|
SECTION("test gray32")
|
|
|
|
{
|
|
|
|
mapnik::image_gray32 im(256, 256);
|
|
|
|
mapnik::set_pixel(im, 0, 0, -1);
|
|
|
|
auto pixel = mapnik::get_pixel<mapnik::image_gray32::pixel_type>(im, 0, 0);
|
|
|
|
INFO(pixel);
|
|
|
|
CHECK(pixel == 0);
|
|
|
|
}
|
2015-06-12 07:12:28 +00:00
|
|
|
|
2022-01-26 22:25:53 +00:00
|
|
|
SECTION("test gray8s")
|
|
|
|
{
|
|
|
|
mapnik::image_gray8s im(256, 256);
|
|
|
|
mapnik::set_pixel(im, 0, 0, std::numeric_limits<mapnik::image_gray8s::pixel_type>::max() + 1);
|
|
|
|
auto pixel = mapnik::get_pixel<mapnik::image_gray8s::pixel_type>(im, 0, 0);
|
|
|
|
INFO(pixel);
|
|
|
|
CHECK((int)pixel == (int)std::numeric_limits<mapnik::image_gray8s::pixel_type>::max());
|
|
|
|
}
|
2017-05-05 11:02:01 +00:00
|
|
|
}
|