internal/processtest: fix the timeout logic

Updates #2571
This commit is contained in:
Hajime Hoshi 2023-02-15 22:41:18 +09:00
parent 5038b8b645
commit 7018d1aebe

View File

@ -43,17 +43,17 @@ func (g *Game) Layout(width, height int) (int, int) {
done := make(chan struct{}) done := make(chan struct{})
timeout := time.After(time.Second) timeout := time.After(time.Second)
go func() { go func() {
i := ebiten.NewImage(width, height)
i.Fill(color.White)
i.Dispose()
close(done)
}()
select { select {
case <-done: case <-done:
case <-timeout: case <-timeout:
panic("timeout") panic("timeout")
} }
}()
defer close(done)
i := ebiten.NewImage(width, height)
i.Fill(color.White)
i.Dispose()
return width, height return width, height
} }