From 7d8dcc02ecbd389726f6c82302121741fc3bb392 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Thu, 10 May 2018 00:53:10 +0200 Subject: [PATCH] Added failing test for #1568 --- .../AvaloniaObjectTests_Attached.cs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_Attached.cs b/tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_Attached.cs index ab2a2d899d..2262f4cfa2 100644 --- a/tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_Attached.cs +++ b/tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_Attached.cs @@ -24,10 +24,23 @@ namespace Avalonia.Base.UnitTests Assert.Throws(() => target.SetValue(Class2.FooProperty, "throw")); } + [Fact] + public void AvaloniaProperty_Initialized_Is_Called_For_Attached_Property() + { + bool raised = false; + + using (Class1.FooProperty.Initialized.Subscribe(x => raised = true)) + { + new Class3(); + } + + Assert.True(raised); + } + private class Class1 : AvaloniaObject { public static readonly AttachedProperty FooProperty = - AvaloniaProperty.RegisterAttached( + AvaloniaProperty.RegisterAttached( "Foo", "foodefault", validate: ValidateFoo); @@ -48,5 +61,9 @@ namespace Avalonia.Base.UnitTests public static readonly AttachedProperty FooProperty = Class1.FooProperty.AddOwner(); } + + private class Class3 : AvaloniaObject + { + } } }