2018-01-19 16:09:48 -06:00
|
|
|
package text_test
|
2018-01-19 15:20:54 -06:00
|
|
|
|
2018-01-19 16:09:48 -06:00
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/faiface/pixel/text"
|
2020-08-13 04:57:30 -05:00
|
|
|
"golang.org/x/image/font/inconsolata"
|
2018-01-19 16:09:48 -06:00
|
|
|
)
|
2018-01-19 15:20:54 -06:00
|
|
|
|
|
|
|
func TestAtlas7x13(t *testing.T) {
|
2018-01-19 16:09:48 -06:00
|
|
|
if text.Atlas7x13 == nil {
|
2018-01-19 15:20:54 -06:00
|
|
|
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}} {
|
2018-01-19 15:20:54 -06:00
|
|
|
for _, r := range tt.runes {
|
2018-01-19 16:09:48 -06:00
|
|
|
if got := text.Atlas7x13.Contains(r); got != tt.want {
|
2018-01-19 15:20:54 -06:00
|
|
|
t.Fatalf("Atlas7x13.Contains('%s') = %v, want %v", string(r), got, tt.want)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-08-13 04:57:30 -05:00
|
|
|
|
|
|
|
func TestAtlasInconsolata(t *testing.T) {
|
|
|
|
text.NewAtlas(inconsolata.Regular8x16, text.ASCII)
|
|
|
|
}
|