Browse Source

Add more visualbrush tests.

pull/2115/head
Dan Walmsley 8 years ago
parent
commit
53638845a6
  1. 153
      tests/Avalonia.RenderTests/Media/VisualBrushTests.cs
  2. BIN
      tests/TestFiles/Direct2D1/Media/VisualBrush/VisualBrush_Grip_144_Dpi.expected.png
  3. BIN
      tests/TestFiles/Direct2D1/Media/VisualBrush/VisualBrush_Grip_192_Dpi.expected.png
  4. BIN
      tests/TestFiles/Direct2D1/Media/VisualBrush/VisualBrush_Grip_96_Dpi.expected.png
  5. BIN
      tests/TestFiles/Skia/Media/VisualBrush/VisualBrush_Grip_144_Dpi.expected.png
  6. BIN
      tests/TestFiles/Skia/Media/VisualBrush/VisualBrush_Grip_192_Dpi.expected.png
  7. BIN
      tests/TestFiles/Skia/Media/VisualBrush/VisualBrush_Grip_96_Dpi.expected.png

153
tests/Avalonia.RenderTests/Media/VisualBrushTests.cs

@ -450,6 +450,159 @@ namespace Avalonia.Direct2D1.RenderTests.Media
CompareImages();
}
[Fact]
public async Task VisualBrush_Grip_96_Dpi()
{
var target = new Border
{
Width = 100,
Height = 10,
Background = new VisualBrush
{
SourceRect = new RelativeRect(0, 0, 4, 5, RelativeUnit.Absolute),
DestinationRect = new RelativeRect(0, 0, 4, 5, RelativeUnit.Absolute),
TileMode = TileMode.Tile,
Stretch = Stretch.UniformToFill,
Visual = new Canvas
{
Width = 4,
Height = 5,
Background = Brushes.WhiteSmoke,
Children =
{
new Rectangle
{
Width = 1,
Height = 1,
Fill = Brushes.Red,
[Canvas.LeftProperty] = 2,
},
new Rectangle
{
Width = 1,
Height = 1,
Fill = Brushes.Red,
[Canvas.TopProperty] = 2,
},
new Rectangle
{
Width = 1,
Height = 1,
Fill = Brushes.Red,
[Canvas.LeftProperty] = 2,
[Canvas.TopProperty] = 4,
}
}
}
}
};
await RenderToFile(target);
CompareImages();
}
[Fact]
public async Task VisualBrush_Grip_144_Dpi()
{
var target = new Border
{
Width = 100,
Height = 7.5,
Background = new VisualBrush
{
SourceRect = new RelativeRect(0, 0, 4, 5, RelativeUnit.Absolute),
DestinationRect = new RelativeRect(0, 0, 4, 5, RelativeUnit.Absolute),
TileMode = TileMode.Tile,
Stretch = Stretch.UniformToFill,
Visual = new Canvas
{
Width = 4,
Height = 5,
Background = Brushes.WhiteSmoke,
Children =
{
new Rectangle
{
Width = 1,
Height = 1,
Fill = Brushes.Red,
[Canvas.LeftProperty] = 2,
},
new Rectangle
{
Width = 1,
Height = 1,
Fill = Brushes.Red,
[Canvas.TopProperty] = 2,
},
new Rectangle
{
Width = 1,
Height = 1,
Fill = Brushes.Red,
[Canvas.LeftProperty] = 2,
[Canvas.TopProperty] = 4,
}
}
}
}
};
await RenderToFile(target, dpi: 144);
CompareImages();
}
[Fact]
public async Task VisualBrush_Grip_192_Dpi()
{
var target = new Border
{
Width = 100,
Height = 10,
Background = new VisualBrush
{
SourceRect = new RelativeRect(0, 0, 4, 5, RelativeUnit.Absolute),
DestinationRect = new RelativeRect(0, 0, 4, 5, RelativeUnit.Absolute),
TileMode = TileMode.Tile,
Stretch = Stretch.UniformToFill,
Visual = new Canvas
{
Width = 4,
Height = 5,
Background = Brushes.WhiteSmoke,
Children =
{
new Rectangle
{
Width = 1,
Height = 1,
Fill = Brushes.Red,
[Canvas.LeftProperty] = 2,
},
new Rectangle
{
Width = 1,
Height = 1,
Fill = Brushes.Red,
[Canvas.TopProperty] = 2,
},
new Rectangle
{
Width = 1,
Height = 1,
Fill = Brushes.Red,
[Canvas.LeftProperty] = 2,
[Canvas.TopProperty] = 4,
}
}
}
}
};
await RenderToFile(target, dpi: 192);
CompareImages();
}
[Fact]
public async Task VisualBrush_Checkerboard_96_Dpi()
{

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 B

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 B

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 B

BIN
tests/TestFiles/Skia/Media/VisualBrush/VisualBrush_Grip_144_Dpi.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 B

BIN
tests/TestFiles/Skia/Media/VisualBrush/VisualBrush_Grip_192_Dpi.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 B

BIN
tests/TestFiles/Skia/Media/VisualBrush/VisualBrush_Grip_96_Dpi.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 B

Loading…
Cancel
Save