From ee6bdb3af325b89a7de077b41cad9d41dea50bca Mon Sep 17 00:00:00 2001 From: Thomas Friedel Date: Fri, 27 Jul 2018 16:46:32 +0200 Subject: [PATCH] added two more test cases --- canvas_test.go | 27 +++++++++++++++++++++++++++ testimages/FillConcavePath.png | Bin 0 -> 310 bytes testimages/FillConvexPath.png | Bin 0 -> 383 bytes 3 files changed, 27 insertions(+) create mode 100755 testimages/FillConcavePath.png create mode 100755 testimages/FillConvexPath.png diff --git a/canvas_test.go b/canvas_test.go index 13c724c..5646916 100644 --- a/canvas_test.go +++ b/canvas_test.go @@ -104,3 +104,30 @@ func TestFillRect(t *testing.T) { cv.FillRect(70, 10, 10, 10) }) } + +func TestFillConvexPath(t *testing.T) { + run(t, func(cv *canvas.Canvas) { + cv.SetFillStyle("#0F0") + cv.BeginPath() + cv.MoveTo(20, 20) + cv.LineTo(60, 20) + cv.LineTo(80, 80) + cv.LineTo(40, 80) + cv.ClosePath() + cv.Fill() + }) +} +func TestFillConcavePath(t *testing.T) { + run(t, func(cv *canvas.Canvas) { + cv.SetFillStyle("#0F0") + cv.BeginPath() + cv.MoveTo(20, 20) + cv.LineTo(60, 20) + cv.LineTo(60, 60) + cv.LineTo(50, 60) + cv.LineTo(50, 40) + cv.LineTo(20, 40) + cv.ClosePath() + cv.Fill() + }) +} diff --git a/testimages/FillConcavePath.png b/testimages/FillConcavePath.png new file mode 100755 index 0000000000000000000000000000000000000000..c6fb294f45a825371155e25bee6f9c3a43076593 GIT binary patch literal 310 zcmeAS@N?(olHy`uVBq!ia0vp^DIm5vWim(Fc`Tzf?#WS7WZRxiN7!VAeu6{1-oD!Mz=5sd#bXl$$X1I-8s(pTjHzi`Tm`aXxzw@%zBKgM^r-FAS_|c0UQF)kNvXjyKlX3 zed>4rJ!>A^iMW6I+{K!EU+!EnBOo0K*;OXk;vd$@?2>^uLp`ri) literal 0 HcmV?d00001