From 0a84ee134017692abe1e89c4ee72e26b988fd757 Mon Sep 17 00:00:00 2001 From: Sebastien Pouliot Date: Fri, 4 Aug 2006 13:29:53 +0000 Subject: [PATCH] 2006-08-04 Sebastien Pouliot * GDIPlusTest.cs: Some test cases for GraphicsPath, PathGradientBrush related GDI+ calls. svn path=/trunk/mcs/; revision=63356 --- .../Test/System.Drawing/ChangeLog | 5 +- .../Test/System.Drawing/GDIPlusTest.cs | 52 +++++++++++++++++++ 2 files changed, 55 insertions(+), 2 deletions(-) diff --git a/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog b/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog index 09c0ca64702..53414c3aaec 100644 --- a/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog +++ b/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog @@ -1,6 +1,7 @@ -2006-08-04 Sebastien Pouliot +2006-08-04 Sebastien Pouliot - * GDIPlusTest.cs: Some test cases for GraphicsPath related GDI+ calls. + * GDIPlusTest.cs: Some test cases for GraphicsPath, PathGradientBrush + related GDI+ calls. 2006-08-03 Sebastien Pouliot diff --git a/mcs/class/System.Drawing/Test/System.Drawing/GDIPlusTest.cs b/mcs/class/System.Drawing/Test/System.Drawing/GDIPlusTest.cs index f15d7f161cf..956fffce822 100644 --- a/mcs/class/System.Drawing/Test/System.Drawing/GDIPlusTest.cs +++ b/mcs/class/System.Drawing/Test/System.Drawing/GDIPlusTest.cs @@ -112,6 +112,17 @@ namespace MonoTests.System.Drawing { Assert.AreEqual (Status.InvalidParameter, GdipCreateBitmapFromScan0 (-1, 10, 10, PixelFormat.Format32bppArgb, IntPtr.Zero, out bmp), "negative width"); } + // Brush + + [DllImport ("gdiplus.dll")] + static internal extern Status GdipDeleteBrush (IntPtr brush); + + [Test] + public void DeleteBrush () + { + Assert.AreEqual (Status.InvalidParameter, GdipDeleteBrush (IntPtr.Zero), "GdipDeleteBrush"); + } + // GraphicsPath [DllImport ("gdiplus.dll")] @@ -204,6 +215,47 @@ namespace MonoTests.System.Drawing { } } + // PathGradientBrush + + [DllImport ("gdiplus.dll")] + static internal extern Status GdipCreatePathGradient (PointF[] points, int count, WrapMode wrapMode, out IntPtr brush); + + [DllImport ("gdiplus.dll")] + static internal extern Status GdipGetPathGradientBlendCount (IntPtr brush, out int count); + + [DllImport ("gdiplus.dll")] + static internal extern Status GdipGetPathGradientPresetBlend (IntPtr brush, int[] blend, float[] positions, int count); + + + [Test] + public void CreatePathGradient () + { + PointF[] points = null; + IntPtr brush; + Assert.AreEqual (Status.OutOfMemory, GdipCreatePathGradient (points, 0, WrapMode.Clamp, out brush), "null"); + + points = new PointF [0]; + Assert.AreEqual (Status.OutOfMemory, GdipCreatePathGradient (points, 0, WrapMode.Clamp, out brush), "empty"); + + points = new PointF[1]; + Assert.AreEqual (Status.OutOfMemory, GdipCreatePathGradient (points, 1, WrapMode.Clamp, out brush), "one"); + + points = new PointF[2] { new PointF (1, 2), new PointF (20, 30) }; + Assert.AreEqual (Status.Ok, GdipCreatePathGradient (points, 2, WrapMode.Clamp, out brush), "two"); + + int count; + Assert.AreEqual (Status.Ok, GdipGetPathGradientBlendCount (brush, out count), "GdipGetPathGradientBlendCount"); + Assert.AreEqual (1, count, "blend count"); + + int[] colors = new int[count]; + float[] positions = new float[count]; + Assert.AreEqual (Status.InvalidParameter, GdipGetPathGradientPresetBlend (brush, colors, positions, count), "GdipGetPathGradientBlend"); + // can't call that for 1 count! + + Assert.AreEqual (Status.Ok, GdipDeleteBrush (brush), "GdipDeleteBrush"); + } + + // Region [DllImport ("gdiplus.dll")] -- 2.25.1