Avoid crashing on "scale(1)" (short for "scale(1, 1)")

The scale function on the transform attribute has a short form, where
only the first argument is used.  But optimizeTransform would always
assume that there were two when checking for the identity scale.

Closes: #190
Signed-off-by: Niels Thykier <niels@thykier.net>
This commit is contained in:
Niels Thykier 2018-04-18 05:40:59 +00:00
parent 8ddb7d8913
commit 18e57cddae
3 changed files with 19 additions and 1 deletions

View file

@ -2304,6 +2304,17 @@ class TransformIdentityTranslate(unittest.TestCase):
'Transform containing identity translation not removed')
class TransformIdentityScale(unittest.TestCase):
def runTest(self):
try:
doc = scourXmlFile('unittests/transform-scale-is-identity.svg')
except IndexError:
self.fail("scour failed to handled scale(1) [See GH#190]")
self.assertEqual(doc.getElementsByTagName('line')[0].getAttribute('scale'), '',
'Transform containing identity translation not removed')
class DuplicateGradientsUpdateStyle(unittest.TestCase):
def runTest(self):