From 7008fa292f3aec1f3acf3a3b8434612722511e74 Mon Sep 17 00:00:00 2001 From: Jakub Sobon Date: Sun, 30 Dec 2018 22:34:36 -0500 Subject: [PATCH] More test coverage. --- draw/braille_line_test.go | 64 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/draw/braille_line_test.go b/draw/braille_line_test.go index 552bc8e..c632c10 100644 --- a/draw/braille_line_test.go +++ b/draw/braille_line_test.go @@ -245,6 +245,70 @@ func TestBrailleLine(t *testing.T) { testbraille.MustSetPixel(bc, image.Point{1, 2}) testbraille.MustSetPixel(bc, image.Point{0, 3}) + testbraille.MustApply(bc, ft) + return ft + }, + }, + { + desc: "draws horizontal line, octant E", + canvas: image.Rect(0, 0, 1, 1), + start: image.Point{0, 0}, + end: image.Point{1, 0}, + want: func(size image.Point) *faketerm.Terminal { + ft := faketerm.MustNew(size) + bc := testbraille.MustNew(ft.Area()) + + testbraille.MustSetPixel(bc, image.Point{0, 0}) + testbraille.MustSetPixel(bc, image.Point{1, 0}) + + testbraille.MustApply(bc, ft) + return ft + }, + }, + { + desc: "draws horizontal line, octant W", + canvas: image.Rect(0, 0, 1, 1), + start: image.Point{1, 0}, + end: image.Point{0, 0}, + want: func(size image.Point) *faketerm.Terminal { + ft := faketerm.MustNew(size) + bc := testbraille.MustNew(ft.Area()) + + testbraille.MustSetPixel(bc, image.Point{0, 0}) + testbraille.MustSetPixel(bc, image.Point{1, 0}) + + testbraille.MustApply(bc, ft) + return ft + }, + }, + { + desc: "draws vertical line, octant S", + canvas: image.Rect(0, 0, 1, 1), + start: image.Point{0, 0}, + end: image.Point{0, 1}, + want: func(size image.Point) *faketerm.Terminal { + ft := faketerm.MustNew(size) + bc := testbraille.MustNew(ft.Area()) + + testbraille.MustSetPixel(bc, image.Point{0, 0}) + testbraille.MustSetPixel(bc, image.Point{0, 1}) + + testbraille.MustApply(bc, ft) + return ft + }, + }, + { + desc: "draws vertical line, octant N", + canvas: image.Rect(0, 0, 1, 1), + start: image.Point{0, 1}, + end: image.Point{0, 0}, + want: func(size image.Point) *faketerm.Terminal { + ft := faketerm.MustNew(size) + bc := testbraille.MustNew(ft.Area()) + + testbraille.MustSetPixel(bc, image.Point{0, 0}) + testbraille.MustSetPixel(bc, image.Point{0, 1}) + testbraille.MustApply(bc, ft) return ft },