Author: spouliot
Date: 2006-05-25 12:08:54 -0400 (Thu, 25 May 2006)
New Revision: 61121
Modified:
trunk/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog
trunk/mcs/class/System.Drawing/Test/System.Drawing/TestRegion.cs
Log:
2006-05-25 Sebastien Pouliot <[EMAIL PROTECTED]>
* TestRegion.cs: Added a new fixture that executes with UnmanagedCode
permission and test the [Get|From]Hrgn methods.
Modified: trunk/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog
===================================================================
--- trunk/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog
2006-05-25 16:08:05 UTC (rev 61120)
+++ trunk/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog
2006-05-25 16:08:54 UTC (rev 61121)
@@ -1,3 +1,8 @@
+2006-05-25 Sebastien Pouliot <[EMAIL PROTECTED]>
+
+ * TestRegion.cs: Added a new fixture that executes with UnmanagedCode
+ permission and test the [Get|From]Hrgn methods.
+
2006-05-24 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
* TestBitmap.cs: new tests for the default format and the default file
Modified: trunk/mcs/class/System.Drawing/Test/System.Drawing/TestRegion.cs
===================================================================
--- trunk/mcs/class/System.Drawing/Test/System.Drawing/TestRegion.cs
2006-05-25 16:08:05 UTC (rev 61120)
+++ trunk/mcs/class/System.Drawing/Test/System.Drawing/TestRegion.cs
2006-05-25 16:08:54 UTC (rev 61121)
@@ -1388,4 +1388,67 @@
Assert.AreEqual (2, region.GetRegionScans
(matrix).Length, "2");
}
}
+
+ [TestFixture]
+ // the test cases in this fixture aren't restricted wrt running
unmanaged code
+ public class RegionTestUnmanaged {
+
+ private Bitmap bitmap;
+ private Graphics graphic;
+
+ [TestFixtureSetUp]
+ public void FixtureSetUp ()
+ {
+ bitmap = new Bitmap (10, 10);
+ graphic = Graphics.FromImage (bitmap);
+ }
+
+ [Test]
+ public void GetHrgn_Infinite_MakeEmpty ()
+ {
+ Region r = new Region ();
+ Assert.IsFalse (r.IsEmpty (graphic), "!Empty");
+ Assert.IsTrue (r.IsInfinite (graphic), "Infinite");
+ Assert.AreEqual (IntPtr.Zero, r.GetHrgn (graphic),
"Handle==0");
+
+ r.MakeEmpty ();
+ Assert.IsTrue (r.IsEmpty (graphic), "Empty");
+ Assert.IsFalse (r.IsInfinite (graphic), "!Infinite");
+ Assert.IsFalse (r.GetHrgn (graphic) == IntPtr.Zero,
"Handle!=0");
+ }
+
+ [Test]
+ public void GetHrgn_Empty_MakeInfinite ()
+ {
+ Region r = new Region (new GraphicsPath ());
+ Assert.IsTrue (r.IsEmpty (graphic), "Empty");
+ Assert.IsFalse (r.IsInfinite (graphic), "!Infinite");
+ Assert.IsFalse (r.GetHrgn (graphic) == IntPtr.Zero,
"Handle!=0");
+
+ r.MakeInfinite ();
+ Assert.IsFalse (r.IsEmpty (graphic), "!Empty");
+ Assert.IsTrue (r.IsInfinite (graphic), "Infinite");
+ Assert.AreEqual (IntPtr.Zero, r.GetHrgn (graphic),
"Handle==0");
+ }
+
+ [Test]
+ public void GetHrgn_FromHrgn ()
+ {
+ Region r1 = new Region (new GraphicsPath ());
+ IntPtr h1 = r1.GetHrgn (graphic);
+ Assert.IsFalse (h1 == IntPtr.Zero, "Handle_1!=0");
+
+ Region r2 = Region.FromHrgn (h1);
+ IntPtr h2 = r2.GetHrgn (graphic);
+ Assert.IsFalse (h2 == IntPtr.Zero, "Handle_2!=0");
+ Assert.IsFalse (h1 == h2, "Handle_1!=Handle_2");
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void FromHrgn_Zero ()
+ {
+ Region.FromHrgn (IntPtr.Zero);
+ }
+ }
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches