Skip to content

Commit

Permalink
-Add rayshader tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tylermorganwall committed Mar 31, 2024
1 parent eb91203 commit 2eb5b3d
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/R-CMD-check.yaml
Expand Up @@ -29,7 +29,7 @@ jobs:
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

Expand All @@ -47,3 +47,4 @@ jobs:
- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
5 changes: 3 additions & 2 deletions DESCRIPTION
Expand Up @@ -34,12 +34,13 @@ Suggests:
dplyr,
Rvcg,
testthat (>= 3.0.0),
tibble
tibble,
rayshader
LinkingTo: Rcpp, RcppThread, progress, spacefillr (>= 0.3.0)
URL: https://www.rayrender.net, https://github.com/tylermorganwall/rayrender
RoxygenNote: 7.3.0
SystemRequirements: C++17
Biarch: true
Encoding: UTF-8
Config/testthat/edition: 3
Remotes: tylermorganwall/rayimage, tylermorganwall/rayvertex
Remotes: tylermorganwall/rayimage, tylermorganwall/rayvertex
Binary file added tests/testthat/Rplots.pdf
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions tests/testthat/test-rayshader.R
@@ -0,0 +1,19 @@
compare_image = function(path1, path2) {
image1 = png::readPNG(path1)
image2 = png::readPNG(path2)
return(identical(image1, image2))
}


test_that("rayshader tests", {
testthat::skip_if_not_installed("rayshader")
set.seed(1)

volcano %>%
rayshader::sphere_shade() %>%
rayshader::plot_3d(volcano,zscale = 2)
temp_hq = tempfile(fileext = ".png")
rayshader::render_highquality(filename=temp_hq, samples = 100)
rgl::close3d()
expect_snapshot_file(temp_hq, compare = compare_image)
})

0 comments on commit 2eb5b3d

Please sign in to comment.