csharpc-sharpdotnetxamlavaloniauicross-platformcross-platform-xamlavaloniaguimulti-platformuser-interfacedotnetcore
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
115 lines
2.9 KiB
115 lines
2.9 KiB
using System.Threading.Tasks;
|
|
using Avalonia.Controls;
|
|
using Avalonia.Controls.Shapes;
|
|
using Avalonia.Media;
|
|
using Xunit;
|
|
|
|
namespace Avalonia.Skia.RenderTests
|
|
{
|
|
public class RectangleTests : TestBase
|
|
{
|
|
public RectangleTests()
|
|
: base(@"Shapes\Rectangle")
|
|
{
|
|
}
|
|
|
|
[Fact]
|
|
public async Task Rectangle_0px_Stroke()
|
|
{
|
|
Decorator target = new Decorator
|
|
{
|
|
Padding = new Thickness(8),
|
|
Width = 200,
|
|
Height = 200,
|
|
Child = new Rectangle
|
|
{
|
|
Fill = Brushes.Transparent,
|
|
Stroke = Brushes.Black,
|
|
StrokeThickness = 0
|
|
}
|
|
};
|
|
|
|
await RenderToFile(target);
|
|
CompareImages();
|
|
}
|
|
|
|
[Fact]
|
|
public async Task Rectangle_1px_Stroke()
|
|
{
|
|
Decorator target = new Decorator
|
|
{
|
|
Padding = new Thickness(8),
|
|
Width = 200,
|
|
Height = 200,
|
|
Child = new Rectangle
|
|
{
|
|
Stroke = Brushes.Black,
|
|
StrokeThickness = 1,
|
|
}
|
|
};
|
|
|
|
await RenderToFile(target);
|
|
CompareImages();
|
|
}
|
|
|
|
[Fact]
|
|
public async Task Rectangle_2px_Stroke()
|
|
{
|
|
Decorator target = new Decorator
|
|
{
|
|
Padding = new Thickness(8),
|
|
Width = 200,
|
|
Height = 200,
|
|
Child = new Rectangle
|
|
{
|
|
Stroke = Brushes.Black,
|
|
StrokeThickness = 2,
|
|
}
|
|
};
|
|
|
|
await RenderToFile(target);
|
|
CompareImages();
|
|
}
|
|
|
|
[Fact]
|
|
public async Task Rectangle_Stroke_Fill()
|
|
{
|
|
Decorator target = new Decorator
|
|
{
|
|
Padding = new Thickness(8),
|
|
Width = 200,
|
|
Height = 200,
|
|
Child = new Rectangle
|
|
{
|
|
Stroke = Brushes.Black,
|
|
StrokeThickness = 2,
|
|
Fill = Brushes.Red,
|
|
}
|
|
};
|
|
|
|
await RenderToFile(target);
|
|
CompareImages();
|
|
}
|
|
|
|
[Fact]
|
|
public async Task Rectangle_Stroke_Fill_ClipToBounds()
|
|
{
|
|
Decorator target = new Decorator
|
|
{
|
|
Padding = new Thickness(8),
|
|
Width = 200,
|
|
Height = 200,
|
|
Child = new Rectangle
|
|
{
|
|
Stroke = Brushes.Black,
|
|
StrokeThickness = 2,
|
|
Fill = Brushes.Red,
|
|
ClipToBounds = true,
|
|
}
|
|
};
|
|
|
|
await RenderToFile(target);
|
|
CompareImages();
|
|
}
|
|
}
|
|
}
|
|
|