public void Background_RadialGradientBrushTest() { var style = new StyleDefn(); style.Background.ImageSource = "radial-gradient(red, green)"; var target = style.CreateBackgroundBrush(); Assert.IsNotNull(target); Assert.IsInstanceOfType(target, typeof(PDFGradientRadialBrush)); PDFGradientRadialBrush gradient = (PDFGradientRadialBrush)target; Assert.AreEqual(2, gradient.Colors.Length); Assert.AreEqual(false, gradient.Repeating); Assert.AreEqual(FillType.Pattern, gradient.FillStyle); style = new StyleDefn(); style.Background.ImageSource = "repeating-radial-gradient(circle, red 10%, green 15%, yellow 25%)"; target = style.CreateBackgroundBrush(); Assert.IsNotNull(target); Assert.IsInstanceOfType(target, typeof(PDFGradientRadialBrush)); gradient = (PDFGradientRadialBrush)target; Assert.AreEqual(RadialShape.Circle, gradient.Shape); Assert.AreEqual(3, gradient.Colors.Length); Assert.AreEqual(true, gradient.Repeating); Assert.AreEqual(FillType.Pattern, gradient.FillStyle); }
public void PDFRadialBrushConstructor_Test() { PDFGradientRadialDescriptor descriptor = new PDFGradientRadialDescriptor(); descriptor.Colors = new List <PDFGradientColor>(new PDFGradientColor[] { new PDFGradientColor(PDFColors.Red, null, null) }); PDFGradientRadialBrush target = new PDFGradientRadialBrush(descriptor); PDFColor color = PDFColors.Red; double? opacity = null; double? distance = null; Assert.IsNotNull(target); Assert.AreEqual(GradientType.Radial, target.GradientType); Assert.AreEqual(false, target.Repeating); //Default Assert.AreEqual(RadialShape.Circle, target.Shape); //Default Assert.AreEqual(color, target.Colors[0].Color); Assert.AreEqual(opacity, target.Colors[0].Opacity); Assert.AreEqual(distance, target.Colors[0].Distance); }