-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathparse_test.go
More file actions
66 lines (58 loc) · 1.32 KB
/
Copy pathparse_test.go
File metadata and controls
66 lines (58 loc) · 1.32 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package svg
import (
"strings"
"testing"
)
func parseSvg(t *testing.T, svgPath string) *Svg {
s, errSvg := ParseFile(svgPath, WarnErrorMode)
if errSvg != nil {
t.Error(errSvg)
}
return s
}
func TestLandscapeIcons(t *testing.T) {
for _, p := range []string{
"beach", "cape", "iceberg", "island",
"mountains", "sea", "trees", "village",
} {
parseSvg(t, "testdata/landscapeIcons/"+p+".svg")
}
}
func TestTestIcons(t *testing.T) {
for _, p := range []string{
"astronaut", "jupiter", "lander", "school-bus", "telescope", "content-cut-light", "defs",
"24px",
} {
parseSvg(t, "testdata/testIcons/"+p+".svg")
}
}
func TestStrokeIcons(t *testing.T) {
for _, p := range []string{
"OpacityStrokeDashTest.svg",
"OpacityStrokeDashTest2.svg",
"OpacityStrokeDashTest3.svg",
"TestShapes.svg",
"TestShapes2.svg",
"TestShapes3.svg",
"TestShapes4.svg",
"TestShapes5.svg",
"TestShapes6.svg",
} {
parseSvg(t, "testdata/"+p)
}
}
func TestPercentages(t *testing.T) {
parseSvg(t, "testdata/TestPercentages.svg")
}
func TestInvalidXML(t *testing.T) {
_, err := Parse(strings.NewReader("dummy"), StrictErrorMode)
if err == nil {
t.Fatal("expected error on invalid input")
}
}
func TestMask(t *testing.T) {
s := parseSvg(t, "testdata/avatar.svg")
if len(s.SvgMasks) != 4 {
t.Fatal("expected to have 4 masks")
}
}