Make tests work with ImageMagick 6 and 7, fixes #111 #117
Loading…
Reference in a new issue
No description provided.
Delete branch "sbraz/img2pdf:im7"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hi,
These three commits should make tests work with both ImageMagick versions. The commit messages detail each change.
I have noticed that #110 seems to be the same as the first commit of this PR and #111 is similar to the last commit.
I have tested my patch with both Debian Bullseye which ships ImageMagick 6.9 and Gentoo which ships ImageMagick 7.1.
And why should I reject #110 in favor of the changes of this pull request?
I'm also not going to vendor sRGB.icc. I rather either:
Oh, that is not what I meant. I only noticed #110 after I fixed the tests. I can simply rebase once you merge it.
As for ICC tests, I can drop that change if you'd like. It's really not the biggest blocker here. It's rather easy to patch or skip downstream.
Please let me know what you would like me to do and I will adapt the PR accordingly.
If you agree, I can probably do something like this (untested pseudo-Python):
This way, we try to make tests pass for as many distros as possible and still fall back to skipping. Would that work for you?
Do you need different ICC profiles (the one from icc-profiles and the one from Ghostscript) or can we use the same for both tests like I did in my initial change?
I just merged #109 and #110.
If you know under which paths srgb.icc is stored for different distros, then yes, it makes sense to try those and skip if nothing can be found.
Thanks, I'll look into possible paths for it. Did you see my other question?
I don't have an answer to that one. To get the answer, we will just have to run the tests and find out. The tests pass for you, right?
4166367318
to2c287a6e98
As far as I can tell, the
compare
function is never called withicc=True
so it is effectively unused.compare_pdfimages_png
is called withicc=True
and either the OpenICC profile my distro ships or the Ghostscript one work.I have pushed a new version, I think the Ghostscript detection part could use a glob since on Arch and Gentoo, the profile moves from one version to another. I will improve this later today.
2c287a6e98
to9036ff860c
9036ff860c
tob0e5f5189f
Pushed with globs that should work on a lot of well-known distros. I've removed the line that installs ICC packages from the Travis CI file since we'll only rely on Ghostscript's profile.
I have fixed CI URLs in the README in a separate commit, feel free to cherry-pick it separately from this PR.
b0e5f5189f
to56c7c3988d
56c7c3988d
tod60b5109e0
Hi @josch, do you agree with the changes? If so, I will backport this patch to the Gentoo package so we can have working tests again.
If not, please let me know and I'll update the PR accordingly.
Are the tests really passing for you? Or are they just skipped?
For example I don't know how you can just remove installing
icc-profiles-free
because those profiles are needed for tests liketest_png_icc
.Also notice, that the icc profiles in
icc-profiles-free
and the ones shipped by ghostscript are not the same even though the files are calledsRGB.icc
in both cases. The profiles shipped by ghostscripts are to decode images and those shipped inicc-profiles-free
are do encode the profile (get embedded into the images themselves).ICC profiles are a big mystery to me and I haven't yet found somebody who could truly tell me whether what img2pdf does is correct or not. So as long as the tests pass, that's fine for me and I can merge your commits.
Thanks!
d60b5109e0
toae5bc0f200
ae5bc0f200
to635b08c321
Tests are passing but
compare
, the function that relied onicc-profiles-free
is never called withicc=True
so that part of the code is never tested.If you could add a test that uses it to the main branch, I would be able to check whether Ghostscript's ICC profile works with it. If it doesn't, I will add logic to fetch the right ICC profile for this test instead of using Ghostscript's.
I don't think you are right here. Have a look at the function
test_png_icc
which callscompare_ghostscript
andcompare_poppler
withicc=True
which then in turn callcompare
withicc=True
.Oh right 🙂 In that case, yes, tests do pass, no skips or anything else.
Here is the output from that Dockerfile, if you want to test yourself:
Since the tests pass for you, I have merged this. But the
test_png_icc
tests keep failing: https://travis-ci.com/github/josch/img2pdfThanks! I tested commit
55d589a548
with Ubuntu 20 to match what Travis does and it fails the ICC tests (and TIFF tests) there too so the problem isn't linked to this PR or the change of the ICC profile:I also see the TIFF failures on Arch (ImageMagick 7) with this Dockerfile, I wonder why Debian Bullseye or Gentoo don't exhibit the same problem:
I guess both the color depth problem and the ICC comparison problem could use separate issues.