gpu/internal/rendertest: allow nil pixel check functions

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2025-02-18 14:55:46 +00:00
parent 77709d1771
commit 0d23240556
3 changed files with 10 additions and 14 deletions
+4 -8
View File
@@ -132,8 +132,7 @@ func TestTexturedStrokeClipped(t *testing.T) {
defer clip.RRect{Rect: image.Rect(-30, -30, 60, 60)}.Push(o).Pop()
defer op.Offset(image.Pt(-10, -10)).Push(o).Pop()
paint.PaintOp{}.Add(o)
}, func(r result) {
})
}, nil)
}
func TestTexturedStroke(t *testing.T) {
@@ -146,8 +145,7 @@ func TestTexturedStroke(t *testing.T) {
}.Op().Push(o).Pop()
defer op.Offset(image.Pt(-10, -10)).Push(o).Pop()
paint.PaintOp{}.Add(o)
}, func(r result) {
})
}, nil)
}
func TestPaintClippedTexture(t *testing.T) {
@@ -252,8 +250,7 @@ func TestPathReuse(t *testing.T) {
stroke := clip.Stroke{Path: spec, Width: 3}.Op().Push(o)
paint.Fill(o, color.NRGBA{B: 0xFF, A: 0xFF})
stroke.Pop()
}, func(r result) {
})
}, nil)
}
func TestPathInterleave(t *testing.T) {
@@ -290,8 +287,7 @@ func TestStrokedRect(t *testing.T) {
Width: 5,
}.Op(),
)
}, func(r result) {
})
}, nil)
}
func TestInstancedRects(t *testing.T) {
+3 -5
View File
@@ -124,8 +124,7 @@ func TestDeferredPaint(t *testing.T) {
defer clip.Rect(image.Rect(0, 0, 80, 80)).Op().Push(o).Pop()
paint.ColorOp{Color: color.NRGBA{A: 0x60, B: 0xff}}.Add(o)
paint.PaintOp{}.Add(o)
}, func(r result) {
})
}, nil)
}
func constSqPath() clip.Op {
@@ -323,7 +322,7 @@ func TestLinearGradientAngled(t *testing.T) {
cl = clip.Rect(image.Rect(0, 64, 64, 128)).Push(ops)
paint.PaintOp{}.Add(ops)
cl.Pop()
}, func(r result) {})
}, nil)
}
func TestZeroImage(t *testing.T) {
@@ -492,8 +491,7 @@ func TestOpacity(t *testing.T) {
opc3 := paint.PushOpacity(ops, .6)
paint.FillShape(ops, color.NRGBA{B: 255, A: 255}, clip.Ellipse(image.Rectangle{Min: image.Pt(20+20, 10), Max: image.Pt(50+64, 128)}).Op(ops))
opc3.Pop()
}, func(r result) {
})
}, nil)
}
// lerp calculates linear interpolation with color b and p.
+3 -1
View File
@@ -90,7 +90,9 @@ func run(t *testing.T, f func(o *op.Ops), c func(r result)) {
name := fmt.Sprintf("%s-%d-bad.png", t.Name(), i)
saveImage(t, name, img)
}
c(result{t: t, img: img})
if c != nil {
c(result{t: t, img: img})
}
}
}