Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions tests/testthat/test-Plot-snapshots.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
## The image snapshots in this file were all recorded with the full Suggests set
## installed, and `raster` in particular changes what gets recorded: several
## tests double the length of their `rasts` list when `raster` is available, and
## snapshot file names come from a running `counter` over those lists (see `fn()`
## in helper-testInit.R). With `raster` absent -- as on the `_R_CHECK_DEPENDS_ONLY_`
## CI leg -- the same names line up against different plots, so every snapshot
## after the first `requireNamespace("raster")` block compares the wrong image.
## Rather than maintain a second set of reference images, skip the image tests
## when `raster` is missing; the rest of the suite still exercises the package.

## block B
test_that("image content is not error-free", {

skip_if_not_installed("raster")
testInit("terra", opts = list(quickPlot.verbose = TRUE), dev = FALSE)

on.exit(
Expand Down Expand Up @@ -80,6 +91,7 @@ test_that("image content is not error-free", {
# # ## block C
test_that("plotting colors", {

skip_if_not_installed("raster")
testInit("terra", opts = list(quickPlot.verbose = TRUE), dev = FALSE)
on.exit(
{
Expand Down Expand Up @@ -130,6 +142,7 @@ test_that("plotting colors", {

# ## test.png 10 to 11
test_that("internal functions in Plot", {
skip_if_not_installed("raster")
testInit("terra", opts = list(quickPlot.verbose = TRUE), dev = FALSE)
on.exit(
{
Expand Down Expand Up @@ -208,6 +221,7 @@ test_that("internal functions in Plot", {

## block E 15 to
test_that("Plot 2 is not error-free", {
skip_if_not_installed("raster")
testInit("terra", opts = list(quickPlot.verbose = TRUE), dev = FALSE)
on.exit(
{
Expand Down Expand Up @@ -462,6 +476,7 @@ test_that("setColors is not error-free", {
# block G
test_that("Plot with base is not error-free", {

skip_if_not_installed("raster")
testInit("terra", opts = list(quickPlot.verbose = TRUE), dev = FALSE)
on.exit(
{
Expand Down Expand Up @@ -584,6 +599,7 @@ test_that("Plot messages and warnings and errors", {

## block I
test_that("rePlot doesn't work", {
skip_if_not_installed("raster")
testInit("terra", opts = list(quickPlot.verbose = TRUE), dev = FALSE)
for (os in oses) {
fil <- fn(tmpdir, desc, counter, os, envir = envirHere)
Expand Down Expand Up @@ -640,6 +656,7 @@ test_that("Plot - going through package coverage", {
# block K
test_that("Plot lists", {
prevLastPlotNumber <- 48
skip_if_not_installed("raster")
testInit("terra", opts = list(quickPlot.verbose = TRUE), dev = FALSE)

clearPlot()
Expand Down Expand Up @@ -751,6 +768,7 @@ test_that("Plot functions NOT in quickPlot, i.e. redefining Plot", {
})

test_that("Issue 20; arr working", {
skip_if_not_installed("raster")
testInit("terra", opts = list(quickPlot.verbose = TRUE), dev = FALSE)

files <- dir(system.file("maps", package = "quickPlot"), full.names = TRUE, pattern = "tif")
Expand All @@ -775,6 +793,7 @@ test_that("Issue 20; arr working", {

test_that("Issue 32 Plot factors lower case id", {
prevLastPlotNumber <- 51
skip_if_not_installed("raster")
testInit("terra", opts = list(quickPlot.verbose = TRUE), dev = FALSE)

for (colPalette in 1:2) {
Expand Down
Loading