/
polyline_test.go
84 lines (61 loc) · 1.89 KB
/
polyline_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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package svg
import (
. "gopkg.in/check.v1"
"testing"
"github.com/iostrovok/svg/style"
"github.com/iostrovok/svg/transform"
)
func TestPOLYLINE(t *testing.T) {
TestingT(t)
}
type POLYLINETestsSuite struct{}
var _ = Suite(&POLYLINETestsSuite{})
func (s POLYLINETestsSuite) Test_polyline(c *C) {
//c.Skip("Not now")
l := Polyline()
c.Assert(l, NotNil)
l2 := Polyline(style.Style())
c.Assert(l2, NotNil)
}
func (s POLYLINETestsSuite) Test_polyline2(c *C) {
//c.Skip("Not now")
l := Polyline(style.Style().StrokeRGB(10, 20, 30))
res := l.Source()
c.Assert(cSL(res), Equals, "")
}
func (s POLYLINETestsSuite) Test_Append_Title(c *C) {
//c.Skip("Not now")
obtained := cSL(`<polyline points="1,2 3,4"><title>WWW</title></polyline>`)
l := Polyline().Points(1, 2, 3, 4)
t := Title("WWW")
l = l.Append(t)
res := l.Source()
c.Assert(cSL(res), Equals, obtained)
}
func (s POLYLINETestsSuite) Test_Style(c *C) {
//c.Skip("Not now")
obtained := cSL(`<polyline points="1.1,2.22 3.3,4" style="fill:rgb(1,2,3)"><title>WWW</title></polyline>`)
l := Polyline().Points(1.1, 2.22, 3.30, 4)
st := style.Style().FillRGB(1, 2, 3)
l = l.Style(st).Append(Title("WWW"))
c.Assert(cSL(l.Source()), Equals, obtained)
}
func (s POLYLINETestsSuite) Test_Transform(c *C) {
//c.Skip("Not now")
obtained := cSL(`<polyline points="1.1,2.22 3.3,4" transform="matrix(12.00, 34.00, 45.00, 34.50, 212.00, 4.45)">
<title>WWW</title>
</polyline>`)
l := Polyline().Points(1.1, 2.22, 3.30, 4)
st := transform.Transform().Matrix(12, 34, 45, 34.5, 212, 4.45)
l = l.Transform(st).Append(Title("WWW"))
c.Assert(cSL(l.Source()), Equals, obtained)
}
func (s POLYLINETestsSuite) Test_ID(c *C) {
//c.Skip("Not now")
check := cSL(`<polyline points="1.1,2.22 3.3,4" id="id-1"/>`)
t := Polyline().Points(1.1, 2.22, 3.30, 4)
t = t.ID("id-1")
c.Assert("id-1", Equals, t.GetID())
res := t.Source()
c.Assert(cSL(res), Equals, check)
}