Test if two image files are equivalent
Usage
expect_equivalent_images(
current,
target,
tol = getOption("tinysnapshot_tol", default = 0),
metric = getOption("tinysnapshot_metric", default = "AE"),
fuzz = getOption("tinysnapshot_fuzz", default = 0),
style = getOption("tinysnapshot_plot_diff_style", default = c("old", "new", "diff")),
review = getOption("tinysnapshot_plot_review", default = TRUE),
diffpath = NULL
)Arguments
- current
path to an image file
- target
path to an image file
- tol
distance estimates larger than this threshold will trigger a test failure. Scale depends on the
metricargument. With the defaultmetric="AE"(absolute error), thetolerancecorresponds roughly to the number of pixels of difference between the plot and the reference image.- metric
string with a metric from
magick::metric_types()such as"AE"or"phash".- fuzz
relative color distance between 0 and 100 to be considered similar.
- style
A character vector to control the panels of the diff image saved to file. The order and number of entries controls the side-by-side panels. Allowable values are: "old", "new", "diff".
- review
logical. TRUE if a a diff plot should be saved to file for review when the expectation fails.
- diffpath
path where to save an image which shows the differences between
currentandtarget.NULLmeans that the diff image is not saved.