A cross-platform UI framework for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

49 lines
1.3 KiB

using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Layout;
using Avalonia.Media;
using Avalonia.UnitTests;
using Xunit;
namespace Avalonia.Base.UnitTests.Input;
public class InputExtensionsTests
{
[Fact]
public void InputHitTest_Should_Use_Coordinates_Relative_To_The_Subtree_Root()
{
Border target;
using var services = new CompositorTestServices(new Size(200, 200))
{
TopLevel =
{
Content = new StackPanel
{
Background = Brushes.White,
Children =
{
new Border
{
Width = 100,
Height = 200,
Background = Brushes.Red,
},
(target = new Border
{
Width = 100,
Height = 200,
Background = Brushes.Green,
})
},
Orientation = Orientation.Horizontal,
}
}
};
services.RunJobs();
var result = target.InputHitTest(new Point(50, 50), enabledElementsOnly: false);
Assert.Same(target, result);
}
}