00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "config.h"
00024 #include <libexif/exif-tag.h>
00025 #include <stdio.h>
00026 #include <string.h>
00027
00028 #define VALIDATE(s) if (!(s)) {printf("Test %s FAILED\n", #s); fail=1;}
00029
00030 #define TESTBLOCK(t) {int rc = (t); fail |= rc; \
00031 if (rc) printf("%s tests FAILED\n", #t);}
00032
00033
00034 static int support_level(void)
00035 {
00036 int fail = 0;
00037
00038
00039
00040
00041
00042 VALIDATE(exif_tag_get_support_level_in_ifd(EXIF_TAG_PLANAR_CONFIGURATION,
00043 EXIF_IFD_0, EXIF_DATA_TYPE_UNCOMPRESSED_CHUNKY) ==
00044 EXIF_SUPPORT_LEVEL_OPTIONAL)
00045
00046 VALIDATE(exif_tag_get_support_level_in_ifd(EXIF_TAG_PLANAR_CONFIGURATION,
00047 EXIF_IFD_0, EXIF_DATA_TYPE_UNCOMPRESSED_PLANAR) ==
00048 EXIF_SUPPORT_LEVEL_MANDATORY)
00049
00050 VALIDATE(exif_tag_get_support_level_in_ifd(EXIF_TAG_PLANAR_CONFIGURATION,
00051 EXIF_IFD_0, EXIF_DATA_TYPE_UNCOMPRESSED_YCC) ==
00052 EXIF_SUPPORT_LEVEL_OPTIONAL)
00053
00054 VALIDATE(exif_tag_get_support_level_in_ifd(EXIF_TAG_PLANAR_CONFIGURATION,
00055 EXIF_IFD_0, EXIF_DATA_TYPE_COMPRESSED) ==
00056 EXIF_SUPPORT_LEVEL_NOT_RECORDED)
00057
00058 VALIDATE(exif_tag_get_support_level_in_ifd(EXIF_TAG_PLANAR_CONFIGURATION,
00059 EXIF_IFD_0, EXIF_DATA_TYPE_UNKNOWN) ==
00060 EXIF_SUPPORT_LEVEL_UNKNOWN)
00061
00062
00063
00064
00065
00066 VALIDATE(exif_tag_get_support_level_in_ifd(EXIF_TAG_YCBCR_POSITIONING,
00067 EXIF_IFD_0, EXIF_DATA_TYPE_COMPRESSED) ==
00068 EXIF_SUPPORT_LEVEL_MANDATORY)
00069
00070 VALIDATE(exif_tag_get_support_level_in_ifd(EXIF_TAG_YCBCR_POSITIONING,
00071 EXIF_IFD_1, EXIF_DATA_TYPE_COMPRESSED) ==
00072 EXIF_SUPPORT_LEVEL_OPTIONAL)
00073
00074 VALIDATE(exif_tag_get_support_level_in_ifd(EXIF_TAG_YCBCR_POSITIONING,
00075 EXIF_IFD_EXIF, EXIF_DATA_TYPE_COMPRESSED) ==
00076 EXIF_SUPPORT_LEVEL_NOT_RECORDED)
00077
00078 VALIDATE(exif_tag_get_support_level_in_ifd(EXIF_TAG_YCBCR_POSITIONING,
00079 EXIF_IFD_GPS, EXIF_DATA_TYPE_COMPRESSED) ==
00080 EXIF_SUPPORT_LEVEL_NOT_RECORDED)
00081
00082 VALIDATE(exif_tag_get_support_level_in_ifd(EXIF_TAG_YCBCR_POSITIONING,
00083 EXIF_IFD_INTEROPERABILITY, EXIF_DATA_TYPE_COMPRESSED) ==
00084 EXIF_SUPPORT_LEVEL_NOT_RECORDED)
00085
00086
00087
00088
00089
00090
00091 VALIDATE(exif_tag_get_support_level_in_ifd(EXIF_TAG_GPS_VERSION_ID,
00092 EXIF_IFD_GPS, EXIF_DATA_TYPE_COMPRESSED) ==
00093 EXIF_SUPPORT_LEVEL_OPTIONAL)
00094
00095 VALIDATE(exif_tag_get_support_level_in_ifd(EXIF_TAG_GPS_VERSION_ID,
00096 EXIF_IFD_GPS, EXIF_DATA_TYPE_UNKNOWN) ==
00097 EXIF_SUPPORT_LEVEL_OPTIONAL)
00098
00099 VALIDATE(exif_tag_get_support_level_in_ifd(EXIF_TAG_GPS_VERSION_ID,
00100 EXIF_IFD_0, EXIF_DATA_TYPE_COMPRESSED) ==
00101 EXIF_SUPPORT_LEVEL_NOT_RECORDED)
00102
00103 VALIDATE(exif_tag_get_support_level_in_ifd(EXIF_TAG_GPS_VERSION_ID,
00104 EXIF_IFD_0, EXIF_DATA_TYPE_UNKNOWN) ==
00105 EXIF_SUPPORT_LEVEL_UNKNOWN)
00106
00107
00108 VALIDATE(exif_tag_get_support_level_in_ifd(0xffff,
00109 EXIF_IFD_0, EXIF_DATA_TYPE_UNKNOWN) ==
00110 EXIF_SUPPORT_LEVEL_UNKNOWN)
00111
00112 VALIDATE(exif_tag_get_support_level_in_ifd(0xffff,
00113 EXIF_IFD_0, EXIF_DATA_TYPE_COMPRESSED) ==
00114 EXIF_SUPPORT_LEVEL_NOT_RECORDED)
00115
00116
00117
00118
00119
00120
00121 VALIDATE(exif_tag_get_support_level_in_ifd(EXIF_TAG_DOCUMENT_NAME,
00122 EXIF_IFD_0, EXIF_DATA_TYPE_UNKNOWN) ==
00123 EXIF_SUPPORT_LEVEL_UNKNOWN)
00124
00125 VALIDATE(exif_tag_get_support_level_in_ifd(EXIF_TAG_DOCUMENT_NAME,
00126 EXIF_IFD_1, EXIF_DATA_TYPE_UNCOMPRESSED_CHUNKY) ==
00127 EXIF_SUPPORT_LEVEL_UNKNOWN)
00128
00129
00130
00131
00132
00133
00134
00135 VALIDATE(exif_tag_get_support_level_in_ifd(EXIF_TAG_INTEROPERABILITY_INDEX,
00136 EXIF_IFD_INTEROPERABILITY, EXIF_DATA_TYPE_COMPRESSED) ==
00137 EXIF_SUPPORT_LEVEL_OPTIONAL)
00138
00139 VALIDATE(exif_tag_get_support_level_in_ifd(EXIF_TAG_INTEROPERABILITY_INDEX,
00140 EXIF_IFD_INTEROPERABILITY, EXIF_DATA_TYPE_UNKNOWN) ==
00141 EXIF_SUPPORT_LEVEL_OPTIONAL)
00142
00143 VALIDATE(exif_tag_get_support_level_in_ifd(EXIF_TAG_INTEROPERABILITY_INDEX,
00144 EXIF_IFD_0, EXIF_DATA_TYPE_COMPRESSED) ==
00145 EXIF_SUPPORT_LEVEL_NOT_RECORDED)
00146
00147 VALIDATE(exif_tag_get_support_level_in_ifd(EXIF_TAG_INTEROPERABILITY_INDEX,
00148 EXIF_IFD_0, EXIF_DATA_TYPE_UNKNOWN) ==
00149 EXIF_SUPPORT_LEVEL_UNKNOWN)
00150
00151 VALIDATE(exif_tag_get_support_level_in_ifd(EXIF_TAG_GPS_LATITUDE_REF,
00152 EXIF_IFD_GPS, EXIF_DATA_TYPE_COMPRESSED) ==
00153 EXIF_SUPPORT_LEVEL_OPTIONAL)
00154
00155 VALIDATE(exif_tag_get_support_level_in_ifd(EXIF_TAG_GPS_LATITUDE_REF,
00156 EXIF_IFD_GPS, EXIF_DATA_TYPE_UNKNOWN) ==
00157 EXIF_SUPPORT_LEVEL_OPTIONAL)
00158
00159
00160 VALIDATE(exif_tag_get_support_level_in_ifd(EXIF_TAG_EXIF_VERSION,
00161 EXIF_IFD_COUNT, EXIF_DATA_TYPE_UNKNOWN) ==
00162 EXIF_SUPPORT_LEVEL_UNKNOWN)
00163
00164 VALIDATE(exif_tag_get_support_level_in_ifd(EXIF_TAG_EXIF_VERSION,
00165 EXIF_IFD_COUNT, EXIF_DATA_TYPE_COMPRESSED) ==
00166 EXIF_SUPPORT_LEVEL_UNKNOWN)
00167
00168 return fail;
00169 }
00170
00171
00172 static int name(void)
00173 {
00174 int fail = 0;
00175
00176
00177
00178
00179
00180 VALIDATE(!strcmp(exif_tag_get_name_in_ifd(
00181 EXIF_TAG_GPS_VERSION_ID, EXIF_IFD_GPS),
00182 "GPSVersionID"))
00183
00184 VALIDATE(exif_tag_get_name_in_ifd(
00185 EXIF_TAG_GPS_VERSION_ID, EXIF_IFD_0) == NULL)
00186
00187
00188
00189
00190
00191
00192 VALIDATE(!strcmp(exif_tag_get_name_in_ifd(
00193 EXIF_TAG_INTEROPERABILITY_INDEX, EXIF_IFD_INTEROPERABILITY),
00194 "InteroperabilityIndex"))
00195
00196 VALIDATE(!strcmp(exif_tag_get_name_in_ifd(
00197 EXIF_TAG_GPS_LATITUDE_REF, EXIF_IFD_GPS),
00198 "GPSLatitudeRef"))
00199
00200
00201 VALIDATE(exif_tag_get_name_in_ifd(
00202 EXIF_TAG_EXIF_VERSION, EXIF_IFD_0) == NULL)
00203
00204
00205 VALIDATE(exif_tag_get_name_in_ifd(
00206 EXIF_TAG_EXIF_VERSION, EXIF_IFD_COUNT) == NULL)
00207
00208 return fail;
00209 }
00210
00211 int
00212 main ()
00213 {
00214 int fail = 0;
00215
00216 TESTBLOCK(support_level())
00217 TESTBLOCK(name())
00218
00219 return fail;
00220 }