@@ -168,6 +168,44 @@ def test_from_string(self):
168
168
169
169
self .assertEqual (len (paths ), 2 )
170
170
171
+ def test_svg2paths_polygon_no_points (self ):
172
+
173
+ paths , _ = svg2paths (join (dirname (__file__ ), 'polygons_no_points.svg' ))
174
+
175
+ path = paths [0 ]
176
+ path_correct = Path ()
177
+ self .assertTrue (len (path )== 0 )
178
+ self .assertTrue (path == path_correct )
179
+
180
+ path = paths [1 ]
181
+ self .assertTrue (len (path )== 0 )
182
+ self .assertTrue (path == path_correct )
183
+
184
+ def test_svg2paths_polyline_tests (self ):
185
+
186
+ paths , _ = svg2paths (join (dirname (__file__ ), 'polyline.svg' ))
187
+
188
+ path = paths [0 ]
189
+ path_correct = Path (Line (59 + 185j , 98 + 203j ),
190
+ Line (98 + 203j , 108 + 245j ),
191
+ Line (108 + 245j , 82 + 279j ),
192
+ Line (82 + 279j , 39 + 280j ),
193
+ Line (39 + 280j , 11 + 247j ),
194
+ Line (11 + 247j , 19 + 205j ))
195
+ self .assertFalse (path .isclosed ())
196
+ self .assertTrue (len (path )== 6 )
197
+ self .assertTrue (path == path_correct )
198
+
199
+ path = paths [1 ]
200
+ path_correct = Path (Line (220 + 50j , 267 + 84j ),
201
+ Line (267 + 84j , 249 + 140j ),
202
+ Line (249 + 140j , 190 + 140j ),
203
+ Line (190 + 140j , 172 + 84j ),
204
+ Line (172 + 84j , 220 + 50j ))
205
+ self .assertTrue (path .isclosed ())
206
+ self .assertTrue (len (path )== 5 )
207
+ self .assertTrue (path == path_correct )
208
+
171
209
172
210
if __name__ == '__main__' :
173
211
unittest .main ()
0 commit comments