ci-platforms / darwin amd64 smoke (push) Skipped
ci-platforms / windows amd64 smoke (push) Skipped
ci-platforms / darwin arm64 smoke (push) Skipped
github-native / linux amd64 native (push) Skipped
ci / checks (push) Successful in 6m33s
ci / build (amd64, linux, ubuntu-24.04) (push) Failing after 12m26s
ci / release (push) Skipped
github-native / darwin amd64 native (push) Canceled after 0s
github-native / windows amd64 native (push) Canceled after 0s
github-native / darwin arm64 native (push) Canceled after 0s
42 lines
896 B
Go
42 lines
896 B
Go
package engine
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"aego/gpu"
|
|
"aego/platform"
|
|
)
|
|
|
|
type finishProbe struct {
|
|
testApp
|
|
texture gpu.TextureHandle
|
|
calls int
|
|
readErr error
|
|
}
|
|
|
|
func (a *finishProbe) Init(e *Engine) error {
|
|
a.testApp.Init(e)
|
|
var err error
|
|
a.texture, err = e.GPU().CreateTexture(gpu.TextureDesc{Width: 1, Height: 1, Format: gpu.TexRGBA8})
|
|
return err
|
|
}
|
|
|
|
func (a *finishProbe) FrameFinished() {
|
|
a.calls++
|
|
a.readErr = a.e.GPU().ReadPixels(a.texture, 0, 0, 1, 1, make([]byte, 4))
|
|
}
|
|
|
|
func TestFrameFinisherRunsAfterEndFrameAndNotWhenMinimized(t *testing.T) {
|
|
e, plat := newTestEngine(t)
|
|
defer e.Close()
|
|
a := &finishProbe{}
|
|
if !e.Step(a) || a.calls != 1 || a.readErr != nil {
|
|
t.Fatalf("finish calls=%d, readback error=%v", a.calls, a.readErr)
|
|
}
|
|
plat.Push(platform.Event{Kind: platform.EvWindowMinimized})
|
|
e.Step(a)
|
|
if a.calls != 1 {
|
|
t.Fatal("finisher ran for a minimized frame")
|
|
}
|
|
}
|