1 // This may look like C code, but it is really -*- C++ -*-
3 // Copyright Bob Friesenhahn, 1999, 2000, 2003
5 // Test STL readImages and writeImages functions
16 using namespace Magick;
18 int main( int /*argc*/, char ** argv)
21 // Initialize ImageMagick install location for Windows
22 InitializeMagick(*argv);
29 if(getenv("SRCDIR") != 0)
30 srcdir = getenv("SRCDIR");
33 // Test readImages and writeImages
37 readImages( &first, srcdir + "test_image_anim.miff" );
39 if ( first.size() != 6 )
42 cout << "Line: " << __LINE__
43 << " Read images failed, number of frames is "
45 << " rather than 6 as expected." << endl;
48 writeImages( first.begin(), first.end(), "testmagick_anim_out.miff" );
51 readImages( &second, "testmagick_anim_out.miff" );
53 list<Image>::iterator firstIter = first.begin();
54 list<Image>::iterator secondIter = second.begin();
55 while( firstIter != first.end() && secondIter != second.end() )
58 if ( firstIter->scene() != secondIter->scene() )
61 cout << "Line: " << __LINE__
62 << " Image scene: " << secondIter->scene()
63 << " is not equal to original "
68 if ( firstIter->rows() != secondIter->rows() )
71 cout << "Line: " << __LINE__
72 << " Image rows " << secondIter->rows()
73 << " are not equal to original "
78 if ( firstIter->columns() != secondIter->columns() )
81 cout << "Line: " << __LINE__
82 << " Image columns " << secondIter->columns()
83 << " are not equal to original "
93 catch( Exception &error_ )
95 cout << "Caught exception: " << error_.what() << endl;
98 catch( exception &error_ )
100 cout << "Caught exception: " << error_.what() << endl;
106 cout << failures << " failures" << endl;