app/headless: add lower-level backend tests

Add a series of low level gpu.Backend tests to assure the correct behaviour of
Backends. The immediate use is debugging of the Direct3D port, in the future
for developing new backends.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-02-23 11:38:02 +01:00
parent 55c74d3159
commit 7ff2f60412
8 changed files with 441 additions and 10 deletions
+16 -7
View File
@@ -13,14 +13,11 @@ import (
)
func TestHeadless(t *testing.T) {
sz := image.Point{X: 800, Y: 600}
w, err := NewWindow(sz.X, sz.Y)
if err != nil {
t.Skipf("headless windows not supported: %v", err)
}
defer w.Release()
w, release := newTestWindow(t)
defer release()
col := color.RGBA{A: 0xff, R: 0xcc, G: 0xcc}
sz := w.size
col := color.RGBA{A: 0xff, R: 0xca, G: 0xfe}
var ops op.Ops
paint.ColorOp{Color: col}.Add(&ops)
// Paint only part of the screen to avoid the glClear optimization.
@@ -41,3 +38,15 @@ func TestHeadless(t *testing.T) {
t.Errorf("got color %v, expected %v", got, col)
}
}
func newTestWindow(t *testing.T) (*Window, func()) {
t.Helper()
sz := image.Point{X: 800, Y: 600}
w, err := NewWindow(sz.X, sz.Y)
if err != nil {
t.Skipf("headless windows not supported: %v", err)
}
return w, func() {
w.Release()
}
}