blob: dbe9c963a2ba8308195f18038445d3c3aa90dc23 [file]
// This may look like C code, but it is really -*- C++ -*-
//
// Copyright Bob Friesenhahn, 1999, 2000, 2003
//
// Test STL appendImages function
//
#include <Magick++.h>
#include <string>
#include <iostream>
#include <list>
#include <vector>
using namespace std;
using namespace Magick;
int main( int /*argc*/, char ** argv)
{
// Initialize ImageMagick install location for Windows
InitializeMagick(*argv);
int failures=0;
try {
string srcdir("");
if(getenv("SRCDIR") != 0)
srcdir = getenv("SRCDIR");
//
// Test appendImages
//
list<Image> imageList;
readImages( &imageList, srcdir + "test_image_anim.miff" );
Image appended;
// Horizontal
appendImages( &appended, imageList.begin(), imageList.end() );
// appended.display();
if ( appended.signature() != "a251c7b271e711604c800658cf80ad17ef32328ab9b24fca54438b214224c3d9" )
{
++failures;
cout << "Line: " << __LINE__
<< " Horizontal append failed, signature = "
<< appended.signature() << endl;
appended.write("appendImages_horizontal_out.miff");
// appended.display();
}
// Vertical
appendImages( &appended, imageList.begin(), imageList.end(), true );
if ( appended.signature() != "a251c7b271e711604c800658cf80ad17ef32328ab9b24fca54438b214224c3d9" )
{
++failures;
cout << "Line: " << __LINE__
<< " Vertical append failed, signature = "
<< appended.signature() << endl;
appended.write("appendImages_vertical_out.miff");
// appended.display();
}
}
catch( Exception &error_ )
{
cout << "Caught exception: " << error_.what() << endl;
return 1;
}
catch( exception &error_ )
{
cout << "Caught exception: " << error_.what() << endl;
return 1;
}
if ( failures )
{
cout << failures << " failures" << endl;
return 1;
}
return 0;
}