examples/2048: Bug fix: Tests didn't work

This commit is contained in:
Hajime Hoshi 2018-03-14 03:13:26 +09:00
parent c925b9de55
commit c289b13a91
2 changed files with 25 additions and 0 deletions

View File

@ -39,6 +39,7 @@ script:
- test -z $(gofmt -s -l $GOPATH/src/github.com/hajimehoshi/ebiten)
- go build -tags example -v github.com/hajimehoshi/ebiten/examples/...
- go test -v github.com/hajimehoshi/ebiten/...
- go test -tags=example -v github.com/hajimehoshi/ebiten/examples/...
- gopherjs build --tags example -v github.com/hajimehoshi/ebiten/examples/blocks
# Looks like testing GL on node is hard.

View File

@ -94,6 +94,30 @@ type Tile struct {
poppingCount int
}
// Pos returns the tile's current position.
// Pos is used only at testing so far.
func (t *Tile) Pos() (int, int) {
return t.current.x, t.current.y
}
// NextPos returns the tile's next position.
// NextPos is used only at testing so far.
func (t *Tile) NextPos() (int, int) {
return t.next.x, t.next.y
}
// Value returns the tile's current value.
// Value is used only at testing so far.
func (t *Tile) Value() int {
return t.current.value
}
// NextValue returns the tile's current value.
// NextValue is used only at testing so far.
func (t *Tile) NextValue() int {
return t.next.value
}
// NewTile creates a new Tile object.
func NewTile(value int, x, y int) *Tile {
return &Tile{