expect_equal_plots: Compares JASP plots in unit tests.

Description Usage Arguments Examples

View source: R/testthat-helper-plots.R

Description

This function compares a stored .svg of a plot, to the plot that is created when the tests are run. If no .svg exists yet then you must first run manageTestPlots.

Usage

1

Arguments

test

The plot object you wish to test (does not work well for non-ggplot2 objects).

name

The name of the reference plot (a .svg stored in /tests/figs).

dir

The directory in tests/figs where the .svg is stored (commonly the name of the analysis).

Examples

1
2
3
4
5
6
options <- analysisOptions("BinomialTest")
options$variables <- "contBinom"
options$descriptivesPlots <- TRUE
results <- runAnalysis("BinomialTest", "test.csv", options)
testPlot <- results[["state"]][["figures"]][[1]][["obj"]]
expect_equal_plots(testPlot, "descriptives-1", dir = "BinomialTest")

TimKDJ/JASPTools documentation built on July 21, 2021, 7:52 p.m.