From 43637f80a7180b36e0fd22ed65afe39260e80ad9 Mon Sep 17 00:00:00 2001 From: William Gearty Date: Mon, 9 Oct 2023 10:06:12 -0400 Subject: [PATCH] Fix test for varying versions of dependencies --- tests/testthat/test-phylopic_utils.R | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/testthat/test-phylopic_utils.R b/tests/testthat/test-phylopic_utils.R index e94fb1b..b8dcc56 100644 --- a/tests/testthat/test-phylopic_utils.R +++ b/tests/testthat/test-phylopic_utils.R @@ -45,9 +45,15 @@ test_that("recolor_phylopic works", { cat <- get_phylopic("23cd6aa4-9587-4a2e-8e26-de42885004c9") cat_recolor <- recolor_phylopic(cat, .5, color = "green", fill = "red") expect_true(is(cat_recolor, "Picture")) - expect_equal(cat_recolor@content[[1]]@gp$col, "green") - expect_equal(cat_recolor@content[[1]]@gp$fill, "red") - expect_equal(cat_recolor@content[[1]]@gp$alpha, .5) + if ("content" %in% slotNames(cat_recolor@content[[1]])) { + expect_equal(cat_recolor@content[[1]]@content[[1]]@gp$col, "green") + expect_equal(cat_recolor@content[[1]]@content[[1]]@gp$fill, "red") + expect_equal(cat_recolor@content[[1]]@content[[1]]@gp$alpha, .5) + } else { + expect_equal(cat_recolor@content[[1]]@gp$col, "green") + expect_equal(cat_recolor@content[[1]]@gp$fill, "red") + expect_equal(cat_recolor@content[[1]]@gp$alpha, .5) + } cat_png <- get_phylopic("23cd6aa4-9587-4a2e-8e26-de42885004c9", format = "raster")