Răsfoiți Sursa

Merge pull request #97 from ncarrillo/gradient-brush

LinearGradientBrush render test
Steven Kirk 10 ani în urmă
părinte
comite
9ce8cafb61

+ 45 - 0
tests/Perspex.RenderTests/Media/LinearGradientBrushTests.cs

@@ -0,0 +1,45 @@
+namespace Perspex.Direct2D1.RenderTests.Media
+{
+    using Perspex.Controls;
+    using Perspex.Media;
+    using System;
+    using System.Collections.Generic;
+    using System.Linq;
+    using System.Text;
+    using System.Threading.Tasks;
+    using Xunit;
+
+    public class LinearGradientBrushTests : TestBase
+    {
+        public LinearGradientBrushTests() : base(@"Media\LinearGradientBrush")
+        {
+        }
+
+        [Fact]
+        public void LinearGradientBrush_RedBlue_Fill()
+        {
+            Decorator target = new Decorator
+            {
+                Padding = new Thickness(8),
+                Width = 200,
+                Height = 200,
+                Child = new Border
+                {
+                    Background = new LinearGradientBrush
+                    {
+                        StartPoint = new Point(0, 0.5),
+                        EndPoint = new Point(1, 0.5),
+                        GradientStops =
+                        {
+                            new GradientStop { Color = Colors.Red, Offset = 0 },
+                            new GradientStop { Color = Colors.Blue, Offset = 1 }
+                        }
+                    }
+                }
+            };
+
+            this.RenderToFile(target);
+            this.CompareImages();
+        }
+    }
+}

+ 1 - 0
tests/Perspex.RenderTests/Perspex.Direct2D1.RenderTests.csproj

@@ -80,6 +80,7 @@
     <Compile Include="Controls\ImageTests.cs" />
     <Compile Include="Controls\BorderTests.cs" />
     <Compile Include="GlobalSuppressions.cs" />
+    <Compile Include="Media\LinearGradientBrushTests.cs" />
     <Compile Include="Shapes\PathTests.cs" />
     <Compile Include="Shapes\EllipseTests.cs" />
     <Compile Include="Shapes\RectangleTests.cs" />

BIN
tests/TestFiles/Direct2D1/Media/LinearGradientBrush/LinearGradientBrush_RedBlue_Fill.expected.png