Browse Source

Add thickness test as well

pull/8422/head
Max Katz 4 years ago
committed by Steven Kirk
parent
commit
41d31d8857
  1. 19
      tests/Avalonia.Markup.Xaml.UnitTests/Xaml/ResourceDictionaryTests.cs

19
tests/Avalonia.Markup.Xaml.UnitTests/Xaml/ResourceDictionaryTests.cs

@ -240,7 +240,7 @@ namespace Avalonia.Markup.Xaml.UnitTests.Xaml
} }
[Fact] [Fact]
public void Value_Type_With_Parse_Should_Not_Be_Deferred() public void Value_Type_With_Parse_Converter_Should_Not_Be_Deferred()
{ {
using (StyledWindow()) using (StyledWindow())
{ {
@ -255,6 +255,23 @@ namespace Avalonia.Markup.Xaml.UnitTests.Xaml
Assert.IsType<Color>(resources["Red"]); Assert.IsType<Color>(resources["Red"]);
} }
} }
[Fact]
public void Value_Type_With_Ctor_Converter_Should_Not_Be_Deferred()
{
using (StyledWindow())
{
var xaml = @"
<ResourceDictionary xmlns='https://github.com/avaloniaui'
xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
<Thickness x:Key='Margin'>1 1 1 1</Thickness>
</ResourceDictionary>";
var resources = (ResourceDictionary)AvaloniaRuntimeXamlLoader.Load(xaml);
Assert.False(resources.ContainsDeferredKey("Margin"));
Assert.IsType<Thickness>(resources["Margin"]);
}
}
private IDisposable StyledWindow(params (string, string)[] assets) private IDisposable StyledWindow(params (string, string)[] assets)
{ {

Loading…
Cancel
Save