r-lib / vdiffr

Visual regression testing and graphical diffing with testthat
https://vdiffr.r-lib.org
Other
180 stars 31 forks source link

Ubuntu and windows doppelgangers differ #130

Closed willgearty closed 1 year ago

willgearty commented 1 year ago

I'm currently working on a revamp of an R package that can be used to add vectorized images (specifially phylopics) to ggplot and base R plots (https://github.com/palaeoverse-community/rphylopic/pull/37). Everything seems to work fine, except for SOME of the expect_doppelganger tests on Ubuntu. Some of the snapshot svgs that are generated on Ubuntu appear to be VERY slightly different from the respective snapshot svgs that I've generated on my Windows machine.

We've tried everything we can think of and have been unable to make the tests pass. Can anyone think of any reason this might occur on Ubuntu but not the other OSes?

The weird details (https://github.com/palaeoverse-community/rphylopic/actions/runs/4306035830):

Part of the svg on windows:

<defs>
  <clipPath id='cpMjYxLjUzfDQ4OC4yM3wyMi43OHw1NDUuMTE='>
    <rect x='261.53' y='22.78' width='226.71' height='522.33' />
  </clipPath>
</defs>
<g clip-path='url(#cpMjYxLjUzfDQ4OC4yM3wyMi43OHw1NDUuMTE=)'>
<path d='M 380.82 47.62 L 380.82 47.62 L 380.64 48.10 L 380.43...

Part of the svg on ubuntu (via github actions):

<defs>
  <clipPath id='cpMjYxLjY5fDQ4OC4wN3wyMi43OHw1NDUuMTE='>
    <rect x='261.69' y='22.78' width='226.39' height='522.33' />
  </clipPath>
</defs>
<g clip-path='url(#cpMjYxLjY5fDQ4OC4wN3wyMi43OHw1NDUuMTE=)'>
<path d='M 380.92 47.62 L 380.92 47.62 L 380.73 48.10 L 380.53...
willgearty commented 1 year ago

I've done some more digging and it looks like this is an rsvg issue: https://github.com/ropensci/rsvg/issues/37

willgearty commented 1 year ago

For anyone else that comes across this issue, I was able to resolve this by switching to using Ubuntu 20.04 for my Github Actions tests. It looks like the most recent version of librsvg (which rsvg depends on) on Ubuntu 20.04 is only 2.48.9, which seems close enough to 2.48.8 (the version bundled with the Windows/OSX versions of rsvg) to not cause the issue anymore.