loaders: PNG: Handle gamma on 16bpp conversion
[gfxprim.git] / tests / loaders / Exif.c
blob3a4aaa050ea617e677e39ab05eefb9184069c9e3
1 /*****************************************************************************
2 * This file is part of gfxprim library. *
3 * *
4 * Gfxprim is free software; you can redistribute it and/or *
5 * modify it under the terms of the GNU Lesser General Public *
6 * License as published by the Free Software Foundation; either *
7 * version 2.1 of the License, or (at your option) any later version. *
8 * *
9 * Gfxprim is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
12 * Lesser General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU Lesser General Public *
15 * License along with gfxprim; if not, write to the Free Software *
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
17 * Boston, MA 02110-1301 USA *
18 * *
19 * Copyright (C) 2009-2014 Cyril Hrubis <metan@ucw.cz> *
20 * *
21 *****************************************************************************/
23 #include <string.h>
24 #include <errno.h>
25 #include <sys/stat.h>
27 #include <loaders/GP_Exif.h>
29 #include "tst_test.h"
31 struct testcase {
32 const char *path;
35 static int test_load_Exif(struct testcase *test)
37 GP_DataStorage *data = GP_DataStorageCreate();
38 GP_IO *io;
39 int ret = TST_SUCCESS;
41 if (!data) {
42 tst_msg("Failed to create DataStorage");
43 return TST_UNTESTED;
46 io = GP_IOFile(test->path, GP_IO_RDONLY);
48 if (!io) {
49 tst_msg("Failed to open IO %s", test->path);
50 GP_DataStorageDestroy(data);
51 return TST_UNTESTED;
54 if (GP_ReadExif(io, data)) {
55 tst_msg("Failed to load Exif");
56 ret = TST_FAILED;
57 goto end;
60 end:
61 GP_DataStorageDestroy(data);
62 GP_IOClose(io);
63 return ret;
66 static struct testcase sample001 = {
67 .path = "sample001.exif",
70 static struct testcase sample002 = {
71 .path = "sample002.exif",
74 const struct tst_suite tst_suite = {
75 .suite_name = "Exif",
76 .tests = {
77 {.name = "Exif sample001",
78 .tst_fn = test_load_Exif,
79 .res_path = "data/exif/sample001.exif",
80 .data = &sample001,
81 .flags = TST_TMPDIR | TST_CHECK_MALLOC},
83 {.name = "Exif sample002",
84 .tst_fn = test_load_Exif,
85 .res_path = "data/exif/sample002.exif",
86 .data = &sample002,
87 .flags = TST_TMPDIR | TST_CHECK_MALLOC},
89 {.name = NULL},