|
|
|
@ -13,7 +13,7 @@ namespace Avalonia.Layout.UnitTests |
|
|
|
var control = new LayoutTestControl(); |
|
|
|
var root = new LayoutTestRoot { Child = control }; |
|
|
|
|
|
|
|
root.LayoutManager.ExecuteInitialLayoutPass(root); |
|
|
|
root.LayoutManager.ExecuteInitialLayoutPass(); |
|
|
|
control.Measured = control.Arranged = false; |
|
|
|
|
|
|
|
control.InvalidateMeasure(); |
|
|
|
@ -23,13 +23,29 @@ namespace Avalonia.Layout.UnitTests |
|
|
|
Assert.True(control.Arranged); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Doesnt_Measure_And_Arrange_InvalidateMeasured_Control_When_TopLevel_Is_Not_Visible() |
|
|
|
{ |
|
|
|
var control = new LayoutTestControl(); |
|
|
|
var root = new LayoutTestRoot { Child = control, IsVisible = false }; |
|
|
|
|
|
|
|
root.LayoutManager.ExecuteInitialLayoutPass(); |
|
|
|
control.Measured = control.Arranged = false; |
|
|
|
|
|
|
|
control.InvalidateMeasure(); |
|
|
|
root.LayoutManager.ExecuteLayoutPass(); |
|
|
|
|
|
|
|
Assert.False(control.Measured); |
|
|
|
Assert.False(control.Arranged); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Arranges_InvalidateArranged_Control() |
|
|
|
{ |
|
|
|
var control = new LayoutTestControl(); |
|
|
|
var root = new LayoutTestRoot { Child = control }; |
|
|
|
|
|
|
|
root.LayoutManager.ExecuteInitialLayoutPass(root); |
|
|
|
root.LayoutManager.ExecuteInitialLayoutPass(); |
|
|
|
control.Measured = control.Arranged = false; |
|
|
|
|
|
|
|
control.InvalidateArrange(); |
|
|
|
@ -45,7 +61,7 @@ namespace Avalonia.Layout.UnitTests |
|
|
|
var control = new LayoutTestControl(); |
|
|
|
var root = new LayoutTestRoot(); |
|
|
|
|
|
|
|
root.LayoutManager.ExecuteInitialLayoutPass(root); |
|
|
|
root.LayoutManager.ExecuteInitialLayoutPass(); |
|
|
|
root.Child = control; |
|
|
|
root.Measured = root.Arranged = false; |
|
|
|
|
|
|
|
@ -80,7 +96,7 @@ namespace Avalonia.Layout.UnitTests |
|
|
|
root.DoMeasureOverride = MeasureOverride; |
|
|
|
control1.DoMeasureOverride = MeasureOverride; |
|
|
|
control2.DoMeasureOverride = MeasureOverride; |
|
|
|
root.LayoutManager.ExecuteInitialLayoutPass(root); |
|
|
|
root.LayoutManager.ExecuteInitialLayoutPass(); |
|
|
|
|
|
|
|
control2.InvalidateMeasure(); |
|
|
|
control1.InvalidateMeasure(); |
|
|
|
@ -115,7 +131,7 @@ namespace Avalonia.Layout.UnitTests |
|
|
|
root.DoMeasureOverride = MeasureOverride; |
|
|
|
control1.DoMeasureOverride = MeasureOverride; |
|
|
|
control2.DoMeasureOverride = MeasureOverride; |
|
|
|
root.LayoutManager.ExecuteInitialLayoutPass(root); |
|
|
|
root.LayoutManager.ExecuteInitialLayoutPass(); |
|
|
|
|
|
|
|
control2.InvalidateMeasure(); |
|
|
|
root.InvalidateMeasure(); |
|
|
|
@ -132,7 +148,7 @@ namespace Avalonia.Layout.UnitTests |
|
|
|
var control = new LayoutTestControl(); |
|
|
|
var root = new LayoutTestRoot { Child = control }; |
|
|
|
|
|
|
|
root.LayoutManager.ExecuteInitialLayoutPass(root); |
|
|
|
root.LayoutManager.ExecuteInitialLayoutPass(); |
|
|
|
root.Measured = root.Arranged = false; |
|
|
|
control.Measured = control.Arranged = false; |
|
|
|
|
|
|
|
@ -151,7 +167,7 @@ namespace Avalonia.Layout.UnitTests |
|
|
|
var control = new LayoutTestControl(); |
|
|
|
var root = new LayoutTestRoot { Child = control }; |
|
|
|
|
|
|
|
root.LayoutManager.ExecuteInitialLayoutPass(root); |
|
|
|
root.LayoutManager.ExecuteInitialLayoutPass(); |
|
|
|
control.Measured = control.Arranged = false; |
|
|
|
|
|
|
|
control.InvalidateMeasure(); |
|
|
|
@ -177,7 +193,7 @@ namespace Avalonia.Layout.UnitTests |
|
|
|
return new Size(100, 100); |
|
|
|
}; |
|
|
|
|
|
|
|
root.LayoutManager.ExecuteInitialLayoutPass(root); |
|
|
|
root.LayoutManager.ExecuteInitialLayoutPass(); |
|
|
|
|
|
|
|
Assert.Equal(Size.Infinity, availableSize); |
|
|
|
} |
|
|
|
@ -199,7 +215,7 @@ namespace Avalonia.Layout.UnitTests |
|
|
|
return s; |
|
|
|
}; |
|
|
|
|
|
|
|
root.LayoutManager.ExecuteInitialLayoutPass(root); |
|
|
|
root.LayoutManager.ExecuteInitialLayoutPass(); |
|
|
|
Assert.Equal(new Size(100, 100), arrangeSize); |
|
|
|
|
|
|
|
root.Width = 120; |
|
|
|
@ -225,7 +241,7 @@ namespace Avalonia.Layout.UnitTests |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
root.LayoutManager.ExecuteInitialLayoutPass(root); |
|
|
|
root.LayoutManager.ExecuteInitialLayoutPass(); |
|
|
|
Assert.Equal(new Size(0, 0), root.DesiredSize); |
|
|
|
|
|
|
|
border.Width = 100; |
|
|
|
@ -241,7 +257,7 @@ namespace Avalonia.Layout.UnitTests |
|
|
|
var control = new LayoutTestControl(); |
|
|
|
var root = new LayoutTestRoot { Child = control }; |
|
|
|
|
|
|
|
root.LayoutManager.ExecuteInitialLayoutPass(root); |
|
|
|
root.LayoutManager.ExecuteInitialLayoutPass(); |
|
|
|
control.Measured = false; |
|
|
|
|
|
|
|
int cnt = 0; |
|
|
|
@ -272,7 +288,7 @@ namespace Avalonia.Layout.UnitTests |
|
|
|
var control = new LayoutTestControl(); |
|
|
|
var root = new LayoutTestRoot { Child = control }; |
|
|
|
|
|
|
|
root.LayoutManager.ExecuteInitialLayoutPass(root); |
|
|
|
root.LayoutManager.ExecuteInitialLayoutPass(); |
|
|
|
control.Arranged = false; |
|
|
|
|
|
|
|
int cnt = 0; |
|
|
|
@ -313,7 +329,7 @@ namespace Avalonia.Layout.UnitTests |
|
|
|
panel.Children.AddRange(nonArrageableTargets); |
|
|
|
panel.Children.AddRange(targets); |
|
|
|
|
|
|
|
root.LayoutManager.ExecuteInitialLayoutPass(root); |
|
|
|
root.LayoutManager.ExecuteInitialLayoutPass(); |
|
|
|
|
|
|
|
foreach (var c in panel.Children.OfType<LayoutTestControl>()) |
|
|
|
{ |
|
|
|
@ -347,7 +363,7 @@ namespace Avalonia.Layout.UnitTests |
|
|
|
var control = new LayoutTestControl(); |
|
|
|
var root = new LayoutTestRoot { Child = control }; |
|
|
|
|
|
|
|
root.LayoutManager.ExecuteInitialLayoutPass(root); |
|
|
|
root.LayoutManager.ExecuteInitialLayoutPass(); |
|
|
|
control.Measured = false; |
|
|
|
|
|
|
|
control.DoMeasureOverride = (l, s) => |
|
|
|
@ -380,7 +396,7 @@ namespace Avalonia.Layout.UnitTests |
|
|
|
var root = new LayoutTestRoot { Child = control }; |
|
|
|
var count = 0; |
|
|
|
|
|
|
|
root.LayoutManager.ExecuteInitialLayoutPass(root); |
|
|
|
root.LayoutManager.ExecuteInitialLayoutPass(); |
|
|
|
control.Measured = false; |
|
|
|
|
|
|
|
control.DoMeasureOverride = (l, s) => |
|
|
|
@ -399,7 +415,7 @@ namespace Avalonia.Layout.UnitTests |
|
|
|
|
|
|
|
root.InvalidateMeasure(); |
|
|
|
control.InvalidateMeasure(); |
|
|
|
root.LayoutManager.ExecuteInitialLayoutPass(root); |
|
|
|
root.LayoutManager.ExecuteInitialLayoutPass(); |
|
|
|
|
|
|
|
Assert.Equal(new Size(200, 200), control.Bounds.Size); |
|
|
|
Assert.Equal(new Size(200, 200), control.DesiredSize); |
|
|
|
|