Make System.Drawing unit tests use Assert.Throws instead of [ExpectedException] ...
[mono.git] / mcs / class / System.Drawing / Test / System.Drawing.Drawing2D / GraphicsPathTest.cs
index af73aa103f7bd46f5eac85fb01c7a08fe8f127cf..9674c311abbd4f19156908c4fa3b2d4bc7427100 100644 (file)
@@ -4,7 +4,7 @@
 // Authors:
 //     Sebastien Pouliot  <sebastien@ximian.com>
 //
-// Copyright (C) 2006 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -59,45 +59,39 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Constructor_Point_Null_Byte ()
                {
-                       new GraphicsPath ((Point[]) null, new byte[1]);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ((Point[]) null, new byte[1]));
                }
 
                [Test]
-               [ExpectedException (typeof (NullReferenceException))]
                public void Constructor_Point_Byte_Null ()
                {
-                       new GraphicsPath (new Point[1], null);
+                       Assert.Throws<NullReferenceException> (() => new GraphicsPath (new Point[1], null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Constructor_Point_Byte_LengthMismatch ()
                {
-                       new GraphicsPath (new Point[1], new byte [2]);
+                       Assert.Throws<ArgumentException> (() => new GraphicsPath (new Point[1], new byte [2]));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Constructor_PointF_Null_Byte ()
                {
-                       new GraphicsPath ((PointF[])null, new byte [1]);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ((PointF[])null, new byte [1]));
                }
 
                [Test]
-               [ExpectedException (typeof (NullReferenceException))]
                public void Constructor_PointF_Byte_Null ()
                {
-                       new GraphicsPath ( new PointF[1], null);
+                       Assert.Throws<NullReferenceException> (() => new GraphicsPath ( new PointF[1], null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Constructor_PointF_Byte_LengthMismatch ()
                {
-                       new GraphicsPath (new PointF[2], new byte [1]);
+                       Assert.Throws<ArgumentException> (() => new GraphicsPath (new PointF[2], new byte [1]));
                }
 
                [Test]
@@ -116,28 +110,67 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void GraphicsPath_Empty_PathPoints ()
                {
-                       Assert.IsNull (new GraphicsPath ().PathPoints);
+                       Assert.Throws<ArgumentException> (() => Assert.IsNull (new GraphicsPath ().PathPoints));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void GraphicsPath_Empty_PathTypes ()
                {
-                       Assert.IsNull (new GraphicsPath ().PathTypes);
+                       Assert.Throws<ArgumentException> (() => Assert.IsNull (new GraphicsPath ().PathTypes));
+               }
+
+               [Test]
+               public void GraphicsPath_SamePoint ()
+               {
+                       Point[] points = new Point [] {
+                               new Point (1, 1),
+                               new Point (1, 1),
+                               new Point (1, 1),
+                               new Point (1, 1),
+                               new Point (1, 1),
+                               new Point (1, 1),
+                       };
+                       byte [] types = new byte [6] { 0, 1, 1, 1, 1, 1 };
+                       using (GraphicsPath gp = new GraphicsPath (points, types)) {
+                               Assert.AreEqual (6, gp.PointCount, "0-PointCount");
+                       }
+                       types [0] = 1;
+                       using (GraphicsPath gp = new GraphicsPath (points, types)) {
+                               Assert.AreEqual (6, gp.PointCount, "1-PointCount");
+                       }
+               }
+
+               [Test]
+               public void GraphicsPath_SamePointF ()
+               {
+                       PointF [] points = new PointF [] {
+                               new PointF (1f, 1f),
+                               new PointF (1f, 1f),
+                               new PointF (1f, 1f),
+                               new PointF (1f, 1f),
+                               new PointF (1f, 1f),
+                               new PointF (1f, 1f),
+                       };
+                       byte [] types = new byte [6] { 0, 1, 1, 1, 1, 1 };
+                       using (GraphicsPath gp = new GraphicsPath (points, types)) {
+                               Assert.AreEqual (6, gp.PointCount, "0-PointCount");
+                       }
+                       types [0] = 1;
+                       using (GraphicsPath gp = new GraphicsPath (points, types)) {
+                               Assert.AreEqual (6, gp.PointCount, "1-PointCount");
+                       }
                }
 
                [Test]
-               [ExpectedException (typeof (SC.InvalidEnumArgumentException))]
                public void FillMode_Invalid ()
                {
                        // constructor accept an invalid FillMode
                        GraphicsPath gp = new GraphicsPath ((FillMode) Int32.MaxValue);
                        Assert.AreEqual (Int32.MaxValue, (int) gp.FillMode, "MaxValue");
                        // but you can't set the FillMode property to an invalid value ;-)
-                       gp.FillMode = (FillMode) Int32.MaxValue;
+                       Assert.Throws<SC.InvalidEnumArgumentException> (() => gp.FillMode = (FillMode) Int32.MaxValue);
                }
 
                [Test]
@@ -194,22 +227,22 @@ namespace MonoTests.System.Drawing.Drawing2D {
 
                        // GetBounds (well GdipGetPathWorldBounds) isn't implemented
                        RectangleF rect = path.GetBounds ();
-                       Assert.AreEqual (2.999624f, rect.X, "Bounds.X");
-                       Assert.AreEqual (2.013707f, rect.Y, "Bounds.Y");
+                       Assert.AreEqual (2.99962401f, rect.X, Delta, "Bounds.X");
+                       Assert.AreEqual (2.01370716f, rect.Y, Delta, "Bounds.Y");
                        Assert.AreEqual (0f, rect.Width, Delta, "Bounds.Width");
-                       Assert.AreEqual (0.01370478f, rect.Height, "Bounds.Height");
+                       Assert.AreEqual (0.0137047768f, rect.Height, "Bounds.Height");
 
-                       Assert.AreEqual (2.999906f, path.PathData.Points[0].X, "Points[0].X");
-                       Assert.AreEqual (2.013707f, path.PathPoints[0].Y, "Points[0].Y");
+                       Assert.AreEqual (2.99990582f, path.PathData.Points[0].X, Delta, "Points[0].X");
+                       Assert.AreEqual (2.01370716f, path.PathPoints[0].Y, Delta, "Points[0].Y");
                        Assert.AreEqual (0, path.PathData.Types[0], "Types[0]");
-                       Assert.AreEqual (2.999843f, path.PathData.Points[1].X, "Points[1].X");
-                       Assert.AreEqual (2.018276f, path.PathPoints[1].Y, "Points[1].Y");
+                       Assert.AreEqual (2.99984312f, path.PathData.Points[1].X, Delta, "Points[1].X");
+                       Assert.AreEqual (2.018276f, path.PathPoints[1].Y, Delta, "Points[1].Y");
                        Assert.AreEqual (3, path.PathTypes[1], "Types[1]");
-                       Assert.AreEqual (2.99974918f, path.PathData.Points[2].X, "Points[2].X");
-                       Assert.AreEqual (2.02284455f, path.PathPoints[2].Y, "Points[2].Y");
+                       Assert.AreEqual (2.99974918f, path.PathData.Points[2].X, Delta, "Points[2].X");
+                       Assert.AreEqual (2.02284455f, path.PathPoints[2].Y, Delta, "Points[2].Y");
                        Assert.AreEqual (3, path.PathData.Types[2], "Types[2]");
-                       Assert.AreEqual (2.999624f, path.PathData.Points[3].X, "Points[3].X");
-                       Assert.AreEqual (2.027412f, path.PathPoints[3].Y, "Points[3].Y");
+                       Assert.AreEqual (2.999624f, path.PathData.Points[3].X, Delta, "Points[3].X");
+                       Assert.AreEqual (2.027412f, path.PathPoints[3].Y, Delta, "Points[3].Y");
                        Assert.AreEqual (3, path.PathTypes[3], "Types[3]");
                }
 
@@ -306,18 +339,56 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
+               public void AddBezier_SamePoint ()
+               {
+                       GraphicsPath gp = new GraphicsPath ();
+                       gp.AddBezier (1, 1, 1, 1, 1, 1, 1, 1);
+                       // all points are present
+                       Assert.AreEqual (4, gp.PointCount, "1-PointCount");
+                       Assert.AreEqual (0, gp.PathTypes [0], "1-PathTypes[0]");
+                       Assert.AreEqual (3, gp.PathTypes [1], "1-PathTypes[1]");
+                       Assert.AreEqual (3, gp.PathTypes [2], "1-PathTypes[2]");
+                       Assert.AreEqual (3, gp.PathTypes [3], "1-PathTypes[3]");
+
+                       gp.AddBezier (new Point (1, 1), new Point (1, 1), new Point (1, 1), new Point (1, 1));
+                       // the first point (move to) can be compressed (i.e. removed)
+                       Assert.AreEqual (7, gp.PointCount, "2-PointCount");
+                       Assert.AreEqual (3, gp.PathTypes [4], "2-PathTypes[4]");
+                       Assert.AreEqual (3, gp.PathTypes [5], "2-PathTypes[5]");
+                       Assert.AreEqual (3, gp.PathTypes [6], "2-PathTypes[6]");
+               }
+
+               [Test]
+               public void AddBezier_SamePointF ()
+               {
+                       GraphicsPath gp = new GraphicsPath ();
+                       gp.AddBezier (new PointF (1f, 1f), new PointF (1f, 1f), new PointF (1f, 1f), new PointF (1f, 1f));
+                       // all points are present
+                       Assert.AreEqual (4, gp.PointCount, "1-PointCount");
+                       Assert.AreEqual (0, gp.PathTypes [0], "1-PathTypes[0]");
+                       Assert.AreEqual (3, gp.PathTypes [1], "1-PathTypes[1]");
+                       Assert.AreEqual (3, gp.PathTypes [2], "1-PathTypes[2]");
+                       Assert.AreEqual (3, gp.PathTypes [3], "1-PathTypes[3]");
+
+                       gp.AddBezier (new PointF (1f, 1f), new PointF (1f, 1f), new PointF (1f, 1f), new PointF (1f, 1f));
+                       // the first point (move to) can be compressed (i.e. removed)
+                       Assert.AreEqual (7, gp.PointCount, "2-PointCount");
+                       Assert.AreEqual (3, gp.PathTypes [4], "2-PathTypes[4]");
+                       Assert.AreEqual (3, gp.PathTypes [5], "2-PathTypes[5]");
+                       Assert.AreEqual (3, gp.PathTypes [6], "2-PathTypes[6]");
+               }
+
+               [Test]
                public void AddBeziers_Point_Null ()
                {
-                       new GraphicsPath ().AddBeziers ((Point[]) null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().AddBeziers ((Point[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddBeziers_3_Points ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddBeziers (new Point[3] { new Point (1, 1), new Point (2, 2), new Point (3, 3) });
+                       Assert.Throws<ArgumentException> (() => gp.AddBeziers (new Point[3] { new Point (1, 1), new Point (2, 2), new Point (3, 3) }));
                }
 
                [Test]
@@ -329,18 +400,16 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void AddBeziers_PointF_Null ()
                {
-                       new GraphicsPath ().AddBeziers ((PointF[]) null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().AddBeziers ((PointF[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddBeziers_3_PointFs ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddBeziers (new PointF[3] { new PointF (1f, 1f), new PointF (2f, 2f), new PointF (3f, 3f) });
+                       Assert.Throws<ArgumentException> (() => gp.AddBeziers (new PointF[3] { new PointF (1f, 1f), new PointF (2f, 2f), new PointF (3f, 3f) }));
                }
 
                [Test]
@@ -351,6 +420,48 @@ namespace MonoTests.System.Drawing.Drawing2D {
                        CheckBezier (gp);
                }
 
+               [Test]
+               public void AddBeziers_SamePoint ()
+               {
+                       Point [] points = new Point [4] { new Point (1, 1), new Point (1, 1), new Point (1, 1), new Point (1, 1) };
+                       GraphicsPath gp = new GraphicsPath ();
+                       gp.AddBeziers (points);
+                       // all points are present
+                       Assert.AreEqual (4, gp.PointCount, "1-PointCount");
+                       Assert.AreEqual (0, gp.PathTypes [0], "1-PathTypes[0]");
+                       Assert.AreEqual (3, gp.PathTypes [1], "1-PathTypes[1]");
+                       Assert.AreEqual (3, gp.PathTypes [2], "1-PathTypes[2]");
+                       Assert.AreEqual (3, gp.PathTypes [3], "1-PathTypes[3]");
+
+                       gp.AddBeziers (points);
+                       // the first point (move to) can be compressed (i.e. removed)
+                       Assert.AreEqual (7, gp.PointCount, "2-PointCount");
+                       Assert.AreEqual (3, gp.PathTypes [4], "2-PathTypes[4]");
+                       Assert.AreEqual (3, gp.PathTypes [5], "2-PathTypes[5]");
+                       Assert.AreEqual (3, gp.PathTypes [6], "2-PathTypes[6]");
+               }
+
+               [Test]
+               public void AddBeziers_SamePointF ()
+               {
+                       PointF[] points = new PointF [4] { new PointF (1f, 1f), new PointF (1f, 1f), new PointF (1f, 1f), new PointF (1f, 1f) };
+                       GraphicsPath gp = new GraphicsPath ();
+                       gp.AddBeziers (points);
+                       // all points are present
+                       Assert.AreEqual (4, gp.PointCount, "1-PointCount");
+                       Assert.AreEqual (0, gp.PathTypes [0], "1-PathTypes[0]");
+                       Assert.AreEqual (3, gp.PathTypes [1], "1-PathTypes[1]");
+                       Assert.AreEqual (3, gp.PathTypes [2], "1-PathTypes[2]");
+                       Assert.AreEqual (3, gp.PathTypes [3], "1-PathTypes[3]");
+
+                       gp.AddBeziers (points);
+                       // the first point (move to) can be compressed (i.e. removed)
+                       Assert.AreEqual (7, gp.PointCount, "2-PointCount");
+                       Assert.AreEqual (3, gp.PathTypes [4], "2-PathTypes[4]");
+                       Assert.AreEqual (3, gp.PathTypes [5], "2-PathTypes[5]");
+                       Assert.AreEqual (3, gp.PathTypes [6], "2-PathTypes[6]");
+               }
+
                private void CheckEllipse (GraphicsPath path)
                {
                        Assert.AreEqual (13, path.PathPoints.Length, "PathPoints");
@@ -460,25 +571,73 @@ namespace MonoTests.System.Drawing.Drawing2D {
                {
                        GraphicsPath gp = new GraphicsPath ();
                        gp.AddLine (new Point (1, 1), new Point (1, 1));
+                       Assert.AreEqual (2, gp.PointCount, "1-PointCount");
+                       Assert.AreEqual (0, gp.PathTypes[0], "1-PathTypes[0]");
+                       Assert.AreEqual (1, gp.PathTypes[1], "1-PathTypes[1]");
+
+                       gp.AddLine (new Point (1, 1), new Point (1, 1));
+                       // 3 not 4 points, the first point (only) is compressed
+                       Assert.AreEqual (3, gp.PointCount, "2-PointCount");
+                       Assert.AreEqual (0, gp.PathTypes [0], "2-PathTypes[0]");
+                       Assert.AreEqual (1, gp.PathTypes [1], "2-PathTypes[1]");
+                       Assert.AreEqual (1, gp.PathTypes [2], "2-PathTypes[2]");
+
+                       gp.AddLine (new Point (1, 1), new Point (1, 1));
+                       // 4 not 5 (or 6) points, the first point (only) is compressed
+                       Assert.AreEqual (4, gp.PointCount, "3-PointCount");
+                       Assert.AreEqual (0, gp.PathTypes [0], "3-PathTypes[0]");
+                       Assert.AreEqual (1, gp.PathTypes [1], "3-PathTypes[1]");
+                       Assert.AreEqual (1, gp.PathTypes [2], "3-PathTypes[2]");
+                       Assert.AreEqual (1, gp.PathTypes [3], "3-PathTypes[3]");
+               }
+
+               [Test]
+               public void AddLine_SamePointF ()
+               {
+                       GraphicsPath gp = new GraphicsPath ();
+                       gp.AddLine (new PointF (49.2f, 157f), new PointF (49.2f, 157f));
                        Assert.AreEqual (2, gp.PointCount, "PointCount");
-                       Assert.AreEqual (0, gp.PathTypes[0], "PathTypes[0]");
-                       Assert.AreEqual (1, gp.PathTypes[1], "PathTypes[1]");
+                       Assert.AreEqual (0, gp.PathTypes [0], "PathTypes[0]");
+                       Assert.AreEqual (1, gp.PathTypes [1], "PathTypes[1]");
+
+                       gp.AddLine (new PointF (49.2f, 157f), new PointF (49.2f, 157f));
+                       // 3 not 4 points, the first point (only) is compressed
+                       Assert.AreEqual (3, gp.PointCount, "2-PointCount");
+                       Assert.AreEqual (0, gp.PathTypes [0], "2-PathTypes[0]");
+                       Assert.AreEqual (1, gp.PathTypes [1], "2-PathTypes[1]");
+                       Assert.AreEqual (1, gp.PathTypes [2], "2-PathTypes[2]");
+               }
+
+               [Test]
+               public void AddLine_SamePointsF ()
+               {
+                       GraphicsPath gp = new GraphicsPath ();
+                       gp.AddLine (new PointF (49.2f, 157f), new PointF (75.6f, 196f));
+                       gp.AddLine (new PointF (75.6f, 196f), new PointF (102f, 209f));
+                       Assert.AreEqual (3, gp.PointCount, "1-PointCount");
+                       Assert.AreEqual (0, gp.PathTypes [0], "1-PathTypes[0]");
+                       Assert.AreEqual (1, gp.PathTypes [1], "1-PathTypes[1]");
+                       Assert.AreEqual (1, gp.PathTypes [2], "1-PathTypes[2]");
+
+                       gp.AddLine (new PointF (102f, 209f), new PointF (75.6f, 196f));
+                       Assert.AreEqual (4, gp.PointCount, "2-PointCount");
+                       Assert.AreEqual (0, gp.PathTypes [0], "2-PathTypes[0]");
+                       Assert.AreEqual (1, gp.PathTypes [1], "2-PathTypes[1]");
+                       Assert.AreEqual (1, gp.PathTypes [2], "2-PathTypes[2]");
+                       Assert.AreEqual (1, gp.PathTypes [3], "2-PathTypes[3]");
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void AddLines_Point_Null ()
                {
-                       new GraphicsPath ().AddLines ((Point[])null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().AddLines ((Point[])null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddLines_Point_0 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddLines (new Point[0]);
-                       CheckLine (gp);
+                       Assert.Throws<ArgumentException> (() => gp.AddLines (new Point[0]));
                }
 
                [Test]
@@ -500,19 +659,16 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void AddLines_PointF_Null ()
                {
-                       new GraphicsPath ().AddLines ((PointF[]) null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().AddLines ((PointF[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddLines_PointF_0 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddLines (new PointF[0]);
-                       CheckLine (gp);
+                       Assert.Throws<ArgumentException> (() => gp.AddLines (new PointF[0]));
                }
 
                [Test]
@@ -533,6 +689,57 @@ namespace MonoTests.System.Drawing.Drawing2D {
                        CheckLine (gp);
                }
 
+               [Test]
+               public void AddLines_SamePoint ()
+               {
+                       Point [] points = new Point [] { new Point (1, 1), new Point (1, 1) };
+                       GraphicsPath gp = new GraphicsPath ();
+                       gp.AddLines (points);
+                       Assert.AreEqual (2, gp.PointCount, "1-PointCount");
+                       Assert.AreEqual (0, gp.PathTypes [0], "1-PathTypes[0]");
+                       Assert.AreEqual (1, gp.PathTypes [1], "1-PathTypes[1]");
+
+                       gp.AddLines (points);
+                       // 3 not 4 points, the first point (only) is compressed
+                       Assert.AreEqual (3, gp.PointCount, "2-PointCount");
+                       Assert.AreEqual (0, gp.PathTypes [0], "2-PathTypes[0]");
+                       Assert.AreEqual (1, gp.PathTypes [1], "2-PathTypes[1]");
+                       Assert.AreEqual (1, gp.PathTypes [2], "2-PathTypes[2]");
+
+                       gp.AddLines (points);
+                       // 4 not 5 (or 6) points, the first point (only) is compressed
+                       Assert.AreEqual (4, gp.PointCount, "3-PointCount");
+                       Assert.AreEqual (0, gp.PathTypes [0], "3-PathTypes[0]");
+                       Assert.AreEqual (1, gp.PathTypes [1], "3-PathTypes[1]");
+                       Assert.AreEqual (1, gp.PathTypes [2], "3-PathTypes[2]");
+                       Assert.AreEqual (1, gp.PathTypes [3], "3-PathTypes[3]");
+               }
+
+               [Test]
+               public void AddLines_SamePointF ()
+               {
+                       PointF [] points = new PointF [] { new PointF (49.2f, 157f), new PointF (49.2f, 157f), new PointF (49.2f, 157f), new PointF (49.2f, 157f) };
+                       GraphicsPath gp = new GraphicsPath ();
+                       gp.AddLines (points);
+                       // all identical points are added
+                       Assert.AreEqual (4, gp.PointCount, "PointCount");
+                       Assert.AreEqual (0, gp.PathTypes [0], "PathTypes[0]");
+                       Assert.AreEqual (1, gp.PathTypes [1], "PathTypes[1]");
+                       Assert.AreEqual (1, gp.PathTypes [2], "PathTypes[2]");
+                       Assert.AreEqual (1, gp.PathTypes [3], "PathTypes[3]");
+
+                       gp.AddLines (points);
+                       // only the first new point is compressed
+                       Assert.AreEqual (7, gp.PointCount, "2-PointCount");
+                       Assert.AreEqual (0, gp.PathTypes [0], "2-PathTypes[0]");
+                       Assert.AreEqual (1, gp.PathTypes [1], "2-PathTypes[1]");
+                       Assert.AreEqual (1, gp.PathTypes [2], "2-PathTypes[2]");
+                       Assert.AreEqual (1, gp.PathTypes [3], "2-PathTypes[3]");
+                       Assert.AreEqual (1, gp.PathTypes [4], "2-PathTypes[4]");
+                       Assert.AreEqual (1, gp.PathTypes [5], "2-PathTypes[5]");
+                       Assert.AreEqual (1, gp.PathTypes [6], "2-PathTypes[6]");
+               }
+
                private void CheckPie (GraphicsPath path)
                {
                        // the number of points generated for a Pie isn't the same between Mono and MS
@@ -620,33 +827,29 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void AddPolygon_Point_Null ()
                {
-                       new GraphicsPath ().AddPolygon ((Point[]) null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().AddPolygon ((Point[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddPolygon_Point_Empty ()
                {
-                       new GraphicsPath ().AddPolygon (new Point[0]);
+                       Assert.Throws<ArgumentException> (() => new GraphicsPath ().AddPolygon (new Point[0]));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddPolygon_Point_1 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddPolygon (new Point[1] { new Point (1, 1) });
+                       Assert.Throws<ArgumentException> (() => gp.AddPolygon (new Point[1] { new Point (1, 1) }));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddPolygon_Point_2 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddPolygon (new Point[2] { new Point (1, 1), new Point (2, 2) });
+                       Assert.Throws<ArgumentException> (() => gp.AddPolygon (new Point[2] { new Point (1, 1), new Point (2, 2) }));
                }
 
                [Test]
@@ -658,33 +861,29 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void AddPolygon_PointF_Null ()
                {
-                       new GraphicsPath ().AddPolygon ((PointF[]) null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().AddPolygon ((PointF[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddPolygon_PointF_Empty ()
                {
-                       new GraphicsPath ().AddPolygon (new PointF[0]);
+                       Assert.Throws<ArgumentException> (() => new GraphicsPath ().AddPolygon (new PointF[0]));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddPolygon_PointF_1 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddPolygon (new PointF[1] { new PointF (1f, 1f) });
+                       Assert.Throws<ArgumentException> (() => gp.AddPolygon (new PointF[1] { new PointF (1f, 1f) }));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddPolygon_PointF_2 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddPolygon (new PointF[2] { new PointF (1f, 1f), new PointF (2f, 2f) });
+                       Assert.Throws<ArgumentException> (() => gp.AddPolygon (new PointF[2] { new PointF (1f, 1f), new PointF (2f, 2f) }));
                }
 
                [Test]
@@ -695,6 +894,74 @@ namespace MonoTests.System.Drawing.Drawing2D {
                        CheckPolygon (gp);
                }
 
+               [Test]
+               public void AddPolygon_SamePoint ()
+               {
+                       Point [] points = new Point [3] { new Point (1, 1), new Point (1, 1), new Point (1, 1) };
+                       GraphicsPath gp = new GraphicsPath ();
+                       gp.AddPolygon (points);
+                       // all identical points are added
+                       Assert.AreEqual (3, gp.PointCount, "PointCount");
+                       Assert.AreEqual (0, gp.PathTypes [0], "PathTypes[0]");
+                       Assert.AreEqual (1, gp.PathTypes [1], "PathTypes[1]");
+                       Assert.AreEqual (129, gp.PathTypes [2], "PathTypes[2]");
+
+                       gp.AddPolygon (points);
+                       // all identical points are added (again)
+                       Assert.AreEqual (6, gp.PointCount, "2-PointCount");
+                       Assert.AreEqual (0, gp.PathTypes [3], "2-PathTypes[3]");
+                       Assert.AreEqual (1, gp.PathTypes [4], "2-PathTypes[4]");
+                       Assert.AreEqual (129, gp.PathTypes [5], "2-PathTypes[5]");
+
+                       gp.AddLines (points);
+                       // all identical points are added as a line (because previous point is closed)
+                       Assert.AreEqual (9, gp.PointCount, "3-PointCount");
+                       Assert.AreEqual (0, gp.PathTypes [6], "3-PathTypes[6]");
+                       Assert.AreEqual (1, gp.PathTypes [7], "3-PathTypes[7]");
+                       Assert.AreEqual (1, gp.PathTypes [8], "3-PathTypes[8]");
+
+                       gp.AddPolygon (points);
+                       // all identical points are added (again)
+                       Assert.AreEqual (12, gp.PointCount, "4-PointCount");
+                       Assert.AreEqual (0, gp.PathTypes [9], "4-PathTypes[9]");
+                       Assert.AreEqual (1, gp.PathTypes [10], "4-PathTypes[10]");
+                       Assert.AreEqual (129, gp.PathTypes [11], "4-PathTypes[11]");
+               }
+
+               [Test]
+               public void AddPolygon_SamePointF ()
+               {
+                       PointF [] points = new PointF [3] { new PointF (1f, 1f), new PointF (1f, 1f), new PointF (1f, 1f) };
+                       GraphicsPath gp = new GraphicsPath ();
+                       gp.AddPolygon (points);
+                       // all identical points are added
+                       Assert.AreEqual (3, gp.PointCount, "PointCount");
+                       Assert.AreEqual (0, gp.PathTypes [0], "PathTypes[0]");
+                       Assert.AreEqual (1, gp.PathTypes [1], "PathTypes[1]");
+                       Assert.AreEqual (129, gp.PathTypes [2], "PathTypes[2]");
+
+                       gp.AddPolygon (points);
+                       // all identical points are added (again)
+                       Assert.AreEqual (6, gp.PointCount, "2-PointCount");
+                       Assert.AreEqual (0, gp.PathTypes [3], "2-PathTypes[3]");
+                       Assert.AreEqual (1, gp.PathTypes [4], "2-PathTypes[4]");
+                       Assert.AreEqual (129, gp.PathTypes [5], "2-PathTypes[5]");
+
+                       gp.AddLines (points);
+                       // all identical points are added as a line (because previous point is closed)
+                       Assert.AreEqual (9, gp.PointCount, "3-PointCount");
+                       Assert.AreEqual (0, gp.PathTypes [6], "3-PathTypes[6]");
+                       Assert.AreEqual (1, gp.PathTypes [7], "3-PathTypes[7]");
+                       Assert.AreEqual (1, gp.PathTypes [8], "3-PathTypes[8]");
+
+                       gp.AddPolygon (points);
+                       // all identical points are added (again)
+                       Assert.AreEqual (12, gp.PointCount, "4-PointCount");
+                       Assert.AreEqual (0, gp.PathTypes [9], "4-PathTypes[9]");
+                       Assert.AreEqual (1, gp.PathTypes [10], "4-PathTypes[10]");
+                       Assert.AreEqual (129, gp.PathTypes [11], "4-PathTypes[11]");
+               }
+
                private void CheckRectangle (GraphicsPath path, int count)
                {
                        Assert.AreEqual (count, path.PathPoints.Length, "PathPoints");
@@ -740,20 +1007,67 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
+               public void AddRectangle_SamePoint ()
+               {
+                       GraphicsPath gp = new GraphicsPath ();
+                       gp.AddRectangle (new Rectangle (1, 1, 0, 0));
+                       Assert.AreEqual (0, gp.PointCount, "0-PointCount");
+
+                       gp.AddRectangle (new Rectangle (1, 1, 1, 1));
+                       Assert.AreEqual (4, gp.PointCount, "1-PointCount");
+                       Assert.AreEqual (0, gp.PathTypes [0], "1-PathTypes[0]");
+                       Assert.AreEqual (1, gp.PathTypes [1], "1-PathTypes[1]");
+                       Assert.AreEqual (1, gp.PathTypes [2], "1-PathTypes[2]");
+                       Assert.AreEqual (129, gp.PathTypes [3], "1-PathTypes[3]");
+                       PointF end = gp.PathPoints [3];
+
+                       // add rectangle at the last path point
+                       gp.AddRectangle (new Rectangle ((int)end.X, (int)end.Y, 1, 1));
+                       // no compression (different type)
+                       Assert.AreEqual (8, gp.PointCount, "2-PointCount");
+                       Assert.AreEqual (0, gp.PathTypes [0], "2-PathTypes[0]");
+                       Assert.AreEqual (1, gp.PathTypes [1], "2-PathTypes[1]");
+                       Assert.AreEqual (1, gp.PathTypes [2], "2-PathTypes[2]");
+                       Assert.AreEqual (129, gp.PathTypes [3], "2-PathTypes[3]");
+               }
+
+               [Test]
+               public void AddRectangle_SamePointF ()
+               {
+                       GraphicsPath gp = new GraphicsPath ();
+                       gp.AddRectangle (new RectangleF (1f, 1f, 0f, 0f));
+                       Assert.AreEqual (0, gp.PointCount, "0-PointCount");
+
+                       gp.AddRectangle (new RectangleF (1f, 1f, 1f, 1f));
+                       Assert.AreEqual (4, gp.PointCount, "1-PointCount");
+                       Assert.AreEqual (0, gp.PathTypes [0], "1-PathTypes[0]");
+                       Assert.AreEqual (1, gp.PathTypes [1], "1-PathTypes[1]");
+                       Assert.AreEqual (1, gp.PathTypes [2], "1-PathTypes[2]");
+                       Assert.AreEqual (129, gp.PathTypes [3], "1-PathTypes[3]");
+                       PointF end = gp.PathPoints [3];
+
+                       // add rectangle at the last path point
+                       gp.AddRectangle (new RectangleF (end.X, end.Y, 1f, 1f));
+                       // no compression (different type)
+                       Assert.AreEqual (8, gp.PointCount, "2-PointCount");
+                       Assert.AreEqual (0, gp.PathTypes [0], "2-PathTypes[0]");
+                       Assert.AreEqual (1, gp.PathTypes [1], "2-PathTypes[1]");
+                       Assert.AreEqual (1, gp.PathTypes [2], "2-PathTypes[2]");
+                       Assert.AreEqual (129, gp.PathTypes [3], "2-PathTypes[3]");
+               }
+
+               [Test]
                public void AddRectangles_Int_Null ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddRectangles ((Rectangle[]) null);
+                       Assert.Throws<ArgumentNullException> (() => gp.AddRectangles ((Rectangle[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddRectangles_Int_Empty ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddRectangles (new Rectangle[0]);
-                       CheckRectangle (gp, 4);
+                       Assert.Throws<ArgumentException> (() => gp.AddRectangles (new Rectangle[0]));
                }
 
                [Test]
@@ -765,20 +1079,17 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void AddRectangles_Float_Null ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddRectangles ((RectangleF[]) null);
+                       Assert.Throws<ArgumentNullException> (() => gp.AddRectangles ((RectangleF[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddRectangles_Float_Empty ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddRectangles ( new RectangleF[0]);
-                       CheckRectangle (gp, 4);
+                       Assert.Throws<ArgumentException> (() => gp.AddRectangles ( new RectangleF[0]));
                }
 
                [Test]
@@ -806,10 +1117,22 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
+               public void AddRectangles_SamePoint ()
+               {
+                       Rectangle r1 = new Rectangle (1, 1, 0, 0);
+                       Rectangle r2 = new Rectangle (1, 1, 1, 1);
+                       Rectangle r3 = new Rectangle (1, 2, 1, 1);
+
+                       GraphicsPath gp = new GraphicsPath ();
+                       gp.AddRectangles (new Rectangle[] { r1, r2, r3 });
+                       Assert.AreEqual (8, gp.PointCount, "1-PointCount");
+                       // first rect is ignore, then all other 2x4 (8) points are present, no compression
+               }
+
+               [Test]
                public void AddPath_Null ()
                {
-                       new GraphicsPath ().AddPath (null, false);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().AddPath (null, false));
                }
 
                [Test]
@@ -842,34 +1165,30 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void AddClosedCurve_Point_Null ()
                {
-                       new GraphicsPath ().AddClosedCurve ((Point[])null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().AddClosedCurve ((Point[])null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddClosedCurve_Point_0 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddClosedCurve (new Point [0]);
+                       Assert.Throws<ArgumentException> (() => gp.AddClosedCurve (new Point [0]));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddClosedCurve_Point_1 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddClosedCurve (new Point[1] { new Point (1, 1) });
+                       Assert.Throws<ArgumentException> (() => gp.AddClosedCurve (new Point[1] { new Point (1, 1) }));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddClosedCurve_Point_2 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddClosedCurve (new Point[2] { new Point (1, 1), new Point (2, 2) });
+                       Assert.Throws<ArgumentException> (() => gp.AddClosedCurve (new Point[2] { new Point (1, 1), new Point (2, 2) }));
                }
 
                [Test]
@@ -881,34 +1200,30 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void AddClosedCurve_PointF_Null ()
                {
-                       new GraphicsPath ().AddClosedCurve ((PointF[]) null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().AddClosedCurve ((PointF[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddClosedCurve_PointF_0 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddClosedCurve (new PointF[0]);
+                       Assert.Throws<ArgumentException> (() => gp.AddClosedCurve (new PointF[0]));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddClosedCurve_PointF_1 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddClosedCurve (new PointF[1] { new PointF (1f, 1f) });
+                       Assert.Throws<ArgumentException> (() => gp.AddClosedCurve (new PointF[1] { new PointF (1f, 1f) }));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddClosedCurve_PointF_2 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddClosedCurve (new PointF[2] { new PointF (1f, 1f), new PointF (2f, 2f) });
+                       Assert.Throws<ArgumentException> (() => gp.AddClosedCurve (new PointF[2] { new PointF (1f, 1f), new PointF (2f, 2f) }));
                }
 
                [Test]
@@ -919,6 +1234,28 @@ namespace MonoTests.System.Drawing.Drawing2D {
                        CheckClosedCurve (gp);
                }
 
+               [Test]
+               public void AddClosedCurve_SamePoint ()
+               {
+                       Point [] points = new Point [3] { new Point (1, 1), new Point (1, 1), new Point (1, 1) };
+                       GraphicsPath gp = new GraphicsPath ();
+                       gp.AddClosedCurve (points);
+                       Assert.AreEqual (10, gp.PointCount, "1-PointCount");
+                       gp.AddClosedCurve (points);
+                       Assert.AreEqual (20, gp.PointCount, "2-PointCount");
+               }
+
+               [Test]
+               public void AddClosedCurve_SamePointF ()
+               {
+                       PointF [] points = new PointF [3] { new PointF (1f, 1f), new PointF (1f, 1f), new PointF (1f, 1f) };
+                       GraphicsPath gp = new GraphicsPath ();
+                       gp.AddClosedCurve (points);
+                       Assert.AreEqual (10, gp.PointCount, "1-PointCount");
+                       gp.AddClosedCurve (points);
+                       Assert.AreEqual (20, gp.PointCount, "2-PointCount");
+               }
+
                private void CheckCurve (GraphicsPath path)
                {
                        Assert.AreEqual (4, path.PathPoints.Length, "PathPoints");
@@ -953,26 +1290,23 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void AddCurve_Point_Null ()
                {
-                       new GraphicsPath ().AddCurve ((Point[]) null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().AddCurve ((Point[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddCurve_Point_0 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddCurve (new Point[0]);
+                       Assert.Throws<ArgumentException> (() => gp.AddCurve (new Point[0]));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddCurve_Point_1 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddCurve (new Point[1] { new Point (1, 1) });
+                       Assert.Throws<ArgumentException> (() => gp.AddCurve (new Point[1] { new Point (1, 1) }));
                }
 
                [Test]
@@ -996,35 +1330,31 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddCurve3_Point_2 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddCurve (new Point[2] { new Point (1, 1), new Point (2, 2) }, 0, 2, 0.5f);
+                       Assert.Throws<ArgumentException> (() => gp.AddCurve (new Point[2] { new Point (1, 1), new Point (2, 2) }, 0, 2, 0.5f));
                        // adding only two points isn't supported by GdipAddCurve3I
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void AddCurve_PointF_Null ()
                {
-                       new GraphicsPath ().AddCurve ((PointF[]) null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().AddCurve ((PointF[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddCurve_PointF_0 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddCurve (new PointF[0]);
+                       Assert.Throws<ArgumentException> (() => gp.AddCurve (new PointF[0]));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddCurve_PointF_1 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddCurve (new PointF[1] { new PointF (1f, 1f) });
+                       Assert.Throws<ArgumentException> (() => gp.AddCurve (new PointF[1] { new PointF (1f, 1f) }));
                }
 
                [Test]
@@ -1048,11 +1378,10 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddCurve3_PointF_2 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddCurve (new PointF[2] { new PointF (1f, 1f), new PointF (2f, 2f) }, 0, 2, 0.5f);
+                       Assert.Throws<ArgumentException> (() => gp.AddCurve (new PointF[2] { new PointF (1f, 1f), new PointF (2f, 2f) }, 0, 2, 0.5f));
                        // adding only two points isn't supported by GdipAddCurve3
                }
 
@@ -1066,27 +1395,24 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddCurve_ZeroSegments ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddCurve (new PointF[2] { new PointF (1f, 1f), new PointF (2f, 2f) }, 0, 0, 0.5f);
+                       Assert.Throws<ArgumentException> (() => gp.AddCurve (new PointF[2] { new PointF (1f, 1f), new PointF (2f, 2f) }, 0, 0, 0.5f));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddCurve_NegativeSegments ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddCurve (new PointF[2] { new PointF (1f, 1f), new PointF (2f, 2f) }, 0, -1, 0.5f);
+                       Assert.Throws<ArgumentException> (() => gp.AddCurve (new PointF[2] { new PointF (1f, 1f), new PointF (2f, 2f) }, 0, -1, 0.5f));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddCurve_OffsetTooLarge ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddCurve (new PointF[3] { new PointF (1f, 1f), new PointF (0f, 20f), new PointF (20f, 0f) }, 1, 2, 0.5f);
+                       Assert.Throws<ArgumentException> (() => gp.AddCurve (new PointF[3] { new PointF (1f, 1f), new PointF (0f, 20f), new PointF (20f, 0f) }, 1, 2, 0.5f));
                }
 
                [Test]
@@ -1098,6 +1424,89 @@ namespace MonoTests.System.Drawing.Drawing2D {
                        gp.Dispose ();
                }
 
+               [Test]
+               public void AddCurve_SamePoint ()
+               {
+                       Point [] points = new Point [2] { new Point (1, 1), new Point (1, 1) };
+                       GraphicsPath gp = new GraphicsPath ();
+                       gp.AddCurve (points);
+                       Assert.AreEqual (4, gp.PointCount, "1-PointCount");
+                       gp.AddCurve (points);
+                       Assert.AreEqual (7, gp.PointCount, "2-PointCount");
+               }
+
+               [Test]
+               public void AddCurve_SamePointF ()
+               {
+                       PointF [] points = new PointF [2] { new PointF (1f, 1f), new PointF (1f, 1f) };
+                       GraphicsPath gp = new GraphicsPath ();
+                       gp.AddCurve (points);
+                       Assert.AreEqual (4, gp.PointCount, "1-PointCount");
+                       gp.AddCurve (points);
+                       Assert.AreEqual (7, gp.PointCount, "2-PointCount");
+               }
+
+               [Test]
+               public void AddCurve ()
+               {
+                       PointF [] points = new PointF [] {
+                               new PointF (37f, 185f),
+                               new PointF (99f, 185f),
+                               new PointF (161f, 159f),
+                               new PointF (223f, 185f),
+                               new PointF (285f, 54f),
+                       };
+                       int[] count = { 4, 7, 10, 13 };
+
+                       using (GraphicsPath gp = new GraphicsPath ()) {
+                               for (int i = 0; i < points.Length - 1; i++) {
+                                       gp.AddCurve (points, i, 1, 0.5f);
+                                       // all non-curves points are compressed expect the first one (positioning)
+                                       Assert.AreEqual (count [i], gp.PointCount, i.ToString ());
+                               }
+
+                               Assert.AreEqual (0, gp.PathData.Types [0], "Types[0]");
+                               Assert.AreEqual (37f, gp.PathData.Points [0].X, 0.001, "Points[0].X");
+                               Assert.AreEqual (185f, gp.PathData.Points [1].Y, 0.001, "Points[0].Y");
+                               Assert.AreEqual (3, gp.PathData.Types [1], "Types[1]");
+                               Assert.AreEqual (47.3334f, gp.PathData.Points [1].X, 0.001, "Points[1].X");
+                               Assert.AreEqual (185f, gp.PathData.Points [1].Y, 0.001, "Points[1].Y");
+                               Assert.AreEqual (3, gp.PathData.Types [2], "Types[2]");
+                               Assert.AreEqual (78.33333f, gp.PathData.Points [2].X, 0.001, "Points[2].X");
+                               Assert.AreEqual (189.3333f, gp.PathData.Points [2].Y, 0.001, "Points[2].Y");
+                               Assert.AreEqual (3, gp.PathData.Types [3], "Types[3]");
+                               Assert.AreEqual (99f, gp.PathData.Points [3].X, 0.001, "Points[3].X");
+                               Assert.AreEqual (185f, gp.PathData.Points [3].Y, 0.001, "Points[3].Y");
+                               Assert.AreEqual (3, gp.PathData.Types [4], "Types[4]");
+                               Assert.AreEqual (119.6667f, gp.PathData.Points [4].X, 0.001, "Points[4].X");
+                               Assert.AreEqual (180.6667f, gp.PathData.Points [4].Y, 0.001, "Points[4].Y");
+                               Assert.AreEqual (3, gp.PathData.Types [5], "Types[5]");
+                               Assert.AreEqual (140.3333f, gp.PathData.Points [5].X, 0.001, "Points[5].X");
+                               Assert.AreEqual (159f, gp.PathData.Points [5].Y, 0.001, "Points[5].Y");
+                               Assert.AreEqual (3, gp.PathData.Types [6], "Types[6]");
+                               Assert.AreEqual (161f, gp.PathData.Points [6].X, 0.001, "Points[6].X");
+                               Assert.AreEqual (159f, gp.PathData.Points [6].Y, 0.001, "Points[6].Y");
+                               Assert.AreEqual (3, gp.PathData.Types [7], "Types[7]");
+                               Assert.AreEqual (181.6667f, gp.PathData.Points [7].X, 0.001, "Points[7].X");
+                               Assert.AreEqual (159f, gp.PathData.Points [7].Y, 0.001, "Points[7].Y");
+                               Assert.AreEqual (3, gp.PathData.Types [8], "Types[8]");
+                               Assert.AreEqual (202.3333f, gp.PathData.Points [8].X, 0.001, "Points[8].X");
+                               Assert.AreEqual (202.5f, gp.PathData.Points [8].Y, 0.001, "Points[8].Y");
+                               Assert.AreEqual (3, gp.PathData.Types [9], "Types[9]");
+                               Assert.AreEqual (223f, gp.PathData.Points [9].X, 0.001, "Points[9].X");
+                               Assert.AreEqual (185f, gp.PathData.Points [9].Y, 0.001, "Points[9].Y");
+                               Assert.AreEqual (3, gp.PathData.Types [10], "Types[10]");
+                               Assert.AreEqual (243.6667f, gp.PathData.Points [10].X, 0.001, "Points[10].X");
+                               Assert.AreEqual (167.5f, gp.PathData.Points [10].Y, 0.001, "Points[10].Y");
+                               Assert.AreEqual (3, gp.PathData.Types [11], "Types[11]");
+                               Assert.AreEqual (274.6667f, gp.PathData.Points [11].X, 0.001, "Points[11].X");
+                               Assert.AreEqual (75.83334f, gp.PathData.Points [11].Y, 0.001, "Points[11].Y");
+                               Assert.AreEqual (3, gp.PathData.Types [12], "Types[12]");
+                               Assert.AreEqual (285f, gp.PathData.Points [12].X, 0.001, "Points[12].X");
+                               Assert.AreEqual (54f, gp.PathData.Points [12].Y, 0.001, "Points[12].Y");
+                       }
+               }
+
                private FontFamily GetFontFamily ()
                {
                        try {
@@ -1110,12 +1519,11 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (NullReferenceException))]
                public void AddString_NullString ()
                {
                        GraphicsPath gp = new GraphicsPath ();
                        FontFamily ff = GetFontFamily ();
-                       gp.AddString (null, ff, 0, 10, new Point (10, 10), StringFormat.GenericDefault);
+                       Assert.Throws<NullReferenceException> (() => gp.AddString (null, ff, 0, 10, new Point (10, 10), StringFormat.GenericDefault));
                }
 
                [Test]
@@ -1128,11 +1536,10 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddString_NullFontFamily ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddString ("mono", null, 0, 10, new Point (10, 10), StringFormat.GenericDefault);
+                       Assert.Throws<ArgumentException> (() => gp.AddString ("mono", null, 0, 10, new Point (10, 10), StringFormat.GenericDefault));
                }
 
                [Test]
@@ -1317,12 +1724,10 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Transform_Null ()
                {
-                       new GraphicsPath ().Transform (null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().Transform (null));
                }
-
                [Test]
                public void Transform_Empty ()
                {
@@ -1515,17 +1920,15 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Warp_Null ()
                {
-                       new GraphicsPath ().Warp (null, new RectangleF ());
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().Warp (null, new RectangleF ()));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Warp_NoPoints ()
                {
-                       new GraphicsPath ().Warp (new PointF[0], new RectangleF ());
+                       Assert.Throws<ArgumentException> (() => new GraphicsPath ().Warp (new PointF[0], new RectangleF ()));
                }
 
                [Test]
@@ -2000,10 +2403,9 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Widen_Pen_Null ()
                {
-                       new GraphicsPath ().Widen (null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().Widen (null));
                }
 
                [Test]
@@ -2059,16 +2461,12 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Widen_Pen_Null_Matrix ()
                {
-                       new GraphicsPath ().Widen (null, new Matrix ());
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().Widen (null, new Matrix ()));
                }
 
                [Test]
-#if ONLY_1_1
-               [ExpectedException (typeof (OutOfMemoryException))]
-#endif
                public void Widen_NoPoint ()
                {
                        using (GraphicsPath gp = new GraphicsPath ()) {
@@ -2080,14 +2478,13 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (OutOfMemoryException))]
                public void Widen_SinglePoint ()
                {
                        using (GraphicsPath gp = new GraphicsPath ()) {
                                gp.AddLines (new Point[1] { new Point (1, 1) });
                                // Special case - a line with a single point is valid
                                Assert.AreEqual (1, gp.PointCount, "PointCount");
-                               gp.Widen (Pens.Red);
+                               Assert.Throws<OutOfMemoryException> (() => gp.Widen (Pens.Red));
                                // oops ;-)
                        }
                }
@@ -2211,31 +2608,27 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void IsOutlineVisible_IntNull ()
                {
-                       new GraphicsPath ().IsOutlineVisible (1, 1, null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().IsOutlineVisible (1, 1, null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void IsOutlineVisible_FloatNull ()
                {
-                       new GraphicsPath ().IsOutlineVisible (1.0f, 1.0f, null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().IsOutlineVisible (1.0f, 1.0f, null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void IsOutlineVisible_PointNull ()
                {
-                       new GraphicsPath ().IsOutlineVisible (new Point (), null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().IsOutlineVisible (new Point (), null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void IsOutlineVisible_PointFNull ()
                {
-                       new GraphicsPath ().IsOutlineVisible (new PointF (), null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().IsOutlineVisible (new PointF (), null));
                }
 
                private void IsOutlineVisible_Line (Graphics graphics)
@@ -2426,7 +2819,8 @@ namespace MonoTests.System.Drawing.Drawing2D {
                                Assert.IsTrue (gp.IsVisible (9.5f, 9.5f, graphics), "Float1");
                                Assert.IsTrue (gp.IsVisible (10f, 10f, graphics), "Float2");
                                Assert.IsTrue (gp.IsVisible (20f, 20f, graphics), "Float3");
-                               Assert.IsTrue (gp.IsVisible (29.4f, 29.4f, graphics), "Float4");
+                               // the next diff is too close, so this fails with libgdiplus/cairo
+                               //Assert.IsTrue (gp.IsVisible (29.4f, 29.4f, graphics), "Float4");
                                Assert.IsFalse (gp.IsVisible (29.5f, 29.5f, graphics), "Float5");
                                Assert.IsFalse (gp.IsVisible (29.5f, 29.4f, graphics), "Float6");
                                Assert.IsFalse (gp.IsVisible (29.4f, 29.5f, graphics), "Float7");
@@ -2449,13 +2843,209 @@ namespace MonoTests.System.Drawing.Drawing2D {
                        }
                }
 
+               // bug #325502 has shown that ellipse didn't work with earlier code
+               private void IsVisible_Ellipse (Graphics graphics)
+               {
+                       using (GraphicsPath gp = new GraphicsPath ()) {
+                               gp.AddEllipse (new Rectangle (10, 10, 20, 20));
+                               Assert.IsFalse (gp.IsVisible (10, 10, graphics), "Int1");
+                               Assert.IsTrue (gp.IsVisible (20, 20, graphics), "Int2");
+                               Assert.IsFalse (gp.IsVisible (29, 29, graphics), "Int3");
+
+                               Assert.IsFalse (gp.IsVisible (10f, 10f, graphics), "Float2");
+                               Assert.IsTrue (gp.IsVisible (20f, 20f, graphics), "Float3");
+                               Assert.IsFalse (gp.IsVisible (29.4f, 29.4f, graphics), "Float4");
+                       }
+               }
+
+               [Test]
+               public void IsVisible_Ellipse_WithoutGraphics ()
+               {
+                       IsVisible_Ellipse (null);
+               }
+
+               [Test]
+               public void IsVisible_Ellipse_WithGraphics ()
+               {
+                       using (Bitmap bitmap = new Bitmap (40, 40)) {
+                               using (Graphics g = Graphics.FromImage (bitmap)) {
+                                       IsVisible_Ellipse (g);
+                               }
+                       }
+               }
+
+               // Reverse simple test cases
+
+               private void Reverse (GraphicsPath gp)
+               {
+                       PointF[] bp = gp.PathPoints;
+                       byte[] bt = gp.PathTypes;
+
+                       gp.Reverse ();
+                       PointF[] ap = gp.PathPoints;
+                       byte[] at = gp.PathTypes;
+
+                       int count = gp.PointCount;
+                       Assert.AreEqual (bp.Length, count, "PointCount");
+                       for (int i = 0; i < count; i++) {
+                               Assert.AreEqual (bp[i], ap[count - i - 1], "Point" + i.ToString ());
+                               Assert.AreEqual (bt[i], at[i], "Type" + i.ToString ());
+                       }
+               }
+
                [Test]
                public void Reverse_Arc ()
                {
                        using (GraphicsPath gp = new GraphicsPath ()) {
                                gp.AddArc (1f, 1f, 2f, 2f, Pi4, Pi4);
+                               Reverse (gp);
+                       }
+               }
+
+               [Test]
+               public void Reverse_Bezier ()
+               {
+                       using (GraphicsPath gp = new GraphicsPath ()) {
+                               gp.AddBezier (1, 2, 3, 4, 5, 6, 7, 8);
+                               Reverse (gp);
+                       }
+               }
+
+               [Test]
+               public void Reverse_Beziers ()
+               {
+                       using (GraphicsPath gp = new GraphicsPath ()) {
+                               Point[] beziers = new Point[] { new Point (1,2), new Point (3,4), new Point (5,6),
+                                       new Point (7,8), new Point (9,10), new Point (11,12), new Point (13,14) };
+                               gp.AddBeziers (beziers);
+                               Reverse (gp);
+                       }
+               }
+
+               [Test]
+               public void Reverse_ClosedCurve ()
+               {
+                       using (GraphicsPath gp = new GraphicsPath ()) {
+                               Point[] beziers = new Point[] { new Point (1,2), new Point (3,4), new Point (5,6),
+                                       new Point (7,8), new Point (9,10), new Point (11,12), new Point (13,14) };
+                               gp.AddClosedCurve (beziers);
+                               Reverse (gp);
+                       }
+               }
+
+               [Test]
+               public void Reverse_Curve ()
+               {
+                       using (GraphicsPath gp = new GraphicsPath ()) {
+                               Point[] beziers = new Point[] { new Point (1,2), new Point (3,4), new Point (5,6),
+                                       new Point (7,8), new Point (9,10), new Point (11,12), new Point (13,14) };
+                               gp.AddCurve (beziers);
+                               Reverse (gp);
+                       }
+               }
+
+               [Test]
+               public void Reverse_Ellipse ()
+               {
+                       using (GraphicsPath gp = new GraphicsPath ()) {
+                               gp.AddEllipse (1, 2, 3, 4);
+                               Reverse (gp);
+                       }
+               }
+
+               [Test]
+               public void Reverse_Line ()
+               {
+                       using (GraphicsPath gp = new GraphicsPath ()) {
+                               gp.AddLine (1, 2, 3, 4);
+                               Reverse (gp);
+                       }
+               }
+
+               [Test]
+               public void Reverse_Line_Closed ()
+               {
+                       using (GraphicsPath gp = new GraphicsPath ()) {
+                               gp.AddLine (1, 2, 3, 4);
+                               gp.CloseFigure ();
+                               Reverse (gp);
+                       }
+               }
+
+               [Test]
+               public void Reverse_Lines ()
+               {
+                       using (GraphicsPath gp = new GraphicsPath ()) {
+                               Point[] points = new Point[] { new Point (1,2), new Point (3,4), new Point (5,6),
+                                       new Point (7,8), new Point (9,10), new Point (11,12), new Point (13,14) };
+                               gp.AddLines (points);
+                               Reverse (gp);
+                       }
+               }
+
+               [Test]
+               public void Reverse_Polygon ()
+               {
+                       using (GraphicsPath gp = new GraphicsPath ()) {
+                               Point[] points = new Point[] { new Point (1,2), new Point (3,4), new Point (5,6),
+                                       new Point (7,8), new Point (9,10), new Point (11,12), new Point (13,14) };
+                               gp.AddPolygon (points);
+                               Reverse (gp);
+                       }
+               }
+
+               [Test]
+               public void Reverse_Rectangle ()
+               {
+                       using (GraphicsPath gp = new GraphicsPath ()) {
+                               gp.AddRectangle (new Rectangle (1,2,3,4));
+                               Reverse (gp);
+                       }
+               }
+
+               [Test]
+               public void Reverse_Rectangles ()
+               {
+                       using (GraphicsPath gp = new GraphicsPath ()) {
+                               Rectangle[] rects = new Rectangle[] { new Rectangle (1, 2, 3, 4), new Rectangle (5, 6, 7, 8) }; 
+                               gp.AddRectangles (rects);
+                               Reverse (gp);
+                       }
+               }
+
+               // Reverse complex test cases
+
+               [Test]
+               [Category ("NotWorking")] // the output differs from GDI+ and libgdiplus
+               public void Reverse_Pie ()
+               {
+                       using (GraphicsPath gp = new GraphicsPath ()) {
+                               gp.AddPie (1, 2, 3, 4, 10, 20);
                                PointF[] bp = gp.PathPoints;
-                               byte[] bt = gp.PathTypes;
+                               byte[] expected = new byte[] { 0, 3, 3, 3, 129 };
+
+                               gp.Reverse ();
+                               PointF[] ap = gp.PathPoints;
+                               byte[] at = gp.PathTypes;
+                               int count = gp.PointCount;
+                               Assert.AreEqual (bp.Length, count, "PointCount");
+                               for (int i = 0; i < count; i++) {
+                                       Assert.AreEqual (bp[i], ap[count - i - 1], "Point" + i.ToString ());
+                                       Assert.AreEqual (expected[i], at[i], "Type" + i.ToString ());
+                               }
+                       }
+               }
+
+               [Test]
+               public void Reverse_Path ()
+               {
+                       using (GraphicsPath gp = new GraphicsPath ()) {
+                               GraphicsPath path = new GraphicsPath ();
+                               path.AddArc (1f, 1f, 2f, 2f, Pi4, Pi4);
+                               path.AddLine (1, 2, 3, 4);
+                               gp.AddPath (path, true);
+                               PointF[] bp = gp.PathPoints;
+                               byte[] expected = new byte[] { 0, 1, 1, 3, 3, 3 };
 
                                gp.Reverse ();
                                PointF[] ap = gp.PathPoints;
@@ -2465,10 +3055,171 @@ namespace MonoTests.System.Drawing.Drawing2D {
                                Assert.AreEqual (bp.Length, count, "PointCount");
                                for (int i = 0; i < count; i++) {
                                        Assert.AreEqual (bp[i], ap[count - i - 1], "Point" + i.ToString ());
-                                       // PathTypes are NOT reversed
-                                       Assert.AreEqual (bt[i], at[i], "Type" + i.ToString ());
+                                       Assert.AreEqual (expected[i], at[i], "Type" + i.ToString ());
                                }
                        }
                }
+
+               [Test]
+               public void Reverse_Path_2 ()
+               {
+                       using (GraphicsPath gp = new GraphicsPath ()) {
+                               gp.AddEllipse (50, 51, 50, 100);
+                               gp.AddRectangle (new Rectangle (200, 201, 60, 61));
+                               PointF[] bp = gp.PathPoints;
+                               byte[] expected = new byte[] { 0, 1, 1, 129, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 131 };
+
+                               gp.Reverse ();
+                               PointF[] ap = gp.PathPoints;
+                               byte[] at = gp.PathTypes;
+
+                               int count = gp.PointCount;
+                               Assert.AreEqual (bp.Length, count, "PointCount");
+                               for (int i = 0; i < count; i++) {
+                                       Assert.AreEqual (bp[i], ap[count - i - 1], "Point" + i.ToString ());
+                                       Assert.AreEqual (expected[i], at[i], "Type" + i.ToString ());
+                               }
+                       }
+               }
+
+               [Test]
+               [Category ("NotWorking")] // the output differs from GDI+ and libgdiplus
+               public void Reverse_String ()
+               {
+                       using (GraphicsPath gp = new GraphicsPath ()) {
+                               FontFamily ff = GetFontFamily ();
+                               gp.AddString ("Mono::", ff, 0, 10, new Point (10, 10), StringFormat.GenericDefault);
+                               PointF[] bp = gp.PathPoints;
+                               byte[] expected = new byte[] { 0,3,3,3,3,3,3,3,3,3,3,3,3,1,3,3,3,3,3,3,3,3,3,3,3,3,129,0,3,3,3,
+                                       3,3,3,3,3,3,3,3,3,1,3,3,3,3,3,3,3,3,3,3,3,3,161,0,3,3,3,3,3,3,3,3,3,3,3,3,1,3,3,3,3,3,
+                                       3,3,3,3,3,3,3,129,0,3,3,3,3,3,3,3,3,3,3,3,3,1,3,3,3,3,3,3,3,3,3,3,3,3,161,0,3,3,3,3,3,
+                                       3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,131,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
+                                       163,0,3,3,3,3,3,3,3,3,3,3,3,3,1,1,1,3,3,3,3,3,3,3,3,3,3,3,3,1,3,3,3,3,3,3,3,3,3,3,3,3,
+                                       1,1,3,3,3,3,3,3,3,3,3,3,3,3,1,1,3,3,3,3,3,3,3,3,3,3,3,3,1,3,3,3,3,3,3,3,3,3,3,3,3,1,1,
+                                       3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,161,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,131,
+                                       0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,163,0,1,1,1,3,3,3,3,3,3,3,3,3,3,3,3,1,
+                                       3,3,3,3,3,3,3,3,3,3,3,3,1,1,1,3,3,3,3,3,3,3,3,3,3,3,3,1,1,1,1,3,3,3,3,3,3,3,3,3,3,3,3,
+                                       1,1,1,3,3,3,3,3,3,3,3,3,3,3,3,1,3,3,3,3,3,3,3,3,3,3,3,3,1,1,1,1,129 };
+
+                               gp.Reverse ();
+                               PointF[] ap = gp.PathPoints;
+                               byte[] at = gp.PathTypes;
+
+                               int count = gp.PointCount;
+                               Assert.AreEqual (bp.Length, count, "PointCount");
+                               for (int i = 0; i < count; i++) {
+                                       Assert.AreEqual (bp[i], ap[count - i - 1], "Point" + i.ToString ());
+                                       Assert.AreEqual (expected[i], at[i], "Type" + i.ToString ());
+                               }
+                       }
+               }
+
+               [Test]
+               public void Reverse_Marker ()
+               {
+                       using (GraphicsPath gp = new GraphicsPath ()) {
+                               gp.AddRectangle (new Rectangle (200, 201, 60, 61));
+                               gp.SetMarkers ();
+                               PointF[] bp = gp.PathPoints;
+                               byte[] expected = new byte[] { 0, 1, 1, 129 };
+
+                               gp.Reverse ();
+                               PointF[] ap = gp.PathPoints;
+                               byte[] at = gp.PathTypes;
+
+                               int count = gp.PointCount;
+                               Assert.AreEqual (bp.Length, count, "PointCount");
+                               for (int i = 0; i < count; i++) {
+                                       Assert.AreEqual (bp[i], ap[count - i - 1], "Point" + i.ToString ());
+                                       Assert.AreEqual (expected[i], at[i], "Type" + i.ToString ());
+                               }
+                       }
+               }
+
+               [Test]
+               public void Reverse_Subpath_Marker ()
+               {
+                       using (GraphicsPath gp = new GraphicsPath ()) {
+                               gp.AddLine (0, 1, 2, 3);
+                               gp.SetMarkers ();
+                               gp.CloseFigure ();
+                               gp.AddBezier (5, 6, 7, 8, 9, 10, 11, 12);
+                               gp.CloseFigure ();
+                               PointF[] bp = gp.PathPoints;
+                               byte[] expected = new byte[] { 0, 3, 3, 163, 0, 129 };
+
+                               gp.Reverse ();
+                               PointF[] ap = gp.PathPoints;
+                               byte[] at = gp.PathTypes;
+
+                               int count = gp.PointCount;
+                               Assert.AreEqual (bp.Length, count, "PointCount");
+                               for (int i = 0; i < count; i++) {
+                                       Assert.AreEqual (bp[i], ap[count - i - 1], "Point" + i.ToString ());
+                                       Assert.AreEqual (expected[i], at[i], "Type" + i.ToString ());
+                               }
+                       }
+               }
+
+               [Test]
+               public void Reverse_Subpath_Marker_2 ()
+               {
+                       using (GraphicsPath gp = new GraphicsPath ()) {
+                               gp.AddLine (0, 1, 2, 3);
+                               gp.SetMarkers ();
+                               gp.StartFigure ();
+                               gp.AddLine (20, 21, 22, 23);
+                               gp.AddBezier (5, 6, 7, 8, 9, 10, 11, 12);
+                               PointF[] bp = gp.PathPoints;
+                               byte[] expected = new byte[] { 0, 3, 3, 3, 1, 33, 0, 1 };
+
+                               gp.Reverse ();
+                               PointF[] ap = gp.PathPoints;
+                               byte[] at = gp.PathTypes;
+
+                               int count = gp.PointCount;
+                               Assert.AreEqual (bp.Length, count, "PointCount");
+                               for (int i = 0; i < count; i++) {
+                                       Assert.AreEqual (bp[i], ap[count - i - 1], "Point" + i.ToString ());
+                                       Assert.AreEqual (expected[i], at[i], "Type" + i.ToString ());
+                               }
+                       }
+               }
+
+               [Test]
+               public void bug413461 ()
+               {
+                       int dX = 520;
+                       int dY = 320;
+                       Point[] expected_points = new Point [] {
+                               new Point(dX-64, dY-24),//start
+                               new Point(dX-59, dY-34),//focal point 1
+                               new Point(dX-52, dY-54),//focal point 2
+                               new Point(dX-18, dY-66),//top
+                               new Point(dX-34, dY-47),//focal point 1
+                               new Point(dX-43, dY-27),//focal point 2
+                               new Point(dX-44, dY-8),//end
+                               };
+                       byte[] expected_types = new byte [] {
+                               (byte)PathPointType.Start,
+                               (byte)PathPointType.Bezier,
+                               (byte)PathPointType.Bezier,
+                               (byte)PathPointType.Bezier,
+                               (byte)PathPointType.Bezier,
+                               (byte)PathPointType.Bezier,
+                               (byte)PathPointType.Bezier };
+                       using (GraphicsPath path = new GraphicsPath (expected_points, expected_types)) {
+                               Assert.AreEqual (7, path.PointCount, "PathCount");
+                               byte [] actual_types = path.PathTypes;
+                               Assert.AreEqual (expected_types [0], actual_types [0], "types-0");
+                               Assert.AreEqual (expected_types [1], actual_types [1], "types-1");
+                               Assert.AreEqual (expected_types [2], actual_types [2], "types-2");
+                               Assert.AreEqual (expected_types [3], actual_types [3], "types-3");
+                               Assert.AreEqual (expected_types [4], actual_types [4], "types-4");
+                               Assert.AreEqual (expected_types [5], actual_types [5], "types-5");
+                               // path is filled like closed but this does not show on the type
+                               Assert.AreEqual (expected_types [6], actual_types [6], "types-6");
+                       }
+               }
        }
 }