Unittests: Complete set of tests checking the removal of empty line segments if round / square linecaps are present (or not)
This commit is contained in:
parent
2fc73a2684
commit
8d7220c222
2 changed files with 23 additions and 8 deletions
23
testscour.py
23
testscour.py
|
|
@ -1036,16 +1036,25 @@ class RemoveEmptyLineSegmentsFromPath(unittest.TestCase):
|
|||
self.assertEqual(path[4][0], 'z',
|
||||
'Did not remove an empty line segment from path')
|
||||
|
||||
# Do not remove empty segments if round linecaps.
|
||||
|
||||
|
||||
class DoNotRemoveEmptySegmentsFromPathWithRoundLineCaps(unittest.TestCase):
|
||||
class RemoveEmptySegmentsFromPathWithButtLineCaps(unittest.TestCase):
|
||||
|
||||
def runTest(self):
|
||||
doc = scourXmlFile('unittests/path-with-caps.svg')
|
||||
path = svg_parser.parse(doc.getElementsByTagNameNS(SVGNS, 'path')[0].getAttribute('d'))
|
||||
self.assertEqual(len(path), 2,
|
||||
'Did not preserve empty segments when path had round linecaps')
|
||||
doc = scourXmlFile('unittests/path-with-caps.svg', parse_args(['--disable-style-to-xml']))
|
||||
for id in ['none', 'attr_butt', 'style_butt']:
|
||||
path = svg_parser.parse(doc.getElementById(id).getAttribute('d'))
|
||||
self.assertEqual(len(path), 1,
|
||||
'Did not remove empty segments when path had butt linecaps')
|
||||
|
||||
|
||||
class DoNotRemoveEmptySegmentsFromPathWithRoundSquareLineCaps(unittest.TestCase):
|
||||
|
||||
def runTest(self):
|
||||
doc = scourXmlFile('unittests/path-with-caps.svg', parse_args(['--disable-style-to-xml']))
|
||||
for id in ['attr_round', 'attr_square', 'style_round', 'style_square']:
|
||||
path = svg_parser.parse(doc.getElementById(id).getAttribute('d'))
|
||||
self.assertEqual(len(path), 2,
|
||||
'Did remove empty segments when path had round or square linecaps')
|
||||
|
||||
|
||||
class ChangeLineToHorizontalLineSegmentInPath(unittest.TestCase):
|
||||
|
|
|
|||
|
|
@ -1,4 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill="none" stroke="#000" stroke-width="5" stroke-linecap="round" d="m 11,8 0,0" />
|
||||
<path id="none" d="m0 0 0 0"/>
|
||||
<path id="attr_butt" d="m0 0 0 0" stroke-linecap="butt"/>
|
||||
<path id="attr_round" d="m0 0 0 0" stroke-linecap="round"/>
|
||||
<path id="attr_square" d="m0 0 0 0" stroke-linecap="square"/>
|
||||
<path id="style_butt" d="m0 0 0 0" style="stroke-linecap:butt"/>
|
||||
<path id="style_round" d="m0 0 0 0" style="stroke-linecap:round"/>
|
||||
<path id="style_square" d="m0 0 0 0" style="stroke-linecap:square"/>
|
||||
</svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 195 B After Width: | Height: | Size: 522 B |
Loading…
Add table
Add a link
Reference in a new issue