mirror of https://github.com/mum4k/termdash.git
Add tests, clean-up
This commit is contained in:
parent
4b7343b987
commit
e980c4bb2b
|
@ -713,7 +713,33 @@ func TestNew(t *testing.T) {
|
|||
},
|
||||
},
|
||||
{
|
||||
desc: "horizontal unequal split",
|
||||
desc: "horizontal, reversed unequal split",
|
||||
termSize: image.Point{10, 20},
|
||||
container: func(ft *faketerm.Terminal) (*Container, error) {
|
||||
return New(
|
||||
ft,
|
||||
SplitHorizontal(
|
||||
Top(
|
||||
Border(linestyle.Light),
|
||||
),
|
||||
Bottom(
|
||||
Border(linestyle.Light),
|
||||
),
|
||||
SplitPercentFromEnd(20),
|
||||
),
|
||||
)
|
||||
},
|
||||
want: func(size image.Point) *faketerm.Terminal {
|
||||
ft := faketerm.MustNew(size)
|
||||
cvs := testcanvas.MustNew(ft.Area())
|
||||
testdraw.MustBorder(cvs, image.Rect(0, 0, 10, 16))
|
||||
testdraw.MustBorder(cvs, image.Rect(0, 16, 10, 20))
|
||||
testcanvas.MustApply(cvs, ft)
|
||||
return ft
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "horizontal fixed splits",
|
||||
termSize: image.Point{10, 20},
|
||||
container: func(ft *faketerm.Terminal) (*Container, error) {
|
||||
return New(
|
||||
|
@ -738,6 +764,32 @@ func TestNew(t *testing.T) {
|
|||
return ft
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "horizontal, reversed fixed splits",
|
||||
termSize: image.Point{10, 20},
|
||||
container: func(ft *faketerm.Terminal) (*Container, error) {
|
||||
return New(
|
||||
ft,
|
||||
SplitHorizontal(
|
||||
Top(
|
||||
Border(linestyle.Light),
|
||||
),
|
||||
Bottom(
|
||||
Border(linestyle.Light),
|
||||
),
|
||||
SplitFixedFromEnd(4),
|
||||
),
|
||||
)
|
||||
},
|
||||
want: func(size image.Point) *faketerm.Terminal {
|
||||
ft := faketerm.MustNew(size)
|
||||
cvs := testcanvas.MustNew(ft.Area())
|
||||
testdraw.MustBorder(cvs, image.Rect(0, 0, 10, 16))
|
||||
testdraw.MustBorder(cvs, image.Rect(0, 16, 10, 20))
|
||||
testcanvas.MustApply(cvs, ft)
|
||||
return ft
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "horizontal split, parent and children have borders",
|
||||
termSize: image.Point{10, 10},
|
||||
|
|
Loading…
Reference in New Issue