Added last file and used fluent style, relocated test

This commit is contained in:
BlazeFace 2024-10-26 07:25:38 -07:00
parent 00b9aecb4f
commit bc88da8056
2 changed files with 60 additions and 33 deletions

View File

@ -0,0 +1,31 @@
┌──────────────────┐┌──────────────────┐
│ Hello, World! ││ Hello, World! │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
└──────────────────┘│ │
┌──────────────────┐│ │
│ Hello, World! ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
└──────────────────┘│ │
┌──────────────────┐│ │
│ Hello, World! ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
└──────────────────┘└──────────────────┘

View File

@ -153,6 +153,35 @@ public sealed class LayoutTests
return Verifier.Verify(console.Output);
}
[Theory]
[InlineData(17, "17")]
[InlineData(20, "20")]
[InlineData(23, "23")]
[InlineData(28, "28")]
[InlineData(31, "31")]
[Expectation("Render_Layout_With_Nested_Three_Rows_In_One_Column")]
public Task Should_Render_Layout_With_Three_And_One_Columns(int height, string expectationPrefix)
{
// Given
var console = new TestConsole().Size(new Size(40, height));
// Layout with 2 columns, left column has 3 rows and right column has 1 row
var layout = new Layout(new Panel("Hello, World!") { Expand = true })
.SplitColumns(
new Layout(new Panel("Hello, World!") { Expand = true })
.SplitRows(
new Layout(new Panel("Hello, World!") { Expand = true }),
new Layout(new Panel("Hello, World!") { Expand = true }),
new Layout(new Panel("Hello, World!") { Expand = true })),
new Layout(new Panel("Hello, World!") { Expand = true }));
// When
console.Write(layout);
// Then
return Verifier.Verify(console.Output).UseTextForParameters(expectationPrefix);
}
[Fact]
[Expectation("Render_Layout_Without_Invisible_Children")]
public Task Should_Render_Layout_Without_Invisible_Children()
@ -264,37 +293,4 @@ public sealed class LayoutTests
// Then
return Verifier.Verify(console.Output);
}
[Fact]
[Expectation("Render_Layout_With_Three_And_One_Columns")]
public Task Should_Render_Layout_With_Three_And_One_Columns()
{
// Given
var console = new TestConsole().Size(new Size(40, 17));
var layout = new Layout();
var col1 = new Layout();
var col1Row1 = new Layout();
var col1Row2 = new Layout();
var col1Row3 = new Layout();
col1.SplitRows(col1Row1, col1Row2, col1Row3);
var col2 = new Layout();
layout.SplitColumns(col1, col2);
var panel = new Panel("Hello, World!") { Expand = true };
List<Layout> layouts = [col1Row1, col1Row2, col1Row3, col2];
foreach (var l in layouts)
{
l.Update(panel);
}
// When
console.Write(layout);
// Then
return Verifier.Verify(console.Output);
}
}