TestBlend.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. //
  2. // Tests for System.Drawing.Drawing2D.Blend.cs
  3. //
  4. // Author:
  5. // Ravindra ([email protected])
  6. //
  7. //
  8. // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
  9. //
  10. // Permission is hereby granted, free of charge, to any person obtaining
  11. // a copy of this software and associated documentation files (the
  12. // "Software"), to deal in the Software without restriction, including
  13. // without limitation the rights to use, copy, modify, merge, publish,
  14. // distribute, sublicense, and/or sell copies of the Software, and to
  15. // permit persons to whom the Software is furnished to do so, subject to
  16. // the following conditions:
  17. //
  18. // The above copyright notice and this permission notice shall be
  19. // included in all copies or substantial portions of the Software.
  20. //
  21. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  22. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  23. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  24. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  25. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  26. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  27. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  28. //
  29. using NUnit.Framework;
  30. using System;
  31. using System.Drawing;
  32. using System.Drawing.Drawing2D;
  33. namespace MonoTests.System.Drawing.Drawing2D
  34. {
  35. [TestFixture]
  36. public class BlendTest : Assertion
  37. {
  38. [TearDown]
  39. public void TearDown () { }
  40. [SetUp]
  41. public void SetUp () { }
  42. [Test]
  43. public void TestConstructors ()
  44. {
  45. Blend blend0 = new Blend ();
  46. AssertEquals ("C#1", 1, blend0.Factors.Length);
  47. AssertEquals ("C#2", 1, blend0.Positions.Length);
  48. Blend blend1 = new Blend (1);
  49. AssertEquals ("C#3", 1, blend1.Factors.Length);
  50. AssertEquals ("C#4", 1, blend1.Positions.Length);
  51. }
  52. [Test]
  53. public void TestProperties ()
  54. {
  55. Blend blend0 = new Blend ();
  56. AssertEquals ("P#1", 0, blend0.Factors[0]);
  57. AssertEquals ("P#2", 0, blend0.Positions[0]);
  58. Blend blend1 = new Blend (1);
  59. float[] positions = {0.0F, 0.5F, 1.0F};
  60. float[] factors = {0.0F, 0.5F, 1.0F};
  61. blend1.Factors = factors;
  62. blend1.Positions = positions;
  63. AssertEquals ("P#3", factors[0], blend1.Factors[0]);
  64. AssertEquals ("P#4", factors[1], blend1.Factors[1]);
  65. AssertEquals ("P#5", factors[2], blend1.Factors[2]);
  66. AssertEquals ("P#6", positions[0], blend1.Positions[0]);
  67. AssertEquals ("P#7", positions[1], blend1.Positions[1]);
  68. AssertEquals ("P#8", positions[2], blend1.Positions[2]);
  69. }
  70. }
  71. }