Rotate transforms now optimize angles, and have test coverage.

This commit is contained in:
Johan Sundström 2011-03-12 03:35:13 -08:00
parent 45bc6c0fac
commit 5987a9a271
5 changed files with 52 additions and 14 deletions

View file

@ -1243,9 +1243,9 @@ class TransformRotate90(unittest.TestCase):
class TransformRotateCCW135(unittest.TestCase):
def runTest(self):
doc = scour.scourXmlFile('unittests/transform-matrix-is-rotate-neg-135.svg')
self.assertEquals(doc.getElementsByTagName('line')[0].getAttribute('transform'), 'rotate(-135)',
'Counter-clockwise rotation matrix not converted to rotate(-135)')
doc = scour.scourXmlFile('unittests/transform-matrix-is-rotate-225.svg')
self.assertEquals(doc.getElementsByTagName('line')[0].getAttribute('transform'), 'rotate(225)',
'Counter-clockwise rotation matrix not converted to rotate(225)')
class TransformRotateCCW45(unittest.TestCase):
def runTest(self):
@ -1277,6 +1277,18 @@ class TransformTranslate(unittest.TestCase):
self.assertEquals(doc.getElementsByTagName('line')[0].getAttribute('transform'), 'translate(2 3)',
'Translation matrix not converted to translate(2 3)')
class TransformRotationRange719_5(unittest.TestCase):
def runTest(self):
doc = scour.scourXmlFile('unittests/transform-rotate-trim-range-719.5.svg')
self.assertEquals(doc.getElementsByTagName('line')[0].getAttribute('transform'), 'rotate(-.5)',
'Transform containing rotate(719.5) not shortened to rotate(-.5)')
class TransformRotationRangeCCW540_0(unittest.TestCase):
def runTest(self):
doc = scour.scourXmlFile('unittests/transform-rotate-trim-range-neg-540.0.svg')
self.assertEquals(doc.getElementsByTagName('line')[0].getAttribute('transform'), 'rotate(180)',
'Transform containing rotate(-540.0) not shortened to rotate(180)')
class TransformRotation3Args(unittest.TestCase):
def runTest(self):
doc = scour.scourXmlFile('unittests/transform-rotate-fold-3args.svg')