-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathfonts_test.go
46 lines (43 loc) · 871 Bytes
/
fonts_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
46
package model
import (
"reflect"
"testing"
)
func TestEncodingString(t *testing.T) {
diffs := Differences{
1: "dsd",
2: "mldsks",
3: "mdsùldùs",
10: "ee",
11: "sd",
12: "ee",
7: "88",
}
exp := "[ 1/dsd/mldsks/mdsùldùs 7/88 10/ee/sd/ee]"
if d := diffs.Write(); d != exp {
t.Errorf("expected %s, got %v", exp, d)
}
}
func TestCloneFont(t *testing.T) {
fonts := []Font{
FontType0{Encoding: CMapEncodingEmbedded{}},
FontType0{Encoding: CMapEncodingPredefined("")},
FontType1{
Encoding: MacRomanEncoding,
},
FontTrueType{
Widths: make([]int, 12),
},
FontType3{
Encoding: MacExpertEncoding,
CharProcs: map[Name]ContentStream{"mkdmsk": {}},
},
}
c := cloneCache{}
for _, f := range fonts {
f2 := f.clone(c)
if !reflect.DeepEqual(f, f2) {
t.Fatalf("expected deep equality, got %v and %v", f, f2)
}
}
}