Browse Source

Fix adorner rounded clip and add render test

pull/20647/head
Wiesław Šoltés 1 month ago
parent
commit
65b40f59bc
  1. 2
      src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionVisual/ServerCompositionVisual.Adorners.cs
  2. 30
      tests/Avalonia.RenderTests/Controls/AdornerTests.cs
  3. BIN
      tests/TestFiles/Skia/Controls/Adorner/Adorner_Respects_Rounded_ClipToBounds.expected.png

2
src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionVisual/ServerCompositionVisual.Adorners.cs

@ -92,7 +92,7 @@ partial class ServerCompositionVisual
if (visual.ClipToBounds)
{
_canvas.PushClip(new Rect(0, 0, visual.Size.X, visual.Size.Y));
visual.PushClipToBounds(_canvas);
_adornerPushedClipStack!.Push((int)Op.PopClip);
}

30
tests/Avalonia.RenderTests/Controls/AdornerTests.cs

@ -80,5 +80,35 @@ public class AdornerTests : TestBase
await CheckAdornedContent(content, adorned, adorner,
testName: "Focus_Adorner_Is_Properly_Clipped_Clip_" + clip);
}
[Fact]
public async Task Adorner_Respects_Rounded_ClipToBounds()
{
Border adorned;
var content = new Border
{
Background = Brushes.DarkRed,
Padding = new Thickness(20),
Width = 240,
Height = 240,
Child = adorned = new Border
{
Width = 160,
Height = 160,
Background = Brushes.Transparent,
BorderBrush = Brushes.Black,
BorderThickness = new Thickness(6),
CornerRadius = new CornerRadius(28),
ClipToBounds = true
}
};
var adorner = new Border
{
Background = Brushes.DeepSkyBlue
};
await CheckAdornedContent(content, adorned, adorner, width: 260, height: 260);
}
}

BIN
tests/TestFiles/Skia/Controls/Adorner/Adorner_Respects_Rounded_ClipToBounds.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 802 B

Loading…
Cancel
Save