• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // 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 
8 #include <Magick++.h>
9 #include <string>
10 #include <iostream>
11 #include <list>
12 #include <vector>
13 
14 using namespace std;
15 
16 using namespace Magick;
17 
main(int,char ** argv)18 int 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();
44     if (( appended.signature() != "3a90bb0bb8f69f6788ab99e9e25598a0d6c5cdbbb797f77ad68011e0a8b1689d" ) &&
45         ( appended.signature() != "493106ee32cdeab9e386fe50aafede73c23c1150af564a4ad71ca1deccc1fa10" ) &&
46         ( appended.signature() != "b98c42c55fc4e661cb3684154256809c03c0c6b53da2738b6ce8066e1b6ddef0" ))
47       {
48 	++failures;
49 	cout << "Line: " << __LINE__
50 	     << "  Horizontal append failed, signature = "
51 	     << appended.signature() << endl;
52 	appended.write("appendImages_horizontal_out.miff");
53 	// appended.display();
54       }
55 
56     // Vertical
57     appendImages( &appended, imageList.begin(), imageList.end(), true );
58     if (( appended.signature() != "a22fbe9ca8e3dc3b34f137d175d51841daf56d231bedd8b18ad55415af558265" ) &&
59         ( appended.signature() != "11b97ba6ac1664aa1c2faed4c86195472ae9cce2ed75402d975bb4ffcf1de751" ) &&
60         ( appended.signature() != "cae4815eeb3cb689e73b94d897a9957d3414d1d4f513e8b5e52579b05d164bfe" ))
61       {
62 	++failures;
63 	cout << "Line: " << __LINE__
64 	     << "  Vertical append failed, signature = "
65 	     << appended.signature() << endl;
66 	appended.write("appendImages_vertical_out.miff");
67 	// appended.display();
68       }
69 
70   }
71 
72   catch( Exception &error_ )
73     {
74       cout << "Caught exception: " << error_.what() << endl;
75       return 1;
76     }
77   catch( exception &error_ )
78     {
79       cout << "Caught exception: " << error_.what() << endl;
80       return 1;
81     }
82 
83   if ( failures )
84     {
85       cout << failures << " failures" << endl;
86       return 1;
87     }
88 
89   return 0;
90 }
91 
92