mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-03 00:16:15 +00:00
app/headless,internal/rendertest: report errors from headless renders
Updates gio#144 Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -106,8 +106,8 @@ func (w *Window) Release() {
|
||||
|
||||
// Frame replace the window content and state with the
|
||||
// operation list.
|
||||
func (w *Window) Frame(frame *op.Ops) {
|
||||
contextDo(w.ctx, func() error {
|
||||
func (w *Window) Frame(frame *op.Ops) error {
|
||||
return contextDo(w.ctx, func() error {
|
||||
w.gpu.Collect(w.size, frame)
|
||||
w.gpu.BeginFrame()
|
||||
w.gpu.EndFrame()
|
||||
|
||||
@@ -26,7 +26,9 @@ func TestHeadless(t *testing.T) {
|
||||
X: float32(sz.X) - 100,
|
||||
Y: float32(sz.Y) - 100,
|
||||
}}}.Add(&ops)
|
||||
w.Frame(&ops)
|
||||
if err := w.Frame(&ops); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
img, err := w.Screenshot()
|
||||
if err != nil {
|
||||
@@ -70,7 +72,9 @@ func TestClipping(t *testing.T) {
|
||||
NW: 75,
|
||||
}.Op(&ops).Add(&ops)
|
||||
pop.Add(&ops)
|
||||
w.Frame(&ops)
|
||||
if err := w.Frame(&ops); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
img, err := w.Screenshot()
|
||||
if err != nil {
|
||||
@@ -113,7 +117,9 @@ func TestDepth(t *testing.T) {
|
||||
paint.PaintOp{Rect: f32.Rectangle{
|
||||
Max: f32.Point{X: 100, Y: 50},
|
||||
}}.Add(&ops)
|
||||
w.Frame(&ops)
|
||||
if err := w.Frame(&ops); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
img, err := w.Screenshot()
|
||||
if err != nil {
|
||||
|
||||
@@ -44,7 +44,9 @@ func drawImage(t *testing.T, size int, ops *op.Ops, draw func(o *op.Ops)) (im *i
|
||||
sz := image.Point{X: size, Y: size}
|
||||
w := newWindow(t, sz.X, sz.Y)
|
||||
draw(ops)
|
||||
w.Frame(ops)
|
||||
if err := w.Frame(ops); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return w.Screenshot()
|
||||
}
|
||||
|
||||
@@ -100,13 +102,16 @@ func multiRun(t *testing.T, frames ...frameT) {
|
||||
for i := range frames {
|
||||
ops.Reset()
|
||||
frames[i].f(ops)
|
||||
w.Frame(ops)
|
||||
if err := w.Frame(ops); err != nil {
|
||||
t.Errorf("rendering failed: %v", err)
|
||||
continue
|
||||
}
|
||||
img, err = w.Screenshot()
|
||||
if err != nil {
|
||||
t.Error("error rendering:", err)
|
||||
return
|
||||
t.Errorf("screenshot failed: %v", err)
|
||||
continue
|
||||
}
|
||||
// check for a reference image and make sure we are identical.
|
||||
// Check for a reference image and make sure they are identical.
|
||||
ok := verifyRef(t, img, i)
|
||||
if frames[i].c != nil {
|
||||
frames[i].c(result{t: t, img: img})
|
||||
|
||||
Reference in New Issue
Block a user