Remove test for "PixarTextureformat" tag because of its unclear status and

format of contents; test passes now.
This commit is contained in:
Andrey Kiselev 2008-04-15 13:32:12 +00:00
parent 481c2432f2
commit a4317025a9

View File

@ -1,4 +1,4 @@
/* $Id: ascii_tag.c,v 1.6 2008-03-28 01:42:06 bfriesen Exp $ */ /* $Id: ascii_tag.c,v 1.7 2008-04-15 13:32:12 dron Exp $ */
/* /*
* Copyright (c) 2004, Andrey Kiselev <dron@ak4719.spb.edu> * Copyright (c) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
@ -40,9 +40,9 @@
#include "tiffio.h" #include "tiffio.h"
const char *filename = "ascii_test.tiff"; static const char filename[] = "ascii_test.tiff";
static struct Tags { static const struct {
ttag_t tag; ttag_t tag;
const char *value; const char *value;
} ascii_tags[] = { } ascii_tags[] = {
@ -56,24 +56,24 @@ static struct Tags {
{ TIFFTAG_ARTIST, "Andrey V. Kiselev" }, { TIFFTAG_ARTIST, "Andrey V. Kiselev" },
{ TIFFTAG_HOSTCOMPUTER, "Debian GNU/Linux (Sarge)" }, { TIFFTAG_HOSTCOMPUTER, "Debian GNU/Linux (Sarge)" },
{ TIFFTAG_TARGETPRINTER, "No printer" }, { TIFFTAG_TARGETPRINTER, "No printer" },
{ TIFFTAG_PIXAR_TEXTUREFORMAT, "No texture" }, { TIFFTAG_COPYRIGHT, "Copyright (c) 2004, Andrey Kiselev" },
{ TIFFTAG_PIXAR_WRAPMODES, "No wrap" }, { TIFFTAG_FAXSUBADDRESS, "Fax subaddress" },
{ TIFFTAG_COPYRIGHT, "Copyright (c) 2004, Andrey Kiselev" } /* DGN tags */
{ TIFFTAG_UNIQUECAMERAMODEL, "No camera" },
{ TIFFTAG_CAMERASERIALNUMBER, "1234567890" }
}; };
#define NTAGS (sizeof (ascii_tags) / sizeof (ascii_tags[0])) #define NTAGS (sizeof (ascii_tags) / sizeof (ascii_tags[0]))
const char *ink_names = "Red\0Green\0Blue"; static const char ink_names[] = "Red\0Green\0Blue";
const int ink_names_size = 15; const int ink_names_size = 15;
int int
main(int argc, char **argv) main()
{ {
TIFF *tif; TIFF *tif;
unsigned int i; size_t i;
unsigned char buf[3] = { 0, 127, 255 }; unsigned char buf[] = { 0, 127, 255 };
char *value; char *value;
(void) argc;
(void) argv;
/* Test whether we can write tags. */ /* Test whether we can write tags. */
tif = TIFFOpen(filename, "w"); tif = TIFFOpen(filename, "w");
@ -94,7 +94,7 @@ main(int argc, char **argv)
fprintf (stderr, "Can't set BitsPerSample tag.\n"); fprintf (stderr, "Can't set BitsPerSample tag.\n");
goto failure; goto failure;
} }
if (!TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 3)) { if (!TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, sizeof(buf))) {
fprintf (stderr, "Can't set SamplesPerPixel tag.\n"); fprintf (stderr, "Can't set SamplesPerPixel tag.\n");
goto failure; goto failure;
} }
@ -110,8 +110,8 @@ main(int argc, char **argv)
for (i = 0; i < NTAGS; i++) { for (i = 0; i < NTAGS; i++) {
if (!TIFFSetField(tif, ascii_tags[i].tag, if (!TIFFSetField(tif, ascii_tags[i].tag,
ascii_tags[i].value)) { ascii_tags[i].value)) {
fprintf(stderr, "Can't set tag %d.\n", fprintf(stderr, "Can't set tag %lu.\n",
(int)ascii_tags[i].tag); (unsigned long)ascii_tags[i].tag);
goto failure; goto failure;
} }
} }
@ -123,7 +123,8 @@ main(int argc, char **argv)
goto failure; goto failure;
} }
if (!TIFFSetField(tif, TIFFTAG_INKNAMES, ink_names_size, ink_names)) { if (!TIFFSetField(tif, TIFFTAG_INKNAMES, ink_names_size, ink_names)) {
fprintf (stderr, "Can't set tag %d (INKNAMES).\n", TIFFTAG_INKNAMES); fprintf (stderr, "Can't set tag %d (INKNAMES).\n",
TIFFTAG_INKNAMES);
goto failure; goto failure;
} }
@ -145,15 +146,16 @@ main(int argc, char **argv)
for (i = 0; i < NTAGS; i++) { for (i = 0; i < NTAGS; i++) {
if (!TIFFGetField(tif, ascii_tags[i].tag, &value) if (!TIFFGetField(tif, ascii_tags[i].tag, &value)
|| strcmp(value, ascii_tags[i].value)) { || strcmp(value, ascii_tags[i].value)) {
fprintf(stderr, "Can't get tag %d.\n", fprintf(stderr, "Can't get tag %lu.\n",
(int)ascii_tags[i].tag); (unsigned long)ascii_tags[i].tag);
goto failure; goto failure;
} }
} }
if (!TIFFGetField(tif, TIFFTAG_INKNAMES, &value) if (!TIFFGetField(tif, TIFFTAG_INKNAMES, &value)
|| memcmp(value, ink_names, ink_names_size)) { || memcmp(value, ink_names, ink_names_size)) {
fprintf (stderr, "Can't get tag %d (INKNAMES).\n", TIFFTAG_INKNAMES); fprintf (stderr, "Can't get tag %d (INKNAMES).\n",
TIFFTAG_INKNAMES);
goto failure; goto failure;
} }
@ -164,9 +166,11 @@ main(int argc, char **argv)
return 0; return 0;
failure: failure:
/* Something goes wrong; close file and return unsuccessful status. */ /*
* Something goes wrong; close file and return unsuccessful status.
* Do not remove the file for further manual investigation.
*/
TIFFClose(tif); TIFFClose(tif);
unlink(filename);
return 1; return 1;
} }