|
|
@@ -102,6 +102,17 @@ namespace Avalonia.Base.UnitTests
|
|
|
Assert.Equal(new[] { "animated" }, result);
|
|
|
}
|
|
|
|
|
|
+ [Fact]
|
|
|
+ public void Notify_Fired_Only_On_Effective_Value_Change()
|
|
|
+ {
|
|
|
+ var target = new Class1();
|
|
|
+
|
|
|
+ target.SetValue(Class1.FooProperty, "animated", BindingPriority.Animation);
|
|
|
+ target.SetValue(Class1.FooProperty, "local");
|
|
|
+
|
|
|
+ Assert.Equal(2, target.NotifyCount);
|
|
|
+ }
|
|
|
+
|
|
|
[Fact]
|
|
|
public void Property_Equals_Should_Handle_Null()
|
|
|
{
|
|
|
@@ -180,7 +191,14 @@ namespace Avalonia.Base.UnitTests
|
|
|
private class Class1 : AvaloniaObject
|
|
|
{
|
|
|
public static readonly StyledProperty<string> FooProperty =
|
|
|
- AvaloniaProperty.Register<Class1, string>("Foo", "default");
|
|
|
+ AvaloniaProperty.Register<Class1, string>("Foo", "default", notifying: FooNotifying);
|
|
|
+
|
|
|
+ public int NotifyCount { get; private set; }
|
|
|
+
|
|
|
+ private static void FooNotifying(IAvaloniaObject o, bool n)
|
|
|
+ {
|
|
|
+ ++((Class1)o).NotifyCount;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private class Class2 : Class1
|