% March 2001 %
% %
% %
-% Copyright 1999-2010 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization %
% dedicated to making software imaging solutions freely available. %
% %
% You may not use this file except in compliance with the License. You may %
#include <string.h>
#include <ctype.h>
#include <math.h>
-#include "wand/MagickWand.h"
-#include "magick/string-private.h"
+#include "MagickWand/MagickWand.h"
+#include "MagickCore/colorspace-private.h"
+#include "MagickCore/string-private.h"
#include "validate.h"
\f
/*
test;
test=0;
- (void) fprintf(stdout,"validate compare command line program:\n");
+ (void) FormatLocaleFile(stdout,"validate compare command line program:\n");
for (i=0; compare_options[i] != (char *) NULL; i++)
{
CatchException(exception);
- (void) fprintf(stdout," test %lu: %s",test++,compare_options[i]);
- (void) FormatMagickString(command,MaxTextExtent,"%s %s %s %s",
+ (void) FormatLocaleFile(stdout," test %.20g: %s",(double) (test++),
+ compare_options[i]);
+ (void) FormatLocaleString(command,MaxTextExtent,"%s %s %s %s",
compare_options[i],reference_filename,reference_filename,output_filename);
arguments=StringToArgv(command,&number_arguments);
if (arguments == (char **) NULL)
{
- (void) fprintf(stdout,"... fail @ %s/%s/%lu.\n",GetMagickModule());
+ (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
+ GetMagickModule());
(*fail)++;
continue;
}
- status=CompareImageCommand(image_info,number_arguments,arguments,
+ status=CompareImagesCommand(image_info,number_arguments,arguments,
(char **) NULL,exception);
- for (j=0; j < number_arguments; j++)
+ for (j=0; j < (ssize_t) number_arguments; j++)
arguments[j]=DestroyString(arguments[j]);
arguments=(char **) RelinquishMagickMemory(arguments);
if (status != MagickFalse)
{
- (void) fprintf(stdout,"... fail @ %s/%s/%lu.\n",GetMagickModule());
+ (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
+ GetMagickModule());
(*fail)++;
continue;
}
- (void) fprintf(stdout,"... pass.\n");
+ (void) FormatLocaleFile(stdout,"... pass.\n");
}
- (void) fprintf(stdout," summary: %lu subtests; %lu passed; %lu failed.\n",
- test,test-(*fail),*fail);
+ (void) FormatLocaleFile(stdout,
+ " summary: %.20g subtests; %.20g passed; %.20g failed.\n",(double) test,
+ (double) (test-(*fail)),(double) *fail);
return(test);
}
\f
test;
test=0;
- (void) fprintf(stdout,"validate composite command line program:\n");
+ (void) FormatLocaleFile(stdout,"validate composite command line program:\n");
for (i=0; composite_options[i] != (char *) NULL; i++)
{
CatchException(exception);
- (void) fprintf(stdout," test %lu: %s",test++,composite_options[i]);
- (void) FormatMagickString(command,MaxTextExtent,"%s %s %s %s",
+ (void) FormatLocaleFile(stdout," test %.20g: %s",(double) (test++),
+ composite_options[i]);
+ (void) FormatLocaleString(command,MaxTextExtent,"%s %s %s %s",
reference_filename,composite_options[i],reference_filename,
output_filename);
arguments=StringToArgv(command,&number_arguments);
if (arguments == (char **) NULL)
{
- (void) fprintf(stdout,"... fail @ %s/%s/%lu.\n",GetMagickModule());
+ (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
+ GetMagickModule());
(*fail)++;
continue;
}
status=CompositeImageCommand(image_info,number_arguments,arguments,
(char **) NULL,exception);
- for (j=0; j < number_arguments; j++)
+ for (j=0; j < (ssize_t) number_arguments; j++)
arguments[j]=DestroyString(arguments[j]);
arguments=(char **) RelinquishMagickMemory(arguments);
if (status != MagickFalse)
{
- (void) fprintf(stdout,"... fail @ %s/%s/%lu.\n",GetMagickModule());
+ (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
+ GetMagickModule());
(*fail)++;
continue;
}
- (void) fprintf(stdout,"... pass.\n");
+ (void) FormatLocaleFile(stdout,"... pass.\n");
}
- (void) fprintf(stdout," summary: %lu subtests; %lu passed; %lu failed.\n",
- test,test-(*fail),*fail);
+ (void) FormatLocaleFile(stdout,
+ " summary: %.20g subtests; %.20g passed; %.20g failed.\n",(double) test,
+ (double) (test-(*fail)),(double) *fail);
return(test);
}
\f
test;
test=0;
- (void) fprintf(stdout,"validate convert command line program:\n");
+ (void) FormatLocaleFile(stdout,"validate convert command line program:\n");
for (i=0; convert_options[i] != (char *) NULL; i++)
{
CatchException(exception);
- (void) fprintf(stdout," test %lu: %s",test++,convert_options[i]);
- (void) FormatMagickString(command,MaxTextExtent,"%s %s %s %s",
+ (void) FormatLocaleFile(stdout," test %.20g: %s",(double) test++,
+ convert_options[i]);
+ (void) FormatLocaleString(command,MaxTextExtent,"%s %s %s %s",
reference_filename,convert_options[i],reference_filename,output_filename);
arguments=StringToArgv(command,&number_arguments);
if (arguments == (char **) NULL)
{
- (void) fprintf(stdout,"... fail @ %s/%s/%lu.\n",GetMagickModule());
+ (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
+ GetMagickModule());
(*fail)++;
continue;
}
status=ConvertImageCommand(image_info,number_arguments,arguments,
(char **) NULL,exception);
- for (j=0; j < number_arguments; j++)
+ for (j=0; j < (ssize_t) number_arguments; j++)
arguments[j]=DestroyString(arguments[j]);
arguments=(char **) RelinquishMagickMemory(arguments);
if (status != MagickFalse)
{
- (void) fprintf(stdout,"... fail @ %s/%s/%lu.\n",GetMagickModule());
+ (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
+ GetMagickModule());
(*fail)++;
continue;
}
- (void) fprintf(stdout,"... pass.\n");
+ (void) FormatLocaleFile(stdout,"... pass.\n");
}
- (void) fprintf(stdout," summary: %lu subtests; %lu passed; %lu failed.\n",
- test,test-(*fail),*fail);
+ (void) FormatLocaleFile(stdout,
+ " summary: %.20g subtests; %.20g passed; %.20g failed.\n",(double) test,
+ (double) (test-(*fail)),(double) *fail);
return(test);
}
\f
(void) output_filename;
test=0;
- (void) fprintf(stdout,"validate identify command line program:\n");
+ (void) FormatLocaleFile(stdout,"validate identify command line program:\n");
for (i=0; identify_options[i] != (char *) NULL; i++)
{
CatchException(exception);
- (void) fprintf(stdout," test %lu: %s",test++,identify_options[i]);
- (void) FormatMagickString(command,MaxTextExtent,"%s %s",
+ (void) FormatLocaleFile(stdout," test %.20g: %s",(double) test++,
+ identify_options[i]);
+ (void) FormatLocaleString(command,MaxTextExtent,"%s %s",
identify_options[i],reference_filename);
arguments=StringToArgv(command,&number_arguments);
if (arguments == (char **) NULL)
{
- (void) fprintf(stdout,"... fail @ %s/%s/%lu.\n",GetMagickModule());
+ (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
+ GetMagickModule());
(*fail)++;
continue;
}
status=IdentifyImageCommand(image_info,number_arguments,arguments,
(char **) NULL,exception);
- for (j=0; j < number_arguments; j++)
+ for (j=0; j < (ssize_t) number_arguments; j++)
arguments[j]=DestroyString(arguments[j]);
arguments=(char **) RelinquishMagickMemory(arguments);
if (status != MagickFalse)
{
- (void) fprintf(stdout,"... fail @ %s/%s/%lu.\n",GetMagickModule());
+ (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
+ GetMagickModule());
(*fail)++;
continue;
}
- (void) fprintf(stdout,"... pass.\n");
+ (void) FormatLocaleFile(stdout,"... pass.\n");
}
- (void) fprintf(stdout," summary: %lu subtests; %lu passed; %lu failed.\n",
- test,test-(*fail),*fail);
+ (void) FormatLocaleFile(stdout,
+ " summary: %.20g subtests; %.20g passed; %.20g failed.\n",(double) test,
+ (double) (test-(*fail)),(double) *fail);
return(test);
}
\f
Image
*difference_image,
- *reference_image,
- *reconstruct_image;
+ *reconstruct_image,
+ *reference_image;
MagickBooleanType
status;
j;
size_t
- length;
+ length,
+ test;
unsigned char
*blob;
- size_t
- test;
-
test=0;
- (void) fprintf(stdout,"validate image formats in memory:\n");
+ (void) FormatLocaleFile(stdout,"validate image formats in memory:\n");
for (i=0; reference_formats[i].magick != (char *) NULL; i++)
{
magick_info=GetMagickInfo(reference_formats[i].magick,exception);
Generate reference image.
*/
CatchException(exception);
- (void) fprintf(stdout," test %lu: %s/%s/%s/%lu-bits",test++,
- reference_formats[i].magick,MagickOptionToMnemonic(
+ (void) FormatLocaleFile(stdout," test %.20g: %s/%s/%s/%.20g-bits",
+ (double) (test++),reference_formats[i].magick,CommandOptionToMnemonic(
MagickCompressOptions,reference_formats[i].compression),
- MagickOptionToMnemonic(MagickTypeOptions,reference_types[j].type),
- reference_types[j].depth);
+ CommandOptionToMnemonic(MagickTypeOptions,reference_types[j].type),
+ (double) reference_types[j].depth);
(void) CopyMagickString(image_info->filename,reference_filename,
MaxTextExtent);
reference_image=ReadImage(image_info,exception);
if (reference_image == (Image *) NULL)
{
- (void) fprintf(stdout,"... fail @ %s/%s/%lu.\n",GetMagickModule());
+ (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
+ GetMagickModule());
(*fail)++;
continue;
}
/*
Write reference image.
*/
- (void) FormatMagickString(size,MaxTextExtent,"%lux%lu",
- reference_image->columns,reference_image->rows);
+ (void) FormatLocaleString(size,MaxTextExtent,"%.20gx%.20g",
+ (double) reference_image->columns,(double) reference_image->rows);
(void) CloneString(&image_info->size,size);
image_info->depth=reference_types[j].depth;
- (void) FormatMagickString(reference_image->filename,MaxTextExtent,"%s:%s",
+ (void) FormatLocaleString(reference_image->filename,MaxTextExtent,"%s:%s",
reference_formats[i].magick,output_filename);
- status=SetImageType(reference_image,reference_types[j].type);
- InheritException(exception,&reference_image->exception);
+ status=SetImageType(reference_image,reference_types[j].type,exception);
if (status == MagickFalse)
{
- (void) fprintf(stdout,"... fail @ %s/%s/%lu.\n",GetMagickModule());
+ (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
+ GetMagickModule());
(*fail)++;
reference_image=DestroyImage(reference_image);
continue;
}
- status=SetImageDepth(reference_image,reference_types[j].depth);
- InheritException(exception,&reference_image->exception);
+ status=SetImageDepth(reference_image,reference_types[j].depth,exception);
if (status == MagickFalse)
{
- (void) fprintf(stdout,"... fail @ %s/%s/%lu.\n",GetMagickModule());
+ (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
+ GetMagickModule());
(*fail)++;
reference_image=DestroyImage(reference_image);
continue;
}
reference_image->compression=reference_formats[i].compression;
- status=WriteImage(image_info,reference_image);
- InheritException(exception,&reference_image->exception);
+ status=WriteImage(image_info,reference_image,exception);
reference_image=DestroyImage(reference_image);
if (status == MagickFalse)
{
- (void) fprintf(stdout,"... fail @ %s/%s/%lu.\n",GetMagickModule());
+ (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
+ GetMagickModule());
(*fail)++;
continue;
}
/*
Read reference image.
*/
- (void) FormatMagickString(image_info->filename,MaxTextExtent,"%s:%s",
+ (void) FormatLocaleString(image_info->filename,MaxTextExtent,"%s:%s",
reference_formats[i].magick,output_filename);
reference_image=ReadImage(image_info,exception);
if (reference_image == (Image *) NULL)
{
- (void) fprintf(stdout,"... fail @ %s/%s/%lu.\n",GetMagickModule());
+ (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
+ GetMagickModule());
(*fail)++;
continue;
}
/*
Write reference image.
*/
- (void) FormatMagickString(reference_image->filename,MaxTextExtent,"%s:%s",
+ (void) FormatLocaleString(reference_image->filename,MaxTextExtent,"%s:%s",
reference_formats[i].magick,output_filename);
(void) CopyMagickString(image_info->magick,reference_formats[i].magick,
MaxTextExtent);
blob=ImageToBlob(image_info,reference_image,&length,exception);
if (blob == (unsigned char *) NULL)
{
- (void) fprintf(stdout,"... fail @ %s/%s/%lu.\n",GetMagickModule());
+ (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
+ GetMagickModule());
(*fail)++;
reference_image=DestroyImage(reference_image);
continue;
/*
Read reconstruct image.
*/
- (void) FormatMagickString(image_info->filename,MaxTextExtent,"%s:%s",
+ (void) FormatLocaleString(image_info->filename,MaxTextExtent,"%s:%s",
reference_formats[i].magick,output_filename);
reconstruct_image=BlobToImage(image_info,blob,length,exception);
blob=(unsigned char *) RelinquishMagickMemory(blob);
if (reconstruct_image == (Image *) NULL)
{
- (void) fprintf(stdout,"... fail @ %s/%s/%lu.\n",GetMagickModule());
+ (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
+ GetMagickModule());
(*fail)++;
reference_image=DestroyImage(reference_image);
continue;
#if defined(MAGICKCORE_HDRI_SUPPORT)
fuzz+=0.003;
#endif
- if (reference_image->colorspace != RGBColorspace)
+ if (IsRGBColorspace(reference_image->colorspace) == MagickFalse)
fuzz+=0.3;
fuzz+=MagickEpsilon;
- difference_image=CompareImageChannels(reference_image,reconstruct_image,
- AllChannels,MeanSquaredErrorMetric,&distortion,exception);
+ difference_image=CompareImages(reference_image,reconstruct_image,
+ MeanSquaredErrorMetric,&distortion,exception);
reconstruct_image=DestroyImage(reconstruct_image);
reference_image=DestroyImage(reference_image);
if (difference_image == (Image *) NULL)
{
- (void) fprintf(stdout,"... fail @ %s/%s/%lu.\n",GetMagickModule());
+ (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
+ GetMagickModule());
(*fail)++;
continue;
}
difference_image=DestroyImage(difference_image);
if ((distortion/QuantumRange) > fuzz)
{
- (void) fprintf(stdout,"... fail (with distortion %g).\n",
+ (void) FormatLocaleFile(stdout,"... fail (with distortion %g).\n",
distortion/QuantumRange);
(*fail)++;
continue;
}
- (void) fprintf(stdout,"... pass.\n");
+ (void) FormatLocaleFile(stdout,"... pass.\n");
}
}
- (void) fprintf(stdout," summary: %lu subtests; %lu passed; %lu failed.\n",
- test,test-(*fail),*fail);
+ (void) FormatLocaleFile(stdout,
+ " summary: %.20g subtests; %.20g passed; %.20g failed.\n",(double) test,
+ (double) (test-(*fail)),(double) *fail);
return(test);
}
\f
test;
test=0;
- (void) fprintf(stdout,"validate image formats on disk:\n");
+ (void) FormatLocaleFile(stdout,"validate image formats on disk:\n");
for (i=0; reference_formats[i].magick != (char *) NULL; i++)
{
magick_info=GetMagickInfo(reference_formats[i].magick,exception);
Generate reference image.
*/
CatchException(exception);
- (void) fprintf(stdout," test %lu: %s/%s/%s/%lu-bits",test++,
- reference_formats[i].magick,MagickOptionToMnemonic(
+ (void) FormatLocaleFile(stdout," test %.20g: %s/%s/%s/%.20g-bits",
+ (double) (test++),reference_formats[i].magick,CommandOptionToMnemonic(
MagickCompressOptions,reference_formats[i].compression),
- MagickOptionToMnemonic(MagickTypeOptions,reference_types[j].type),
- reference_types[j].depth);
+ CommandOptionToMnemonic(MagickTypeOptions,reference_types[j].type),
+ (double) reference_types[j].depth);
(void) CopyMagickString(image_info->filename,reference_filename,
MaxTextExtent);
reference_image=ReadImage(image_info,exception);
if (reference_image == (Image *) NULL)
{
- (void) fprintf(stdout,"... fail @ %s/%s/%lu.\n",GetMagickModule());
+ (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
+ GetMagickModule());
(*fail)++;
continue;
}
/*
Write reference image.
*/
- (void) FormatMagickString(size,MaxTextExtent,"%lux%lu",
- reference_image->columns,reference_image->rows);
+ (void) FormatLocaleString(size,MaxTextExtent,"%.20gx%.20g",
+ (double) reference_image->columns,(double) reference_image->rows);
(void) CloneString(&image_info->size,size);
image_info->depth=reference_types[j].depth;
- (void) FormatMagickString(reference_image->filename,MaxTextExtent,"%s:%s",
+ (void) FormatLocaleString(reference_image->filename,MaxTextExtent,"%s:%s",
reference_formats[i].magick,output_filename);
- status=SetImageType(reference_image,reference_types[j].type);
- InheritException(exception,&reference_image->exception);
+ status=SetImageType(reference_image,reference_types[j].type,exception);
if (status == MagickFalse)
{
- (void) fprintf(stdout,"... fail @ %s/%s/%lu.\n",GetMagickModule());
+ (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
+ GetMagickModule());
(*fail)++;
reference_image=DestroyImage(reference_image);
continue;
}
- status=SetImageDepth(reference_image,reference_types[j].depth);
- InheritException(exception,&reference_image->exception);
+ status=SetImageDepth(reference_image,reference_types[j].depth,exception);
if (status == MagickFalse)
{
- (void) fprintf(stdout,"... fail @ %s/%s/%lu.\n",GetMagickModule());
+ (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
+ GetMagickModule());
(*fail)++;
reference_image=DestroyImage(reference_image);
continue;
}
reference_image->compression=reference_formats[i].compression;
- status=WriteImage(image_info,reference_image);
- InheritException(exception,&reference_image->exception);
+ status=WriteImage(image_info,reference_image,exception);
reference_image=DestroyImage(reference_image);
if (status == MagickFalse)
{
- (void) fprintf(stdout,"... fail @ %s/%s/%lu.\n",GetMagickModule());
+ (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
+ GetMagickModule());
(*fail)++;
continue;
}
/*
Read reference image.
*/
- (void) FormatMagickString(image_info->filename,MaxTextExtent,"%s:%s",
+ (void) FormatLocaleString(image_info->filename,MaxTextExtent,"%s:%s",
reference_formats[i].magick,output_filename);
reference_image=ReadImage(image_info,exception);
if (reference_image == (Image *) NULL)
{
- (void) fprintf(stdout,"... fail @ %s/%s/%lu.\n",GetMagickModule());
+ (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
+ GetMagickModule());
(*fail)++;
continue;
}
/*
Write reference image.
*/
- (void) FormatMagickString(reference_image->filename,MaxTextExtent,"%s:%s",
+ (void) FormatLocaleString(reference_image->filename,MaxTextExtent,"%s:%s",
reference_formats[i].magick,output_filename);
reference_image->depth=reference_types[j].depth;
reference_image->compression=reference_formats[i].compression;
- status=WriteImage(image_info,reference_image);
- InheritException(exception,&reference_image->exception);
+ status=WriteImage(image_info,reference_image,exception);
if (status == MagickFalse)
{
- (void) fprintf(stdout,"... fail @ %s/%s/%lu.\n",GetMagickModule());
+ (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
+ GetMagickModule());
(*fail)++;
reference_image=DestroyImage(reference_image);
continue;
/*
Read reconstruct image.
*/
- (void) FormatMagickString(image_info->filename,MaxTextExtent,"%s:%s",
+ (void) FormatLocaleString(image_info->filename,MaxTextExtent,"%s:%s",
reference_formats[i].magick,output_filename);
reconstruct_image=ReadImage(image_info,exception);
if (reconstruct_image == (Image *) NULL)
{
- (void) fprintf(stdout,"... fail @ %s/%s/%lu.\n",GetMagickModule());
+ (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
+ GetMagickModule());
(*fail)++;
reference_image=DestroyImage(reference_image);
continue;
#if defined(MAGICKCORE_HDRI_SUPPORT)
fuzz+=0.003;
#endif
- if (reference_image->colorspace != RGBColorspace)
+ if (IsRGBColorspace(reference_image->colorspace) == MagickFalse)
fuzz+=0.3;
fuzz+=MagickEpsilon;
- difference_image=CompareImageChannels(reference_image,reconstruct_image,
- AllChannels,MeanSquaredErrorMetric,&distortion,exception);
+ difference_image=CompareImages(reference_image,reconstruct_image,
+ MeanSquaredErrorMetric,&distortion,exception);
reconstruct_image=DestroyImage(reconstruct_image);
reference_image=DestroyImage(reference_image);
if (difference_image == (Image *) NULL)
{
- (void) fprintf(stdout,"... fail @ %s/%s/%lu.\n",GetMagickModule());
+ (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
+ GetMagickModule());
(*fail)++;
continue;
}
difference_image=DestroyImage(difference_image);
if ((distortion/QuantumRange) > fuzz)
{
- (void) fprintf(stdout,"... fail (with distortion %g).\n",
+ (void) FormatLocaleFile(stdout,"... fail (with distortion %g).\n",
distortion/QuantumRange);
(*fail)++;
continue;
}
- (void) fprintf(stdout,"... pass.\n");
+ (void) FormatLocaleFile(stdout,"... pass.\n");
}
}
- (void) fprintf(stdout," summary: %lu subtests; %lu passed; %lu failed.\n",
- test,test-(*fail),*fail);
+ (void) FormatLocaleFile(stdout,
+ " summary: %.20g subtests; %.20g passed; %.20g failed.\n",(double) test,
+ (double) (test-(*fail)),(double) *fail);
return(test);
}
\f
(void) output_filename;
test=0;
- (void) fprintf(stdout,"validate the import and export of image pixels:\n");
+ (void) FormatLocaleFile(stdout,
+ "validate the import and export of image pixels:\n");
for (i=0; reference_map[i] != (char *) NULL; i++)
{
for (j=0; reference_storage[j].type != UndefinedPixel; j++)
Generate reference image.
*/
CatchException(exception);
- (void) fprintf(stdout," test %lu: %s/%s",test++,
- reference_map[i],MagickOptionToMnemonic(MagickStorageOptions,
+ (void) FormatLocaleFile(stdout," test %.20g: %s/%s",(double) (test++),
+ reference_map[i],CommandOptionToMnemonic(MagickStorageOptions,
reference_storage[j].type));
(void) CopyMagickString(image_info->filename,reference_filename,
MaxTextExtent);
reference_image=ReadImage(image_info,exception);
if (reference_image == (Image *) NULL)
{
- (void) fprintf(stdout,"... fail @ %s/%s/%lu.\n",GetMagickModule());
+ (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
+ GetMagickModule());
(*fail)++;
continue;
}
if (LocaleNCompare(reference_map[i],"cmy",3) == 0)
- (void) TransformImageColorspace(reference_image,CMYKColorspace);
+ reference_image->colorspace=CMYKColorspace;
length=strlen(reference_map[i])*reference_image->columns*
reference_image->rows*reference_storage[j].quantum;
pixels=(unsigned char *) AcquireQuantumMemory(length,sizeof(*pixels));
if (pixels == (unsigned char *) NULL)
{
- (void) fprintf(stdout,"... fail @ %s/%s/%lu.\n",GetMagickModule());
+ (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
+ GetMagickModule());
(*fail)++;
reference_image=DestroyImage(reference_image);
continue;
exception);
if (status == MagickFalse)
{
- (void) fprintf(stdout,"... fail @ %s/%s/%lu.\n",GetMagickModule());
+ (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
+ GetMagickModule());
(*fail)++;
pixels=(unsigned char *) RelinquishMagickMemory(pixels);
reference_image=DestroyImage(reference_image);
continue;
}
- (void) SetImageBackgroundColor(reference_image);
+ (void) SetImageBackgroundColor(reference_image,exception);
status=ImportImagePixels(reference_image,0,0,reference_image->columns,
reference_image->rows,reference_map[i],reference_storage[j].type,
- pixels);
- InheritException(exception,&reference_image->exception);
+ pixels,exception);
if (status == MagickFalse)
{
- (void) fprintf(stdout,"... fail @ %s/%s/%lu.\n",GetMagickModule());
+ (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
+ GetMagickModule());
(*fail)++;
pixels=(unsigned char *) RelinquishMagickMemory(pixels);
reference_image=DestroyImage(reference_image);
/*
Read reconstruct image.
*/
- reconstruct_image=AcquireImage(image_info);
+ reconstruct_image=AcquireImage(image_info,exception);
(void) SetImageExtent(reconstruct_image,reference_image->columns,
- reference_image->rows);
- (void) SetImageColorspace(reconstruct_image,reference_image->colorspace);
- (void) SetImageBackgroundColor(reconstruct_image);
+ reference_image->rows,exception);
+ (void) SetImageColorspace(reconstruct_image,reference_image->colorspace,
+ exception);
+ (void) SetImageBackgroundColor(reconstruct_image,exception);
status=ImportImagePixels(reconstruct_image,0,0,reconstruct_image->columns,
reconstruct_image->rows,reference_map[i],reference_storage[j].type,
- pixels);
- InheritException(exception,&reconstruct_image->exception);
+ pixels,exception);
pixels=(unsigned char *) RelinquishMagickMemory(pixels);
if (status == MagickFalse)
{
- (void) fprintf(stdout,"... fail @ %s/%s/%lu.\n",GetMagickModule());
+ (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
+ GetMagickModule());
(*fail)++;
reference_image=DestroyImage(reference_image);
continue;
/*
Compare reference to reconstruct image.
*/
- difference_image=CompareImageChannels(reference_image,reconstruct_image,
- AllChannels,MeanSquaredErrorMetric,&distortion,exception);
+ difference_image=CompareImages(reference_image,reconstruct_image,
+ MeanSquaredErrorMetric,&distortion,exception);
reconstruct_image=DestroyImage(reconstruct_image);
reference_image=DestroyImage(reference_image);
if (difference_image == (Image *) NULL)
{
- (void) fprintf(stdout,"... fail @ %s/%s/%lu.\n",GetMagickModule());
+ (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
+ GetMagickModule());
(*fail)++;
continue;
}
difference_image=DestroyImage(difference_image);
if ((distortion/QuantumRange) > 0.0)
{
- (void) fprintf(stdout,"... fail (with distortion %g).\n",
+ (void) FormatLocaleFile(stdout,"... fail (with distortion %g).\n",
distortion/QuantumRange);
(*fail)++;
continue;
}
- (void) fprintf(stdout,"... pass.\n");
+ (void) FormatLocaleFile(stdout,"... pass.\n");
}
}
- (void) fprintf(stdout," summary: %lu subtests; %lu passed; %lu failed.\n",
- test,test-(*fail),*fail);
+ (void) FormatLocaleFile(stdout,
+ " summary: %.20g subtests; %.20g passed; %.20g failed.\n",(double) test,
+ (double) (test-(*fail)),(double) *fail);
return(test);
}
\f
test;
test=0;
- (void) fprintf(stdout,"validate montage command line program:\n");
+ (void) FormatLocaleFile(stdout,"validate montage command line program:\n");
for (i=0; montage_options[i] != (char *) NULL; i++)
{
CatchException(exception);
- (void) fprintf(stdout," test %lu: %s",test++,montage_options[i]);
- (void) FormatMagickString(command,MaxTextExtent,"%s %s %s %s",
+ (void) FormatLocaleFile(stdout," test %.20g: %s",(double) (test++),
+ montage_options[i]);
+ (void) FormatLocaleString(command,MaxTextExtent,"%s %s %s %s",
reference_filename,montage_options[i],reference_filename,
output_filename);
arguments=StringToArgv(command,&number_arguments);
if (arguments == (char **) NULL)
{
- (void) fprintf(stdout,"... fail @ %s/%s/%lu.\n",GetMagickModule());
+ (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
+ GetMagickModule());
(*fail)++;
continue;
}
status=MontageImageCommand(image_info,number_arguments,arguments,
(char **) NULL,exception);
- for (j=0; j < number_arguments; j++)
+ for (j=0; j < (ssize_t) number_arguments; j++)
arguments[j]=DestroyString(arguments[j]);
arguments=(char **) RelinquishMagickMemory(arguments);
if (status != MagickFalse)
{
- (void) fprintf(stdout,"... fail @ %s/%s/%lu.\n",GetMagickModule());
+ (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
+ GetMagickModule());
(*fail)++;
continue;
}
- (void) fprintf(stdout,"... pass.\n");
+ (void) FormatLocaleFile(stdout,"... pass.\n");
}
- (void) fprintf(stdout," summary: %lu subtests; %lu passed; %lu failed.\n",
- test,test-(*fail),*fail);
+ (void) FormatLocaleFile(stdout,
+ " summary: %.20g subtests; %.20g passed; %.20g failed.\n",(double) test,
+ (double) (test-(*fail)),(double) *fail);
return(test);
}
\f
test;
test=0;
- (void) fprintf(stdout,"validate stream command line program:\n");
+ (void) FormatLocaleFile(stdout,"validate stream command line program:\n");
for (i=0; stream_options[i] != (char *) NULL; i++)
{
CatchException(exception);
- (void) fprintf(stdout," test %lu: %s",test++,stream_options[i]);
- (void) FormatMagickString(command,MaxTextExtent,"%s %s %s",
+ (void) FormatLocaleFile(stdout," test %.20g: %s",(double) (test++),
+ stream_options[i]);
+ (void) FormatLocaleString(command,MaxTextExtent,"%s %s %s",
stream_options[i],reference_filename,output_filename);
arguments=StringToArgv(command,&number_arguments);
if (arguments == (char **) NULL)
{
- (void) fprintf(stdout,"... fail @ %s/%s/%lu.\n",GetMagickModule());
+ (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
+ GetMagickModule());
(*fail)++;
continue;
}
status=StreamImageCommand(image_info,number_arguments,arguments,
(char **) NULL,exception);
- for (j=0; j < number_arguments; j++)
+ for (j=0; j < (ssize_t) number_arguments; j++)
arguments[j]=DestroyString(arguments[j]);
arguments=(char **) RelinquishMagickMemory(arguments);
if (status != MagickFalse)
{
- (void) fprintf(stdout,"... fail @ %s/%s/%lu.\n",GetMagickModule());
+ (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
+ GetMagickModule());
(*fail)++;
continue;
}
- (void) fprintf(stdout,"... pass.\n");
+ (void) FormatLocaleFile(stdout,"... pass.\n");
}
- (void) fprintf(stdout," summary: %lu subtests; %lu passed; %lu failed.\n",
- test,test-(*fail),*fail);
+ (void) FormatLocaleFile(stdout,
+ " summary: %.20g subtests; %.20g passed; %.20g failed.\n",(double) test,
+ (double) (test-(*fail)),(double) *fail);
return(test);
}
\f
status=MagickFalse;
type=AllValidate;
regard_warnings=MagickFalse;
+ (void) regard_warnings;
exception=AcquireExceptionInfo();
image_info=AcquireImageInfo();
(void) CopyMagickString(image_info->filename,ReferenceFilename,MaxTextExtent);
for (i=1; i < (ssize_t) argc; i++)
{
option=argv[i];
- if (IsMagickOption(option) == MagickFalse)
+ if (IsCommandOption(option) == MagickFalse)
{
(void) CopyMagickString(image_info->filename,option,MaxTextExtent);
continue;
i++;
if (i == (ssize_t) argc)
ThrowValidateException(OptionError,"MissingArgument",option);
- validate=ParseMagickOption(MagickValidateOptions,MagickFalse,
+ validate=ParseCommandOption(MagickValidateOptions,MagickFalse,
argv[i]);
if (validate < 0)
ThrowValidateException(OptionError,"UnrecognizedValidateType",
if ((LocaleCompare("version",option+1) == 0) ||
(LocaleCompare("-version",option+1) == 0))
{
- (void) fprintf(stdout,"Version: %s\n",
+ (void) FormatLocaleFile(stdout,"Version: %s\n",
GetMagickVersion((size_t *) NULL));
- (void) fprintf(stdout,"Copyright: %s\n\n",GetMagickCopyright());
- (void) fprintf(stdout,"Features: %s\n\n",GetMagickFeatures());
+ (void) FormatLocaleFile(stdout,"Copyright: %s\n\n",
+ GetMagickCopyright());
+ (void) FormatLocaleFile(stdout,"Features: %s\n\n",
+ GetMagickFeatures());
return(0);
}
ThrowValidateException(OptionError,"UnrecognizedOption",option)
(void) AcquireUniqueFilename(output_filename);
(void) CopyMagickString(reference_image->filename,reference_filename,
MaxTextExtent);
- status=WriteImage(image_info,reference_image);
- InheritException(exception,&reference_image->exception);
+ status=WriteImage(image_info,reference_image,exception);
reference_image=DestroyImage(reference_image);
if (status == MagickFalse)
fail++;
else
{
- (void) fprintf(stdout,"Version: %s\n",
+ (void) FormatLocaleFile(stdout,"Version: %s\n",
GetMagickVersion((size_t *) NULL));
- (void) fprintf(stdout,"Copyright: %s\n\n",
+ (void) FormatLocaleFile(stdout,"Copyright: %s\n\n",
GetMagickCopyright());
- (void) fprintf(stdout,"ImageMagick Validation Suite (%s)\n\n",
- MagickOptionToMnemonic(MagickValidateOptions,(ssize_t) type));
+ (void) FormatLocaleFile(stdout,
+ "ImageMagick Validation Suite (%s)\n\n",CommandOptionToMnemonic(
+ MagickValidateOptions,(ssize_t) type));
if ((type & CompareValidate) != 0)
tests+=ValidateCompareCommand(image_info,reference_filename,
output_filename,&fail,exception);
if ((type & StreamValidate) != 0)
tests+=ValidateStreamCommand(image_info,reference_filename,
output_filename,&fail,exception);
- (void) fprintf(stdout,"validation suite: %lu tests; %lu passed; "
- "%lu failed.\n",tests,tests-fail,fail);
+ (void) FormatLocaleFile(stdout,
+ "validation suite: %.20g tests; %.20g passed; %.20g failed.\n",
+ (double) tests,(double) (tests-fail),(double) fail);
}
(void) RelinquishUniqueFileResource(output_filename);
(void) RelinquishUniqueFileResource(reference_filename);
{
elapsed_time=GetElapsedTime(timer);
user_time=GetUserTime(timer);
- (void) fprintf(stderr,
- "Performance: %lui %gips %0.3fu %ld:%02ld.%03ld\n",
- iterations,1.0*iterations/elapsed_time,user_time,(ssize_t)
- (elapsed_time/60.0),(ssize_t) ceil(fmod(elapsed_time,60.0)),
- (ssize_t) (1000.0*(elapsed_time-floor(elapsed_time))));
+ (void) FormatLocaleFile(stderr,
+ "Performance: %.20gi %gips %0.3fu %ld:%02ld.%03ld\n",(double)
+ iterations,1.0*iterations/elapsed_time,user_time,(long)
+ (elapsed_time/60.0),(long) ceil(fmod(elapsed_time,60.0)),
+ (long) (1000.0*(elapsed_time-floor(elapsed_time))));
timer=DestroyTimerInfo(timer);
}
DestroyValidate();