forked from ImageMagick/ImageMagick
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgeometry.cpp
71 lines (58 loc) · 1.35 KB
/
geometry.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// This may look like C code, but it is really -*- C++ -*-
//
// Copyright Dirk Lemstra 2015
//
// Test Magick::Geometry class
//
#include <Magick++.h>
#include <string>
#include <iostream>
using namespace std;
using namespace Magick;
int main(int, char **argv)
{
// Initialize ImageMagick install location for Windows
InitializeMagick(*argv);
int failures=0;
try
{
//
// Verify conversion from and to string
//
string input="100x50+10-5!";
Geometry geometry(input);
if ((geometry.width() != 100) || (geometry.height() != 50) ||
(geometry.xOff() != 10) || (geometry.yOff() != -5) ||
(geometry.aspect() == false))
{
++failures;
cout << "Line: " << __LINE__
<< " Conversion from " << input << " failed"
<< endl;
}
string output=geometry;
if (output != input)
{
++failures;
cout << "Line: " << __LINE__
<< " Output " << output << " is not the same as " << input
<< endl;
}
}
catch( Exception &error_ )
{
cout << "Caught exception: " << error_.what() << endl;
return 1;
}
catch( exception &error_ )
{
cout << "Caught exception: " << error_.what() << endl;
return 1;
}
if ( failures )
{
cout << failures << " failures" << endl;
return 1;
}
return 0;
}