mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-16 08:52:50 +08:00
(#1188) Rows measure greedy
This commit is contained in:
parent
e2a674815d
commit
bbf58ee814
@ -41,8 +41,8 @@ public sealed class Rows : Renderable, IExpandable
|
|||||||
if (measurements.Length > 0)
|
if (measurements.Length > 0)
|
||||||
{
|
{
|
||||||
return new Measurement(
|
return new Measurement(
|
||||||
measurements.Min(c => c.Min),
|
measurements.Max(c => c.Min),
|
||||||
measurements.Min(c => c.Max));
|
measurements.Max(c => c.Max));
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Measurement(0, 0);
|
return new Measurement(0, 0);
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
┌─────┐
|
||||||
|
│ 1 │
|
||||||
|
│ 22 │
|
||||||
|
│ 333 │
|
||||||
|
└─────┘
|
@ -4,6 +4,29 @@ namespace Spectre.Console.Tests.Unit;
|
|||||||
[ExpectationPath("Widgets/Rows")]
|
[ExpectationPath("Widgets/Rows")]
|
||||||
public sealed class RowsTests
|
public sealed class RowsTests
|
||||||
{
|
{
|
||||||
|
[Fact]
|
||||||
|
[Expectation("GH-1188-Rows")]
|
||||||
|
[GitHubIssue("https://github.com/spectreconsole/spectre.console/issues/1188")]
|
||||||
|
public Task Should_Render_Rows_In_Panel_Without_Breaking_Lines()
|
||||||
|
{
|
||||||
|
// Given
|
||||||
|
var console = new TestConsole().Width(60);
|
||||||
|
var rows = new Rows(
|
||||||
|
new IRenderable[]
|
||||||
|
{
|
||||||
|
new Text("1"),
|
||||||
|
new Text("22"),
|
||||||
|
new Text("333"),
|
||||||
|
});
|
||||||
|
var panel = new Panel(rows);
|
||||||
|
|
||||||
|
// When
|
||||||
|
console.Write(panel);
|
||||||
|
|
||||||
|
// Then
|
||||||
|
return Verifier.Verify(console.Output);
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
[Expectation("Render")]
|
[Expectation("Render")]
|
||||||
public Task Should_Render_Rows()
|
public Task Should_Render_Rows()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user