mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +01:00
117 lines
5.6 KiB
Go
117 lines
5.6 KiB
Go
// Copyright 2014 Hajime Hoshi
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
// +build js
|
|
|
|
package ebiten_test
|
|
|
|
import (
|
|
"encoding/base64"
|
|
"errors"
|
|
"io"
|
|
"strings"
|
|
)
|
|
|
|
// NOTE: Please update if any of testdata/* is updated.
|
|
var data = map[string]string{
|
|
"testdata/ebiten.png": `
|
|
iVBORw0KGgoAAAANSUhEUgAAADkAAAAaCAYAAAANIPQdAAAEJGlDQ1BJQ0Mg
|
|
UHJvZmlsZQAAOBGFVd9v21QUPolvUqQWPyBYR4eKxa9VU1u5GxqtxgZJk6Xt
|
|
Shal6dgqJOQ6N4mpGwfb6baqT3uBNwb8AUDZAw9IPCENBmJ72fbAtElThyqq
|
|
SUh76MQPISbtBVXhu3ZiJ1PEXPX6yznfOec7517bRD1fabWaGVWIlquunc8k
|
|
lZOnFpSeTYrSs9RLA9Sr6U4tkcvNEi7BFffO6+EdigjL7ZHu/k72I796i9zR
|
|
iSJPwG4VHX0Z+AxRzNRrtksUvwf7+Gm3BtzzHPDTNgQCqwKXfZwSeNHHJz1O
|
|
IT8JjtAq6xWtCLwGPLzYZi+3YV8DGMiT4VVuG7oiZpGzrZJhcs/hL49xtzH/
|
|
Dy6bdfTsXYNY+5yluWO4D4neK/ZUvok/17X0HPBLsF+vuUlhfwX4j/rSfAJ4
|
|
H1H0qZJ9dN7nR19frRTeBt4Fe9Fw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vOOOID95cD444rX4v+sHr7yGb/8JabkxZC5Kp1sAAAAA
|
|
SUVORK5CYII=`,
|
|
}
|
|
|
|
func readFile(path string) (io.Reader, error) {
|
|
// According to https://github.com/gopherjs/gopherjs/blob/master/doc/syscalls.md,
|
|
// syscall can be available on the unstable version of npm.
|
|
// Let's not use os package here.
|
|
str, ok := data[path]
|
|
if !ok {
|
|
return nil, errors.New("ebiten_test: not found")
|
|
}
|
|
return base64.NewDecoder(base64.StdEncoding, strings.NewReader(str)), nil
|
|
}
|