Bugfix - correctly determine area on a braille canvas.

This commit is contained in:
Jakub Sobon 2019-01-20 15:44:43 -05:00
parent 310ea212d3
commit 54b6dce805
No known key found for this signature in database
GPG Key ID: F2451A77FB05D3B7
2 changed files with 7 additions and 1 deletions

View File

@ -115,7 +115,7 @@ func (c *Canvas) Size() image.Point {
// than the area used to create the braille canvas.
func (c *Canvas) Area() image.Rectangle {
ar := c.regular.Area()
return image.Rect(0, 0, ar.Dx()*ColMult, ar.Dx()*RowMult)
return image.Rect(0, 0, ar.Dx()*ColMult, ar.Dy()*RowMult)
}
// Clear clears all the content on the canvas.

View File

@ -109,6 +109,12 @@ func TestNew(t *testing.T) {
wantSize: image.Point{6, 12},
wantArea: image.Rect(0, 0, 6, 12),
},
{
desc: "braille from non-zero-based multi-cell rectangular area",
ar: image.Rect(6, 6, 9, 10),
wantSize: image.Point{6, 16},
wantArea: image.Rect(0, 0, 6, 16),
},
}
for _, tc := range tests {