mirror of https://github.com/gizak/termui.git
Adjust Block test
This commit is contained in:
parent
ba58fa4034
commit
5816873b74
|
@ -11,7 +11,11 @@ func TestBlock_InnerBounds(t *testing.T) {
|
||||||
|
|
||||||
assert := func(name string, x, y, w, h int) {
|
assert := func(name string, x, y, w, h int) {
|
||||||
t.Log(name)
|
t.Log(name)
|
||||||
cx, cy, cw, ch := b.InnerBounds()
|
area := b.InnerBounds()
|
||||||
|
cx := area.Min.X
|
||||||
|
cy := area.Min.Y
|
||||||
|
cw := area.Dx()
|
||||||
|
ch := area.Dy()
|
||||||
if cx != x {
|
if cx != x {
|
||||||
t.Errorf("expected x to be %d but got %d", x, cx)
|
t.Errorf("expected x to be %d but got %d", x, cx)
|
||||||
}
|
}
|
||||||
|
@ -26,10 +30,10 @@ func TestBlock_InnerBounds(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
b.HasBorder = false
|
b.Border = false
|
||||||
assert("no border, no padding", 10, 11, 12, 13)
|
assert("no border, no padding", 10, 11, 12, 13)
|
||||||
|
|
||||||
b.HasBorder = true
|
b.Border = true
|
||||||
assert("border, no padding", 11, 12, 10, 11)
|
assert("border, no padding", 11, 12, 10, 11)
|
||||||
|
|
||||||
b.PaddingBottom = 2
|
b.PaddingBottom = 2
|
|
@ -17,6 +17,7 @@ import rw "github.com/mattn/go-runewidth"
|
||||||
// Attribute is printable cell's color and style.
|
// Attribute is printable cell's color and style.
|
||||||
type Attribute uint16
|
type Attribute uint16
|
||||||
|
|
||||||
|
// 8 basic clolrs
|
||||||
const (
|
const (
|
||||||
ColorDefault Attribute = iota
|
ColorDefault Attribute = iota
|
||||||
ColorBlack
|
ColorBlack
|
||||||
|
@ -29,7 +30,10 @@ const (
|
||||||
ColorWhite
|
ColorWhite
|
||||||
)
|
)
|
||||||
|
|
||||||
const NumberofColors = 8 //Have a constant that defines number of colors
|
//Have a constant that defines number of colors
|
||||||
|
const NumberofColors = 8
|
||||||
|
|
||||||
|
// Text style
|
||||||
const (
|
const (
|
||||||
AttrBold Attribute = 1 << (iota + 9)
|
AttrBold Attribute = 1 << (iota + 9)
|
||||||
AttrUnderline
|
AttrUnderline
|
||||||
|
|
Loading…
Reference in New Issue