Browse Source

Added render tests for geometry clipping.

pull/544/head
Jeremy Koritzinsky 10 years ago
parent
commit
33bd33e38c
  1. 5
      tests/Avalonia.RenderTests/Avalonia.RenderTests.projitems
  2. 51
      tests/Avalonia.RenderTests/GeometryClippingTests.cs
  3. BIN
      tests/TestFiles/Cairo/GeometryClipping/Geometry_Clip_Clips_Path.expected.png
  4. BIN
      tests/TestFiles/Direct2D1/GeometryClipping/Geometry_Clip_Clips_Path.expected.png
  5. BIN
      tests/TestFiles/Skia/GeometryClipping/Geometry_Clip_Clips_Path.expected.png

5
tests/Avalonia.RenderTests/Avalonia.RenderTests.projitems

@ -8,7 +8,7 @@
<PropertyGroup Label="Configuration">
<Import_RootNamespace>Avalonia.RenderTests</Import_RootNamespace>
</PropertyGroup>
<ItemGroup>
<ItemGroup>
<Compile Include="Controls\ImageTests.cs" />
<Compile Include="Controls\BorderTests.cs" />
<Compile Include="Media\ImageBrushTests.cs" />
@ -22,5 +22,6 @@
<Compile Include="Shapes\RectangleTests.cs" />
<Compile Include="TestBase.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="GeometryClippingTests.cs" />
</ItemGroup>
</Project>
</Project>

51
tests/Avalonia.RenderTests/GeometryClippingTests.cs

@ -0,0 +1,51 @@
using Avalonia.Controls;
using Avalonia.Controls.Shapes;
using Avalonia.Media;
using System;
using System.Collections.Generic;
using System.Text;
using Xunit;
#if AVALONIA_CAIRO
namespace Avalonia.Cairo.RenderTests
#elif AVALONIA_SKIA
namespace Avalonia.Skia.RenderTests
#else
namespace Avalonia.Direct2D1.RenderTests
#endif
{
public class GeometryClippingTests : TestBase
{
public GeometryClippingTests()
:base("GeometryClipping")
{
}
[Fact]
public void Geometry_Clip_Clips_Path()
{
var target = new Canvas
{
Clip = StreamGeometry.Parse("F1 M 0,0 H 76 V 76 Z"),
Width = 76,
Height = 76,
Children = new Avalonia.Controls.Controls
{
new Path
{
Width = 32,
Height = 40,
[Canvas.LeftProperty] = 23,
[Canvas.TopProperty] = 18,
Stretch = Stretch.Fill,
Fill = Brushes.Black,
Data = StreamGeometry.Parse("F1 M 27,18L 23,26L 33,30L 24,38L 33,46L 23,50L 27,58L 45,58L 55,38L 45,18L 27,18 Z")
}
}
};
RenderToFile(target);
CompareImages();
}
}
}

BIN
tests/TestFiles/Cairo/GeometryClipping/Geometry_Clip_Clips_Path.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 373 B

BIN
tests/TestFiles/Direct2D1/GeometryClipping/Geometry_Clip_Clips_Path.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 373 B

BIN
tests/TestFiles/Skia/GeometryClipping/Geometry_Clip_Clips_Path.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 373 B

Loading…
Cancel
Save