From 4c11aac9291846f95d1df2765ea6fb9b27fb8b4b Mon Sep 17 00:00:00 2001 From: Thomas Friedel Date: Sat, 1 Sep 2018 15:59:14 +0200 Subject: [PATCH] added another test --- canvas_test.go | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) 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() + }) +}