public void ArrangeEmptyMustNotCrash() { var g = new BoxGroup(LayoutTestStyle.Create()); g.Arrange(new Rectangle(10, 20, 400, 300)); g.DesiredSize.Should().Be(new Size()); g.LayoutRect.Should().Be(new Rectangle(10, 20, 0, 0)); }
public void ArrangeVerticalWithAnchor() { var g = new BoxGroup(LayoutTestStyle.Create()); g.Spacing = 5; g.Add(LayoutTestWidget.FixedSize(200, 100).WithAnchorRect(AnchoredRect.Full)); g.Add(LayoutTestWidget.FixedSize(150, 50).WithAnchorRect(AnchoredRect.Full)); g.Arrange(new Rectangle(10, 20, 400, 300)); g.LayoutRect.Should().Be(new Rectangle(10, 20, 400, 155)); g[0].LayoutRect.Should().Be(new Rectangle(10, 20, 400, 100)); g[1].LayoutRect.Should().Be(new Rectangle(10, 125, 400, 50)); }
public void ArrangeHorizontal() { var g = new BoxGroup(LayoutTestStyle.Create()); g.Spacing = 5; g.Orientation = Orientation.Horizontal; g.Add(LayoutTestWidget.FixedSize(200, 100).WithAnchorRect(AnchoredRect.CreateTopLeftAnchored(0, 0))); g.Add(LayoutTestWidget.FixedSize(150, 50).WithAnchorRect(AnchoredRect.CreateTopLeftAnchored(0, 0))); g.Arrange(new Rectangle(10, 20, 400, 300)); g.LayoutRect.Should().Be(new Rectangle(10, 20, 355, 300)); g[0].LayoutRect.Should().Be(new Rectangle(10, 20, 200, 100)); g[1].LayoutRect.Should().Be(new Rectangle(215, 20, 150, 50)); }
public void ArrangeHorizontalExpanded() { var g = new BoxGroup(LayoutTestStyle.Create()); g.Spacing = 5; g.Orientation = Orientation.Horizontal; g.Add(LayoutTestWidget.FixedSize(200, 100).WithAnchorRect(AnchoredRect.Full)); g.Add(LayoutTestWidget.FixedSize(150, 50).WithAnchorRect(AnchoredRect.Full), true); g.Add(LayoutTestWidget.FixedSize(150, 50).WithAnchorRect(AnchoredRect.Full)); g.Arrange(new Rectangle(10, 20, 800, 500)); g.LayoutRect.Should().Be(new Rectangle(10, 20, 800, 500)); g[0].LayoutRect.Should().Be(new Rectangle(10, 20, 200, 500)); g[1].LayoutRect.Should().Be(new Rectangle(215, 20, 440, 500)); g[2].LayoutRect.Should().Be(new Rectangle(660, 20, 150, 500)); }
public void ArrangeVerticalExpanded() { var g = new BoxGroup(LayoutTestStyle.Create()); g.Spacing = 5; g.Add(LayoutTestWidget.FixedSize(200, 100)); g.Add(LayoutTestWidget.FixedSize(150, 50), true); g.Add(LayoutTestWidget.FixedSize(150, 50), true); g.Add(LayoutTestWidget.FixedSize(150, 50)); g.Arrange(new Rectangle(10, 20, 400, 1300)); g.LayoutRect.Should().Be(new Rectangle(10, 20, 400, 1300)); g[0].LayoutRect.Should().Be(new Rectangle(10, 20, 400, 100)); g[1].LayoutRect.Should().Be(new Rectangle(10, 125, 400, 567)); g[2].LayoutRect.Should().Be(new Rectangle(10, 697, 400, 568)); g[3].LayoutRect.Should().Be(new Rectangle(10, 1270, 400, 50)); }
public void ArrangeHugeAnchored() { var g = new BoxGroup(LayoutTestStyle.Create()); g.Spacing = 5; g.Orientation = Orientation.Horizontal; g.Add(LayoutTestWidget.FixedSize(2000, 1000).WithAnchorRect(AnchoredRect.CreateCentered(500, 500))); g.Add(LayoutTestWidget.FixedSize(150, 50).WithAnchorRect(AnchoredRect.CreateFull(10))); g.Arrange(new Rectangle(10, 20, 400, 300)); g.DesiredSize.Should().Be(new Size(675, 500)); // 500 + 150 + 20 (from full-anchor) + 5 g[0].DesiredSize.Should().Be(new Size(2000, 1000)); g[1].DesiredSize.Should().Be(new Size(150, 50)); g.LayoutRect.Should().Be(new Rectangle(10, 20, 675, 300)); g[0].LayoutRect.Should().Be(new Rectangle(10, -80, 500, 500)); g[1].LayoutRect.Should().Be(new Rectangle(525, 30, 150, 280)); }