|
|
|
@ -100,5 +100,58 @@ namespace Avalonia.Layout.UnitTests |
|
|
|
|
|
|
|
Assert.Equal(0, target.DesiredSize.Height); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Margin_Should_Affect_AvailableSize() |
|
|
|
{ |
|
|
|
MeasureTest target; |
|
|
|
|
|
|
|
var outer = new Decorator |
|
|
|
{ |
|
|
|
Width = 100, |
|
|
|
Height = 100, |
|
|
|
Child = target = new MeasureTest |
|
|
|
{ |
|
|
|
Margin = new Thickness(10), |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
outer.Measure(Size.Infinity); |
|
|
|
|
|
|
|
Assert.Equal(new Size(80, 80), target.AvailableSize); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Margin_Should_Be_Applied_Before_Width_Height() |
|
|
|
{ |
|
|
|
MeasureTest target; |
|
|
|
|
|
|
|
var outer = new Decorator |
|
|
|
{ |
|
|
|
Width = 100, |
|
|
|
Height = 100, |
|
|
|
Child = target = new MeasureTest |
|
|
|
{ |
|
|
|
Width = 80, |
|
|
|
Height = 80, |
|
|
|
Margin = new Thickness(10), |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
outer.Measure(Size.Infinity); |
|
|
|
|
|
|
|
Assert.Equal(new Size(80, 80), target.AvailableSize); |
|
|
|
} |
|
|
|
|
|
|
|
class MeasureTest : Control |
|
|
|
{ |
|
|
|
public Size? AvailableSize { get; private set; } |
|
|
|
|
|
|
|
protected override Size MeasureOverride(Size availableSize) |
|
|
|
{ |
|
|
|
AvailableSize = availableSize; |
|
|
|
return availableSize; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|