Browse Source

+ hit test attempt

pull/8599/head
Evgeny Gorbovoy 4 years ago
parent
commit
01d040bf6c
  1. 31
      tests/Avalonia.Base.UnitTests/Rendering/DeferredRendererTests_HitTesting.cs

31
tests/Avalonia.Base.UnitTests/Rendering/DeferredRendererTests_HitTesting.cs

@ -537,6 +537,37 @@ namespace Avalonia.Base.UnitTests.Rendering
} }
} }
[Fact]
public void HitTest_Should_Not_Hit_Controls_Next_Pixel()
{
using (TestApplication())
{
Button targetButton;
var root = new TestRoot
{
Width = 300,
Height = 200,
Child = new StackPanel
{
Orientation = Orientation.Vertical,
Children =
{
new Button { Width = 10, Height = 10 },
{ targetButton = new Button { Width = 10, Height = 10 } }
}
}
};
root.Renderer = new DeferredRenderer(root, null);
root.Measure(Size.Infinity);
root.Arrange(new Rect(root.DesiredSize));
var result = root.Renderer.HitTest(new Point(5, 10), root, null);
Assert.Equal(new[] { targetButton }, result);
}
}
private IDisposable TestApplication() private IDisposable TestApplication()
{ {
return UnitTestApplication.Start(TestServices.MockPlatformRenderInterface); return UnitTestApplication.Start(TestServices.MockPlatformRenderInterface);

Loading…
Cancel
Save