OLD | NEW |
1 description("This tests the SVG path parser by parsing and then re-serializing v
arious paths."); | 1 description("This tests the SVG path parser by parsing and then re-serializing v
arious paths."); |
2 | 2 |
3 var pathElement = document.createElementNS("http://www.w3.org/2000/svg", "path")
; | 3 var pathElement = document.createElementNS("http://www.w3.org/2000/svg", "path")
; |
4 | 4 |
5 var pathProperties = { | 5 var pathProperties = { |
6 "M": [ "x", "y" ], | 6 "M": [ "x", "y" ], |
7 "m": [ "x", "y" ], | 7 "m": [ "x", "y" ], |
8 "L": [ "x", "y" ], | 8 "L": [ "x", "y" ], |
9 "l": [ "x", "y" ], | 9 "l": [ "x", "y" ], |
10 "H": [ "x" ], | 10 "H": [ "x" ], |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 shouldBe("parsePath('M100,200 a3,4,5,0,1,6,7')", "'M100,200 a3,4,5,0,1,6,7'"); | 93 shouldBe("parsePath('M100,200 a3,4,5,0,1,6,7')", "'M100,200 a3,4,5,0,1,6,7'"); |
94 shouldBe("parsePath('M100,200 a3,4,5,1,0,6,7')", "'M100,200 a3,4,5,1,0,6,7'"); | 94 shouldBe("parsePath('M100,200 a3,4,5,1,0,6,7')", "'M100,200 a3,4,5,1,0,6,7'"); |
95 shouldBe("parsePath('M100,200 a3,4,5,1,1,6,7')", "'M100,200 a3,4,5,1,1,6,7'"); | 95 shouldBe("parsePath('M100,200 a3,4,5,1,1,6,7')", "'M100,200 a3,4,5,1,1,6,7'"); |
96 shouldBe("parsePath('M100,200 a3,4,5,006,7')", "'M100,200 a3,4,5,0,0,6,7'"); | 96 shouldBe("parsePath('M100,200 a3,4,5,006,7')", "'M100,200 a3,4,5,0,0,6,7'"); |
97 shouldBe("parsePath('M100,200 a3,4,5,016,7')", "'M100,200 a3,4,5,0,1,6,7'"); | 97 shouldBe("parsePath('M100,200 a3,4,5,016,7')", "'M100,200 a3,4,5,0,1,6,7'"); |
98 shouldBe("parsePath('M100,200 a3,4,5,106,7')", "'M100,200 a3,4,5,1,0,6,7'"); | 98 shouldBe("parsePath('M100,200 a3,4,5,106,7')", "'M100,200 a3,4,5,1,0,6,7'"); |
99 shouldBe("parsePath('M100,200 a3,4,5,116,7')", "'M100,200 a3,4,5,1,1,6,7'"); | 99 shouldBe("parsePath('M100,200 a3,4,5,116,7')", "'M100,200 a3,4,5,1,1,6,7'"); |
100 shouldBe("parsePath('M100,200 a3,4,5,2,1,6,7')", "'M100,200'"); | 100 shouldBe("parsePath('M100,200 a3,4,5,2,1,6,7')", "'M100,200'"); |
101 shouldBe("parsePath('M100,200 a3,4,5,1,2,6,7')", "'M100,200'"); | 101 shouldBe("parsePath('M100,200 a3,4,5,1,2,6,7')", "'M100,200'"); |
102 | 102 |
103 // FIXME: This uses 'If rx = 0 or ry = 0 then this arc is treated as a straight
line segment (a "lineto") joining the endpoints.' | 103 shouldBe("parsePath('M100,200 a0,4,5,0,0,10,0 a4,0,5,0,0,0,10 a0,0,5,0,0,-10,0 z
')", "'M100,200 a0,4,5,0,0,10,0 a4,0,5,0,0,0,10 a0,0,5,0,0,-10,0 Z'"); |
104 // I think the SVG DOM should still show the arc segment, fix that! | |
105 shouldBe("parsePath('M100,200 a0,4,5,0,0,10,0 a4,0,5,0,0,0,10 a0,0,5,0,0,-10,0 z
')", "'M100,200 l10,0 l0,10 l-10,0 Z'"); | |
106 | 104 |
107 shouldBe("parsePath('M1,2,3,4')", "'M1,2 L3,4'"); | 105 shouldBe("parsePath('M1,2,3,4')", "'M1,2 L3,4'"); |
108 shouldBe("parsePath('m100,200,3,4')", "'m100,200 l3,4'"); | 106 shouldBe("parsePath('m100,200,3,4')", "'m100,200 l3,4'"); |
109 | 107 |
110 shouldBe("parsePath('M 100-200')", "'M100,-200'"); | 108 shouldBe("parsePath('M 100-200')", "'M100,-200'"); |
111 shouldBe("parsePath('M 0.6.5')", "'M0.6,0.5'"); | 109 shouldBe("parsePath('M 0.6.5')", "'M0.6,0.5'"); |
112 | 110 |
113 shouldBe("parsePath(' M1,2')", "'M1,2'"); | 111 shouldBe("parsePath(' M1,2')", "'M1,2'"); |
114 shouldBe("parsePath(' M1,2')", "'M1,2'"); | 112 shouldBe("parsePath(' M1,2')", "'M1,2'"); |
115 shouldBe("parsePath('\\tM1,2')", "'M1,2'"); | 113 shouldBe("parsePath('\\tM1,2')", "'M1,2'"); |
116 shouldBe("parsePath('\\nM1,2')", "'M1,2'"); | 114 shouldBe("parsePath('\\nM1,2')", "'M1,2'"); |
117 shouldBe("parsePath('\\rM1,2')", "'M1,2'"); | 115 shouldBe("parsePath('\\rM1,2')", "'M1,2'"); |
118 shouldBe("parsePath('\\vM1,2')", "''"); | 116 shouldBe("parsePath('\\vM1,2')", "''"); |
119 shouldBe("parsePath('xM1,2')", "''"); | 117 shouldBe("parsePath('xM1,2')", "''"); |
120 shouldBe("parsePath('M1,2 ')", "'M1,2'"); | 118 shouldBe("parsePath('M1,2 ')", "'M1,2'"); |
121 shouldBe("parsePath('M1,2\\t')", "'M1,2'"); | 119 shouldBe("parsePath('M1,2\\t')", "'M1,2'"); |
122 shouldBe("parsePath('M1,2\\n')", "'M1,2'"); | 120 shouldBe("parsePath('M1,2\\n')", "'M1,2'"); |
123 shouldBe("parsePath('M1,2\\r')", "'M1,2'"); | 121 shouldBe("parsePath('M1,2\\r')", "'M1,2'"); |
124 shouldBe("parsePath('M1,2\\v')", "'M1,2'"); | 122 shouldBe("parsePath('M1,2\\v')", "'M1,2'"); |
125 shouldBe("parsePath('M1,2x')", "'M1,2'"); | 123 shouldBe("parsePath('M1,2x')", "'M1,2'"); |
126 shouldBe("parsePath('M1,2 L40,0#90')", "'M1,2 L40,0'"); | 124 shouldBe("parsePath('M1,2 L40,0#90')", "'M1,2 L40,0'"); |
127 | 125 |
128 shouldBe("parsePath('')", "''"); | 126 shouldBe("parsePath('')", "''"); |
129 shouldBe("parsePath(' ')", "''"); | 127 shouldBe("parsePath(' ')", "''"); |
130 shouldBe("parsePath('x')", "''"); | 128 shouldBe("parsePath('x')", "''"); |
131 shouldBe("parsePath('L1,2')", "''"); | 129 shouldBe("parsePath('L1,2')", "''"); |
132 shouldBe("parsePath('M.1 .2 L.3 .4 .5 .6')", "'M0.1,0.2 L0.3,0.4 L0.5,0.6'"); | 130 shouldBe("parsePath('M.1 .2 L.3 .4 .5 .6')", "'M0.1,0.2 L0.3,0.4 L0.5,0.6'"); |
133 | 131 |
134 successfullyParsed = true; | 132 successfullyParsed = true; |
OLD | NEW |