-
Notifications
You must be signed in to change notification settings - Fork 1
/
font_test.go
45 lines (34 loc) · 953 Bytes
/
font_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package chessImager
import (
"testing"
)
func TestFontStandard(t *testing.T) {
t.Parallel()
filename := "fontStandard.png"
imager, err := NewImagerFromPath("test/data/fontStandard.json")
if err != nil {
t.Errorf("Failed to load JSON file: %v", err)
}
// Render the image
const fen = "b2r3r/k3Rp1p/p2q1np1/Np1P4/3p1Q2/P4PPB/1PP4P/1K6 b - - 1 25"
img, err := imager.Render(fen)
if err != nil {
t.Errorf("Failed to render chess board: %v", err)
}
compareImages(t, filename, &img)
}
func TestFontRoboto(t *testing.T) {
t.Parallel()
filename := "fontRoboto.png"
imager, err := NewImagerFromPath("test/data/fontRoboto.json")
if err != nil {
t.Errorf("Failed to load JSON file: %v", err)
}
// Render the image
const fen = "b2r3r/k3Rp1p/p2q1np1/Np1P4/3p1Q2/P4PPB/1PP4P/1K6 b - - 1 25"
img, err := imager.Render(fen)
if err != nil {
t.Errorf("Failed to render chess board: %v", err)
}
compareImages(t, filename, &img)
}