go-opengl-pixel/text/atlas_test.go

30 lines
604 B
Go
Raw Normal View History

2018-01-19 16:09:48 -06:00
package text_test
2018-01-19 16:09:48 -06:00
import (
"testing"
"github.com/faiface/pixel/text"
"golang.org/x/image/font/inconsolata"
2018-01-19 16:09:48 -06:00
)
func TestAtlas7x13(t *testing.T) {
2018-01-19 16:09:48 -06:00
if text.Atlas7x13 == nil {
t.Fatalf("Atlas7x13 is nil")
}
for _, tt := range []struct {
runes []rune
want bool
2018-01-19 16:09:48 -06:00
}{{text.ASCII, true}, {[]rune("ÅÄÖ"), false}} {
for _, r := range tt.runes {
2018-01-19 16:09:48 -06:00
if got := text.Atlas7x13.Contains(r); got != tt.want {
t.Fatalf("Atlas7x13.Contains('%s') = %v, want %v", string(r), got, tt.want)
}
}
}
}
func TestAtlasInconsolata(t *testing.T) {
text.NewAtlas(inconsolata.Regular8x16, text.ASCII)
}