diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-06-25 23:18:42 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-06-25 23:18:42 +0800 |
commit | b0a5be4495962c291a25cbea793e43bad0781510 (patch) | |
tree | e058201e7b29c3cb8efd710e20ec1e1f97f64368 /Godeps/_workspace/src/github.com/gizak/termui/block_test.go | |
parent | e64625aa8215985c85f97f914a98db081e07714f (diff) | |
parent | e9c0b5431cbd7430ddec9fd17983241018fd8a55 (diff) | |
download | go-tangerine-b0a5be4495962c291a25cbea793e43bad0781510.tar go-tangerine-b0a5be4495962c291a25cbea793e43bad0781510.tar.gz go-tangerine-b0a5be4495962c291a25cbea793e43bad0781510.tar.bz2 go-tangerine-b0a5be4495962c291a25cbea793e43bad0781510.tar.lz go-tangerine-b0a5be4495962c291a25cbea793e43bad0781510.tar.xz go-tangerine-b0a5be4495962c291a25cbea793e43bad0781510.tar.zst go-tangerine-b0a5be4495962c291a25cbea793e43bad0781510.zip |
Merge pull request #1321 from karalabe/cut-it-open-3000
Metrics collecting and reporting support
Diffstat (limited to 'Godeps/_workspace/src/github.com/gizak/termui/block_test.go')
-rw-r--r-- | Godeps/_workspace/src/github.com/gizak/termui/block_test.go | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/Godeps/_workspace/src/github.com/gizak/termui/block_test.go b/Godeps/_workspace/src/github.com/gizak/termui/block_test.go new file mode 100644 index 000000000..2de205b21 --- /dev/null +++ b/Godeps/_workspace/src/github.com/gizak/termui/block_test.go @@ -0,0 +1,46 @@ +package termui + +import "testing" + +func TestBlock_InnerBounds(t *testing.T) { + b := NewBlock() + b.X = 10 + b.Y = 11 + b.Width = 12 + b.Height = 13 + + assert := func(name string, x, y, w, h int) { + t.Log(name) + cx, cy, cw, ch := b.InnerBounds() + if cx != x { + t.Errorf("expected x to be %d but got %d", x, cx) + } + if cy != y { + t.Errorf("expected y to be %d but got %d", y, cy) + } + if cw != w { + t.Errorf("expected width to be %d but got %d", w, cw) + } + if ch != h { + t.Errorf("expected height to be %d but got %d", h, ch) + } + } + + b.HasBorder = false + assert("no border, no padding", 10, 11, 12, 13) + + b.HasBorder = true + assert("border, no padding", 11, 12, 10, 11) + + b.PaddingBottom = 2 + assert("border, 2b padding", 11, 12, 10, 9) + + b.PaddingTop = 3 + assert("border, 2b 3t padding", 11, 15, 10, 6) + + b.PaddingLeft = 4 + assert("border, 2b 3t 4l padding", 15, 15, 6, 6) + + b.PaddingRight = 5 + assert("border, 2b 3t 4l 5r padding", 15, 15, 1, 6) +} |