handle uneven disribution of space
This commit is contained in:
@@ -55,6 +55,32 @@ func TestContainerTwoBoxesHStack(t *testing.T) {
|
||||
t.Fail()
|
||||
}
|
||||
}
|
||||
func TestContainerThreeBoxesUnevenHStack(t *testing.T) {
|
||||
expect := `┌─ one ──┐┌─ two ──┐┌─ three
|
||||
│ ││ ││ │
|
||||
│ ││ ││ │
|
||||
│ ││ ││ │
|
||||
└────────┘└────────┘└───────┘
|
||||
`
|
||||
m := &MockScreen{}
|
||||
one := NewBox("one", nil, Contents{})
|
||||
two := NewBox("two", nil, Contents{})
|
||||
three := NewBox("three", nil, Contents{})
|
||||
container := NewContainer(
|
||||
Contents{{Container: one}, {Container: two}, {Container: three}},
|
||||
LayoutHorizontalEven,
|
||||
)
|
||||
m.Init()
|
||||
m.Resize(0, 0, 5, 29)
|
||||
container.SetSize(0, 0, 5, 29)
|
||||
container.Draw(m)
|
||||
result := m.DumpContents()
|
||||
if result != expect {
|
||||
fmt.Printf("expected:\n%+v", expect)
|
||||
fmt.Printf("actual:\n%+v", result)
|
||||
t.Fail()
|
||||
}
|
||||
}
|
||||
|
||||
func TestContainerTwoBoxesVStack(t *testing.T) {
|
||||
expect := `┌─ one ──┐
|
||||
|
Reference in New Issue
Block a user