Browse Source

Add another failing test relating to #1099.

pull/2264/head
Steven Kirk 7 years ago
parent
commit
372f0f266e
  1. 46
      tests/Avalonia.Visuals.UnitTests/VisualTests.cs

46
tests/Avalonia.Visuals.UnitTests/VisualTests.cs

@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Avalonia.Controls;
using Avalonia.Data;
using Avalonia.Media;
using Avalonia.Rendering;
using Avalonia.UnitTests;
@ -236,5 +237,50 @@ namespace Avalonia.Visuals.UnitTests
//child is centered (400 - 100*2 scale)/2
Assert.Equal(new Point(100, 100), point);
}
[Fact]
public void Should_Not_Log_Binding_Error_When_Not_Attached_To_Logical_Tree()
{
var target = new Decorator { DataContext = "foo" };
var called = false;
LogCallback checkLogMessage = (level, area, src, mt, pv) =>
{
if (level >= Logging.LogEventLevel.Warning)
{
called = true;
}
};
using (TestLogSink.Start(checkLogMessage))
{
target.Bind(Decorator.TagProperty, new Binding("Foo"));
}
Assert.False(called);
}
[Fact]
public void Should_Log_Binding_Error_When_Attached_To_Logical_Tree()
{
var target = new Decorator();
var root = new TestRoot { Child = target, DataContext = "foo" };
var called = false;
LogCallback checkLogMessage = (level, area, src, mt, pv) =>
{
if (level >= Logging.LogEventLevel.Warning)
{
called = true;
}
};
using (TestLogSink.Start(checkLogMessage))
{
target.Bind(Decorator.TagProperty, new Binding("Foo"));
}
Assert.True(called);
}
}
}

Loading…
Cancel
Save