Skip to content

Commit 19394e0

Browse files
authored
Skia - Add a unit test for the dash array calculation (#18001)
1 parent 230e4fd commit 19394e0

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

tests/Avalonia.RenderTests/Shapes/LineTests.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,33 @@ public async Task Line_1px_Stroke_Vertical()
7676
await RenderToFile(target);
7777
CompareImages();
7878
}
79+
80+
[Fact]
81+
public async Task Lines_With_DashArray()
82+
{
83+
var stackPanel = new StackPanel();
84+
85+
stackPanel.Children.Add(new Line() { Margin = new Thickness(8), StrokeThickness = 8, StartPoint = new Point(0, 0), EndPoint = new Point(200, 0), Stroke = Brushes.Black, StrokeDashArray = [1] });
86+
stackPanel.Children.Add(new Line() { Margin = new Thickness(8), StrokeThickness = 8, StartPoint = new Point(0, 0), EndPoint = new Point(200, 0), Stroke = Brushes.Black, StrokeDashArray = [1, 1] });
87+
stackPanel.Children.Add(new Line() { Margin = new Thickness(8), StrokeThickness = 8, StartPoint = new Point(0, 0), EndPoint = new Point(200, 0), Stroke = Brushes.Black, StrokeDashArray = [1, 6] });
88+
stackPanel.Children.Add(new Line() { Margin = new Thickness(8), StrokeThickness = 8, StartPoint = new Point(0, 0), EndPoint = new Point(200, 0), Stroke = Brushes.Black, StrokeDashArray = [6, 1] });
89+
stackPanel.Children.Add(new Line() { Margin = new Thickness(8), StrokeThickness = 8, StartPoint = new Point(0, 0), EndPoint = new Point(200, 0), Stroke = Brushes.Black, StrokeDashArray = [0.25, 1] });
90+
stackPanel.Children.Add(new Line() { Margin = new Thickness(8), StrokeThickness = 8, StartPoint = new Point(0, 0), EndPoint = new Point(200, 0), Stroke = Brushes.Black, StrokeDashArray = [4, 1, 1, 1, 1, 1] });
91+
stackPanel.Children.Add(new Line() { Margin = new Thickness(8), StrokeThickness = 8, StartPoint = new Point(0, 0), EndPoint = new Point(200, 0), Stroke = Brushes.Black, StrokeDashArray = [5, 5, 1, 5] });
92+
stackPanel.Children.Add(new Line() { Margin = new Thickness(8), StrokeThickness = 8, StartPoint = new Point(0, 0), EndPoint = new Point(200, 0), Stroke = Brushes.Black, StrokeDashArray = [1, 2, 4] });
93+
stackPanel.Children.Add(new Line() { Margin = new Thickness(8), StrokeThickness = 8, StartPoint = new Point(0, 0), EndPoint = new Point(200, 0), Stroke = Brushes.Black, StrokeDashArray = [4, 2, 4] });
94+
stackPanel.Children.Add(new Line() { Margin = new Thickness(8), StrokeThickness = 8, StartPoint = new Point(0, 0), EndPoint = new Point(200, 0), Stroke = Brushes.Black, StrokeDashArray = [4, 2, 4, 1, 1] });
95+
96+
97+
Decorator target = new Decorator
98+
{
99+
Width = 200,
100+
Height = 200,
101+
Child = stackPanel
102+
};
103+
104+
await RenderToFile(target);
105+
CompareImages();
106+
}
79107
}
80108
}
Loading
Loading

0 commit comments

Comments
 (0)