diff --git a/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Layout/Render_Layout_With_Nested_Three_Rows_In_One_Column.Output_31.verified.txt b/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Layout/Render_Layout_With_Nested_Three_Rows_In_One_Column.Output_31.verified.txt new file mode 100644 index 0000000..be6f4b5 --- /dev/null +++ b/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Layout/Render_Layout_With_Nested_Three_Rows_In_One_Column.Output_31.verified.txt @@ -0,0 +1,31 @@ +┌──────────────────┐┌──────────────────┐ +│ Hello, World! ││ Hello, World! │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +└──────────────────┘│ │ +┌──────────────────┐│ │ +│ Hello, World! ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +└──────────────────┘│ │ +┌──────────────────┐│ │ +│ Hello, World! ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +└──────────────────┘└──────────────────┘ \ No newline at end of file diff --git a/src/Tests/Spectre.Console.Tests/Unit/Widgets/LayoutTests.cs b/src/Tests/Spectre.Console.Tests/Unit/Widgets/LayoutTests.cs index b73cb67..54182e1 100644 --- a/src/Tests/Spectre.Console.Tests/Unit/Widgets/LayoutTests.cs +++ b/src/Tests/Spectre.Console.Tests/Unit/Widgets/LayoutTests.cs @@ -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 layouts = [col1Row1, col1Row2, col1Row3, col2]; - foreach (var l in layouts) - { - l.Update(panel); - } - - // When - console.Write(layout); - - // Then - return Verifier.Verify(console.Output); - } }