From ec4e7b3594091e37d06c95eef78a9237d570fda7 Mon Sep 17 00:00:00 2001 From: JSCHILL1 Date: Mon, 27 Apr 2009 10:03:39 -0500 Subject: [PATCH] Unit test for abs-to-rel path data conversion. --- fulltests/{README.txt => README.fulltests.txt} | 0 testscour.py | 10 +++++++++- unittests/path-abs-to-rel.svg | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) rename fulltests/{README.txt => README.fulltests.txt} (100%) diff --git a/fulltests/README.txt b/fulltests/README.fulltests.txt similarity index 100% rename from fulltests/README.txt rename to fulltests/README.fulltests.txt diff --git a/testscour.py b/testscour.py index f64aed5..b3e8463 100755 --- a/testscour.py +++ b/testscour.py @@ -404,7 +404,6 @@ class CollapseSinglyReferencedGradients(unittest.TestCase): class InheritGradientUnitsUponCollapsing(unittest.TestCase): def runTest(self): doc = scour.scourXmlFile('unittests/collapse-gradients.svg') -# print doc.toprettyxml(' ') self.assertEquals(doc.getElementsByTagNameNS(SVGNS, 'radialGradient')[0].getAttribute('gradientUnits'), 'userSpaceOnUse', 'gradientUnits not properly inherited when collapsing gradients' ) @@ -436,5 +435,14 @@ class RemoveDelimiterBeforeNegativeCoordsInPath(unittest.TestCase): self.assertEquals(path[4], '-', 'Delimiters not removed before negative coordinates in path data' ) +class ConvertAbsoluteToRelativePathCommands(unittest.TestCase): + def runTest(self): + doc = scour.scourXmlFile('unittests/path-abs-to-rel.svg') + path = svg_parser.parse(doc.getElementsByTagNameNS(SVGNS, 'path')[0].getAttribute('d')) + self.assertEquals(path[1][0], 'v', + 'Absolute V command not converted to relative v command') + self.assertEquals(path[1][1][0], -20.0, + 'Absolute V value not converted to relative v value') + if __name__ == '__main__': unittest.main() diff --git a/unittests/path-abs-to-rel.svg b/unittests/path-abs-to-rel.svg index 9c9fa3b..2647269 100644 --- a/unittests/path-abs-to-rel.svg +++ b/unittests/path-abs-to-rel.svg @@ -1,3 +1,3 @@ - + \ No newline at end of file