From 4a75bb457fd8657404fa9648fe456cf00cc9babd Mon Sep 17 00:00:00 2001 From: RLumSK Date: Thu, 24 Oct 2024 11:20:42 +0200 Subject: [PATCH] analyse_pIRIRSequence(): + fx minor regression issue with the plot warning + ad tests --- R/analyse_pIRIRSequence.R | 4 ++-- tests/testthat/test_analyse_pIRIRSequence.R | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/R/analyse_pIRIRSequence.R b/R/analyse_pIRIRSequence.R index 1d6e5d0de..e5873c8ef 100644 --- a/R/analyse_pIRIRSequence.R +++ b/R/analyse_pIRIRSequence.R @@ -282,10 +282,10 @@ analyse_pIRIRSequence <- function( ## CHECK FOR PLOT ...we safe users the pain by checking whether plot device has the ## required size. - if (plot[1] && plot.single && all(grDevices::dev.size("in") < 20)) { + if (plot[1] && !plot.single && all(grDevices::dev.size("in") < 18)) { plot <- FALSE .throw_warning("Argument 'plot' reset to 'FALSE'. The smallest plot ", - "size required is 20 x 20 in.\n", + "size required is 18 x 18 in.\n", "Consider plotting via `pdf(..., height = 20, width = 20)` ", "or setting `plot.single = FALSE`") } diff --git a/tests/testthat/test_analyse_pIRIRSequence.R b/tests/testthat/test_analyse_pIRIRSequence.R index fdb65ff44..9e40fbe2a 100644 --- a/tests/testthat/test_analyse_pIRIRSequence.R +++ b/tests/testthat/test_analyse_pIRIRSequence.R @@ -64,10 +64,24 @@ test_that("check plot stuff", { sequence.structure = c("TL", "pseudoIRSL1", "pseudoIRSL2"), main = "Pseudo pIRIR data set based on quartz OSL", plot = TRUE, - plot.single = TRUE, + plot.single = FALSE, verbose = FALSE), "[analyse_pIRIRSequence()] Argument 'plot' reset to 'FALSE'", fixed = TRUE) + + ## here it should not throw any warning because we used plot.single = TRUE + expect_silent(analyse_pIRIRSequence( + object, + signal.integral.min = 1, + signal.integral.max = 2, + background.integral.min = 900, + background.integral.max = 1000, + fit.method = "EXP", + sequence.structure = c("TL", "pseudoIRSL1", "pseudoIRSL2"), + main = "Pseudo pIRIR data set based on quartz OSL", + plot = TRUE, + plot.single = TRUE, + verbose = FALSE)) }) test_that("input validation", {