added two more test cases

This commit is contained in:
Thomas Friedel 2018-07-27 16:46:32 +02:00
parent 61612d0b50
commit ee6bdb3af3
3 changed files with 27 additions and 0 deletions

View file

@ -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()
})
}

BIN
testimages/FillConcavePath.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 B

BIN
testimages/FillConvexPath.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 B