diff options
author | Øyvind Kolås <pippin@gimp.org> | 2020-05-03 12:13:14 +0200 |
---|---|---|
committer | Øyvind Kolås <pippin@gimp.org> | 2020-05-03 12:13:32 +0200 |
commit | 976fc36ac1e5661ed4f77ff83a275efeeadb27a4 (patch) | |
tree | 042880d21edecb671c96c5c8035e9d68cda2050a /tests | |
parent | f555c0eea07edce72076ed96619cd53aa8949ea4 (diff) |
tests: add a test for naive CMYK conversion
Diffstat (limited to 'tests')
-rw-r--r-- | tests/cmyk.c | 56 | ||||
-rw-r--r-- | tests/meson.build | 1 |
2 files changed, 57 insertions, 0 deletions
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 + * <https://www.gnu.org/licenses/>. + */ + +#include <stdio.h> + +#include <babl/babl.h> + +#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', |