|
|
@@ -45,6 +45,7 @@ namespace MonoTests.System.Drawing.Drawing2D {
|
|
|
private Color c2;
|
|
|
private LinearGradientBrush default_brush;
|
|
|
private Matrix empty_matrix;
|
|
|
+ private RectangleF rect;
|
|
|
|
|
|
[TestFixtureSetUp]
|
|
|
public void FixtureSetUp ()
|
|
|
@@ -55,6 +56,7 @@ namespace MonoTests.System.Drawing.Drawing2D {
|
|
|
c2 = Color.Red;
|
|
|
default_brush = new LinearGradientBrush (pt1, pt2, c1, c2);
|
|
|
empty_matrix = new Matrix ();
|
|
|
+ rect = new RectangleF (0, 0, 32, 32);
|
|
|
}
|
|
|
|
|
|
private void CheckDefaultRectangle (string msg, RectangleF rect)
|
|
|
@@ -65,17 +67,6 @@ namespace MonoTests.System.Drawing.Drawing2D {
|
|
|
Assert.AreEqual (pt2.Y, rect.Height, msg + ".Rectangle.Height");
|
|
|
}
|
|
|
|
|
|
- private void CheckEmptyMatrix (Matrix matrix)
|
|
|
- {
|
|
|
- float[] elements = matrix.Elements;
|
|
|
- Assert.AreEqual (1, elements[0], "matrix.0");
|
|
|
- Assert.AreEqual (0, elements[1], "matrix.1");
|
|
|
- Assert.AreEqual (0, elements[2], "matrix.2");
|
|
|
- Assert.AreEqual (1, elements[3], 0.1, "matrix.3");
|
|
|
- Assert.AreEqual (0, elements[4], "matrix.4");
|
|
|
- Assert.AreEqual (0, elements[5], "matrix.5");
|
|
|
- }
|
|
|
-
|
|
|
private void CheckDefaultMatrix (Matrix matrix)
|
|
|
{
|
|
|
float[] elements = matrix.Elements;
|
|
|
@@ -87,19 +78,25 @@ namespace MonoTests.System.Drawing.Drawing2D {
|
|
|
Assert.AreEqual (-16, elements[5], "matrix.5");
|
|
|
}
|
|
|
|
|
|
- [Test]
|
|
|
- [NUnit.Framework.Category ("NotWorking")]
|
|
|
- public void Constructor4 ()
|
|
|
+ private void CheckBrushAt45 (LinearGradientBrush lgb)
|
|
|
{
|
|
|
- LinearGradientBrush lgb = new LinearGradientBrush (pt1, pt2, c1, c2);
|
|
|
CheckDefaultRectangle ("4", lgb.Rectangle);
|
|
|
Assert.AreEqual (1, lgb.Blend.Factors.Length, "Blend.Factors");
|
|
|
- Assert.AreEqual (1, lgb.Blend.Factors [0], "Blend.Factors [0]");
|
|
|
+ Assert.AreEqual (1, lgb.Blend.Factors[0], "Blend.Factors [0]");
|
|
|
Assert.AreEqual (1, lgb.Blend.Positions.Length, "Blend.Positions");
|
|
|
+ // lgb.Blend.Positions [0] is always small (e-39) but never quite the same
|
|
|
Assert.IsFalse (lgb.GammaCorrection, "GammaCorrection");
|
|
|
Assert.AreEqual (2, lgb.LinearColors.Length, "LinearColors");
|
|
|
Assert.IsNotNull (lgb.Transform, "Transform");
|
|
|
CheckDefaultMatrix (lgb.Transform);
|
|
|
+ }
|
|
|
+
|
|
|
+ [Test]
|
|
|
+ [NUnit.Framework.Category ("NotWorking")]
|
|
|
+ public void Constructor_Point_Point_Color_Color ()
|
|
|
+ {
|
|
|
+ LinearGradientBrush lgb = new LinearGradientBrush (pt1, pt2, c1, c2);
|
|
|
+ CheckBrushAt45 (lgb);
|
|
|
|
|
|
Assert.AreEqual (WrapMode.Tile, lgb.WrapMode, "WrapMode.Tile");
|
|
|
lgb.WrapMode = WrapMode.TileFlipX;
|
|
|
@@ -111,6 +108,147 @@ namespace MonoTests.System.Drawing.Drawing2D {
|
|
|
// can't set WrapMode.Clamp
|
|
|
}
|
|
|
|
|
|
+ [Test]
|
|
|
+ public void Constructor_RectangleF_Color_Color_Single_0 ()
|
|
|
+ {
|
|
|
+ LinearGradientBrush lgb = new LinearGradientBrush (rect, c1, c2, 0f);
|
|
|
+ Assert.AreEqual (1, lgb.Blend.Factors.Length, "Blend.Factors");
|
|
|
+ Assert.AreEqual (1, lgb.Blend.Factors[0], "Blend.Factors[0]");
|
|
|
+ Assert.AreEqual (1, lgb.Blend.Positions.Length, "Blend.Positions");
|
|
|
+ // lgb.Blend.Positions [0] is always small (e-39) but never quite the same
|
|
|
+ Assert.IsFalse (lgb.GammaCorrection, "GammaCorrection");
|
|
|
+ Assert.AreEqual (c1.ToArgb (), lgb.LinearColors[0].ToArgb (), "LinearColors[0]");
|
|
|
+ Assert.AreEqual (c2.ToArgb (), lgb.LinearColors[1].ToArgb (), "LinearColors[1]");
|
|
|
+ Assert.AreEqual (rect, lgb.Rectangle, "Rectangle");
|
|
|
+ Assert.IsTrue (lgb.Transform.IsIdentity, "Transform.IsIdentity");
|
|
|
+ Assert.AreEqual (WrapMode.Tile, lgb.WrapMode, "WrapMode");
|
|
|
+
|
|
|
+ Matrix matrix = new Matrix (2, -1, 1, 2, 10, 10);
|
|
|
+ lgb.Transform = matrix;
|
|
|
+ Assert.AreEqual (matrix, lgb.Transform, "Transform");
|
|
|
+ }
|
|
|
+
|
|
|
+ [Test]
|
|
|
+ [NUnit.Framework.Category ("NotWorking")]
|
|
|
+ public void Constructor_RectangleF_Color_Color_Single_22_5 ()
|
|
|
+ {
|
|
|
+ LinearGradientBrush lgb = new LinearGradientBrush (rect, c1, c2, 22.5f);
|
|
|
+ float[] elements = lgb.Transform.Elements;
|
|
|
+ Assert.AreEqual (1.207107, elements[0], 0.0001, "matrix.0");
|
|
|
+ Assert.AreEqual (0.5, elements[1], 0.0001, "matrix.1");
|
|
|
+ Assert.AreEqual (-0.5, elements[2], 0.0001, "matrix.2");
|
|
|
+ Assert.AreEqual (1.207107, elements[3], 0.0001, "matrix.3");
|
|
|
+ Assert.AreEqual (4.686291, elements[4], 0.0001, "matrix.4");
|
|
|
+ Assert.AreEqual (-11.313709, elements[5], 0.0001, "matrix.5");
|
|
|
+ }
|
|
|
+
|
|
|
+ [Test]
|
|
|
+ [NUnit.Framework.Category ("NotWorking")]
|
|
|
+ public void Constructor_RectangleF_Color_Color_Single_45 ()
|
|
|
+ {
|
|
|
+ LinearGradientBrush lgb = new LinearGradientBrush (rect, c1, c2, 45f);
|
|
|
+ CheckBrushAt45 (lgb);
|
|
|
+ }
|
|
|
+
|
|
|
+ [Test]
|
|
|
+ [NUnit.Framework.Category ("NotWorking")]
|
|
|
+ public void Constructor_RectangleF_Color_Color_Single_90 ()
|
|
|
+ {
|
|
|
+ LinearGradientBrush lgb = new LinearGradientBrush (rect, c1, c2, 90f);
|
|
|
+ float[] elements = lgb.Transform.Elements;
|
|
|
+ Assert.AreEqual (0, elements[0], 0.0001, "matrix.0");
|
|
|
+ Assert.AreEqual (1, elements[1], 0.0001, "matrix.1");
|
|
|
+ Assert.AreEqual (-1, elements[2], 0.0001, "matrix.2");
|
|
|
+ Assert.AreEqual (0, elements[3], 0.0001, "matrix.3");
|
|
|
+ Assert.AreEqual (32, elements[4], 0.0001, "matrix.4");
|
|
|
+ Assert.AreEqual (0, elements[5], 0.0001, "matrix.5");
|
|
|
+ }
|
|
|
+
|
|
|
+ [Test]
|
|
|
+ [NUnit.Framework.Category ("NotWorking")]
|
|
|
+ public void Constructor_RectangleF_Color_Color_Single_135 ()
|
|
|
+ {
|
|
|
+ LinearGradientBrush lgb = new LinearGradientBrush (rect, c1, c2, 135f);
|
|
|
+ float[] elements = lgb.Transform.Elements;
|
|
|
+ Assert.AreEqual (-1, elements[0], 0.0001, "matrix.0");
|
|
|
+ Assert.AreEqual (1, elements[1], 0.0001, "matrix.1");
|
|
|
+ Assert.AreEqual (-1, elements[2], 0.0001, "matrix.2");
|
|
|
+ Assert.AreEqual (-1, elements[3], 0.0001, "matrix.3");
|
|
|
+ Assert.AreEqual (48, elements[4], 0.0001, "matrix.4");
|
|
|
+ Assert.AreEqual (16, elements[5], 0.0001, "matrix.5");
|
|
|
+ }
|
|
|
+
|
|
|
+ [Test]
|
|
|
+ [NUnit.Framework.Category ("NotWorking")]
|
|
|
+ public void Constructor_RectangleF_Color_Color_Single_180 ()
|
|
|
+ {
|
|
|
+ LinearGradientBrush lgb = new LinearGradientBrush (rect, c1, c2, 180f);
|
|
|
+ float[] elements = lgb.Transform.Elements;
|
|
|
+ Assert.AreEqual (-1, elements[0], 0.0001, "matrix.0");
|
|
|
+ Assert.AreEqual (0, elements[1], 0.0001, "matrix.1");
|
|
|
+ Assert.AreEqual (0, elements[2], 0.0001, "matrix.2");
|
|
|
+ Assert.AreEqual (-1, elements[3], 0.0001, "matrix.3");
|
|
|
+ Assert.AreEqual (32, elements[4], 0.0001, "matrix.4");
|
|
|
+ Assert.AreEqual (32, elements[5], 0.0001, "matrix.5");
|
|
|
+ }
|
|
|
+
|
|
|
+ [Test]
|
|
|
+ [NUnit.Framework.Category ("NotWorking")]
|
|
|
+ public void Constructor_RectangleF_Color_Color_Single_270 ()
|
|
|
+ {
|
|
|
+ LinearGradientBrush lgb = new LinearGradientBrush (rect, c1, c2, 270f);
|
|
|
+ float[] elements = lgb.Transform.Elements;
|
|
|
+ Assert.AreEqual (0, elements[0], 0.0001, "matrix.0");
|
|
|
+ Assert.AreEqual (-1, elements[1], 0.0001, "matrix.1");
|
|
|
+ Assert.AreEqual (1, elements[2], 0.0001, "matrix.2");
|
|
|
+ Assert.AreEqual (0, elements[3], 0.0001, "matrix.3");
|
|
|
+ Assert.AreEqual (0, elements[4], 0.0001, "matrix.4");
|
|
|
+ Assert.AreEqual (32, elements[5], 0.0001, "matrix.5");
|
|
|
+ }
|
|
|
+
|
|
|
+ [Test]
|
|
|
+ [NUnit.Framework.Category ("NotWorking")]
|
|
|
+ public void Constructor_RectangleF_Color_Color_Single_315 ()
|
|
|
+ {
|
|
|
+ LinearGradientBrush lgb = new LinearGradientBrush (rect, c1, c2, 315f);
|
|
|
+ float[] elements = lgb.Transform.Elements;
|
|
|
+ Assert.AreEqual (1, elements[0], 0.0001, "matrix.0");
|
|
|
+ Assert.AreEqual (-1, elements[1], 0.0001, "matrix.1");
|
|
|
+ Assert.AreEqual (1, elements[2], 0.0001, "matrix.2");
|
|
|
+ Assert.AreEqual (1, elements[3], 0.0001, "matrix.3");
|
|
|
+ Assert.AreEqual (-16, elements[4], 0.0001, "matrix.4");
|
|
|
+ Assert.AreEqual (16, elements[5], 0.0001, "matrix.5");
|
|
|
+ }
|
|
|
+
|
|
|
+ [Test]
|
|
|
+ public void Constructor_RectangleF_Color_Color_Single_360()
|
|
|
+ {
|
|
|
+ LinearGradientBrush lgb = new LinearGradientBrush (rect, c1, c2, 360f);
|
|
|
+ float[] elements = lgb.Transform.Elements;
|
|
|
+ // just like 0'
|
|
|
+ Assert.AreEqual (1, elements[0], 0.0001, "matrix.0");
|
|
|
+ Assert.AreEqual (0, elements[1], 0.0001, "matrix.1");
|
|
|
+ Assert.AreEqual (0, elements[2], 0.0001, "matrix.2");
|
|
|
+ Assert.AreEqual (1, elements[3], 0.0001, "matrix.3");
|
|
|
+ Assert.AreEqual (0, elements[4], 0.0001, "matrix.4");
|
|
|
+ Assert.AreEqual (0, elements[5], 0.0001, "matrix.5");
|
|
|
+ }
|
|
|
+
|
|
|
+ [Test]
|
|
|
+ [NUnit.Framework.Category ("NotWorking")]
|
|
|
+ public void Constructor_RectangleF_Color_Color_Single_540 ()
|
|
|
+ {
|
|
|
+ LinearGradientBrush lgb = new LinearGradientBrush (rect, c1, c2, 540f);
|
|
|
+ float[] elements = lgb.Transform.Elements;
|
|
|
+ // just like 180'
|
|
|
+ Assert.AreEqual (-1, elements[0], 0.0001, "matrix.0");
|
|
|
+ Assert.AreEqual (0, elements[1], 0.0001, "matrix.1");
|
|
|
+ Assert.AreEqual (0, elements[2], 0.0001, "matrix.2");
|
|
|
+ Assert.AreEqual (-1, elements[3], 0.0001, "matrix.3");
|
|
|
+ Assert.AreEqual (32, elements[4], 0.0001, "matrix.4");
|
|
|
+ Assert.AreEqual (32, elements[5], 0.0001, "matrix.5");
|
|
|
+ }
|
|
|
+
|
|
|
[Test]
|
|
|
[ExpectedException (typeof (ArgumentException))]
|
|
|
public void InterpolationColors_Colors_InvalidBlend ()
|
|
|
@@ -176,7 +314,14 @@ namespace MonoTests.System.Drawing.Drawing2D {
|
|
|
{
|
|
|
LinearGradientBrush lgb = new LinearGradientBrush (pt1, pt2, c1, c2);
|
|
|
lgb.Transform = new Matrix ();
|
|
|
- CheckEmptyMatrix (lgb.Transform);
|
|
|
+ Assert.IsTrue (lgb.Transform.IsIdentity, "Transform.IsIdentity");
|
|
|
+ }
|
|
|
+
|
|
|
+ [Test]
|
|
|
+ [ExpectedException (typeof (ArgumentException))]
|
|
|
+ public void Transform_NonInvertible ()
|
|
|
+ {
|
|
|
+ default_brush.Transform = new Matrix (123, 24, 82, 16, 47, 30);
|
|
|
}
|
|
|
|
|
|
[Test]
|
|
|
@@ -211,9 +356,16 @@ namespace MonoTests.System.Drawing.Drawing2D {
|
|
|
[Test]
|
|
|
public void Clone ()
|
|
|
{
|
|
|
- CheckDefaultRectangle ("default", default_brush.Rectangle);
|
|
|
- LinearGradientBrush clone = (LinearGradientBrush) default_brush.Clone ();
|
|
|
- CheckDefaultRectangle ("clone", clone.Rectangle);
|
|
|
+ LinearGradientBrush lgb = new LinearGradientBrush (rect, c1, c2, 0f);
|
|
|
+ LinearGradientBrush clone = (LinearGradientBrush) lgb.Clone ();
|
|
|
+ Assert.AreEqual (lgb.Blend.Factors.Length, clone.Blend.Factors.Length, "Blend.Factors.Length");
|
|
|
+ Assert.AreEqual (lgb.Blend.Positions.Length, clone.Blend.Positions.Length, "Blend.Positions.Length");
|
|
|
+ Assert.AreEqual (lgb.GammaCorrection, clone.GammaCorrection, "GammaCorrection");
|
|
|
+ Assert.AreEqual (lgb.LinearColors.Length, clone.LinearColors.Length, "LinearColors.Length");
|
|
|
+ Assert.AreEqual (lgb.LinearColors.Length, clone.LinearColors.Length, "LinearColors.Length");
|
|
|
+ Assert.AreEqual (lgb.Rectangle, clone.Rectangle, "Rectangle");
|
|
|
+ Assert.AreEqual (lgb.Transform, clone.Transform, "Transform");
|
|
|
+ Assert.AreEqual (lgb.WrapMode, clone.WrapMode, "WrapMode");
|
|
|
}
|
|
|
|
|
|
[Test]
|
|
|
@@ -237,59 +389,61 @@ namespace MonoTests.System.Drawing.Drawing2D {
|
|
|
}
|
|
|
|
|
|
[Test]
|
|
|
+ [NUnit.Framework.Category ("NotWorking")]
|
|
|
public void ResetTransform ()
|
|
|
{
|
|
|
LinearGradientBrush lgb = new LinearGradientBrush (pt1, pt2, c1, c2);
|
|
|
+ Assert.IsFalse (lgb.Transform.IsIdentity, "Transform.IsIdentity");
|
|
|
lgb.ResetTransform ();
|
|
|
- CheckEmptyMatrix (lgb.Transform);
|
|
|
+ Assert.IsTrue (lgb.Transform.IsIdentity, "Reset.IsIdentity");
|
|
|
}
|
|
|
|
|
|
[Test]
|
|
|
[NUnit.Framework.Category ("NotWorking")]
|
|
|
public void RotateTransform ()
|
|
|
{
|
|
|
- LinearGradientBrush lgb = new LinearGradientBrush (pt1, pt2, c1, c2);
|
|
|
+ LinearGradientBrush lgb = new LinearGradientBrush (rect, c1, c2, 0f);
|
|
|
lgb.RotateTransform (90);
|
|
|
float[] elements = lgb.Transform.Elements;
|
|
|
- Assert.AreEqual (-1, elements[0], 0.1, "matrix.0");
|
|
|
+ Assert.AreEqual (0, elements[0], 0.1, "matrix.0");
|
|
|
Assert.AreEqual (1, elements[1], 0.1, "matrix.1");
|
|
|
Assert.AreEqual (-1, elements[2], 0.1, "matrix.2");
|
|
|
- Assert.AreEqual (-1, elements[3], 0.1, "matrix.3");
|
|
|
- Assert.AreEqual (16, elements[4], 0.1, "matrix.4");
|
|
|
- Assert.AreEqual (-16, elements[5], 0.1, "matrix.5");
|
|
|
+ Assert.AreEqual (0, elements[3], 0.1, "matrix.3");
|
|
|
+ Assert.AreEqual (0, elements[4], 0.1, "matrix.4");
|
|
|
+ Assert.AreEqual (0, elements[5], 0.1, "matrix.5");
|
|
|
|
|
|
lgb.RotateTransform (270);
|
|
|
- CheckDefaultMatrix (lgb.Transform);
|
|
|
+ Assert.IsTrue (lgb.Transform.IsIdentity, "Transform.IsIdentity");
|
|
|
}
|
|
|
|
|
|
[Test]
|
|
|
[NUnit.Framework.Category ("NotWorking")]
|
|
|
public void RotateTransform_Max ()
|
|
|
{
|
|
|
- LinearGradientBrush lgb = new LinearGradientBrush (pt1, pt2, c1, c2);
|
|
|
+ LinearGradientBrush lgb = new LinearGradientBrush (rect, c1, c2, 0f);
|
|
|
lgb.RotateTransform (Single.MaxValue);
|
|
|
float[] elements = lgb.Transform.Elements;
|
|
|
- Assert.AreEqual (-1.69580966E+30, elements[0], 1e25, "matrix.0");
|
|
|
- Assert.AreEqual (1.18780928E+37, elements[1], 1e32, "matrix.1");
|
|
|
- Assert.AreEqual (-1.18780953E+37, elements[2], 1e32, "matrix.2");
|
|
|
- Assert.AreEqual (-2.79830475E+29, elements[3], 1e24, "matrix.3");
|
|
|
- Assert.AreEqual (16, elements[4], 0.1, "matrix.4");
|
|
|
- Assert.AreEqual (-16, elements[5], 0.1, "matrix.5");
|
|
|
+ Assert.AreEqual (5.93904E+36, elements[0], 1e32, "matrix.0");
|
|
|
+ Assert.AreEqual (5.93904E+36, elements[1], 1e32, "matrix.1");
|
|
|
+ Assert.AreEqual (-5.93904E+36, elements[2], 1e32, "matrix.2");
|
|
|
+ Assert.AreEqual (5.93904E+36, elements[3], 1e32, "matrix.3");
|
|
|
+ Assert.AreEqual (0, elements[4], 0.1, "matrix.4");
|
|
|
+ Assert.AreEqual (0, elements[5], 0.1, "matrix.5");
|
|
|
}
|
|
|
|
|
|
[Test]
|
|
|
[NUnit.Framework.Category ("NotWorking")]
|
|
|
public void RotateTransform_Min ()
|
|
|
{
|
|
|
- LinearGradientBrush lgb = new LinearGradientBrush (pt1, pt2, c1, c2);
|
|
|
+ LinearGradientBrush lgb = new LinearGradientBrush (rect, c1, c2, 0f);
|
|
|
lgb.RotateTransform (Single.MinValue);
|
|
|
float[] elements = lgb.Transform.Elements;
|
|
|
- Assert.AreEqual (1.06198436E+30, elements[0], 1e25, "matrix.0");
|
|
|
- Assert.AreEqual (-1.18780953E+37, elements[1], 1e32, "matrix.1");
|
|
|
- Assert.AreEqual (1.1878094E+37, elements[2], 1e32, "matrix.2");
|
|
|
- Assert.AreEqual (-3.53994825E+29, elements[3], 1e24, "matrix.3");
|
|
|
- Assert.AreEqual (16, elements[4], 0.1, "matrix.4");
|
|
|
- Assert.AreEqual (-16, elements[5], 0.1, "matrix.5");
|
|
|
+ Assert.AreEqual (-5.93904E+36, elements[0], 1e32, "matrix.0");
|
|
|
+ Assert.AreEqual (-5.93904E+36, elements[1], 1e32, "matrix.1");
|
|
|
+ Assert.AreEqual (5.93904E+36, elements[2], 1e32, "matrix.2");
|
|
|
+ Assert.AreEqual (-5.93904E+36, elements[3], 1e32, "matrix.3");
|
|
|
+ Assert.AreEqual (0, elements[4], 0.1, "matrix.4");
|
|
|
+ Assert.AreEqual (0, elements[5], 0.1, "matrix.5");
|
|
|
}
|
|
|
|
|
|
[Test]
|
|
|
@@ -301,36 +455,34 @@ namespace MonoTests.System.Drawing.Drawing2D {
|
|
|
}
|
|
|
|
|
|
[Test]
|
|
|
- [NUnit.Framework.Category ("NotWorking")]
|
|
|
public void ScaleTransform ()
|
|
|
{
|
|
|
- LinearGradientBrush lgb = new LinearGradientBrush (pt1, pt2, c1, c2);
|
|
|
+ LinearGradientBrush lgb = new LinearGradientBrush (rect, c1, c2, 0f);
|
|
|
lgb.ScaleTransform (2, 4);
|
|
|
float[] elements = lgb.Transform.Elements;
|
|
|
Assert.AreEqual (2, elements[0], 0.1, "matrix.0");
|
|
|
- Assert.AreEqual (2, elements[1], 0.1, "matrix.1");
|
|
|
- Assert.AreEqual (-4, elements[2], 0.1, "matrix.2");
|
|
|
+ Assert.AreEqual (0, elements[1], 0.1, "matrix.1");
|
|
|
+ Assert.AreEqual (0, elements[2], 0.1, "matrix.2");
|
|
|
Assert.AreEqual (4, elements[3], 0.1, "matrix.3");
|
|
|
- Assert.AreEqual (16, elements[4], 0.1, "matrix.4");
|
|
|
- Assert.AreEqual (-16, elements[5], 0.1, "matrix.5");
|
|
|
+ Assert.AreEqual (0, elements[4], 0.1, "matrix.4");
|
|
|
+ Assert.AreEqual (0, elements[5], 0.1, "matrix.5");
|
|
|
|
|
|
lgb.ScaleTransform (0.5f, 0.25f);
|
|
|
- CheckDefaultMatrix (lgb.Transform);
|
|
|
+ Assert.IsTrue (lgb.Transform.IsIdentity, "Transform.IsIdentity");
|
|
|
}
|
|
|
|
|
|
[Test]
|
|
|
- [NUnit.Framework.Category ("NotWorking")]
|
|
|
public void ScaleTransform_MaxMin ()
|
|
|
{
|
|
|
- LinearGradientBrush lgb = new LinearGradientBrush (pt1, pt2, c1, c2);
|
|
|
+ LinearGradientBrush lgb = new LinearGradientBrush (rect, c1, c2, 0f);
|
|
|
lgb.ScaleTransform (Single.MaxValue, Single.MinValue);
|
|
|
float[] elements = lgb.Transform.Elements;
|
|
|
Assert.AreEqual (Single.MaxValue, elements[0], 1e33, "matrix.0");
|
|
|
- Assert.AreEqual (Single.MaxValue, elements[1], 1e33, "matrix.1");
|
|
|
- Assert.AreEqual (Single.MaxValue, elements[2], 1e33, "matrix.2");
|
|
|
+ Assert.AreEqual (0, elements[1], 0.1, "matrix.1");
|
|
|
+ Assert.AreEqual (0, elements[2], 0.1, "matrix.2");
|
|
|
Assert.AreEqual (Single.MinValue, elements[3], 1e33, "matrix.3");
|
|
|
- Assert.AreEqual (16, elements[4], 0.1, "matrix.4");
|
|
|
- Assert.AreEqual (-16, elements[5], 0.1, "matrix.5");
|
|
|
+ Assert.AreEqual (0, elements[4], 0.1, "matrix.4");
|
|
|
+ Assert.AreEqual (0, elements[5], 0.1, "matrix.5");
|
|
|
}
|
|
|
|
|
|
[Test]
|
|
|
@@ -342,36 +494,34 @@ namespace MonoTests.System.Drawing.Drawing2D {
|
|
|
}
|
|
|
|
|
|
[Test]
|
|
|
- [NUnit.Framework.Category ("NotWorking")]
|
|
|
public void SetBlendTriangularShape_Focus ()
|
|
|
{
|
|
|
- LinearGradientBrush lgb = new LinearGradientBrush (pt1, pt2, c1, c2);
|
|
|
+ LinearGradientBrush lgb = new LinearGradientBrush (rect, c1, c2, 0f);
|
|
|
// max valid
|
|
|
lgb.SetBlendTriangularShape (1);
|
|
|
- CheckDefaultMatrix (lgb.Transform);
|
|
|
+ Assert.IsTrue (lgb.Transform.IsIdentity, "Transform.IsIdentity-1");
|
|
|
// min valid
|
|
|
lgb.SetBlendTriangularShape (0);
|
|
|
- CheckDefaultMatrix (lgb.Transform);
|
|
|
+ Assert.IsTrue (lgb.Transform.IsIdentity, "Transform.IsIdentity-1");
|
|
|
// middle
|
|
|
lgb.SetBlendTriangularShape (0.5f);
|
|
|
- CheckDefaultMatrix (lgb.Transform);
|
|
|
+ Assert.IsTrue (lgb.Transform.IsIdentity, "Transform.IsIdentity-1");
|
|
|
// no impact on matrix
|
|
|
}
|
|
|
|
|
|
[Test]
|
|
|
- [NUnit.Framework.Category ("NotWorking")]
|
|
|
public void SetBlendTriangularShape_Scale ()
|
|
|
{
|
|
|
- LinearGradientBrush lgb = new LinearGradientBrush (pt1, pt2, c1, c2);
|
|
|
+ LinearGradientBrush lgb = new LinearGradientBrush (rect, c1, c2, 0f);
|
|
|
// max valid
|
|
|
lgb.SetBlendTriangularShape (0, 1);
|
|
|
- CheckDefaultMatrix (lgb.Transform);
|
|
|
+ Assert.IsTrue (lgb.Transform.IsIdentity, "Transform.IsIdentity-1");
|
|
|
// min valid
|
|
|
lgb.SetBlendTriangularShape (1, 0);
|
|
|
- CheckDefaultMatrix (lgb.Transform);
|
|
|
+ Assert.IsTrue (lgb.Transform.IsIdentity, "Transform.IsIdentity-1");
|
|
|
// middle
|
|
|
lgb.SetBlendTriangularShape (0.5f, 0.5f);
|
|
|
- CheckDefaultMatrix (lgb.Transform);
|
|
|
+ Assert.IsTrue (lgb.Transform.IsIdentity, "Transform.IsIdentity-1");
|
|
|
// no impact on matrix
|
|
|
}
|
|
|
|
|
|
@@ -404,36 +554,34 @@ namespace MonoTests.System.Drawing.Drawing2D {
|
|
|
}
|
|
|
|
|
|
[Test]
|
|
|
- [NUnit.Framework.Category ("NotWorking")]
|
|
|
public void SetSigmaBellShape_Focus ()
|
|
|
{
|
|
|
- LinearGradientBrush lgb = new LinearGradientBrush (pt1, pt2, c1, c2);
|
|
|
+ LinearGradientBrush lgb = new LinearGradientBrush (rect, c1, c2, 0f);
|
|
|
// max valid
|
|
|
lgb.SetSigmaBellShape (1);
|
|
|
- CheckDefaultMatrix (lgb.Transform);
|
|
|
+ Assert.IsTrue (lgb.Transform.IsIdentity, "Transform.IsIdentity-1");
|
|
|
// min valid
|
|
|
lgb.SetSigmaBellShape (0);
|
|
|
- CheckDefaultMatrix (lgb.Transform);
|
|
|
+ Assert.IsTrue (lgb.Transform.IsIdentity, "Transform.IsIdentity-1");
|
|
|
// middle
|
|
|
lgb.SetSigmaBellShape (0.5f);
|
|
|
- CheckDefaultMatrix (lgb.Transform);
|
|
|
+ Assert.IsTrue (lgb.Transform.IsIdentity, "Transform.IsIdentity-1");
|
|
|
// no impact on matrix
|
|
|
}
|
|
|
|
|
|
[Test]
|
|
|
- [NUnit.Framework.Category ("NotWorking")]
|
|
|
public void SetSigmaBellShape_Scale ()
|
|
|
{
|
|
|
- LinearGradientBrush lgb = new LinearGradientBrush (pt1, pt2, c1, c2);
|
|
|
+ LinearGradientBrush lgb = new LinearGradientBrush (rect, c1, c2, 0f);
|
|
|
// max valid
|
|
|
lgb.SetSigmaBellShape (0, 1);
|
|
|
- CheckDefaultMatrix (lgb.Transform);
|
|
|
+ Assert.IsTrue (lgb.Transform.IsIdentity, "Transform.IsIdentity-1");
|
|
|
// min valid
|
|
|
lgb.SetSigmaBellShape (1, 0);
|
|
|
- CheckDefaultMatrix (lgb.Transform);
|
|
|
+ Assert.IsTrue (lgb.Transform.IsIdentity, "Transform.IsIdentity-2");
|
|
|
// middle
|
|
|
lgb.SetSigmaBellShape (0.5f, 0.5f);
|
|
|
- CheckDefaultMatrix (lgb.Transform);
|
|
|
+ Assert.IsTrue (lgb.Transform.IsIdentity, "Transform.IsIdentity-3");
|
|
|
// no impact on matrix
|
|
|
}
|
|
|
|
|
|
@@ -466,21 +614,27 @@ namespace MonoTests.System.Drawing.Drawing2D {
|
|
|
}
|
|
|
|
|
|
[Test]
|
|
|
- [NUnit.Framework.Category ("NotWorking")]
|
|
|
public void TranslateTransform ()
|
|
|
{
|
|
|
- LinearGradientBrush lgb = new LinearGradientBrush (pt1, pt2, c1, c2);
|
|
|
+ LinearGradientBrush lgb = new LinearGradientBrush (rect, c1, c2, 0f);
|
|
|
lgb.TranslateTransform (1, 1);
|
|
|
float[] elements = lgb.Transform.Elements;
|
|
|
Assert.AreEqual (1, elements[0], 0.1, "matrix.0");
|
|
|
- Assert.AreEqual (1, elements[1], 0.1, "matrix.1");
|
|
|
- Assert.AreEqual (-1, elements[2], 0.1, "matrix.2");
|
|
|
+ Assert.AreEqual (0, elements[1], 0.1, "matrix.1");
|
|
|
+ Assert.AreEqual (0, elements[2], 0.1, "matrix.2");
|
|
|
Assert.AreEqual (1, elements[3], 0.1, "matrix.3");
|
|
|
- Assert.AreEqual (16, elements[4], 0.1, "matrix.4");
|
|
|
- Assert.AreEqual (-14, elements[5], 0.1, "matrix.5");
|
|
|
+ Assert.AreEqual (1, elements[4], 0.1, "matrix.4");
|
|
|
+ Assert.AreEqual (1, elements[5], 0.1, "matrix.5");
|
|
|
|
|
|
lgb.TranslateTransform (-1, -1);
|
|
|
- CheckDefaultMatrix (lgb.Transform);
|
|
|
+ // strangely lgb.Transform.IsIdentity is false
|
|
|
+ elements = lgb.Transform.Elements;
|
|
|
+ Assert.AreEqual (1, elements[0], 0.1, "revert.matrix.0");
|
|
|
+ Assert.AreEqual (0, elements[1], 0.1, "revert.matrix.1");
|
|
|
+ Assert.AreEqual (0, elements[2], 0.1, "revert.matrix.2");
|
|
|
+ Assert.AreEqual (1, elements[3], 0.1, "revert.matrix.3");
|
|
|
+ Assert.AreEqual (0, elements[4], 0.1, "revert.matrix.4");
|
|
|
+ Assert.AreEqual (0, elements[5], 0.1, "revert.matrix.5");
|
|
|
}
|
|
|
|
|
|
[Test]
|