示例#1
0
func (s PATHTestsSuite) Test_path_Style(c *C) {
	// c.Skip(`Not now")

	p := Path(style.Style().StrokeRGB(10, 20, 30))
	p = p.M(0, 0).L(100, 200)
	st := style.Style().FillRGB(1, 2, 3)
	p = p.Style(st).Append(Title("WWW"))
	obtained := cSL(`<path d="M0,0 L100,200" style="fill:rgb(1,2,3)"><title>WWW</title></path>`)

	c.Assert(cSL(p.Source()), Equals, obtained)
}
示例#2
0
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, "")
}
示例#3
0
文件: use_test.go 项目: iostrovok/svg
func (s USETestsSuite) Test_use2(c *C) {
	//c.Skip("Not now")

	l := Use(style.Style().StrokeRGB(10, 20, 30))
	res := l.Source()
	c.Assert(cSL(res), Equals, ``)
}
示例#4
0
func (s LINETestsSuite) Test_line(c *C) {
	//c.Skip("Not now")

	l := Line(1, 2, 3, 4)
	c.Assert(l, NotNil)
	l2 := Line(1, 2, 3, 4, style.Style())
	c.Assert(l2, NotNil)
}
示例#5
0
func (s RECTTestsSuite) Test_rect(c *C) {
	//c.Skip("Not now")

	l := Rect(1, 2, 3, 4)
	c.Assert(l, NotNil)
	l2 := Rect(1, 2, 3, 4, style.Style())
	c.Assert(l2, NotNil)
}
示例#6
0
文件: use_test.go 项目: iostrovok/svg
func (s USETestsSuite) Test_use_href(c *C) {
	//c.Skip("Not now")
	obtained := cSL(`<use xlink:href="#MySymbol" style="stroke:rgb(10,20,30)"/>`)

	l := Use(style.Style().StrokeRGB(10, 20, 30)).Href(`#MySymbol`)
	res := l.Source()
	c.Assert(cSL(res), Equals, obtained)
}
示例#7
0
文件: g_test.go 项目: iostrovok/svg
func (s GROUPTestsSuite) Test_group(c *C) {
	//c.Skip("Not now")

	l := Group()
	c.Assert(l, NotNil)
	l2 := Group(style.Style())
	c.Assert(l2, NotNil)
}
示例#8
0
func (s PATHTestsSuite) Test_path_Aa(c *C) {
	//c.Skip(`Not now")

	obtained := cSL(`<path d="M0,0 A10,20 30 1,1 40,50 a11,21 31 0,0 41,51" style="stroke:rgb(10,20,30)"/>`)
	p := Path(style.Style().StrokeRGB(10, 20, 30))
	p = p.M(0, 0).A(10, 20, 30, 1, 1, 40, 50).Aa(11, 21, 31, 0, 0, 41, 51)
	c.Assert(cSL(p.Source()), Equals, obtained)
}
示例#9
0
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)
}
示例#10
0
func (s TEXTTestsSuite) Test_text(c *C) {
	//c.Skip("Not now")

	t1 := Text()
	c.Assert(t1, NotNil)
	t2 := Text(style.Style())
	c.Assert(t2, NotNil)
}
示例#11
0
func (s POLYGONTestsSuite) Test_polygon(c *C) {
	//c.Skip("Not now")

	l := Polygon()
	c.Assert(l, NotNil)
	l2 := Polygon(style.Style())
	c.Assert(l2, NotNil)
}
示例#12
0
文件: use_test.go 项目: iostrovok/svg
func (s USETestsSuite) Test_use(c *C) {
	//c.Skip("Not now")

	l := Use()
	c.Assert(l, NotNil)
	l2 := Use(style.Style())
	c.Assert(l2, NotNil)
}
示例#13
0
func (s RECTTestsSuite) Test_rect2(c *C) {
	//c.Skip("Not now")

	obtained := cSL(`<rect height="4" width="3" x="1" y="2" style="stroke:rgb(10,20,30)"/>`)

	l := Rect(1, 2, 3, 4, style.Style().StrokeRGB(10, 20, 30))
	res := l.Source()
	c.Assert(cSL(res), Equals, obtained)
}
示例#14
0
func (s PATHTestsSuite) Test_path_HhVv(c *C) {
	//c.Skip(`Not now")

	obtained := cSL(`<path d="M0,0 V100 v200 H300 h400" style="stroke:rgb(10,20,30)"/>`)

	p := Path(style.Style().StrokeRGB(10, 20, 30))
	p = p.M(0, 0).V(100).Vv(200).H(300).Hh(400)
	c.Assert(cSL(p.Source()), Equals, obtained)
}
示例#15
0
文件: tag_test.go 项目: iostrovok/svg
func (s TAGTestsSuite) Test_Style(c *C) {
	//c.Skip("Not now")
	obtained := cSL(`<g style="fill:rgb(1,2,3)"/>`)

	st := style.Style().FillRGB(1, 2, 3)

	l := Tag("g").Style(st)
	c.Assert(cSL(l.Source()), Equals, obtained)
}
示例#16
0
文件: g_test.go 项目: iostrovok/svg
func (s GROUPTestsSuite) Test_Style(c *C) {
	//c.Skip("Not now")
	obtained := cSL(`<g style="fill:rgb(1,2,3)"><title>WWW</title></g>`)

	l := Group()
	st := style.Style().FillRGB(1, 2, 3)
	l = l.Style(st).Append(Title("WWW"))
	c.Assert(cSL(l.Source()), Equals, obtained)
}
示例#17
0
文件: g_test.go 项目: iostrovok/svg
func (s GROUPTestsSuite) Test_group2(c *C) {
	//c.Skip("Not now")

	obtained := cSL(`<g style="stroke:rgb(10,20,30)"/>`)

	l := Group(style.Style().StrokeRGB(10, 20, 30))
	res := l.Source()
	c.Assert(cSL(res), Equals, obtained)
}
示例#18
0
func (s PATHTestsSuite) Test_path_Cc(c *C) {
	//c.Skip(`Not now")

	obtained := cSL(`<path d="M0,0 C10,20 30,40 50,60 c11,21 31,41 51,61" style="stroke:rgb(10,20,30)"/>`)

	p := Path(style.Style().StrokeRGB(10, 20, 30))
	p = p.M(0, 0).C(10, 20, 30, 40, 50, 60).Cc(11, 21, 31, 41, 51, 61)
	c.Assert(cSL(p.Source()), Equals, obtained)
}
示例#19
0
func (s PATHTestsSuite) Test_path_Qq(c *C) {
	//c.Skip(`Not now")

	obtained := cSL(`<path d="M0,0 Q1,2 3,4 q5,6 7,8 S9,0 10,11 s12,13 14,15" style="stroke:rgb(10,20,30)"/>`)

	p := Path(style.Style().StrokeRGB(10, 20, 30))
	p = p.M(0, 0).Q(1, 2, 3, 4).Qq(5, 6, 7, 8).S(9, 0, 10, 11).Ss(12, 13, 14, 15)
	c.Assert(cSL(p.Source()), Equals, obtained)
}
示例#20
0
func (s LINETestsSuite) Test_line2(c *C) {
	//c.Skip("Not now")

	obtained := cSL(`<line x1="1" y1="2" x2="3" y2="4" style="stroke:rgb(10,20,30)" />`)

	l := Line(1, 2, 3, 4, style.Style().StrokeRGB(10, 20, 30))
	res := l.Source()
	c.Assert(cSL(res), Equals, obtained)
}
示例#21
0
func (s RECTTestsSuite) Test_Style(c *C) {
	//c.Skip("Not now")

	obtained := cSL(`<rect height="4" width="3" x="1" y="2" style="fill:rgb(1,2,3)"><title>WWW</title></rect>`)

	l := Rect(1, 2, 3, 4)
	st := style.Style().FillRGB(1, 2, 3)
	l = l.Style(st).Append(Title("WWW"))
	c.Assert(cSL(l.Source()), Equals, obtained)
}
示例#22
0
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)
}
示例#23
0
func (s TEXTTestsSuite) Test_text2(c *C) {
	//c.Skip("Not now")

	obtained := cSL(`<text x="250" y="150" style="font-family:Verdana;font-size:55;fill:blue">Hello, out there</text>`)
	f := style.Font("font-family:Verdana;font-size:55")
	text := Text(style.Style().Fill("blue").Font(f))
	text = text.XY(250, 150).String("Hello, out there")
	res := text.Source()
	c.Assert(cSL(res), Equals, obtained)
}
示例#24
0
文件: use_test.go 项目: iostrovok/svg
func (s USETestsSuite) Test_Style(c *C) {
	// c.Skip("Not now")

	obtained := cSL(`<use xlink:href="#MySymbol" style="fill:rgb(1,2,3)" ><title>WWW</title></use>`)

	l := Use().Href(`#MySymbol`)
	st := style.Style().FillRGB(1, 2, 3)
	l = l.Style(st).Append(Title("WWW"))
	c.Assert(cSL(l.Source()), Equals, obtained)
}
示例#25
0
func (s LINETestsSuite) Test_Style(c *C) {
	//c.Skip("Not now")

	obtained := cSL(`<line x1="1" y1="2" x2="3" y2="4" style="fill:rgb(1,2,3)" ><title>WWW</title></line>`)

	l := Line(1, 2, 3, 4)
	st := style.Style().FillRGB(1, 2, 3)
	l = l.Style(st).Append(Title("WWW"))
	c.Assert(cSL(l.Source()), Equals, obtained)
}
示例#26
0
func (s PATHTestsSuite) Test_Append_Title(c *C) {
	//c.Skip(`Not now")

	p := Path(style.Style().StrokeRGB(10, 20, 30))
	p = p.M(0, 0).L(100, 200)
	t := Title("WWW")
	p = p.Append(t)
	obtained := cSL(`<path d="M0,0 L100,200" style="stroke:rgb(10,20,30)"><title>WWW</title></path>`)

	c.Assert(cSL(p.Source()), Equals, obtained)
}
示例#27
0
func (s PATHTestsSuite) Test_path_Lxxx(c *C) {
	//c.Skip(`Not now")

	obtained := cSL(`<path d="M2,2 L0,1 1,2 2,3 3,4 4,5 5,6 6,7 7,8 8,9 9,10" style="stroke:rgb(10,20,30)"/>`)

	p := Path(style.Style().StrokeRGB(10, 20, 30)).M(2, 2)
	for i := 0; i < 10; i++ {
		p = p.L(float64(i), float64(i+1))
	}
	c.Assert(cSL(p.Source()), Equals, obtained)
}
示例#28
0
func (s TEXTTestsSuite) Test_Transform(c *C) {
	//c.Skip("Not now")

	obtained := cSL(`<text x="250" y="150" style="font-family:Verdana;font-size:55;fill:blue" transform="matrix(12.00, 34.00, 45.00, 34.50, 212.00, 4.45)">Hello, out there</text>`)
	f := style.Font("font-family:Verdana;font-size:55")
	text := Text(style.Style().Fill("blue").Font(f))
	text = text.XY(250, 150).String("Hello, out there")
	tr := transform.Transform().Matrix(12, 34, 45, 34.5, 212, 4.45)
	text = text.Transform(tr)
	res := text.Source()
	c.Assert(cSL(res), Equals, obtained)
}
示例#29
0
func (s PATHTestsSuite) Test_path_ML(c *C) {
	//c.Skip(`Not now")

	p := Path(style.Style().StrokeRGB(10, 20, 30))
	p = p.M(100, 200)
	c.Assert(cSL(p.Source()), Equals, cSL(`<path d="M100,200" style="stroke:rgb(10,20,30)"/>`))

	p = Path(style.Style().StrokeRGB(10, 20, 30))
	p = p.M(0, 0).L(100, 200)
	c.Assert(cSL(p.Source()), Equals, cSL(`<path d="M0,0 L100,200" style="stroke:rgb(10,20,30)"/>`))

	p = Path(style.Style().StrokeRGB(10, 20, 30))
	p = p.M(0, 0).Ll(100, 200)
	c.Assert(cSL(p.Source()), Equals, cSL(`<path d="M0,0 l100,200" style="stroke:rgb(10,20,30)"/>`))

	p = Path(style.Style().StrokeRGB(10, 20, 30))
	p = p.Mm(100, 200)
	c.Assert(cSL(p.Source()), Equals, cSL(`<path d="m100,200" style="stroke:rgb(10,20,30)"/>`))

	p = Path(style.Style().StrokeRGB(10, 20, 30))
	p = p.Mm(100, 200).L(11, 12)
	c.Assert(cSL(p.Source()), Equals, cSL(`<path d="m100,200 L11,12" style="stroke:rgb(10,20,30)"/>`))
}
示例#30
0
func (s PATHTestsSuite) Test_path2(c *C) {
	//c.Skip(`Not now")

	p := Path(style.Style().StrokeRGB(10, 20, 30))
	c.Assert(cSL(p.Source()), Equals, cSL(`<path d="" style="stroke:rgb(10,20,30)"/>`))
}