ebiten: Skip some slow tests on GopherJS

Fixes #1138
This commit is contained in:
Hajime Hoshi 2020-04-19 01:32:54 +09:00
parent bbf9b219ec
commit 81159b8538

View File

@ -29,6 +29,7 @@ import (
"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"
t "github.com/hajimehoshi/ebiten/internal/testing" t "github.com/hajimehoshi/ebiten/internal/testing"
"github.com/hajimehoshi/ebiten/internal/web"
) )
func TestMain(m *testing.M) { func TestMain(m *testing.M) {
@ -67,6 +68,10 @@ func sameColors(c1, c2 color.RGBA, delta int) bool {
abs(int(c1.A)-int(c2.A)) <= delta abs(int(c1.A)-int(c2.A)) <= delta
} }
func isGopherJS() bool {
return web.IsBrowser() && runtime.GOOS != "js"
}
func TestImagePixels(t *testing.T) { func TestImagePixels(t *testing.T) {
img0, img, err := openEbitenImage() img0, img, err := openEbitenImage()
if err != nil { if err != nil {
@ -542,6 +547,11 @@ func TestImageClear(t *testing.T) {
// Issue #317, #558, #724 // Issue #317, #558, #724
func TestImageEdge(t *testing.T) { func TestImageEdge(t *testing.T) {
if isGopherJS() {
t.Skip("too slow on GopherJS")
return
}
const ( const (
img0Width = 16 img0Width = 16
img0Height = 16 img0Height = 16
@ -927,6 +937,11 @@ func TestImageCopy(t *testing.T) {
// Issue #611, #907 // Issue #611, #907
func TestImageStretch(t *testing.T) { func TestImageStretch(t *testing.T) {
if isGopherJS() {
t.Skip("too slow on GopherJS")
return
}
const w = 16 const w = 16
dst, _ := NewImage(w, 4096, FilterDefault) dst, _ := NewImage(w, 4096, FilterDefault)