File: image_set_pixel.cpp

package info (click to toggle)
mapnik 4.2.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 18,548 kB
  • sloc: cpp: 163,861; python: 1,190; sh: 690; xml: 161; makefile: 123; perl: 28; lisp: 13
file content (27 lines) | stat: -rw-r--r-- 770 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

#include "catch.hpp"

// mapnik
#include <mapnik/image.hpp>
#include <mapnik/image_util.hpp>

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);
    }

    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());
    }
}