From 5816873b7463df16e67b3ffe67ee8eda4fdd243c Mon Sep 17 00:00:00 2001 From: gizak Date: Wed, 13 May 2015 08:57:11 -0400 Subject: [PATCH] Adjust Block test --- _block_test.go => block_test.go | 10 +++++++--- helper.go | 6 +++++- 2 files changed, 12 insertions(+), 4 deletions(-) rename _block_test.go => block_test.go (86%) diff --git a/_block_test.go b/block_test.go similarity index 86% rename from _block_test.go rename to block_test.go index 2de205b..0b97c3e 100644 --- a/_block_test.go +++ b/block_test.go @@ -11,7 +11,11 @@ func TestBlock_InnerBounds(t *testing.T) { assert := func(name string, x, y, w, h int) { 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 { 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) - b.HasBorder = true + b.Border = true assert("border, no padding", 11, 12, 10, 11) b.PaddingBottom = 2 diff --git a/helper.go b/helper.go index 1c8f5ef..275cb9c 100644 --- a/helper.go +++ b/helper.go @@ -17,6 +17,7 @@ import rw "github.com/mattn/go-runewidth" // Attribute is printable cell's color and style. type Attribute uint16 +// 8 basic clolrs const ( ColorDefault Attribute = iota ColorBlack @@ -29,7 +30,10 @@ const ( 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 ( AttrBold Attribute = 1 << (iota + 9) AttrUnderline