mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
ebiten: Use internal/testing for tests
This commit is contained in:
parent
ab94cebd02
commit
19333c51e4
@ -16,13 +16,11 @@ package ebiten_test
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
|
||||||
"image"
|
"image"
|
||||||
"image/color"
|
"image/color"
|
||||||
"image/draw"
|
"image/draw"
|
||||||
_ "image/png"
|
_ "image/png"
|
||||||
"math"
|
"math"
|
||||||
"os"
|
|
||||||
"runtime"
|
"runtime"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
@ -30,24 +28,11 @@ import (
|
|||||||
"github.com/hajimehoshi/ebiten/ebitenutil"
|
"github.com/hajimehoshi/ebiten/ebitenutil"
|
||||||
"github.com/hajimehoshi/ebiten/examples/resources/images"
|
"github.com/hajimehoshi/ebiten/examples/resources/images"
|
||||||
"github.com/hajimehoshi/ebiten/internal/graphics"
|
"github.com/hajimehoshi/ebiten/internal/graphics"
|
||||||
"github.com/hajimehoshi/ebiten/internal/testflock"
|
t "github.com/hajimehoshi/ebiten/internal/testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
testflock.Lock()
|
t.MainWithRunLoop(m)
|
||||||
defer testflock.Unlock()
|
|
||||||
|
|
||||||
code := 0
|
|
||||||
// Run an Ebiten process so that (*Image).At is available.
|
|
||||||
regularTermination := errors.New("regular termination")
|
|
||||||
f := func(screen *Image) error {
|
|
||||||
code = m.Run()
|
|
||||||
return regularTermination
|
|
||||||
}
|
|
||||||
if err := Run(f, 320, 240, 1, "Test"); err != nil && err != regularTermination {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
os.Exit(code)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func openEbitenImage() (*Image, image.Image, error) {
|
func openEbitenImage() (*Image, image.Image, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user