|
|
|
@ -8,6 +8,7 @@ using Avalonia.Controls.Templates; |
|
|
|
using Avalonia.Data; |
|
|
|
using Avalonia.Markup.Data; |
|
|
|
using Avalonia.Styling; |
|
|
|
using Avalonia.UnitTests; |
|
|
|
using Xunit; |
|
|
|
|
|
|
|
namespace Avalonia.Controls.UnitTests.Primitives |
|
|
|
@ -160,6 +161,38 @@ namespace Avalonia.Controls.UnitTests.Primitives |
|
|
|
Assert.Equal(expected, track.Value); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Coercion_Should_Not_Be_Done_During_Initialization() |
|
|
|
{ |
|
|
|
var target = new TestRange(); |
|
|
|
|
|
|
|
target.BeginInit(); |
|
|
|
|
|
|
|
var root = new TestRoot(target); |
|
|
|
target.Minimum = 1; |
|
|
|
Assert.Equal(0, target.Value); |
|
|
|
|
|
|
|
target.Value = 50; |
|
|
|
target.EndInit(); |
|
|
|
|
|
|
|
Assert.Equal(50, target.Value); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Coercion_Should_Be_Done_After_Initialization() |
|
|
|
{ |
|
|
|
var target = new TestRange(); |
|
|
|
|
|
|
|
target.BeginInit(); |
|
|
|
|
|
|
|
var root = new TestRoot(target); |
|
|
|
target.Minimum = 1; |
|
|
|
|
|
|
|
target.EndInit(); |
|
|
|
|
|
|
|
Assert.Equal(1, target.Value); |
|
|
|
} |
|
|
|
|
|
|
|
private class TestRange : RangeBase |
|
|
|
{ |
|
|
|
} |
|
|
|
@ -199,4 +232,4 @@ namespace Avalonia.Controls.UnitTests.Primitives |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|