added two more tests

This commit is contained in:
Thomas Friedel 2018-08-06 17:17:04 +02:00
parent 368dda1372
commit 1392b6caa8
3 changed files with 52 additions and 0 deletions

View file

@ -237,3 +237,55 @@ func TestLineDash(t *testing.T) {
}
})
}
func TestCurves(t *testing.T) {
run(t, func(cv *canvas.Canvas) {
cv.SetStrokeStyle("#00F")
cv.SetLineWidth(2.5)
cv.BeginPath()
cv.Arc(30, 30, 15, 0, 4, false)
cv.ClosePath()
cv.MoveTo(30, 70)
cv.LineTo(40, 70)
cv.ArcTo(50, 70, 50, 55, 5)
cv.ArcTo(50, 40, 55, 40, 5)
cv.QuadraticCurveTo(70, 40, 80, 60)
cv.BezierCurveTo(70, 80, 60, 80, 50, 90)
cv.Stroke()
})
}
func TestAlpha(t *testing.T) {
run(t, func(cv *canvas.Canvas) {
cv.SetStrokeStyle("#F00")
cv.SetLineWidth(2.5)
cv.BeginPath()
cv.Arc(30, 30, 15, 0, 4, false)
cv.ClosePath()
cv.MoveTo(30, 70)
cv.LineTo(40, 70)
cv.ArcTo(50, 70, 50, 55, 5)
cv.ArcTo(50, 40, 55, 40, 5)
cv.QuadraticCurveTo(70, 40, 80, 60)
cv.BezierCurveTo(70, 80, 60, 80, 50, 90)
cv.Stroke()
cv.SetStrokeStyle("#0F08")
cv.SetLineWidth(5)
cv.BeginPath()
cv.MoveTo(10, 10)
cv.LineTo(90, 90)
cv.LineTo(90, 10)
cv.LineTo(10, 90)
cv.ClosePath()
cv.Stroke()
cv.SetGlobalAlpha(0.5)
cv.SetStrokeStyle("#FFF8")
cv.SetLineWidth(8)
cv.BeginPath()
cv.MoveTo(50, 10)
cv.LineTo(50, 90)
cv.Stroke()
})
}

BIN
testimages/Alpha.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
testimages/Curves.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 641 B