src/img2pdf_test.py: skip tests when icc profiles are not present
This commit is contained in:
parent
853a1ec363
commit
4c5b72dab0
1 changed files with 10 additions and 2 deletions
|
@ -304,7 +304,11 @@ def compare(im1, im2, exact, icc, cmyk):
|
||||||
else:
|
else:
|
||||||
iccargs = []
|
iccargs = []
|
||||||
if icc:
|
if icc:
|
||||||
iccargs = ["-profile", "/usr/share/color/icc/sRGB.icc"]
|
profile = "/usr/share/color/icc/sRGB.icc"
|
||||||
|
if not os.path.isfile(profile):
|
||||||
|
warnings.warn(profile + " not present, skipping checks...")
|
||||||
|
return
|
||||||
|
iccargs = ["-profile", profile]
|
||||||
psnr = subprocess.run(
|
psnr = subprocess.run(
|
||||||
["compare"]
|
["compare"]
|
||||||
+ iccargs
|
+ iccargs
|
||||||
|
@ -417,6 +421,10 @@ def compare_pdfimages_png(tmpdir, img, pdf, exact=True, icc=False):
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
if icc:
|
if icc:
|
||||||
|
profile = "/usr/share/color/icc/ghostscript/srgb.icc"
|
||||||
|
if not os.path.isfile(profile):
|
||||||
|
warnings.warn(profile + " not present, skipping checks...")
|
||||||
|
return
|
||||||
psnr = subprocess.run(
|
psnr = subprocess.run(
|
||||||
[
|
[
|
||||||
"compare",
|
"compare",
|
||||||
|
@ -424,7 +432,7 @@ def compare_pdfimages_png(tmpdir, img, pdf, exact=True, icc=False):
|
||||||
"PSNR",
|
"PSNR",
|
||||||
"(",
|
"(",
|
||||||
"-profile",
|
"-profile",
|
||||||
"/usr/share/color/icc/ghostscript/srgb.icc",
|
profile,
|
||||||
"-depth",
|
"-depth",
|
||||||
"8",
|
"8",
|
||||||
str(img),
|
str(img),
|
||||||
|
|
Loading…
Reference in a new issue