Browse Source

Added failing custom renderer test.

Deferred rendering does not yet support opacity from `Visual.Render`.
scenegraph-after-breakage
Steven Kirk 9 years ago
parent
commit
1c42bbf644
  1. 1
      tests/Avalonia.RenderTests/Avalonia.RenderTests.projitems
  2. 59
      tests/Avalonia.RenderTests/Controls/CustomRenderTests.cs
  3. BIN
      tests/TestFiles/Direct2D1/Controls/CustomRender/Opacity.expected.png

1
tests/Avalonia.RenderTests/Avalonia.RenderTests.projitems

@ -9,6 +9,7 @@
<Import_RootNamespace>Avalonia.RenderTests</Import_RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)Controls\CustomRenderTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)GeometryClippingTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Media\RadialGradientBrushTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Media\BitmapTests.cs" />

59
tests/Avalonia.RenderTests/Controls/CustomRenderTests.cs

@ -0,0 +1,59 @@
// Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System.Threading.Tasks;
using Avalonia.Controls;
using Avalonia.Layout;
using Avalonia.Media;
using Xunit;
#if AVALONIA_CAIRO
namespace Avalonia.Cairo.RenderTests.Controls
#elif AVALONIA_SKIA
namespace Avalonia.Skia.RenderTests
#else
namespace Avalonia.Direct2D1.RenderTests.Controls
#endif
{
public class CustomRenderTests : TestBase
{
public CustomRenderTests()
: base(@"Controls\CustomRender")
{
}
[Fact]
public async Task Opacity()
{
Decorator target = new Decorator
{
Padding = new Thickness(8),
Width = 200,
Height = 200,
Child = new OpacityRenderer(),
};
await RenderToFile(target);
CompareImages();
}
class OpacityRenderer : Control
{
public override void Render(DrawingContext context)
{
context.FillRectangle(
Brushes.Red,
Bounds,
4);
using (context.PushOpacity(0.5))
{
context.FillRectangle(
Brushes.Blue,
Bounds.Deflate(20),
4);
}
}
}
}
}

BIN
tests/TestFiles/Direct2D1/Controls/CustomRender/Opacity.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 942 B

Loading…
Cancel
Save