Browse Source

Added tests for VisualBrush.Stretch Uniform*.

Steven Kirk 10 years ago
parent
commit
c0e707a117

+ 74 - 0
tests/Perspex.RenderTests/Media/VisualBrushTests.cs

@@ -132,6 +132,80 @@ namespace Perspex.Direct2D1.RenderTests.Media
             this.CompareImages();
         }
 
+        [Fact]
+        public void VisualBrush_Stretch_Uniform()
+        {
+            Decorator target = new Decorator
+            {
+                Padding = new Thickness(8),
+                Width = 920,
+                Height = 820,
+                Child = new Rectangle
+                {
+                    Fill = new VisualBrush
+                    {
+                        Stretch = Stretch.Uniform,
+                        Visual = new Border
+                        {
+                            Width = 92,
+                            Height = 92,
+                            Background = Brushes.Red,
+                            BorderBrush = Brushes.Black,
+                            BorderThickness = 2,
+                            Child = new TextBlock
+                            {
+                                Text = "Perspex",
+                                FontSize = 12,
+                                FontFamily = "Arial",
+                                HorizontalAlignment = HorizontalAlignment.Center,
+                                VerticalAlignment = VerticalAlignment.Center,
+                            }
+                        }
+                    }
+                }
+            };
+
+            this.RenderToFile(target);
+            this.CompareImages();
+        }
+
+        [Fact]
+        public void VisualBrush_Stretch_UniformToFill()
+        {
+            Decorator target = new Decorator
+            {
+                Padding = new Thickness(8),
+                Width = 920,
+                Height = 820,
+                Child = new Rectangle
+                {
+                    Fill = new VisualBrush
+                    {
+                        Stretch = Stretch.UniformToFill,
+                        Visual = new Border
+                        {
+                            Width = 92,
+                            Height = 92,
+                            Background = Brushes.Red,
+                            BorderBrush = Brushes.Black,
+                            BorderThickness = 2,
+                            Child = new TextBlock
+                            {
+                                Text = "Perspex",
+                                FontSize = 12,
+                                FontFamily = "Arial",
+                                HorizontalAlignment = HorizontalAlignment.Center,
+                                VerticalAlignment = VerticalAlignment.Center,
+                            }
+                        }
+                    }
+                }
+            };
+
+            this.RenderToFile(target);
+            this.CompareImages();
+        }
+
         ////[Fact]
         ////public void VisualBrush_Line_Fill()
         ////{

BIN
tests/TestFiles/Direct2D1/Media/VisualBrush/VisualBrush_Stretch_Uniform.expected.png


BIN
tests/TestFiles/Direct2D1/Media/VisualBrush/VisualBrush_Stretch_UniformToFill.expected.png