Author: spouliot
Date: 2006-06-30 13:49:54 -0400 (Fri, 30 Jun 2006)
New Revision: 62161

Added:
   trunk/mcs/class/System.Drawing/Test/System.Drawing/SolidBrushTest.cs
Modified:
   trunk/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog
Log:
2006-06-30  Sebastien Pouliot  <[EMAIL PROTECTED]>

        * SolidBrushTest.cs: New. Unit tests for SolidBrush.



Modified: trunk/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog
===================================================================
--- trunk/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog        
2006-06-30 17:06:37 UTC (rev 62160)
+++ trunk/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog        
2006-06-30 17:49:54 UTC (rev 62161)
@@ -1,3 +1,7 @@
+2006-06-30  Sebastien Pouliot  <[EMAIL PROTECTED]>
+
+       * SolidBrushTest.cs: New. Unit tests for SolidBrush.
+
 2006-06-28  Sebastien Pouliot  <[EMAIL PROTECTED]>
 
        * TestFont.cs: Expanded a test case to check for bug #78721 where the

Added: trunk/mcs/class/System.Drawing/Test/System.Drawing/SolidBrushTest.cs
===================================================================
--- trunk/mcs/class/System.Drawing/Test/System.Drawing/SolidBrushTest.cs        
2006-06-30 17:06:37 UTC (rev 62160)
+++ trunk/mcs/class/System.Drawing/Test/System.Drawing/SolidBrushTest.cs        
2006-06-30 17:49:54 UTC (rev 62161)
@@ -0,0 +1,93 @@
+//
+// System.Drawing.SolidBrush unit tests
+//
+// Authors:
+//     Sebastien Pouliot  <[EMAIL PROTECTED]>
+//
+// Copyright (C) 2006 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
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Drawing;
+using System.Security.Permissions;
+using NUnit.Framework;
+
+namespace MonoTests.System.Drawing {
+
+       [TestFixture]
+       [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+       public class SolidBrushTest {
+
+               [Test]
+               public void Transparent ()
+               {
+                       SolidBrush sb = new SolidBrush (Color.Transparent);
+                       Assert.AreEqual (Color.Transparent, sb.Color, "Color");
+                       sb.Color = Color.Empty;
+                       SolidBrush clone = (SolidBrush) sb.Clone ();
+                       sb.Dispose ();
+                       Assert.AreEqual (Color.Empty.ToArgb (), 
clone.Color.ToArgb (), "Clone.Color");
+               }
+
+               [Test]
+               public void Dispose_Color ()
+               {
+                       SolidBrush sb = new SolidBrush (Color.Transparent);
+                       sb.Dispose ();
+                       Assert.AreEqual (Color.Transparent, sb.Color, "Color");
+                       // no exception - the call probably doesn't get to gdi+
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentException))]
+               public void Dispose_Clone ()
+               {
+                       SolidBrush sb = new SolidBrush (Color.Transparent);
+                       sb.Dispose ();
+                       sb.Clone ();
+               }
+
+               [Test]
+               public void Dispose_Dispose ()
+               {
+                       SolidBrush sb = new SolidBrush (Color.Transparent);
+                       sb.Dispose ();
+                       sb.Dispose ();
+               }
+
+               [Test]
+               public void FillRectangle ()
+               {
+                       using (Bitmap bmp = new Bitmap (10, 10)) {
+                               using (Graphics g = Graphics.FromImage (bmp)) {
+                                       SolidBrush sb = new SolidBrush 
(Color.Red);
+                                       g.FillRectangle (sb, 0, 0, 9, 9);
+                                       sb.Color = Color.Blue;
+                                       g.FillRectangle (sb, 4, 4, 5, 5);
+                               }
+                               Assert.AreEqual (Color.Red.ToArgb (), 
bmp.GetPixel (0, 0).ToArgb (), "0,0");
+                               Assert.AreEqual (Color.Blue.ToArgb (), 
bmp.GetPixel (8, 8).ToArgb (), "8,8");
+                               Assert.AreEqual (0, bmp.GetPixel (9, 9).ToArgb 
(), "9,9");
+                       }
+               }
+       }
+}


Property changes on: 
trunk/mcs/class/System.Drawing/Test/System.Drawing/SolidBrushTest.cs
___________________________________________________________________
Name: svn:eol-style
   + native

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to