blob: a61cfa08e1c5b6b63245b048ff0126b043a90669 [file] [log] [blame]
cristy3ed852e2009-09-05 21:47:34 +00001// This may look like C code, but it is really -*- C++ -*-
2//
3// Copyright Bob Friesenhahn, 1999, 2000, 2003
4//
5// Test STL appendImages function
6//
7
cristy3ed852e2009-09-05 21:47:34 +00008#include <Magick++.h>
9#include <string>
10#include <iostream>
11#include <list>
12#include <vector>
13
14using namespace std;
15
16using namespace Magick;
17
18int main( int /*argc*/, char ** argv)
19{
20
21 // Initialize ImageMagick install location for Windows
22 InitializeMagick(*argv);
23
24 int failures=0;
25
26 try {
27
28 string srcdir("");
29 if(getenv("SRCDIR") != 0)
30 srcdir = getenv("SRCDIR");
31
32 //
33 // Test appendImages
34 //
35
36 list<Image> imageList;
37 readImages( &imageList, srcdir + "test_image_anim.miff" );
38
39 Image appended;
40
41 // Horizontal
42 appendImages( &appended, imageList.begin(), imageList.end() );
43 // appended.display();
cristy6e564992013-05-24 01:21:04 +000044 if ( appended.signature() != "493106ee32cdeab9e386fe50aafede73c23c1150af564a4ad71ca1deccc1fa10" )
cristy3ed852e2009-09-05 21:47:34 +000045 {
46 ++failures;
47 cout << "Line: " << __LINE__
48 << " Horizontal append failed, signature = "
49 << appended.signature() << endl;
50 appended.write("appendImages_horizontal_out.miff");
51 // appended.display();
52 }
53
54 // Vertical
55 appendImages( &appended, imageList.begin(), imageList.end(), true );
cristy6e564992013-05-24 01:21:04 +000056 if ( appended.signature() != "a22fbe9ca8e3dc3b34f137d175d51841daf56d231bedd8b18ad55415af558265" )
cristy3ed852e2009-09-05 21:47:34 +000057 {
58 ++failures;
59 cout << "Line: " << __LINE__
60 << " Vertical append failed, signature = "
61 << appended.signature() << endl;
62 appended.write("appendImages_vertical_out.miff");
63 // appended.display();
64 }
65
66 }
67
68 catch( Exception &error_ )
69 {
70 cout << "Caught exception: " << error_.what() << endl;
71 return 1;
72 }
73 catch( exception &error_ )
74 {
75 cout << "Caught exception: " << error_.what() << endl;
76 return 1;
77 }
78
79 if ( failures )
80 {
81 cout << failures << " failures" << endl;
82 return 1;
83 }
84
85 return 0;
86}
87