diff --git a/tests/Avalonia.RenderTests/Shapes/PathTests.cs b/tests/Avalonia.RenderTests/Shapes/PathTests.cs index 9250b6a8a0..00d9102581 100644 --- a/tests/Avalonia.RenderTests/Shapes/PathTests.cs +++ b/tests/Avalonia.RenderTests/Shapes/PathTests.cs @@ -24,6 +24,220 @@ namespace Avalonia.Direct2D1.RenderTests.Shapes { } + [Fact] + public void Line_Absolute() + { + Decorator target = new Decorator + { + Width = 200, + Height = 200, + Child = new Path + { + Stroke = Brushes.Red, + StrokeThickness = 1, + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center, + Data = StreamGeometry.Parse("M 10,190 L 190,10 M0,0M200,200"), + } + }; + + RenderToFile(target); + CompareImages(); + } + + [Fact] + public void Line_Relative() + { + Decorator target = new Decorator + { + Width = 200, + Height = 200, + Child = new Path + { + Stroke = Brushes.Red, + StrokeThickness = 1, + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center, + Data = StreamGeometry.Parse("M10,190 l190,-190 M0,0M200,200"), + } + }; + + RenderToFile(target); + CompareImages(); + } + + [Fact] + public void HorizontalLine_Absolute() + { + Decorator target = new Decorator + { + Width = 200, + Height = 200, + Child = new Path + { + Stroke = Brushes.Red, + StrokeThickness = 1, + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center, + Data = StreamGeometry.Parse("M190,100 H10 M0,0M200,200"), + } + }; + + RenderToFile(target); + CompareImages(); + } + + [Fact] + public void HorizontalLine_Relative() + { + Decorator target = new Decorator + { + Width = 200, + Height = 200, + Child = new Path + { + Stroke = Brushes.Red, + StrokeThickness = 1, + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center, + Data = StreamGeometry.Parse("M190,100 h-180 M0,0M200,200"), + } + }; + + RenderToFile(target); + CompareImages(); + } + + [Fact] + public void VerticalLine_Absolute() + { + Decorator target = new Decorator + { + Width = 200, + Height = 200, + Child = new Path + { + Stroke = Brushes.Red, + StrokeThickness = 1, + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center, + Data = StreamGeometry.Parse("M100,190 V10 M0,0M200,200"), + } + }; + + RenderToFile(target); + CompareImages(); + } + + [Fact] + public void VerticalLine_Relative() + { + Decorator target = new Decorator + { + Width = 200, + Height = 200, + Child = new Path + { + Stroke = Brushes.Red, + StrokeThickness = 1, + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center, + Data = StreamGeometry.Parse("M100,190 V-180 M0,0M200,200"), + } + }; + + RenderToFile(target); + CompareImages(); + } + + [Fact] + public void CubicBezier_Absolute() + { + Decorator target = new Decorator + { + Width = 200, + Height = 200, + Child = new Path + { + Fill = Brushes.Gray, + Stroke = Brushes.Red, + StrokeThickness = 1, + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center, + Data = StreamGeometry.Parse("M190,0 C10,10 190,190 10,190 M0,0M200,200"), + } + }; + + RenderToFile(target); + CompareImages(); + } + + [Fact] + public void CubicBezier_Relative() + { + Decorator target = new Decorator + { + Width = 200, + Height = 200, + Child = new Path + { + Fill = Brushes.Gray, + Stroke = Brushes.Red, + StrokeThickness = 1, + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center, + Data = StreamGeometry.Parse("M190,0 c-180,10 0,190 -180,190 M0,0M200,200"), + } + }; + + RenderToFile(target); + CompareImages(); + } + + [Fact] + public void Arc_Absolute() + { + Decorator target = new Decorator + { + Width = 200, + Height = 200, + Child = new Path + { + Fill = Brushes.Gray, + Stroke = Brushes.Red, + StrokeThickness = 1, + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center, + Data = StreamGeometry.Parse("M190,100 A90,90 0 1,0 10,100 M0,0M200,200"), + } + }; + + RenderToFile(target); + CompareImages(); + } + + [Fact] + public void Arc_Relative() + { + Decorator target = new Decorator + { + Width = 200, + Height = 200, + Child = new Path + { + Fill = Brushes.Gray, + Stroke = Brushes.Red, + StrokeThickness = 1, + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center, + Data = StreamGeometry.Parse("M190,100 a90,90 0 1,0 -180,0 M0,0M200,200"), + } + }; + + RenderToFile(target); + CompareImages(); + } + [Fact] public void Path_100px_Triangle_Centered() { diff --git a/tests/TestFiles/Direct2D1/Shapes/Path/Arc_Absolute.expected.png b/tests/TestFiles/Direct2D1/Shapes/Path/Arc_Absolute.expected.png new file mode 100644 index 0000000000..113cc908e6 Binary files /dev/null and b/tests/TestFiles/Direct2D1/Shapes/Path/Arc_Absolute.expected.png differ diff --git a/tests/TestFiles/Direct2D1/Shapes/Path/Arc_Relative.expected.png b/tests/TestFiles/Direct2D1/Shapes/Path/Arc_Relative.expected.png new file mode 100644 index 0000000000..113cc908e6 Binary files /dev/null and b/tests/TestFiles/Direct2D1/Shapes/Path/Arc_Relative.expected.png differ diff --git a/tests/TestFiles/Direct2D1/Shapes/Path/CubicBezier_Absolute.expected.png b/tests/TestFiles/Direct2D1/Shapes/Path/CubicBezier_Absolute.expected.png new file mode 100644 index 0000000000..8c8f5350ee Binary files /dev/null and b/tests/TestFiles/Direct2D1/Shapes/Path/CubicBezier_Absolute.expected.png differ diff --git a/tests/TestFiles/Direct2D1/Shapes/Path/CubicBezier_Relative.expected.png b/tests/TestFiles/Direct2D1/Shapes/Path/CubicBezier_Relative.expected.png new file mode 100644 index 0000000000..8c8f5350ee Binary files /dev/null and b/tests/TestFiles/Direct2D1/Shapes/Path/CubicBezier_Relative.expected.png differ diff --git a/tests/TestFiles/Direct2D1/Shapes/Path/HorizontalLine_Absolute.expected.png b/tests/TestFiles/Direct2D1/Shapes/Path/HorizontalLine_Absolute.expected.png new file mode 100644 index 0000000000..546ffec3bb Binary files /dev/null and b/tests/TestFiles/Direct2D1/Shapes/Path/HorizontalLine_Absolute.expected.png differ diff --git a/tests/TestFiles/Direct2D1/Shapes/Path/HorizontalLine_Relative.expected.png b/tests/TestFiles/Direct2D1/Shapes/Path/HorizontalLine_Relative.expected.png new file mode 100644 index 0000000000..546ffec3bb Binary files /dev/null and b/tests/TestFiles/Direct2D1/Shapes/Path/HorizontalLine_Relative.expected.png differ diff --git a/tests/TestFiles/Direct2D1/Shapes/Path/Line_Absolute.expected.png b/tests/TestFiles/Direct2D1/Shapes/Path/Line_Absolute.expected.png new file mode 100644 index 0000000000..4661a6a8c4 Binary files /dev/null and b/tests/TestFiles/Direct2D1/Shapes/Path/Line_Absolute.expected.png differ diff --git a/tests/TestFiles/Direct2D1/Shapes/Path/Line_Relative.expected.png b/tests/TestFiles/Direct2D1/Shapes/Path/Line_Relative.expected.png new file mode 100644 index 0000000000..4661a6a8c4 Binary files /dev/null and b/tests/TestFiles/Direct2D1/Shapes/Path/Line_Relative.expected.png differ diff --git a/tests/TestFiles/Direct2D1/Shapes/Path/VerticalLine_Absolute.expected.png b/tests/TestFiles/Direct2D1/Shapes/Path/VerticalLine_Absolute.expected.png new file mode 100644 index 0000000000..b2e2beafd4 Binary files /dev/null and b/tests/TestFiles/Direct2D1/Shapes/Path/VerticalLine_Absolute.expected.png differ diff --git a/tests/TestFiles/Direct2D1/Shapes/Path/VerticalLine_Relative.expected.png b/tests/TestFiles/Direct2D1/Shapes/Path/VerticalLine_Relative.expected.png new file mode 100644 index 0000000000..ff36de2a5c Binary files /dev/null and b/tests/TestFiles/Direct2D1/Shapes/Path/VerticalLine_Relative.expected.png differ