Skip to content

Commit

Permalink
cops: add a render_model8 test case
Browse files Browse the repository at this point in the history
  • Loading branch information
jcorbin committed Dec 18, 2017
1 parent 9e9e452 commit aabb915
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions internal/cops/display/render_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package display_test
import (
"image"
"image/color"
"strings"
"testing"

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -44,3 +45,28 @@ func TestRender_blankAndMultiRuneCellOver(t *testing.T) {
buf, cur = RenderOver(buf, cur, front, back, Model0)
assert.Equal(t, []byte(" "+whiteHand+"\r\033[2C "), buf)
}

func TestRender_model8(t *testing.T) {
dis := New(image.Rect(0, 0, 16, 8))
for y := 0; y < 8; y++ {
b := Colors[y]
for x := 0; x < 16; x++ {
f := Colors[x/2]
dis.SetRGBA(x, y, "<", f, b)
x++
dis.SetRGBA(x, y, ">", f, b)
}
}
// TODO also cur = Start
buf, _ := Render(nil, Reset, dis, Model3)
assert.Equal(t, []string{
"<><><><><><><><>",
"<><><><><><><><>",
"<><><><><><><><>",
"<><><><><><><><>",
"<><><><><><><><>",
"<><><><><><><><>",
"<><><><><><><><>",
"<><><><><><><><>",
}, strings.Split(string(buf), "\r\n"))
}

0 comments on commit aabb915

Please sign in to comment.