mirror of
https://github.com/mum4k/termdash.git
synced 2025-04-30 13:48:54 +08:00
Bugfix - correctly determine area on a braille canvas.
This commit is contained in:
parent
310ea212d3
commit
54b6dce805
@ -115,7 +115,7 @@ func (c *Canvas) Size() image.Point {
|
|||||||
// than the area used to create the braille canvas.
|
// than the area used to create the braille canvas.
|
||||||
func (c *Canvas) Area() image.Rectangle {
|
func (c *Canvas) Area() image.Rectangle {
|
||||||
ar := c.regular.Area()
|
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.
|
// Clear clears all the content on the canvas.
|
||||||
|
@ -109,6 +109,12 @@ func TestNew(t *testing.T) {
|
|||||||
wantSize: image.Point{6, 12},
|
wantSize: image.Point{6, 12},
|
||||||
wantArea: image.Rect(0, 0, 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 {
|
for _, tc := range tests {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user