This commit is contained in:
Niels Thykier 2018-04-18 20:13:48 +00:00 committed by GitHub
commit 18f3cbd193
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 56 additions and 35 deletions

View file

@ -2387,7 +2387,7 @@ class DoNotStripXmlSpaceAttribute(unittest.TestCase):
class CommandLineUsage(unittest.TestCase):
USAGE_STRING = "Usage: scour [INPUT.SVG [OUTPUT.SVG]] [OPTIONS]"
USAGE_STRING = "Usage: scour [INPUT.SVG [[... INPUT.SVG] OUTPUT]] [OPTIONS]"
MINIMAL_SVG = '<?xml version="1.0" encoding="UTF-8"?>\n' \
'<svg xmlns="http://www.w3.org/2000/svg"/>\n'
TEMP_SVG_FILE = 'testscour_temp.svg'
@ -2555,12 +2555,13 @@ class EmbedRasters(unittest.TestCase):
def test_disable_embed_rasters(self):
doc = scourXmlFile('unittests/raster-formats.svg',
parse_args(['--disable-embed-rasters']))
parse_args(['--disable-embed-rasters']),
'unittests')
self.assertEqual(doc.getElementById('png').getAttribute('xlink:href'), 'raster.png',
"Raster image embedded when '--disable-embed-rasters' was specified")
def test_raster_formats(self):
doc = scourXmlFile('unittests/raster-formats.svg')
doc = scourXmlFile('unittests/raster-formats.svg', None, 'unittests')
self.assertEqual(doc.getElementById('png').getAttribute('xlink:href'),
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAABAgMAAABmjvwnAAAAC'
'VBMVEUAAP//AAAA/wBmtfVOAAAACklEQVQI12NIAAAAYgBhGxZhsAAAAABJRU5ErkJggg==',
@ -2578,7 +2579,7 @@ class EmbedRasters(unittest.TestCase):
"Raster image (JPG) not correctly embedded.")
def test_raster_paths_local(self):
doc = scourXmlFile('unittests/raster-paths-local.svg')
doc = scourXmlFile('unittests/raster-paths-local.svg', None, 'unittests')
images = doc.getElementsByTagName('image')
for image in images:
href = image.getAttribute('xlink:href')
@ -2592,7 +2593,7 @@ class EmbedRasters(unittest.TestCase):
# create a reference string by scouring the original file with relative links
options = ScourOptions
options.infilename = 'unittests/raster-formats.svg'
reference_svg = scourString(svg, options)
reference_svg = scourString(svg, options, 'unittests')
# this will not always create formally valid paths but it'll check how robust our implementation is
# (the third path is invalid for sure because file: needs three slashes according to URI spec)