-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathpages_test.go
52 lines (43 loc) · 895 Bytes
/
pages_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
47
48
49
50
51
52
package model
import (
"reflect"
"testing"
)
func TestCloneResources(t *testing.T) {
r := ResourcesDict{
ExtGState: map[Name]*GraphicState{
"lmdsm": {
D: &DashPattern{
Array: []Fl{78, 9},
},
},
},
ColorSpace: map[ColorSpaceName]ColorSpace{"eee": nil},
}
cache := newCloneCache()
r2 := r.clone(cache)
if !reflect.DeepEqual(r, r2) {
t.Errorf("expected %v, got %v2", r, r2)
}
}
func TestShallowClone(t *testing.T) {
r := ResourcesDict{
ExtGState: map[Name]*GraphicState{
"lmdsm": {
D: &DashPattern{
Array: []Fl{78, 9},
},
},
},
ColorSpace: map[ColorSpaceName]ColorSpace{"eee": nil},
}
r2 := r.ShallowCopy()
r2.ColorSpace["eee"] = ColorSpaceCMYK
if r.ColorSpace["eee"] != nil {
t.Error("expected no impact")
}
r.ExtGState["lmdsm"].Ca = ObjFloat(4.)
if r2.ExtGState["lmdsm"].Ca == nil {
t.Error("expected impact")
}
}