mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 09:55:40 +00:00
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:
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user