r-lib / vdiffr

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

Improve README / vignette #116

Open eeholmes opened 2 years ago

eeholmes commented 2 years ago

Just FYI

DESCRIPTION file says depends on R 3.2.0 but this code throws an error saying it depends on R 4.1.0. It's a really minor thing but saves time for users to know that a package depends on the latest R version.

disp_hist_base <- function() hist(mtcars$disp)
disp_hist_ggplot <- ggplot(mtcars, aes(disp)) + geom_histogram()

vdiffr::expect_doppelganger("Base graphics histogram", disp_hist_base)
vdiffr::expect_doppelganger("ggplot2 histogram", disp_hist_ggplot)

Error: Reason: The R graphics engine is too old. Please update to R 4.1.0 and regenerate the vdiffr snapshots.

> packageVersion("vdiffr")
[1] ‘1.0.2’
lionel- commented 2 years ago

This is not an error but a testthat::skip(). Skips are caught by testthat and ignored, even though they appear to be errors when called interactively.

eeholmes commented 2 years ago

Got it. However, I think the package still "depends" on R 4.1.0 since the test won't run without it. Maybe a message on loading the package to alert the user? Obviously, very minor issue. The package worked well once I installed R 4.1.0.

BTW, the documentation is a bit hard to follow on https://vdiffr.r-lib.org/ and it took me a long time to get just a simple test comparing two figures working. If you'd like feedback, I can post an issue. Perhaps I am using differently than you imagined when you wrote the help info.

lionel- commented 2 years ago

If it depended on 4.1 that would cause issues when checking a package on older R versions on CI.

Any feedback on the documentation is welcome :)

eeholmes commented 2 years ago

Here is a write-up I did on how to use vdiffr to compare 2 images for those in my group. I posted to a R-users blog that I contribute to. Maybe looking at this will be informative, or maybe not.

https://rgovys.github.io/posts/2021-09-28-vdiffr/

The write-up is a toy example to get a test working that is similar to my application.

Cheers! Hopefully this is a little helpful. Thanks for the package! It is very helpful for the tests I need to do.