TestMatrix.cs: Added new test cases for contructors accepting rectangles and points.
authorSebastien Pouliot <sebastien@ximian.com>
Mon, 10 Apr 2006 18:42:44 +0000 (18:42 -0000)
committerSebastien Pouliot <sebastien@ximian.com>
Mon, 10 Apr 2006 18:42:44 +0000 (18:42 -0000)
svn path=/trunk/mcs/; revision=59316

mcs/class/System.Drawing/Test/System.Drawing.Drawing2D/ChangeLog
mcs/class/System.Drawing/Test/System.Drawing.Drawing2D/TestMatrix.cs

index c2479adc33270a15f7eabd30f92fe9594acc48cb..f6f6976bcf39a42cbc34666c020475fc73757820 100644 (file)
@@ -1,3 +1,8 @@
+2006-04-10  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * TestMatrix.cs: Added new test cases for contructors accepting
+       rectangles and points.
+
 2006-03-30  Sebastien Pouliot  <sebastien@ximian.com>
 
        * LinearGradientBrushTest.cs: Added a bunch of test cases to check
index 5ecd51b5ccf2a0fde436fb6a180be1c31d47633d..73c9cc48d5eca0c34bedc007214feb00a0ff3912 100644 (file)
@@ -96,6 +96,27 @@ namespace MonoTests.System.Drawing.Drawing2D
                        new Matrix (rect, new Point[0]);
                }
 
+               [Test]
+               [ExpectedException (typeof (ArgumentException))]
+               public void Constructor_Int_4Point ()
+               {
+                       new Matrix (rect, new Point[4]);
+               }
+
+               [Test]
+               public void Constructor_Rect_Point ()
+               {
+                       Rectangle r = new Rectangle (100, 200, 300, 400);
+                       Matrix m = new Matrix (r, new Point[3] { new Point (10, 20), new Point (30, 40), new Point (50, 60) });
+                       float[] elements = m.Elements;
+                       AssertEquals ("0", 0.06666666, elements[0], 0.00001);
+                       AssertEquals ("1", 0.06666666, elements[1], 0.00001);
+                       AssertEquals ("2", 0.09999999, elements[2], 0.00001);
+                       AssertEquals ("3", 0.09999999, elements[3], 0.00001);
+                       AssertEquals ("4", -16.6666679, elements[4], 0.00001);
+                       AssertEquals ("5", -6.666667, elements[5], 0.00001);
+               }
+
                [Test]
                [ExpectedException (typeof (ArgumentNullException))]
                public void Constructor_Float_Null ()
@@ -110,6 +131,27 @@ namespace MonoTests.System.Drawing.Drawing2D
                        new Matrix (rectf, new PointF[0]);
                }
 
+               [Test]
+               [ExpectedException (typeof (ArgumentException))]
+               public void Constructor_Float_2PointF ()
+               {
+                       new Matrix (rectf, new PointF[2]);
+               }
+
+               [Test]
+               public void Constructor_RectF_PointF ()
+               {
+                       RectangleF r = new RectangleF (100, 200, 300, 400);
+                       Matrix m = new Matrix (r, new PointF[3] { new PointF (10, 20), new PointF (30, 40), new PointF (50, 60) });
+                       float[] elements = m.Elements;
+                       AssertEquals ("0", 0.06666666, elements[0], 0.00001);
+                       AssertEquals ("1", 0.06666666, elements[1], 0.00001);
+                       AssertEquals ("2", 0.09999999, elements[2], 0.00001);
+                       AssertEquals ("3", 0.09999999, elements[3], 0.00001);
+                       AssertEquals ("4", -16.6666679, elements[4], 0.00001);
+                       AssertEquals ("5", -6.666667, elements[5], 0.00001);
+               }
+
                // Properties
 
                [Test]