From aaed6cab9148eb3e69f3397494415b13daf8f29f Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Fri, 4 Sep 2015 15:34:36 +0200 Subject: [PATCH] Add tests for percent rects on VisualBrush --- .../Media/VisualBrushTests.cs | 38 ++++++++++++++++++ ...eRect_DestinationRect_Percent.expected.png | Bin 0 -> 1996 bytes 2 files changed, 38 insertions(+) create mode 100644 tests/TestFiles/Direct2D1/Media/VisualBrush/VisualBrush_SourceRect_DestinationRect_Percent.expected.png diff --git a/tests/Perspex.RenderTests/Media/VisualBrushTests.cs b/tests/Perspex.RenderTests/Media/VisualBrushTests.cs index 7d32014cc3..4d404cfefd 100644 --- a/tests/Perspex.RenderTests/Media/VisualBrushTests.cs +++ b/tests/Perspex.RenderTests/Media/VisualBrushTests.cs @@ -358,5 +358,43 @@ namespace Perspex.Direct2D1.RenderTests.Media this.RenderToFile(target); this.CompareImages(); } + + [Fact] + public void VisualBrush_SourceRect_DestinationRect_Percent() + { + Decorator target = new Decorator + { + Padding = new Thickness(8), + Width = 200, + Height = 200, + Child = new Rectangle + { + Fill = new VisualBrush + { + SourceRect = new RelativeRect(0.22, 0.22, 0.56, 0.56, OriginUnit.Percent), + DestinationRect = new RelativeRect(0.5, 0.5, 0.5, 0.5, OriginUnit.Percent), + Visual = new Border + { + Width = 180, + Height = 180, + Background = Brushes.Red, + BorderBrush = Brushes.Black, + BorderThickness = 2, + Child = new Ellipse + { + Width = 100, + Height = 100, + Fill = Brushes.Yellow, + VerticalAlignment = VerticalAlignment.Center, + HorizontalAlignment = HorizontalAlignment.Center, + } + } + } + } + }; + + this.RenderToFile(target); + this.CompareImages(); + } } } diff --git a/tests/TestFiles/Direct2D1/Media/VisualBrush/VisualBrush_SourceRect_DestinationRect_Percent.expected.png b/tests/TestFiles/Direct2D1/Media/VisualBrush/VisualBrush_SourceRect_DestinationRect_Percent.expected.png new file mode 100644 index 0000000000000000000000000000000000000000..1aedd35831100ebfdacbde93529d21e50629d698 GIT binary patch literal 1996 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