diff --git a/canvas_test.go b/canvas_test.go index d3d4c27..cee10f4 100644 --- a/canvas_test.go +++ b/canvas_test.go @@ -289,3 +289,36 @@ func TestAlpha(t *testing.T) { cv.Stroke() }) } + +func TestClosePath(t *testing.T) { + run(t, func(cv *canvas.Canvas) { + cv.SetStrokeStyle("#0F0") + cv.SetLineWidth(2.5) + cv.BeginPath() + cv.MoveTo(20, 20) + cv.LineTo(40, 20) + cv.LineTo(40, 40) + cv.LineTo(20, 40) + cv.ClosePath() + cv.MoveTo(60, 20) + cv.LineTo(80, 20) + cv.LineTo(80, 40) + cv.LineTo(60, 40) + cv.ClosePath() + cv.Stroke() + + cv.SetFillStyle("#00F") + cv.BeginPath() + cv.MoveTo(20, 60) + cv.LineTo(40, 60) + cv.LineTo(40, 80) + cv.LineTo(20, 80) + cv.ClosePath() + cv.MoveTo(60, 60) + cv.LineTo(80, 60) + cv.LineTo(80, 80) + cv.LineTo(60, 80) + cv.ClosePath() + cv.Fill() + }) +}