expect_known_scene: Helper for 'testthat' testing.

Description Usage Arguments Details Value Examples

View source: R/testthat.R

Description

Gets the current scene using scene3d, and compares the result to a saved value, optionally closing the window afterwards.

Usage

1
2
3
4
expect_known_scene(name, 
                   close = TRUE, 
                   file = paste0("testdata/", name, ".rds"),
                   ...)

Arguments

name

By default, the base name of the file to save results in. Not used if file is specified.

close

Whether to close the rgl window after the comparison.

file

The file in which to save the result.

...

Other arguments which will be passed to expect_known_value.

Details

This function uses expect_known_value to save a representation of the scene. During the comparison, the scene is modified so that non-reproducible aspects are standardized or omitted:

Calls to expect_known_scene() enable testthat::local_edition(2) for the duration of the call, so it will work in testthat “3rd edition”.

Value

A value describing the changes to the saved object, suitable for use in test_that().

Examples

1
2
3
4
5
6
## Not run: 
# These lines can be included in testthat::test_that() code.
plot3d(1:10, 1:10, 1:10)
expect_known_scene("plot")

## End(Not run)

rgl documentation built on Aug. 21, 2021, 5:08 p.m.