Author: spouliot
Date: 2007-05-28 16:34:26 -0400 (Mon, 28 May 2007)
New Revision: 78090
Modified:
trunk/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog
trunk/mcs/class/System.Drawing/Test/System.Drawing/GDIPlusTest.cs
trunk/mcs/class/System.Drawing/Test/System.Drawing/TestGraphics.cs
Log:
2007-05-28 Sebastien Pouliot <[EMAIL PROTECTED]>
* GDIPlusTest.cs: Add test cases for GdipDrawRectangles[I]
* TestGraphics.cs: Re-enable [Draw|Fill]Rectangles tests and remove
the saved bitmap (used for debugging).
Modified: trunk/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog
===================================================================
--- trunk/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog
2007-05-28 20:30:54 UTC (rev 78089)
+++ trunk/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog
2007-05-28 20:34:26 UTC (rev 78090)
@@ -1,3 +1,9 @@
+2007-05-28 Sebastien Pouliot <[EMAIL PROTECTED]>
+
+ * GDIPlusTest.cs: Add test cases for GdipDrawRectangles[I]
+ * TestGraphics.cs: Re-enable [Draw|Fill]Rectangles tests and remove
+ the saved bitmap (used for debugging).
+
2007-05-28 Sebastien Pouliot <[EMAIL PROTECTED]>
* TestGraphics.cs: Add test cases for [Draw|Fill]Rectangles (#81737)
Modified: trunk/mcs/class/System.Drawing/Test/System.Drawing/GDIPlusTest.cs
===================================================================
--- trunk/mcs/class/System.Drawing/Test/System.Drawing/GDIPlusTest.cs
2007-05-28 20:30:54 UTC (rev 78089)
+++ trunk/mcs/class/System.Drawing/Test/System.Drawing/GDIPlusTest.cs
2007-05-28 20:34:26 UTC (rev 78090)
@@ -312,6 +312,48 @@
}
[Test]
+ public void DrawRectangles ()
+ {
+ IntPtr image;
+ GDIPlus.GdipCreateBitmapFromScan0 (10, 10, 0,
PixelFormat.Format32bppArgb, IntPtr.Zero, out image);
+ Assert.IsTrue (image != IntPtr.Zero, "image");
+
+ IntPtr graphics;
+ Assert.AreEqual (Status.Ok,
GDIPlus.GdipGetImageGraphicsContext (image, out graphics),
"GdipGetImageGraphicsContext");
+ Assert.IsTrue (graphics != IntPtr.Zero, "graphics");
+
+ Rectangle[] r = new Rectangle[1] { new Rectangle (1, 2,
-2, -1) };
+ Assert.AreEqual (Status.InvalidParameter,
GDIPlus.GdipDrawRectanglesI (graphics, IntPtr.Zero, r, 1),
"GdipDrawRectanglesI-PenNull");
+
+ RectangleF[] rf = new RectangleF[2] { new RectangleF
(1, 2, -2, -1), new RectangleF (0, 0, 10, 10) };
+ Assert.AreEqual (Status.InvalidParameter,
GDIPlus.GdipDrawRectangles (graphics, IntPtr.Zero, rf, 2),
"GdipDrawRectanglesI-PenNull");
+
+ IntPtr pen;
+ Assert.AreEqual (Status.Ok, GDIPlus.GdipCreatePen1 (0,
0f, Unit.UnitWorld, out pen), "GdipCreatePen1");
+ Assert.IsTrue (pen != IntPtr.Zero, "pen");
+
+ Assert.AreEqual (Status.InvalidParameter,
GDIPlus.GdipDrawRectanglesI (IntPtr.Zero, pen, r, 1),
"GdipDrawRectanglesI-GraphicsNull");
+ Assert.AreEqual (Status.InvalidParameter,
GDIPlus.GdipDrawRectangles (IntPtr.Zero, pen, rf, 2),
"GdipDrawRectangles-GraphicsNull");
+
+ Assert.AreEqual (Status.InvalidParameter,
GDIPlus.GdipDrawRectanglesI (graphics, pen, null, 1),
"GdipDrawRectanglesI-RectanglesNull");
+ Assert.AreEqual (Status.InvalidParameter,
GDIPlus.GdipDrawRectangles (graphics, pen, null, 1),
"GdipDrawRectangles-RectanglesNull");
+
+ Assert.AreEqual (Status.InvalidParameter,
GDIPlus.GdipDrawRectanglesI (graphics, pen, new Rectangle[0], 0),
"GdipDrawRectanglesI-RectanglesEmpty");
+ Assert.AreEqual (Status.InvalidParameter,
GDIPlus.GdipDrawRectangles (graphics, pen, new RectangleF[0], 0),
"GdipDrawRectangles-RectanglesEmpty");
+
+ Assert.AreEqual (Status.InvalidParameter,
GDIPlus.GdipDrawRectanglesI (graphics, pen, r, -1),
"GdipDrawRectanglesI-RectanglesNegative");
+ Assert.AreEqual (Status.InvalidParameter,
GDIPlus.GdipDrawRectangles (graphics, pen, rf, -1),
"GdipDrawRectangles-RectanglesNegative");
+
+ Assert.AreEqual (Status.Ok, GDIPlus.GdipDrawRectanglesI
(graphics, pen, r, 1), "GdipDrawRectanglesI-Rectangles1");
+ Assert.AreEqual (Status.Ok, GDIPlus.GdipDrawRectangles
(graphics, pen, rf, 2), "GdipDrawRectangles-Rectangles2");
+
+ Assert.AreEqual (Status.Ok, GDIPlus.GdipDeletePen
(pen), "GdipDeletePen");
+
+ Assert.AreEqual (Status.Ok, GDIPlus.GdipDeleteGraphics
(graphics), "GdipDeleteGraphics");
+ Assert.AreEqual (Status.Ok, GDIPlus.GdipDisposeImage
(image), "GdipDisposeImage");
+ }
+
+ [Test]
public void MeasureCharacterRanges ()
{
IntPtr image;
Modified: trunk/mcs/class/System.Drawing/Test/System.Drawing/TestGraphics.cs
===================================================================
--- trunk/mcs/class/System.Drawing/Test/System.Drawing/TestGraphics.cs
2007-05-28 20:30:54 UTC (rev 78089)
+++ trunk/mcs/class/System.Drawing/Test/System.Drawing/TestGraphics.cs
2007-05-28 20:34:26 UTC (rev 78090)
@@ -1427,12 +1427,10 @@
}
[Test]
- [Category ("NotWorking")] // libgdiplus is one pixel off (+1,+1)
public void FillDrawRectangle_Width_2 ()
{
// even pen size
using (Bitmap bitmap = FillDrawRectangle (2.0f)) {
- bitmap.Save (@"FillDrawRectangle_Width_2.bmp");
// NW
Assert.AreEqual (0xFFFF0000, (uint)
bitmap.GetPixel (3, 3).ToArgb (), "3,3");
Assert.AreEqual (0xFF0000FF, (uint)
bitmap.GetPixel (4, 4).ToArgb (), "4,4");
@@ -1592,7 +1590,6 @@
}
[Test]
- [Category ("NotWorking")] // libgdiplus is one pixel off (+1,+1)
public void DrawFillRectangle_Width_2 ()
{
// even pen size
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches