Add rounded border

This commit is contained in:
Patrik Svensson
2020-08-05 14:07:46 +02:00
committed by Patrik Svensson
parent 66994cd904
commit 108e56c229
6 changed files with 68 additions and 2 deletions

View File

@ -12,6 +12,7 @@ namespace Spectre.Console.Tests.Unit.Composition
[Theory]
[InlineData(BorderKind.Ascii, typeof(AsciiBorder))]
[InlineData(BorderKind.Square, typeof(SquareBorder))]
[InlineData(BorderKind.Rounded, typeof(RoundedBorder))]
public void Should_Return_Correct_Border_For_Specified_Kind(BorderKind kind, Type expected)
{
// Given, When

View File

@ -111,7 +111,7 @@ namespace Spectre.Console.Tests.Unit.Composition
}
[Fact]
public void Should_Render_Table_With_Specified_Border_Correctly()
public void Should_Render_Table_With_Ascii_Border_Correctly()
{
// Given
var console = new PlainConsole(width: 80);
@ -132,6 +132,28 @@ namespace Spectre.Console.Tests.Unit.Composition
console.Lines[5].ShouldBe("+-------------------------+");
}
[Fact]
public void Should_Render_Table_With_Rounded_Border_Correctly()
{
// Given
var console = new PlainConsole(width: 80);
var table = new Table(BorderKind.Rounded);
table.AddColumns("Foo", "Bar", "Baz");
table.AddRow("Qux", "Corgi", "Waldo");
table.AddRow("Grault", "Garply", "Fred");
// When
console.Render(table);
// Then
console.Lines[0].ShouldBe("╭────────┬────────┬───────╮");
console.Lines[1].ShouldBe("│ Foo │ Bar │ Baz │");
console.Lines[2].ShouldBe("├────────┼────────┼───────┤");
console.Lines[3].ShouldBe("│ Qux │ Corgi │ Waldo │");
console.Lines[4].ShouldBe("│ Grault │ Garply │ Fred │");
console.Lines[5].ShouldBe("╰────────┴────────┴───────╯");
}
[Fact]
public void Should_Render_Table_With_No_Border_Correctly()
{