|
|
|
@ -294,7 +294,7 @@ namespace Avalonia.LeakTests |
|
|
|
{ |
|
|
|
new FuncTreeDataTemplate<Node>( |
|
|
|
(x, _) => new TextBlock { Text = x.Name }, |
|
|
|
x => x.Children) |
|
|
|
x => x.Children ?? []) |
|
|
|
}, |
|
|
|
ItemsSource = nodes |
|
|
|
} |
|
|
|
@ -409,7 +409,7 @@ namespace Avalonia.LeakTests |
|
|
|
screens.Setup(x => x.ScreenFromWindow(It.IsAny<IWindowBaseImpl>())).Returns(screen1.Object); |
|
|
|
|
|
|
|
var impl = new Mock<IWindowImpl>(); |
|
|
|
impl.Setup(r => r.TryGetFeature(It.IsAny<Type>())).Returns(null); |
|
|
|
impl.Setup(r => r.TryGetFeature(It.IsAny<Type>())).Returns((object?)null); |
|
|
|
impl.SetupGet(x => x.RenderScaling).Returns(1); |
|
|
|
impl.SetupProperty(x => x.Closed); |
|
|
|
impl.Setup(x => x.Compositor).Returns(RendererMocks.CreateDummyCompositor()); |
|
|
|
@ -516,7 +516,7 @@ namespace Avalonia.LeakTests |
|
|
|
Assert.True(weakMenuItem2.IsAlive); |
|
|
|
Assert.True(weakContextMenu.IsAlive); |
|
|
|
|
|
|
|
Mock.Get(window.PlatformImpl).Invocations.Clear(); |
|
|
|
Mock.Get(window.PlatformImpl!).Invocations.Clear(); |
|
|
|
CollectGarbage(); |
|
|
|
|
|
|
|
Assert.False(weakMenuItem1.IsAlive); |
|
|
|
@ -605,7 +605,7 @@ namespace Avalonia.LeakTests |
|
|
|
Assert.True(weakMenuItem4.IsAlive); |
|
|
|
Assert.True(weakContextMenu2.IsAlive); |
|
|
|
|
|
|
|
Mock.Get(window.PlatformImpl).Invocations.Clear(); |
|
|
|
Mock.Get(window.PlatformImpl!).Invocations.Clear(); |
|
|
|
CollectGarbage(); |
|
|
|
|
|
|
|
Assert.False(weakMenuItem1.IsAlive); |
|
|
|
@ -930,7 +930,7 @@ namespace Avalonia.LeakTests |
|
|
|
window.Content = null; |
|
|
|
|
|
|
|
// Mock keep reference on a Popup via InvocationsCollection. So let's clear it before.
|
|
|
|
Mock.Get(window.PlatformImpl).Invocations.Clear(); |
|
|
|
Mock.Get(window.PlatformImpl!).Invocations.Clear(); |
|
|
|
|
|
|
|
return (new WeakReference(toolTip), new WeakReference(textBlock)); |
|
|
|
} |
|
|
|
@ -984,7 +984,7 @@ namespace Avalonia.LeakTests |
|
|
|
window.Content = null; |
|
|
|
|
|
|
|
// Mock keep reference on a Popup via InvocationsCollection. So let's clear it before.
|
|
|
|
Mock.Get(window.PlatformImpl).Invocations.Clear(); |
|
|
|
Mock.Get(window.PlatformImpl!).Invocations.Clear(); |
|
|
|
|
|
|
|
return (new WeakReference(flyout), new WeakReference(textBlock)); |
|
|
|
} |
|
|
|
@ -1093,8 +1093,8 @@ namespace Avalonia.LeakTests |
|
|
|
|
|
|
|
private class Node |
|
|
|
{ |
|
|
|
public string Name { get; set; } |
|
|
|
public IEnumerable<Node> Children { get; set; } |
|
|
|
public string? Name { get; set; } |
|
|
|
public IEnumerable<Node>? Children { get; set; } |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|