1 // Tests for System.Drawing.PointF.cs
4 // Ravindra (rkumar@novell.com)
8 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
10 // Permission is hereby granted, free of charge, to any person obtaining
11 // a copy of this software and associated documentation files (the
12 // "Software"), to deal in the Software without restriction, including
13 // without limitation the rights to use, copy, modify, merge, publish,
14 // distribute, sublicense, and/or sell copies of the Software, and to
15 // permit persons to whom the Software is furnished to do so, subject to
16 // the following conditions:
18 // The above copyright notice and this permission notice shall be
19 // included in all copies or substantial portions of the Software.
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 using NUnit
.Framework
;
35 namespace MonoTests
.System
.Drawing
38 public class PointFTest
: Assertion
45 public void TearDown () {}
50 pt11_99
= new PointF (1.1F
, 9.9F
);
51 pt11_0
= new PointF (1.1F
, 0F
);
52 pt0_11
= new PointF (0F
, 1.1F
);
56 public void TestConstructors ()
58 PointF pt
= new PointF (1.5F
, 5.8F
);
59 AssertEquals ("C#1", 1.5F
, pt
.X
);
60 AssertEquals ("C#2", 5.8F
, pt
.Y
);
64 public void TestEmptyField ()
66 PointF pt
= new PointF (0.0F
, 0.0F
);
67 AssertEquals ("EMP#1", pt
, PointF
.Empty
);
71 public void TestProperties ()
73 PointF pt
= new PointF (0.0F
, 0.0F
);
75 Assert ("P#1", pt
.IsEmpty
);
76 Assert ("P#2", ! pt11_99
.IsEmpty
);
77 AssertEquals ("P#3", 1.1F
, pt11_0
.X
);
78 AssertEquals ("P#4", 1.1F
, pt0_11
.Y
);
82 public void TestEquals ()
84 AssertEquals ("EQ#1", pt11_99
, pt11_99
);
85 AssertEquals ("EQ#2", pt11_99
, new PointF (1.1F
, 9.9F
));
86 Assert ("EQ#3", ! pt11_99
.Equals (pt11_0
));
87 Assert ("EQ#4", ! pt11_99
.Equals (pt0_11
));
88 Assert ("EQ#5", ! pt11_0
.Equals (pt0_11
));
93 public void TestAddition ()
95 AssertEquals ("ADD#1", pt11_0
, pt11_0
+ new Size (0, 0));
96 AssertEquals ("ADD#2", pt0_11
, pt0_11
+ new Size (0, 0));
100 public void TestEqualityOp ()
102 Assert ("EOP#1", pt11_99
== pt11_99
);
103 Assert ("EOP#2", pt11_99
== new PointF (1.1F
, 9.9F
));
104 Assert ("EOP#3", ! (pt11_99
== pt11_0
));
105 Assert ("EOP#4", ! (pt11_99
== pt0_11
));
106 Assert ("EOP#5", ! (pt11_0
== pt0_11
));
110 public void TestInequalityOp ()
112 Assert ("IOP#1", ! (pt11_99
!= pt11_99
));
113 Assert ("IOP#2", ! (pt11_99
!= new PointF (1.1F
, 9.9F
)));
114 Assert ("IOP#3", pt11_99
!= pt11_0
);
115 Assert ("IOP#4", pt11_99
!= pt0_11
);
116 Assert ("IOP#5", pt11_0
!= pt0_11
);
120 public void TestSubtraction ()
122 AssertEquals ("SUB#1", pt11_0
, pt11_0
- new Size (0, 0));
123 AssertEquals ("SUB#2", pt0_11
, pt0_11
- new Size (0, 0));