diff options
author | Øyvind Kolås <ok@src.gnome.org> | 2005-08-23 07:39:59 +0000 |
---|---|---|
committer | Øyvind Kolås <ok@src.gnome.org> | 2005-08-23 07:39:59 +0000 |
commit | abd6a5b308869c7f5df4b526102036c63ffee8be (patch) | |
tree | b252aaa2acbd33080207991cbec06a50aec813b9 /tests | |
parent | 5d92569378fbee71bb358ee287b6219fb6e1cd23 (diff) |
test for babl_class_name
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 6 | ||||
-rw-r--r-- | tests/babl_class_name.c | 75 |
2 files changed, 78 insertions, 3 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index e39b1fd..1bc9955 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -4,7 +4,8 @@ TESTS = \ u8_to_float \ rgb_to_lab_to_rgb \ rgb_to_ycbcr \ - rgb_to_ycbcr_to_rgb + rgb_to_ycbcr_to_rgb \ + babl_class_name float_to_u8_SOURCES = float_to_u8.c u8_to_float_SOURCES = u8_to_float.c @@ -12,6 +13,7 @@ grayscale_to_rgb_SOURCES = grayscale_to_rgb.c rgb_to_lab_to_rgb_SOURCES = rgb_to_lab_to_rgb.c rgb_to_ycbcr_SOURCES = rgb_to_ycbcr.c rgb_to_ycbcr_to_rgb_SOURCES = rgb_to_ycbcr_to_rgb.c +babl_class_name_SOURCES = babl_class_name.c AM_CFLAGS = -I$(top_srcdir) -I$(top_srcdir)/babl @@ -28,6 +30,4 @@ introspect_SOURCES = introspect.c babl_html_dump_SOURCES = babl-html-dump.c nop_SOURCES = nop.c - EXTRA_DIST = .cvsignore - diff --git a/tests/babl_class_name.c b/tests/babl_class_name.c new file mode 100644 index 0000000..643848b --- /dev/null +++ b/tests/babl_class_name.c @@ -0,0 +1,75 @@ +/* babl - dynamically extendable universal pixel conversion library. + * Copyright (C) 2005, Øyvind Kolås. + * + * 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 2 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, write to the + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include <string.h> +#include <stdio.h> +#include "babl.h" + +struct + { + long klass; const char *name; + } reference[]= { + {BABL_INSTANCE, "BablInstance"}, + {BABL_TYPE, "BablType"}, + {BABL_TYPE_INTEGER, "BablTypeInteger"}, + {BABL_TYPE_FLOAT, "BablTypeFloat"}, + {BABL_SAMPLING, "BablSampling"}, + {BABL_COMPONENT, "BablComponent"}, + {BABL_MODEL, "BablModel"}, + {BABL_PIXEL_FORMAT, "BablPixelFormat"}, + {BABL_CONVERSION, "BablConversion"}, + {BABL_CONVERSION_TYPE, "BablConversionType"}, + {BABL_CONVERSION_TYPE_PLANAR, "BablConversionTypePlanar"}, + {BABL_CONVERSION_MODEL_PLANAR, "BablConversionModelPlanar"}, + {BABL_CONVERSION_PIXEL_FORMAT, "BablConversionPixelFormat"}, + {BABL_CONVERSION_PIXEL_FORMAT_PLANAR, "BablConversionPixelFormatPlanar"}, + {BABL_FISH, "BablFish"}, + {BABL_FISH_REFERENCE, "BablFishReference"}, + {BABL_IMAGE, "BablImage"}, + {BABL_SKY, "BablSky"}, + {0, NULL} + }; + +int +test (void) +{ + int i=0; + int OK=1; + while (reference[i].klass) + { + if (strcmp (reference[i].name, babl_class_name (reference[i].klass))) + { + OK=0; + printf ("'%s'!='%s'\n", reference[i].name, babl_class_name (reference[i].klass)); + } + i++; + } + return !OK; +} + +int +main (int argc, + char **argv) +{ + babl_init (); + if (test()) + return -1; + babl_destroy (); + return 0; +} |