* roottypes.cs: Rename from tree.cs.
[mono.git] / mcs / class / System.Drawing / Test / System.Drawing / ColorConverter.cs
index 379366379af4cc8cbb94949c31f3608d4d33315e..0337258603cd8ec883e1423c4f29e6c06cc42913 100644 (file)
@@ -1,3 +1,28 @@
+//
+// ColorConverter 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.Collections;
 using System.ComponentModel;
@@ -34,6 +59,9 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
+#if TARGET_JVM
+               [NUnit.Framework.Category ("NotWorking")]
+#endif
                public void CanConvertFrom () {
                        Assert.IsTrue (colconv.CanConvertFrom (typeof (String)), "CCF#1");
                        Assert.IsTrue (colconv.CanConvertFrom (null, typeof (String)), "CCF#1a");
@@ -64,6 +92,9 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
+#if TARGET_JVM
+               [NUnit.Framework.Category ("NotWorking")]
+#endif
                public void ConvertFrom ()
                {
                        Color color = (Color) colconv.ConvertFrom (null, CultureInfo.InvariantCulture,
@@ -115,6 +146,7 @@ namespace MonoTests.System.Drawing {
                        Assert.AreEqual (0, color.G, "CF7#3");
                        Assert.AreEqual (0, color.B, "CF7#4");
 
+
                        Assert.AreEqual (col, (Color) colconv.ConvertFrom (null,
                                CultureInfo.InvariantCulture, colStrInvariant), "CF#1");
                        Assert.AreEqual (colnamed, (Color) colconv.ConvertFrom (null,
@@ -124,7 +156,25 @@ namespace MonoTests.System.Drawing {
                        Assert.AreEqual (Color.Empty, colconv.ConvertFrom (" "), "CF#4");
                        Assert.AreEqual (Color.Red, colconv.ConvertFrom ("Red"), "CF#5");
                        Assert.AreEqual (Color.Red, colconv.ConvertFrom (" Red "), "CF#6");
+               }
+
+               [Test]
+               [NUnit.Framework.Category ("NotWorking")]
+               public void ConvertFrom_NotWorking ()
+               {
+                       Color color = (Color) colconv.ConvertFrom (null, CultureInfo.InvariantCulture,
+                               "0x123");
+                       Assert.AreEqual (0, color.A, "CF8#1");
+                       Assert.AreEqual (0, color.R, "CF8#2");
+                       Assert.AreEqual (1, color.G, "CF8#3");
+                       Assert.AreEqual (35, color.B, "CF8#4");
 
+                       color = (Color) colconv.ConvertFrom (null, CultureInfo.InvariantCulture,
+                               "#123");
+                       Assert.AreEqual (0, color.A, "CF9#1");
+                       Assert.AreEqual (0, color.R, "CF9#2");
+                       Assert.AreEqual (1, color.G, "CF9#3");
+                       Assert.AreEqual (35, color.B, "CF9#4");
                }
 
                [Test]
@@ -151,6 +201,9 @@ namespace MonoTests.System.Drawing {
 
                [Test]
                [ExpectedException (typeof (Exception))]
+#if TARGET_JVM
+               [NUnit.Framework.Category ("NotWorking")]
+#endif
                public void ConvertFrom_x4 ()
                {
                        colconv.ConvertFrom (null, CultureInfo.InvariantCulture,
@@ -309,6 +362,9 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
+#if TARGET_JVM
+               [NUnit.Framework.Category ("NotWorking")]
+#endif
                public void ConvertFromInvariantString_InvalidNumber ()
                {
                        try {
@@ -338,6 +394,9 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
+#if TARGET_JVM
+               [NUnit.Framework.Category ("NotWorking")]
+#endif
                public void ConvertFromString_InvalidNumber ()
                {
                        try {
@@ -369,8 +428,13 @@ namespace MonoTests.System.Drawing {
 
                [Test]
                public void GetStandardValues () {
-                       Assert.AreEqual (167, colconv.GetStandardValues ().Count);
-                       Assert.AreEqual (167, colconv.GetStandardValues (null).Count);
+#if NET_2_0
+                       Assert.AreEqual ((int)KnownColor.MenuHighlight, colconv.GetStandardValues ().Count);
+                       Assert.AreEqual ((int)KnownColor.MenuHighlight, colconv.GetStandardValues (null).Count);                        
+#else
+                       Assert.AreEqual ((int)KnownColor.YellowGreen, colconv.GetStandardValues ().Count);
+                       Assert.AreEqual ((int)KnownColor.YellowGreen, colconv.GetStandardValues (null).Count);  
+#endif
                }
 
                [Test]