expect_known_scene {rgl}R Documentation

Helper for testthat testing.

Description

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

Usage

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

## 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)

[Package rgl version 1.3.1 Index]