Browse Source

Added a render test.

pull/553/head
Jeremy Koritzinsky 10 years ago
parent
commit
5bbdfc55b4
  1. 3
      tests/Avalonia.RenderTests/Avalonia.RenderTests.projitems
  2. 64
      tests/Avalonia.RenderTests/OpacityMaskTests.cs
  3. BIN
      tests/TestFiles/Cairo/OpacityMask/Opacity_Mask_Masks_Element.expected.png
  4. BIN
      tests/TestFiles/Direct2D1/OpacityMask/Opacity_Mask_Masks_Element.expected.png
  5. BIN
      tests/TestFiles/Skia/OpacityMask/Opacity_Mask_Masks_Element.expected.png

3
tests/Avalonia.RenderTests/Avalonia.RenderTests.projitems

@ -9,6 +9,8 @@
<Import_RootNamespace>Avalonia.RenderTests</Import_RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)GeometryClippingTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)OpacityMaskTests.cs" />
<Compile Include="Controls\ImageTests.cs" />
<Compile Include="Controls\BorderTests.cs" />
<Compile Include="Media\ImageBrushTests.cs" />
@ -22,6 +24,5 @@
<Compile Include="Shapes\RectangleTests.cs" />
<Compile Include="TestBase.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="GeometryClippingTests.cs" />
</ItemGroup>
</Project>

64
tests/Avalonia.RenderTests/OpacityMaskTests.cs

@ -0,0 +1,64 @@
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 OpacityMaskTests : TestBase
{
public OpacityMaskTests()
: base("OpacityMask")
{
}
#if AVALONIA_SKIA
[Fact(Skip = "Opacity Masks not supported on Skia")]
#else
[Fact]
#endif
public void Opacity_Mask_Masks_Element()
{
var target = new Canvas
{
OpacityMask = new LinearGradientBrush
{
StartPoint = new RelativePoint(0, 0, RelativeUnit.Relative),
EndPoint = new RelativePoint(1, 1, RelativeUnit.Relative),
GradientStops = new List<GradientStop>
{
new GradientStop(Color.FromUInt32(0xffffffff), 0),
new GradientStop(Color.FromUInt32(0x00ffffff), 1)
}
},
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.Red,
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/OpacityMask/Opacity_Mask_Masks_Element.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 846 B

BIN
tests/TestFiles/Direct2D1/OpacityMask/Opacity_Mask_Masks_Element.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 989 B

BIN
tests/TestFiles/Skia/OpacityMask/Opacity_Mask_Masks_Element.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 846 B

Loading…
Cancel
Save