gpu: don't panic for nil op.Ops argument to GPU.Frame

Updates gio#306

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-11-10 13:19:42 +01:00
parent 3f25a49c75
commit 5ddd572a41
4 changed files with 19 additions and 3 deletions
+1 -1
View File
@@ -55,7 +55,7 @@ func newContext() (context, error) {
if firstErr != nil {
return nil, firstErr
}
return nil, errors.New("x11: no available GPU backends")
return nil, errors.New("headless: no available GPU backends")
}
// NewWindow creates a new headless window.
+8
View File
@@ -132,6 +132,14 @@ func TestDepth(t *testing.T) {
}
}
func TestNoOps(t *testing.T) {
w, release := newTestWindow(t)
defer release()
if err := w.Frame(nil); err != nil {
t.Error(err)
}
}
func newTestWindow(t *testing.T) (*Window, func()) {
t.Helper()
sz := image.Point{X: 800, Y: 600}