Browse Source

Merge pull request #1050 from AvaloniaUI/fixes/874-fix-tilebrush-tiling

Added more ImageBrush tests.
pull/1051/merge
Steven Kirk 9 years ago
committed by GitHub
parent
commit
fb6229c6f3
  1. 76
      tests/Avalonia.RenderTests/Media/ImageBrushTests.cs
  2. BIN
      tests/TestFiles/Cairo/Media/ImageBrush/ImageBrush_Tile_Fill.expected.png
  3. BIN
      tests/TestFiles/Cairo/Media/ImageBrush/ImageBrush_Tile_Small_Image.expected.png
  4. BIN
      tests/TestFiles/Cairo/Media/ImageBrush/ImageBrush_Tile_UniformToFill.expected.png
  5. BIN
      tests/TestFiles/Cairo/Media/ImageBrush/github_icon_small.png
  6. BIN
      tests/TestFiles/Direct2D1/Media/ImageBrush/ImageBrush_Tile_Fill.expected.png
  7. BIN
      tests/TestFiles/Direct2D1/Media/ImageBrush/ImageBrush_Tile_Small_Image.expected.png
  8. BIN
      tests/TestFiles/Direct2D1/Media/ImageBrush/ImageBrush_Tile_UniformToFill.expected.png
  9. BIN
      tests/TestFiles/Direct2D1/Media/ImageBrush/github_icon_small.png
  10. BIN
      tests/TestFiles/Skia/Media/ImageBrush/ImageBrush_Tile_Fill.expected.png
  11. BIN
      tests/TestFiles/Skia/Media/ImageBrush/ImageBrush_Tile_Small_Image.expected.png
  12. BIN
      tests/TestFiles/Skia/Media/ImageBrush/ImageBrush_Tile_UniformToFill.expected.png
  13. BIN
      tests/TestFiles/Skia/Media/ImageBrush/github_icon_small.png

76
tests/Avalonia.RenderTests/Media/ImageBrushTests.cs

@ -28,6 +28,82 @@ namespace Avalonia.Direct2D1.RenderTests.Media
get { return System.IO.Path.Combine(OutputPath, "github_icon.png"); }
}
private string SmallBitmapPath
{
get { return System.IO.Path.Combine(OutputPath, "github_icon_small.png"); }
}
[Fact]
public void ImageBrush_Tile_Fill()
{
Decorator target = new Decorator
{
Width = 200,
Height = 200,
Child = new Rectangle
{
Margin = new Thickness(8),
Fill = new ImageBrush
{
Stretch = Stretch.Fill,
TileMode = TileMode.Tile,
DestinationRect = new RelativeRect(0, 0, 25, 30, RelativeUnit.Absolute),
Source = new Bitmap(BitmapPath),
}
}
};
RenderToFile(target);
CompareImages();
}
[Fact]
public void ImageBrush_Tile_UniformToFill()
{
Decorator target = new Decorator
{
Width = 200,
Height = 200,
Child = new Rectangle
{
Margin = new Thickness(8),
Fill = new ImageBrush
{
Stretch = Stretch.Uniform,
TileMode = TileMode.Tile,
DestinationRect = new RelativeRect(0, 0, 25, 30, RelativeUnit.Absolute),
Source = new Bitmap(BitmapPath),
}
}
};
RenderToFile(target);
CompareImages();
}
[Fact]
public void ImageBrush_Tile_Small_Image()
{
Decorator target = new Decorator
{
Width = 200,
Height = 200,
Child = new Rectangle
{
Margin = new Thickness(8),
Fill = new ImageBrush
{
Stretch = Stretch.None,
TileMode = TileMode.Tile,
Source = new Bitmap(SmallBitmapPath),
}
}
};
RenderToFile(target);
CompareImages();
}
[Fact]
public void ImageBrush_NoStretch_NoTile_Alignment_TopLeft()
{

BIN
tests/TestFiles/Cairo/Media/ImageBrush/ImageBrush_Tile_Fill.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
tests/TestFiles/Cairo/Media/ImageBrush/ImageBrush_Tile_Small_Image.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
tests/TestFiles/Cairo/Media/ImageBrush/ImageBrush_Tile_UniformToFill.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
tests/TestFiles/Cairo/Media/ImageBrush/github_icon_small.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 928 B

BIN
tests/TestFiles/Direct2D1/Media/ImageBrush/ImageBrush_Tile_Fill.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
tests/TestFiles/Direct2D1/Media/ImageBrush/ImageBrush_Tile_Small_Image.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
tests/TestFiles/Direct2D1/Media/ImageBrush/ImageBrush_Tile_UniformToFill.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
tests/TestFiles/Direct2D1/Media/ImageBrush/github_icon_small.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 928 B

BIN
tests/TestFiles/Skia/Media/ImageBrush/ImageBrush_Tile_Fill.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

BIN
tests/TestFiles/Skia/Media/ImageBrush/ImageBrush_Tile_Small_Image.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
tests/TestFiles/Skia/Media/ImageBrush/ImageBrush_Tile_UniformToFill.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

BIN
tests/TestFiles/Skia/Media/ImageBrush/github_icon_small.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 928 B

Loading…
Cancel
Save