Unittests for --enable-viewboxing

This commit is contained in:
Eduard Braun 2017-02-19 15:39:53 +01:00
parent 01cb120d71
commit 0ffefcd8bb
3 changed files with 21 additions and 1 deletions

View file

@ -2505,7 +2505,21 @@ class EmbedRasters(unittest.TestCase):
"Raster image from remote path '" + href + "' not embedded.") "Raster image from remote path '" + href + "' not embedded.")
# TODO: write tests for --enable-viewboxing class ViewBox(unittest.TestCase):
def test_viewbox_create(self):
doc = scourXmlFile('unittests/viewbox-create.svg', parse_args(['--enable-viewboxing']))
viewBox = doc.documentElement.getAttribute('viewBox')
self.assertEqual(viewBox, '0 0 123.46 654.32', "viewBox not properly created with '--enable-viewboxing'.")
def test_viewbox_remove_width_and_height(self):
doc = scourXmlFile('unittests/viewbox-remove.svg', parse_args(['--enable-viewboxing']))
width = doc.documentElement.getAttribute('width')
height = doc.documentElement.getAttribute('height')
self.assertEqual(width, '', "width not removed with '--enable-viewboxing'.")
self.assertEqual(height, '', "height not removed with '--enable-viewboxing'.")
# TODO: write tests for --keep-editor-data # TODO: write tests for --keep-editor-data
if __name__ == '__main__': if __name__ == '__main__':

View file

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="123.456" height="654.321">
</svg>

After

Width:  |  Height:  |  Size: 120 B

View file

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="123.456" height="654.321" viewBox="0 0 123.456 654.321">
</svg>

After

Width:  |  Height:  |  Size: 150 B