This source file includes following definitions.
- main
#include <Magick++.h>
#include <string>
#include <iostream>
using namespace std;
using namespace Magick;
int main( int , char ** argv)
{
InitializeMagick(*argv);
volatile int failures=0;
cout << "Checking for working exceptions (may crash) ... ";
cout.flush();
{
try
{
failures++;
throw int(100);
}
catch ( int )
{
failures--;
}
try
{
failures++;
cout << "Throwing 'Magick::WarningResourceLimit' exception" << endl;
cout.flush();
throw WarningResourceLimit("How now brown cow?");
}
catch( Exception & )
{
cout << "Successfully caught 'Magick::WarningResourceLimit' exception" << endl;
cout.flush();
failures--;
}
try
{
size_t columns = 640;
size_t rows = 480;
Geometry geometry(columns,rows);
Color canvasColor( "red" );
Image image( geometry, canvasColor);
{
try
{
failures++;
cout << "Throwing library 'Magick::Exception' exception" << endl;
cout.flush();
image.directory();
}
catch ( Exception& )
{
cout << "Successfully caught library 'Magick::Exception' exception" << endl;
cout.flush();
failures--;
}
}
}
catch( Exception &error_ )
{
cout << "Bogus catch: Caught exception: " << error_.what() << endl;
cout.flush();
return 1;
}
catch( exception &error_ )
{
cout << "Bogus catch: Caught exception: " << error_.what() << endl;
cout.flush();
return 1;
}
if ( failures )
{
cout << failures << " failures" << endl;
cout.flush();
return 1;
}
cout << "Exception testing passed!" << endl;
}
return 0;
}