From: Øyvind Kolås Date: Sun, 3 May 2020 10:13:14 +0000 (+0200) Subject: tests: add a test for naive CMYK conversion X-Git-Tag: archive/raspbian/1%0.1.106-3+rpi1^2~15^2~9^2~21 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=976fc36ac1e5661ed4f77ff83a275efeeadb27a4;p=babl.git tests: add a test for naive CMYK conversion --- diff --git a/tests/cmyk.c b/tests/cmyk.c new file mode 100644 index 0000000..3b11e44 --- /dev/null +++ b/tests/cmyk.c @@ -0,0 +1,56 @@ +/* babl - dynamically extendable universal pixel conversion library. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see + * . + */ + +#include + +#include + +#include "common.inc" + + +int +main (int argc, + char **argv) +{ + int OK = 1; + + float rgba[][4] = {{1.0 , 1.0 , 1.0 , 1.0}, + {0.0 , 1.0 , 0.0 , 1.0}, + {0.5 , 0.5 , 0.5 , 1.0}, + {0.0 , 1.0 , 1.0 , 1.0}}; + + float cmyk[][4] = {{0.0, 0.0 , 0.0 , 0.0}, + {1.0, 0.0 , 1.0 , 0.0}, + {0.0, 0.0 , 0.0 , 0.5}, + {1.0, 0.0 , 0.0 , 0.0}}; + + babl_init (); + + CHECK_CONV_FLOAT ("rgba to cmyk ", float, 0.001, + babl_format ("RGBA float"), + babl_format ("CMYK float"), + rgba, cmyk); + + CHECK_CONV_FLOAT ("cmyk to rgba ", float, 0.001, + babl_format ("CMYK float"), + babl_format ("RGBA float"), + cmyk, rgba); + + babl_exit (); + + return !OK; +} diff --git a/tests/meson.build b/tests/meson.build index dfe7d45..a656618 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -3,6 +3,7 @@ test_names = [ 'babl_class_name', 'cairo_cmyk_hack', 'cairo-RGB24', + 'cmyk', 'chromaticities', 'extract', 'floatclamp',