|
|
|
@ -18,6 +18,7 @@ using Avalonia.Input; |
|
|
|
using Avalonia.Rendering; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Avalonia.Threading; |
|
|
|
using Avalonia.Interactivity; |
|
|
|
|
|
|
|
namespace Avalonia.Controls.UnitTests.Primitives |
|
|
|
{ |
|
|
|
@ -1048,6 +1049,30 @@ namespace Avalonia.Controls.UnitTests.Primitives |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Events_Should_Be_Routed_To_Popup_Parent() |
|
|
|
{ |
|
|
|
using (CreateServices()) |
|
|
|
{ |
|
|
|
var popupContent = new Border(); |
|
|
|
var popup = new Popup { Child = popupContent }; |
|
|
|
var popupParent = new Border { Child = popup }; |
|
|
|
var root = PreparedWindow(popupParent); |
|
|
|
var raised = 0; |
|
|
|
|
|
|
|
root.LayoutManager.ExecuteInitialLayoutPass(); |
|
|
|
popup.Open(); |
|
|
|
root.LayoutManager.ExecuteLayoutPass(); |
|
|
|
|
|
|
|
var ev = new RoutedEventArgs(Button.ClickEvent); |
|
|
|
|
|
|
|
popupParent.AddHandler(Button.ClickEvent, (s, e) => ++raised); |
|
|
|
popupContent.RaiseEvent(ev); |
|
|
|
|
|
|
|
Assert.Equal(1, raised); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private IDisposable CreateServices() |
|
|
|
{ |
|
|
|
return UnitTestApplication.Start(TestServices.StyledWindow.With(windowingPlatform: |
|
|
|
|