EXIF library (libexif) Internals 0.6.26
test-tagtable.c
Go to the documentation of this file.
1/* test-tagtable.c
2 *
3 * Test various functions that involve the tag table.
4 *
5 * Copyright (c) 2009 Dan Fandrich <dan@coneharvesters.com>
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301 USA.
21 *
22 * SPDX-License-Identifier: LGPL-2.0-or-later
23 */
24
25#include "config.h"
26#include <libexif/exif-tag.h>
27#include <stdio.h>
28#include <string.h>
29
30#define VALIDATE(s) if (!(s)) {printf("Test %s FAILED\n", #s); fail=1;}
31
32#define TESTBLOCK(t) {int rc = (t); fail |= rc; \
33 if (rc) printf("%s tests FAILED\n", #t);}
34
35/* Test exif_tag_get_support_level_in_ifd */
36static int support_level(void)
37{
38 int fail = 0;
39
40 /*
41 * The tag EXIF_TAG_PLANAR_CONFIGURATION support varies greatly between
42 * data types.
43 */
47
51
55
59
63
64 /*
65 * The tag EXIF_TAG_YCBCR_POSITIONING support varies greatly between
66 * IFDs
67 */
71
75
79
83
87
88
89 /*
90 * The tag EXIF_TAG_GPS_VERSION_ID has value 0 which should NOT be
91 * treated specially
92 */
96
100
104
108
109 /* The unused tag 0xffff should NOT be treated specially */
113
117
118 /*
119 * The tag EXIF_TAG_DOCUMENT_NAME isn't in the EXIF 2.2 standard but
120 * it exists in the tag table, which causes it to show up as unknown
121 * instead of not recorded.
122 */
126
130
131
132 /*
133 * The tag number for EXIF_TAG_INTEROPERABILITY_INDEX (1) exists in both
134 * IFD Interoperability and IFD GPS (as EXIF_TAG_GPS_LATITUDE_REF) so
135 * there are two entries in the table.
136 */
140
144
148
152
156
160
161 /* The result of an unknown IFD should always be unknown */
165
169
170 return fail;
171}
172
173/* Test exif_tag_get_name_in_ifd */
174static int name(void)
175{
176 int fail = 0;
177
178 /*
179 * The tag EXIF_TAG_GPS_VERSION_ID has value 0 which should NOT be
180 * treated specially
181 */
184 "GPSVersionID"))
185
188
189 /*
190 * The tag number for EXIF_TAG_INTEROPERABILITY_INDEX (1) exists in both
191 * IFD Interoperability and IFD GPS (as EXIF_TAG_GPS_LATITUDE_REF) so
192 * there are two entries in the table.
193 */
196 "InteroperabilityIndex"))
197
200 "GPSLatitudeRef"))
201
202 /* Tag that doesn't appear in an IFD produces a NULL */
205
206 /* Invalid IFD produces a NULL */
209
210 return fail;
211}
212
213int
214main (void)
215{
216 int fail = 0;
217
219 TESTBLOCK(name())
220
221 return fail;
222}
@ EXIF_DATA_TYPE_UNCOMPRESSED_PLANAR
@ EXIF_DATA_TYPE_COMPRESSED
@ EXIF_DATA_TYPE_UNCOMPRESSED_CHUNKY
@ EXIF_DATA_TYPE_UNKNOWN
@ EXIF_DATA_TYPE_UNCOMPRESSED_YCC
@ EXIF_IFD_GPS
Definition exif-ifd.h:35
@ EXIF_IFD_INTEROPERABILITY
Definition exif-ifd.h:36
@ EXIF_IFD_EXIF
Definition exif-ifd.h:34
@ EXIF_IFD_1
Definition exif-ifd.h:33
@ EXIF_IFD_COUNT
Not a real value, just (max_value + 1).
Definition exif-ifd.h:37
@ EXIF_IFD_0
Definition exif-ifd.h:32
const char * exif_tag_get_name_in_ifd(ExifTag tag, ExifIfd ifd)
Return a textual name of the given tag when found in the given IFD.
Definition exif-tag.c:1042
ExifSupportLevel exif_tag_get_support_level_in_ifd(ExifTag tag, ExifIfd ifd, ExifDataType t)
Return whether the given tag is mandatory or not in the given IFD and data type according to the EXIF...
Definition exif-tag.c:1260
Handling EXIF tags.
@ EXIF_TAG_EXIF_VERSION
Definition exif-tag.h:101
@ EXIF_TAG_PLANAR_CONFIGURATION
Definition exif-tag.h:57
@ EXIF_TAG_YCBCR_POSITIONING
Definition exif-tag.h:72
@ EXIF_TAG_DOCUMENT_NAME
Definition exif-tag.h:46
@ EXIF_TAG_INTEROPERABILITY_INDEX
Definition exif-tag.h:37
#define EXIF_TAG_GPS_VERSION_ID
Definition exif-tag.h:176
#define EXIF_TAG_GPS_LATITUDE_REF
Definition exif-tag.h:177
@ EXIF_SUPPORT_LEVEL_UNKNOWN
The meaning of this tag is unknown.
Definition exif-tag.h:212
@ EXIF_SUPPORT_LEVEL_OPTIONAL
This tag is optional in the given IFD.
Definition exif-tag.h:221
@ EXIF_SUPPORT_LEVEL_NOT_RECORDED
This tag is not allowed in the given IFD.
Definition exif-tag.h:215
@ EXIF_SUPPORT_LEVEL_MANDATORY
This tag is mandatory in the given IFD.
Definition exif-tag.h:218
#define TESTBLOCK(t)
#define VALIDATE(s)
static int name(void)
static int support_level(void)
int main(void)

libexif Generated by doxygen