[Tests][Changed] SVG -> PNG conversion

- Now using a fixed height instead of 300 dpi
- Helps when comparing using different OS libs
This commit is contained in:
Salvador E. Tropea 2024-03-20 06:36:28 -03:00
parent 8beead8e7a
commit 1cbbed1414
1 changed files with 8 additions and 2 deletions

View File

@ -550,13 +550,19 @@ class TestContext(object):
png_ref = None
if reference[-3:] == 'svg':
png_ref = reference[:-3]+'png'
subprocess.check_call(['rsvg-convert', '-d', '300', '-p', '300', '-o', png_ref, reference])
cmd = ['rsvg-convert', '-h', '2160', '-o', png_ref, reference]
logging.debug('Converting reference to PNG with: '+usable_cmd(cmd))
subprocess.check_call(cmd)
reference = png_ref
assert os.path.isfile(png_ref)
png_image = None
if image[-3:] == 'svg':
png_image = image[:-3]+'png'
subprocess.check_call(['rsvg-convert', '-d', '300', '-p', '300', '-o', png_image, image])
cmd = ['rsvg-convert', '-h', '2160', '-o', png_image, image]
logging.debug('Converting result image to PNG with: '+usable_cmd(cmd))
subprocess.check_call(cmd)
image = png_image
assert os.path.isfile(png_image)
if trim:
cmd = ['convert', image, '-trim', image]
subprocess.run(cmd)