Added tests for Blend.cs and ColorBlend.cs.
authorRavindra <ravindra@mono-cvs.ximian.com>
Wed, 17 Mar 2004 14:57:46 +0000 (14:57 -0000)
committerRavindra <ravindra@mono-cvs.ximian.com>
Wed, 17 Mar 2004 14:57:46 +0000 (14:57 -0000)
svn path=/trunk/mcs/; revision=24227

mcs/class/System.Drawing/Test/System.Drawing.Drawing2D/ChangeLog
mcs/class/System.Drawing/Test/System.Drawing.Drawing2D/TestBlend.cs [new file with mode: 0644]
mcs/class/System.Drawing/Test/System.Drawing.Drawing2D/TestColorBlend.cs [new file with mode: 0644]

index 655f21cb8389ca07ba780170748dcfd2ee8519bc..e99364de7372ada19742ffdc8f13aa86b5052211 100644 (file)
@@ -1,4 +1,8 @@
-2004-03-17  Ravindra <rkumar@novell.com>
+2004-03-17  Ravindra  <rkumar@novell.com>
+       * TestBlend.cs: Added.
+       * TestColorBlend.cs: Added.
+
+2004-03-17  Ravindra  <rkumar@novell.com>
        * System.Drawing.Drawing2D: Created a repository for
        System.Drawing.Drawing2D tests.
        * ChangeLog: Added.
diff --git a/mcs/class/System.Drawing/Test/System.Drawing.Drawing2D/TestBlend.cs b/mcs/class/System.Drawing/Test/System.Drawing.Drawing2D/TestBlend.cs
new file mode 100644 (file)
index 0000000..8820ebf
--- /dev/null
@@ -0,0 +1,63 @@
+//\r
+// Tests for System.Drawing.Drawing2D.Blend.cs\r
+//\r
+// Author:\r
+//   Ravindra (rkumar@novell.com)\r
+//\r
+// Copyright (C) 2004 Novell, Inc. http://www.novell.com\r
+//
+\r
+using NUnit.Framework;\r
+using System;\r
+using System.Drawing;\r
+using System.Drawing.Drawing2D;\r
+
+namespace MonoTests.System.Drawing
+{
+       [TestFixture]
+       public class BlendTest : Assertion
+       {
+
+               [TearDown]
+               public void TearDown () { }
+
+               [SetUp]
+               public void SetUp () { }
+
+               [Test]
+               public void TestConstructors ()
+               {
+                       Blend blend0 = new Blend ();
+
+                       AssertEquals ("C#1", 1, blend0.Factors.Length);
+                       AssertEquals ("C#2", 1, blend0.Positions.Length);
+
+                       Blend blend1 = new Blend (1);
+
+                       AssertEquals ("C#3", 1, blend1.Factors.Length);
+                       AssertEquals ("C#4", 1, blend1.Positions.Length);
+               }
+
+               [Test]
+               public void TestProperties () 
+               {
+                       Blend blend0 = new Blend ();
+
+                       AssertEquals ("P#1", 0, blend0.Factors[0]);
+                       AssertEquals ("P#2", 0, blend0.Positions[0]);
+
+                       Blend blend1 = new Blend (1);
+                       float[] positions = {0.0F, 0.5F, 1.0F};\r
+                       float[] factors = {0.0F, 0.5F, 1.0F};\r
+                       blend1.Factors = factors;\r
+                       blend1.Positions = positions;\r
+
+                       AssertEquals ("P#3", factors[0], blend1.Factors[0]);
+                       AssertEquals ("P#4", factors[1], blend1.Factors[1]);
+                       AssertEquals ("P#5", factors[2], blend1.Factors[2]);
+                       AssertEquals ("P#6", positions[0], blend1.Positions[0]);
+                       AssertEquals ("P#7", positions[1], blend1.Positions[1]);
+                       AssertEquals ("P#8", positions[2], blend1.Positions[2]);
+               }
+       }\r
+}
diff --git a/mcs/class/System.Drawing/Test/System.Drawing.Drawing2D/TestColorBlend.cs b/mcs/class/System.Drawing/Test/System.Drawing.Drawing2D/TestColorBlend.cs
new file mode 100644 (file)
index 0000000..9fefb80
--- /dev/null
@@ -0,0 +1,63 @@
+//\r
+// Tests for System.Drawing.Drawing2D.ColorBlend.cs\r
+//\r
+// Author:\r
+//   Ravindra (rkumar@novell.com)\r
+//\r
+// Copyright (C) 2004 Novell, Inc. http://www.novell.com\r
+//
+\r
+using NUnit.Framework;\r
+using System;\r
+using System.Drawing;\r
+using System.Drawing.Drawing2D;\r
+
+namespace MonoTests.System.Drawing 
+{
+       [TestFixture]   
+       public class ColorBlendTest : Assertion
+       {
+
+               [TearDown]
+               public void TearDown () { }
+
+               [SetUp]
+               public void SetUp () { }
+
+               [Test]
+               public void TestConstructors ()
+               {
+                       ColorBlend cb0 = new ColorBlend ();
+
+                       AssertEquals ("C#1", 1, cb0.Colors.Length);
+                       AssertEquals ("C#2", 1, cb0.Positions.Length);
+
+                       ColorBlend cb1 = new ColorBlend (1);
+
+                       AssertEquals ("C#3", 1, cb1.Colors.Length);
+                       AssertEquals ("C#4", 1, cb1.Positions.Length);
+               }
+
+               [Test]
+               public void TestProperties () 
+               {
+                       ColorBlend cb0 = new ColorBlend ();
+
+                       AssertEquals ("P#1", Color.Empty, cb0.Colors[0]);
+                       AssertEquals ("P#2", 0, cb0.Positions[0]);
+
+                       ColorBlend cb1 = new ColorBlend (1);
+                       float[] positions = {0.0F, 0.5F, 1.0F};\r
+                       Color[] colors = {Color.Red, Color.White, Color.Black};\r
+                       cb1.Colors = colors;\r
+                       cb1.Positions = positions;\r
+
+                       AssertEquals ("P#3", colors[0], cb1.Colors[0]);
+                       AssertEquals ("P#4", colors[1], cb1.Colors[1]);
+                       AssertEquals ("P#5", colors[2], cb1.Colors[2]);
+                       AssertEquals ("P#6", positions[0], cb1.Positions[0]);
+                       AssertEquals ("P#7", positions[1], cb1.Positions[1]);
+                       AssertEquals ("P#8", positions[2], cb1.Positions[2]);
+               }
+       }\r
+}