Author: spouliot
Date: 2006-08-27 19:43:19 -0400 (Sun, 27 Aug 2006)
New Revision: 64455

Modified:
   trunk/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog
   trunk/mcs/class/System.Drawing/Test/System.Drawing/ColorConverter.cs
   trunk/mcs/class/System.Drawing/Test/System.Drawing/ColorTranslator.cs
Log:
2006-08-27  Sebastien Pouliot  <[EMAIL PROTECTED]> 

        * ColorConverter.cs: Add a new test case for a color with a integer 
        part that is too large to convert into an int.
        * ColorTranslator.cs: Add more test cases for FromHtml method.



Modified: trunk/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog
===================================================================
--- trunk/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog        
2006-08-27 23:43:01 UTC (rev 64454)
+++ trunk/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog        
2006-08-27 23:43:19 UTC (rev 64455)
@@ -1,3 +1,9 @@
+2006-08-27  Sebastien Pouliot  <[EMAIL PROTECTED]> 
+
+       * ColorConverter.cs: Add a new test case for a color with a integer 
+       part that is too large to convert into an int.
+       * ColorTranslator.cs: Add more test cases for FromHtml method.
+
 2006-08-25  Sebastien Pouliot  <[EMAIL PROTECTED]> 
 
        * GDIPlusTest.cs: Fix ImageAttributes test case.

Modified: trunk/mcs/class/System.Drawing/Test/System.Drawing/ColorConverter.cs
===================================================================
--- trunk/mcs/class/System.Drawing/Test/System.Drawing/ColorConverter.cs        
2006-08-27 23:43:01 UTC (rev 64454)
+++ trunk/mcs/class/System.Drawing/Test/System.Drawing/ColorConverter.cs        
2006-08-27 23:43:19 UTC (rev 64455)
@@ -441,6 +441,13 @@
                public void GetStandardValuesExclusive () {
                        Assert.AreEqual (false, 
colconv.GetStandardValuesExclusive ());
                }
+
+               [Test]
+               [ExpectedException (typeof (Exception))]
+               public void ConvertFromString_FromHtml_PoundTooLarge ()
+               {
+                       colconv.ConvertFromString ("#100000000");
+               }
        }
 }
 

Modified: trunk/mcs/class/System.Drawing/Test/System.Drawing/ColorTranslator.cs
===================================================================
--- trunk/mcs/class/System.Drawing/Test/System.Drawing/ColorTranslator.cs       
2006-08-27 23:43:01 UTC (rev 64454)
+++ trunk/mcs/class/System.Drawing/Test/System.Drawing/ColorTranslator.cs       
2006-08-27 23:43:19 UTC (rev 64455)
@@ -1,3 +1,28 @@
+//
+// ColorTranslator class testing unit
+//
+// 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;
@@ -8,7 +33,60 @@
        [TestFixture]
        [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
        public class ColorTranslatorFixture {
+
                [Test]
+               public void FromHtml_Null ()
+               {
+                       Assert.AreEqual (0, ColorTranslator.FromHtml 
(null).ToArgb ());
+               }
+
+               [Test]
+               public void FromHtml_Empty ()
+               {
+                       Assert.AreEqual (0, ColorTranslator.FromHtml 
(String.Empty).ToArgb ());
+               }
+
+               [Test]
+               public void FromHtml_Int ()
+               {
+                       Assert.AreEqual (-1, ColorTranslator.FromHtml 
("-1").ToArgb (), "-1");
+                       Assert.AreEqual (0, ColorTranslator.FromHtml 
("0").ToArgb (), "0");
+                       Assert.AreEqual (1, ColorTranslator.FromHtml 
("1").ToArgb (), "1");
+               }
+
+               [Test]
+               public void FromHtml_PoundInt ()
+               {
+                       Assert.AreEqual (0, ColorTranslator.FromHtml 
("#0").ToArgb (), "#0");
+                       Assert.AreEqual (1, ColorTranslator.FromHtml 
("#1").ToArgb (), "#1");
+                       Assert.AreEqual (255, ColorTranslator.FromHtml 
("#FF").ToArgb (), "#FF");
+                       Assert.AreEqual (65535, ColorTranslator.FromHtml 
("#FFFF").ToArgb (), "#FFFF");
+                       Assert.AreEqual (-1, ColorTranslator.FromHtml 
("#FFFFFF").ToArgb (), "#FFFFFF");
+                       Assert.AreEqual (-1, ColorTranslator.FromHtml 
("#FFFFFFFF").ToArgb (), "#FFFFFFFF");
+               }
+
+               [Test]
+               [ExpectedException (typeof (Exception))]
+               public void FromHtml_PoundNegative ()
+               {
+                       ColorTranslator.FromHtml ("#-1");
+               }
+
+               [Test]
+               [ExpectedException (typeof (Exception))]
+               public void FromHtml_PoundTooLarge ()
+               {
+                       ColorTranslator.FromHtml ("#100000000");
+               }
+
+               [Test]
+               [ExpectedException (typeof (Exception))]
+               public void FromHtml_Unkown ()
+               {
+                       ColorTranslator.FromHtml ("unknown-color-test");
+               }
+
+               [Test]
                public void FromHtml ()
                {
                        Color [] colors = new Color [] {

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

Reply via email to