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{})
timeout := time.After(time.Second)
go func() {
select {
case <-done:
case <-timeout:
panic("timeout")
}
i := ebiten.NewImage(width, height)
i.Fill(color.White)
i.Dispose()
close(done)
}()
defer close(done)
i := ebiten.NewImage(width, height)
i.Fill(color.White)
i.Dispose()
select {
case <-done:
case <-timeout:
panic("timeout")
}
return width, height
}