gpu/internal/rendertest: test textured strokes, including clipping

The new compute renderer can draw simple strokes. Test that clipping
works with a stroke basis, and that images can be drawn into strokes.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-03-19 21:44:29 +01:00
parent ac800a9d8f
commit 60bab15164
4 changed files with 42 additions and 5 deletions
+33
View File
@@ -118,6 +118,39 @@ func TestPaintTexture(t *testing.T) {
})
}
func TestTexturedStrokeClipped(t *testing.T) {
run(t, func(o *op.Ops) {
smallSquares.Add(o)
op.Offset(f32.Pt(50, 50)).Add(o)
clip.Stroke{
Path: clip.RRect{Rect: f32.Rect(0, 0, 30, 30)}.Path(o),
Style: clip.StrokeStyle{
Width: 10,
},
}.Op().Add(o)
clip.RRect{Rect: f32.Rect(-30, -30, 60, 60)}.Add(o)
op.Offset(f32.Pt(-10, -10)).Add(o)
paint.PaintOp{}.Add(o)
}, func(r result) {
})
}
func TestTexturedStroke(t *testing.T) {
run(t, func(o *op.Ops) {
smallSquares.Add(o)
op.Offset(f32.Pt(50, 50)).Add(o)
clip.Stroke{
Path: clip.RRect{Rect: f32.Rect(0, 0, 30, 30)}.Path(o),
Style: clip.StrokeStyle{
Width: 10,
},
}.Op().Add(o)
op.Offset(f32.Pt(-10, -10)).Add(o)
paint.PaintOp{}.Add(o)
}, func(r result) {
})
}
func TestPaintClippedTexture(t *testing.T) {
run(t, func(o *op.Ops) {
squares.Add(o)