Browse Source

Don't validate thread affinity for bindings.

The scheduler should ensure that bindings are called on the correct
thread.
pull/909/head
Steven Kirk 9 years ago
parent
commit
380bd7b74f
  1. 1
      src/Avalonia.Base/AvaloniaObject.cs
  2. 34
      tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_Threading.cs

1
src/Avalonia.Base/AvaloniaObject.cs

@ -335,7 +335,6 @@ namespace Avalonia
}
subscription = source
.Do(_ => VerifyAccess())
.Select(x => CastOrDefault(x, property.PropertyType))
.Do(_ => { }, () => _directBindings.Remove(subscription))
.Subscribe(x => SetDirectValue(property, x));

34
tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_Threading.cs

@ -49,23 +49,6 @@ namespace Avalonia.Base.UnitTests
}
}
[Fact]
public void StyledProperty_Binding_Producing_Value_Should_Throw()
{
var ti = new ThreadingInterface(true);
using (UnitTestApplication.Start(new TestServices(threadingInterface: ti)))
{
var target = new Class1();
var source = new BehaviorSubject<string>("foo");
target.Bind(Class1.StyledProperty, source);
ti.CurrentThreadIsLoopThread = false;
Assert.Throws<InvalidOperationException>(() => source.OnNext("bar"));
}
}
[Fact]
public void StyledProperty_ClearValue_Should_Throw()
{
@ -124,23 +107,6 @@ namespace Avalonia.Base.UnitTests
}
}
[Fact]
public void DirectProperty_Binding_Producing_Value_Should_Throw()
{
var ti = new ThreadingInterface(true);
using (UnitTestApplication.Start(new TestServices(threadingInterface: ti)))
{
var target = new Class1();
var source = new BehaviorSubject<string>("foo");
target.Bind(Class1.DirectProperty, source);
ti.CurrentThreadIsLoopThread = false;
Assert.Throws<InvalidOperationException>(() => source.OnNext("bar"));
}
}
[Fact]
public void DirectProperty_ClearValue_Should_Throw()
{

Loading…
Cancel
Save