| 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 |
|
| 18 |
int main( int /*argc*/, char ** argv) |
| 19 |
{ |
| 20 |
|
| 21 |
// Initialize ImageMagick install location for Windows |
| 22 |
MagickPlusPlusGenesis genesis(*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 ( |
| 45 |
( appended.signature() != "f5ed4a96632126a30c353340a1ddc4e0745295bb1f4bbbb6e020138c972c2f5e" ) && |
| 46 |
( appended.signature() != "aa8789792be68dde5d686ddcbce4f551cbe8093cf3c782f5313443594abff8c0" ) && |
| 47 |
( appended.signature() != "d2b63ade27f08ba413533c56239fd5dca7ac5cdfcae7a15d48980209dbfc0a40" ) && |
| 48 |
( appended.signature() != "f48dd74b57ed277c9c62da1a65788186a910b8f2faa47851fcf1f4572640ed9c" )) |
| 49 |
{ |
| 50 |
++failures; |
| 51 |
cout << "Line: " << __LINE__ |
| 52 |
<< " Horizontal append failed, signature = " |
| 53 |
<< appended.signature() << endl; |
| 54 |
appended.write("appendImages_horizontal_out.miff"); |
| 55 |
// appended.display(); |
| 56 |
} |
| 57 |
|
| 58 |
// Vertical |
| 59 |
appendImages( &appended, imageList.begin(), imageList.end(), true ); |
| 60 |
if ( |
| 61 |
( appended.signature() != "de891eb85d168bd2177ee92940ab0e29d32c9f8e4be41906f9272a88925d9dd3" ) && |
| 62 |
( appended.signature() != "5e119331c70db1b0bc3fdf51920b85449b4b02f63653250c34b68c1528171bb2" ) && |
| 63 |
( appended.signature() != "bb411d8cc99700f29547e8ca60d925d0d3be3aaf16e70260a3506428e61339de" ) && |
| 64 |
( appended.signature() != "9cfe22dacae97e4e0fe1c12567a5d7e111f4680ec65a40da16281928cf4ba6be" )) |
| 65 |
{ |
| 66 |
++failures; |
| 67 |
cout << "Line: " << __LINE__ |
| 68 |
<< " Vertical append failed, signature = " |
| 69 |
<< appended.signature() << endl; |
| 70 |
appended.write("appendImages_vertical_out.miff"); |
| 71 |
// appended.display(); |
| 72 |
} |
| 73 |
|
| 74 |
} |
| 75 |
|
| 76 |
catch( Exception &error_ ) |
| 77 |
{ |
| 78 |
cout << "Caught exception: " << error_.what() << endl; |
| 79 |
return 1; |
| 80 |
} |
| 81 |
catch( exception &error_ ) |
| 82 |
{ |
| 83 |
cout << "Caught exception: " << error_.what() << endl; |
| 84 |
return 1; |
| 85 |
} |
| 86 |
|
| 87 |
if ( failures ) |
| 88 |
{ |
| 89 |
cout << failures << " failures" << endl; |
| 90 |
return 1; |
| 91 |
} |
| 92 |
|
| 93 |
return 0; |
| 94 |
} |
| 95 |
|