From 4ebe63886d6356361237a79cf28e9be436452945 Mon Sep 17 00:00:00 2001 From: RLumSK Date: Thu, 26 Dec 2024 19:51:17 +0100 Subject: [PATCH] Add vdiffr for figure snapshots to suggests and ad one example for the Abanico plot. + ad NEWS + up rebuild NEWS + up build number --- DESCRIPTION | 5 +- NEWS.Rmd | 7 + NEWS.md | 13 +- .../plot_AbanicoPlot/abanico-expected.svg | 182 ++++++++++++++++++ tests/testthat/test_plot_AbanicoPlot.R | 13 ++ 5 files changed, 217 insertions(+), 3 deletions(-) create mode 100644 tests/testthat/_snaps/plot_AbanicoPlot/abanico-expected.svg diff --git a/DESCRIPTION b/DESCRIPTION index f787f0c60..999b8a992 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: Luminescence Type: Package Title: Comprehensive Luminescence Dating Data Analysis -Version: 0.9.26.9000-102 -Date: 2024-12-18 +Version: 0.9.26.9000-107 +Date: 2024-12-26 Authors@R: c( person("Sebastian", "Kreutzer", role = c("aut", "trl", "cre", "dtc"), email = "maintainer_luminescence@r-luminescence.org", comment = c(ORCID = "0000-0002-0734-2199")), person("Christoph", "Burow", role = c("aut", "trl", "dtc"), comment = c(ORCID = "0000-0002-5023-4046")), @@ -65,6 +65,7 @@ Suggests: coda (>= 0.19-4), pander (>= 0.6.5), testthat (>= 3.2.1), + vdiffr (>= 1.0.0), tiff (>= 0.1-12), devtools (>= 2.4.5), R.rsp (>= 0.46.0) diff --git a/NEWS.Rmd b/NEWS.Rmd index c49b516b1..0e4269f16 100644 --- a/NEWS.Rmd +++ b/NEWS.Rmd @@ -69,6 +69,13 @@ deprecated and will produce a warning (#499, fixed in #503). * Function `Second2Gray()` has been renamed to `convert_Second2Gray()` (#498, fixed in #500). +## New dependencies +* We have added package `’vdiffr’` as dependency in `suggests`. The package +enables us to automatically verify the consistency of plot outputs generated by +package functions against reference figures captured earlier. Although this new +dependency does not have any user-visible impact, it becomes necessary (means already installed) +when building `’Luminescence’` from source. The primary advantage lies in the developer’s domain, +as it ensures that modifications to functions do not inadvertently alter plot outputs. ## Bugfixes diff --git a/NEWS.md b/NEWS.md index d8c4f7890..d58366d51 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,7 +5,7 @@ -# Changes in version 0.9.26.9000-102 (2024-12-19) +# Changes in version 0.9.26.9000-107 (2024-12-26) ## New functions @@ -77,6 +77,17 @@ - Function `Second2Gray()` has been renamed to `convert_Second2Gray()` (#498, fixed in \#500). +## New dependencies + +- We have added package `’vdiffr’` as dependency in `suggests`. The + package enables us to automatically verify the consistency of plot + outputs generated by package functions against reference figures + captured earlier. Although this new dependency does not have any + user-visible impact, it becomes necessary (means already installed) + when building `’Luminescence’` from source. The primary advantage lies + in the developer’s domain, as it ensures that modifications to + functions do not inadvertently alter plot outputs. + ## Bugfixes ### `analyse_Al2O3C_CrossTalk()` diff --git a/tests/testthat/_snaps/plot_AbanicoPlot/abanico-expected.svg b/tests/testthat/_snaps/plot_AbanicoPlot/abanico-expected.svg new file mode 100644 index 000000000..a82ff894d --- /dev/null +++ b/tests/testthat/_snaps/plot_AbanicoPlot/abanico-expected.svg @@ -0,0 +1,182 @@ + + + + + + + + + + + + +Standardised estimate + + + + + + + + + + + + + + + + +D +e + distribution + + + + + +0 +5 +10 +15 + + + +Precision +Relative standard error (%) + + + + +20 +10 +6.7 + + + + +-2 +0 +2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +20 +40 +60 +80 +100 +120 +D +e + [Gy] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0 +0.016 +Density (bw 0.15) + + +n = 62 | in 2 sigma = 41.9 % + + diff --git a/tests/testthat/test_plot_AbanicoPlot.R b/tests/testthat/test_plot_AbanicoPlot.R index f145f3ca2..352fbf379 100644 --- a/tests/testthat/test_plot_AbanicoPlot.R +++ b/tests/testthat/test_plot_AbanicoPlot.R @@ -49,6 +49,7 @@ test_that("input validation", { "Lower x-axis limit was 2, reset to zero") }) + test_that("Test examples from the example page", { testthat::skip_on_cran() @@ -302,3 +303,15 @@ test_that("more coverage", { par(mfrow = c(1,1)) }) + +test_that("Test graphical snapshot", { + testthat::skip_on_cran() + testthat::skip_if_not_installed("vdiffr") + + SW({ + vdiffr::expect_doppelganger( + title = "Abanico expected", + fig = plot_AbanicoPlot(data = ExampleData.DeValues)) + }) + +})