diff --git a/DESCRIPTION b/DESCRIPTION
index 97238c5b..3196e104 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -42,7 +42,8 @@ Suggests:
rmarkdown,
scales,
testthat,
- utils
+ utils,
+ vdiffr
VignetteBuilder:
knitr
RoxygenNote: 7.3.2
diff --git a/tests/testthat/_snaps/independent-test-hGraph/alpha-allocation-hypotheses-names-transitions.svg b/tests/testthat/_snaps/independent-test-hGraph/alpha-allocation-hypotheses-names-transitions.svg
new file mode 100644
index 00000000..122e0ee6
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-hGraph/alpha-allocation-hypotheses-names-transitions.svg
@@ -0,0 +1,53 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-hGraph/alpha-digits.svg b/tests/testthat/_snaps/independent-test-hGraph/alpha-digits.svg
new file mode 100644
index 00000000..8fa01296
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-hGraph/alpha-digits.svg
@@ -0,0 +1,65 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-hGraph/basic-layout.svg b/tests/testthat/_snaps/independent-test-hGraph/basic-layout.svg
new file mode 100644
index 00000000..d651e25b
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-hGraph/basic-layout.svg
@@ -0,0 +1,92 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-hGraph/clockwise-order.svg b/tests/testthat/_snaps/independent-test-hGraph/clockwise-order.svg
new file mode 100644
index 00000000..1fdcdde6
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-hGraph/clockwise-order.svg
@@ -0,0 +1,127 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-hGraph/custom-ellipses-multiline.svg b/tests/testthat/_snaps/independent-test-hGraph/custom-ellipses-multiline.svg
new file mode 100644
index 00000000..cf44703d
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-hGraph/custom-ellipses-multiline.svg
@@ -0,0 +1,73 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-hGraph/gray-shades.svg b/tests/testthat/_snaps/independent-test-hGraph/gray-shades.svg
new file mode 100644
index 00000000..1de39515
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-hGraph/gray-shades.svg
@@ -0,0 +1,65 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-hGraph/hue-palette.svg b/tests/testthat/_snaps/independent-test-hGraph/hue-palette.svg
new file mode 100644
index 00000000..5812857f
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-hGraph/hue-palette.svg
@@ -0,0 +1,92 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plot.binomialSPRT/binomial-sprt-plottype-1.svg b/tests/testthat/_snaps/independent-test-plot.binomialSPRT/binomial-sprt-plottype-1.svg
new file mode 100644
index 00000000..6b4d3c91
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plot.binomialSPRT/binomial-sprt-plottype-1.svg
@@ -0,0 +1,111 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plot.binomialSPRT/binomial-sprt.svg b/tests/testthat/_snaps/independent-test-plot.binomialSPRT/binomial-sprt.svg
new file mode 100644
index 00000000..cccad204
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plot.binomialSPRT/binomial-sprt.svg
@@ -0,0 +1,111 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plot.gsBinomialExact/binomial-exact-plottype-1.svg b/tests/testthat/_snaps/independent-test-plot.gsBinomialExact/binomial-exact-plottype-1.svg
new file mode 100644
index 00000000..f61ae689
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plot.gsBinomialExact/binomial-exact-plottype-1.svg
@@ -0,0 +1,57 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plot.gsBinomialExact/binomial-exact-plottype-2.svg b/tests/testthat/_snaps/independent-test-plot.gsBinomialExact/binomial-exact-plottype-2.svg
new file mode 100644
index 00000000..4a78e9a5
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plot.gsBinomialExact/binomial-exact-plottype-2.svg
@@ -0,0 +1,71 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plot.gsBinomialExact/binomial-exact-plottype-3.svg b/tests/testthat/_snaps/independent-test-plot.gsBinomialExact/binomial-exact-plottype-3.svg
new file mode 100644
index 00000000..8f8844b8
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plot.gsBinomialExact/binomial-exact-plottype-3.svg
@@ -0,0 +1,57 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plot.gsBinomialExact/binomial-exact-plottype-6.svg b/tests/testthat/_snaps/independent-test-plot.gsBinomialExact/binomial-exact-plottype-6.svg
new file mode 100644
index 00000000..4ebc402b
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plot.gsBinomialExact/binomial-exact-plottype-6.svg
@@ -0,0 +1,58 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plot.gsBinomialExact/binomial-exact-plottype-default.svg b/tests/testthat/_snaps/independent-test-plot.gsBinomialExact/binomial-exact-plottype-default.svg
new file mode 100644
index 00000000..d3b42aa6
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plot.gsBinomialExact/binomial-exact-plottype-default.svg
@@ -0,0 +1,57 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plot.gsDesign/gssurv-base-false.svg b/tests/testthat/_snaps/independent-test-plot.gsDesign/gssurv-base-false.svg
new file mode 100644
index 00000000..62d1c53b
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plot.gsDesign/gssurv-base-false.svg
@@ -0,0 +1,82 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plot.gsDesign/gssurv-base-true.svg b/tests/testthat/_snaps/independent-test-plot.gsDesign/gssurv-base-true.svg
new file mode 100644
index 00000000..a96df7cf
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plot.gsDesign/gssurv-base-true.svg
@@ -0,0 +1,111 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plot.gsDesign/plottype-1-base-false.svg b/tests/testthat/_snaps/independent-test-plot.gsDesign/plottype-1-base-false.svg
new file mode 100644
index 00000000..643c8c98
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plot.gsDesign/plottype-1-base-false.svg
@@ -0,0 +1,80 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plot.gsDesign/plottype-1-base-true.svg b/tests/testthat/_snaps/independent-test-plot.gsDesign/plottype-1-base-true.svg
new file mode 100644
index 00000000..ae75c779
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plot.gsDesign/plottype-1-base-true.svg
@@ -0,0 +1,82 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plot.gsDesign/plottype-2-base-true.svg b/tests/testthat/_snaps/independent-test-plot.gsDesign/plottype-2-base-true.svg
new file mode 100644
index 00000000..8da46b64
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plot.gsDesign/plottype-2-base-true.svg
@@ -0,0 +1,108 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plot.gsDesign/plottype-3-base-true.svg b/tests/testthat/_snaps/independent-test-plot.gsDesign/plottype-3-base-true.svg
new file mode 100644
index 00000000..b9647b36
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plot.gsDesign/plottype-3-base-true.svg
@@ -0,0 +1,75 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plot.gsDesign/plottype-4-base-false.svg b/tests/testthat/_snaps/independent-test-plot.gsDesign/plottype-4-base-false.svg
new file mode 100644
index 00000000..35d1d873
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plot.gsDesign/plottype-4-base-false.svg
@@ -0,0 +1,82 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plot.gsDesign/plottype-4-base-true.svg b/tests/testthat/_snaps/independent-test-plot.gsDesign/plottype-4-base-true.svg
new file mode 100644
index 00000000..853ee972
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plot.gsDesign/plottype-4-base-true.svg
@@ -0,0 +1,100 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plot.gsDesign/plottype-5-base-true.svg b/tests/testthat/_snaps/independent-test-plot.gsDesign/plottype-5-base-true.svg
new file mode 100644
index 00000000..e09b87c9
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plot.gsDesign/plottype-5-base-true.svg
@@ -0,0 +1,63 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plot.gsDesign/plottype-6-base-false.svg b/tests/testthat/_snaps/independent-test-plot.gsDesign/plottype-6-base-false.svg
new file mode 100644
index 00000000..4d5b8509
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plot.gsDesign/plottype-6-base-false.svg
@@ -0,0 +1,56 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plot.gsDesign/plottype-6-base-true.svg b/tests/testthat/_snaps/independent-test-plot.gsDesign/plottype-6-base-true.svg
new file mode 100644
index 00000000..b8b5a876
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plot.gsDesign/plottype-6-base-true.svg
@@ -0,0 +1,62 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plot.gsDesign/plottype-7-base-true.svg b/tests/testthat/_snaps/independent-test-plot.gsDesign/plottype-7-base-true.svg
new file mode 100644
index 00000000..779d53b3
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plot.gsDesign/plottype-7-base-true.svg
@@ -0,0 +1,76 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plot.gsDesign/plottype-power-base-false.svg b/tests/testthat/_snaps/independent-test-plot.gsDesign/plottype-power-base-false.svg
new file mode 100644
index 00000000..8f16a7e9
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plot.gsDesign/plottype-power-base-false.svg
@@ -0,0 +1,94 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plot.gsDesign/test-type-1-plottype-2.svg b/tests/testthat/_snaps/independent-test-plot.gsDesign/test-type-1-plottype-2.svg
new file mode 100644
index 00000000..4c7282dc
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plot.gsDesign/test-type-1-plottype-2.svg
@@ -0,0 +1,104 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plot.gsProbability/plottype-1-base-false.svg b/tests/testthat/_snaps/independent-test-plot.gsProbability/plottype-1-base-false.svg
new file mode 100644
index 00000000..643c8c98
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plot.gsProbability/plottype-1-base-false.svg
@@ -0,0 +1,80 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plot.gsProbability/plottype-1-base-true.svg b/tests/testthat/_snaps/independent-test-plot.gsProbability/plottype-1-base-true.svg
new file mode 100644
index 00000000..ae75c779
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plot.gsProbability/plottype-1-base-true.svg
@@ -0,0 +1,82 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plot.gsProbability/plottype-2-base-true.svg b/tests/testthat/_snaps/independent-test-plot.gsProbability/plottype-2-base-true.svg
new file mode 100644
index 00000000..60a05662
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plot.gsProbability/plottype-2-base-true.svg
@@ -0,0 +1,123 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plot.gsProbability/plottype-4-base-false.svg b/tests/testthat/_snaps/independent-test-plot.gsProbability/plottype-4-base-false.svg
new file mode 100644
index 00000000..35d1d873
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plot.gsProbability/plottype-4-base-false.svg
@@ -0,0 +1,82 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plot.gsProbability/plottype-4-base-true.svg b/tests/testthat/_snaps/independent-test-plot.gsProbability/plottype-4-base-true.svg
new file mode 100644
index 00000000..4c3df633
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plot.gsProbability/plottype-4-base-true.svg
@@ -0,0 +1,100 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plot.gsProbability/plottype-6-base-false.svg b/tests/testthat/_snaps/independent-test-plot.gsProbability/plottype-6-base-false.svg
new file mode 100644
index 00000000..b4bf8ea9
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plot.gsProbability/plottype-6-base-false.svg
@@ -0,0 +1,62 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plot.gsProbability/plottype-6-base-true.svg b/tests/testthat/_snaps/independent-test-plot.gsProbability/plottype-6-base-true.svg
new file mode 100644
index 00000000..cdb455f8
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plot.gsProbability/plottype-6-base-true.svg
@@ -0,0 +1,62 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plot.gsProbability/plottype-7-base-true.svg b/tests/testthat/_snaps/independent-test-plot.gsProbability/plottype-7-base-true.svg
new file mode 100644
index 00000000..779d53b3
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plot.gsProbability/plottype-7-base-true.svg
@@ -0,0 +1,76 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plot.gsProbability/plottype-power-base-false.svg b/tests/testthat/_snaps/independent-test-plot.gsProbability/plottype-power-base-false.svg
new file mode 100644
index 00000000..0bb88031
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plot.gsProbability/plottype-power-base-false.svg
@@ -0,0 +1,96 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plot.ssrCP/ssr-cp.svg b/tests/testthat/_snaps/independent-test-plot.ssrCP/ssr-cp.svg
new file mode 100644
index 00000000..38f1710e
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plot.ssrCP/ssr-cp.svg
@@ -0,0 +1,138 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plotASN/plotasn-gsdesign.svg b/tests/testthat/_snaps/independent-test-plotASN/plotasn-gsdesign.svg
new file mode 100644
index 00000000..69ab559d
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plotASN/plotasn-gsdesign.svg
@@ -0,0 +1,56 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plotASN/plotasn-gsurv.svg b/tests/testthat/_snaps/independent-test-plotASN/plotasn-gsurv.svg
new file mode 100644
index 00000000..5a90b60a
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plotASN/plotasn-gsurv.svg
@@ -0,0 +1,54 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plotBval/plotbval.svg b/tests/testthat/_snaps/independent-test-plotBval/plotbval.svg
new file mode 100644
index 00000000..32372800
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plotBval/plotbval.svg
@@ -0,0 +1,80 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plotHR/plothr.svg b/tests/testthat/_snaps/independent-test-plotHR/plothr.svg
new file mode 100644
index 00000000..67e26271
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plotHR/plothr.svg
@@ -0,0 +1,70 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plotRR/plotrr.svg b/tests/testthat/_snaps/independent-test-plotRR/plotrr.svg
new file mode 100644
index 00000000..9069aedf
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plotRR/plotrr.svg
@@ -0,0 +1,72 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plotgsCP/plotgscp-test-type-1.svg b/tests/testthat/_snaps/independent-test-plotgsCP/plotgscp-test-type-1.svg
new file mode 100644
index 00000000..5cad1dd6
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plotgsCP/plotgscp-test-type-1.svg
@@ -0,0 +1,63 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plotgsCP/plotgscp-test-type-2.svg b/tests/testthat/_snaps/independent-test-plotgsCP/plotgscp-test-type-2.svg
new file mode 100644
index 00000000..171c1913
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plotgsCP/plotgscp-test-type-2.svg
@@ -0,0 +1,74 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plotgsPower/gspower-test-type-1.svg b/tests/testthat/_snaps/independent-test-plotgsPower/gspower-test-type-1.svg
new file mode 100644
index 00000000..c1de4b7f
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plotgsPower/gspower-test-type-1.svg
@@ -0,0 +1,76 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plotgsPower/gspower-test-type-2.svg b/tests/testthat/_snaps/independent-test-plotgsPower/gspower-test-type-2.svg
new file mode 100644
index 00000000..7c70a14b
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plotgsPower/gspower-test-type-2.svg
@@ -0,0 +1,82 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plotgsZ/plotgsz.svg b/tests/testthat/_snaps/independent-test-plotgsZ/plotgsz.svg
new file mode 100644
index 00000000..1d7e3ba4
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plotgsZ/plotgsz.svg
@@ -0,0 +1,78 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plotsf/plotgscp-test-type-4.svg b/tests/testthat/_snaps/independent-test-plotsf/plotgscp-test-type-4.svg
new file mode 100644
index 00000000..3c4250e2
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plotsf/plotgscp-test-type-4.svg
@@ -0,0 +1,67 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plotsf/plotsf-test-type-1.svg b/tests/testthat/_snaps/independent-test-plotsf/plotsf-test-type-1.svg
new file mode 100644
index 00000000..a7683b99
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plotsf/plotsf-test-type-1.svg
@@ -0,0 +1,61 @@
+
+
diff --git a/tests/testthat/_snaps/independent-test-plotsf/plotsf-test-type-5.svg b/tests/testthat/_snaps/independent-test-plotsf/plotsf-test-type-5.svg
new file mode 100644
index 00000000..ea27f746
--- /dev/null
+++ b/tests/testthat/_snaps/independent-test-plotsf/plotsf-test-type-5.svg
@@ -0,0 +1,118 @@
+
+
diff --git a/tests/testthat/helper.R b/tests/testthat/helper.R
index 09e2a497..35d18dda 100644
--- a/tests/testthat/helper.R
+++ b/tests/testthat/helper.R
@@ -993,40 +993,6 @@ Validate_comp_sprt_bnd <- function(alpha, beta, p0, p1, nmin, nmax) {
return(result)
}
-#-------------------------------------------------------------------------------
-#save_gg_plot() : Function to save plots created with ggplot2 package and saved
-# with ggsave() function.
-#
-# plot : Plot to save, defaults to last plot displayed.
-# path : Path of the directory to save plot to: path and filename are
-# combined to create the fully qualified file name.
-# width : the width of the device (in inches).
-# height: the height of the device (in inches).
-# dpi : Plot resolution.
-
-# Plot size in units ("in", "cm", or "mm")
-#-------------------------------------------------------------------------------
-save_gg_plot <- function(code, width = 4, height = 4) {
- path <- tempfile(fileext = ".png")
- ggplot2::ggsave(path, plot = code, width = width, height = height, dpi = 72, units = "in")
- path
-}
-
-#-------------------------------------------------------------------------------
-# save_gr_plot(): Function to save plots created with graphics package and saved
-# with png() function.
-# width: the width of the device (in pixels).
-# height: the height of the device (in pixels).
-#-------------------------------------------------------------------------------
-save_gr_plot <- function(code, width = 400, height = 400) {
- path <- tempfile(fileext = ".png")
- png(path, width = width, height = height)
- oldpar <- par(no.readonly = TRUE)
- on.exit(par(oldpar))
- code
- invisible(dev.off())
- path
-}
#-------------------------------------------------------------------------------
#ssrCP : ssrCP() adapts 2-stage group sequential designs to 2-stage sample size
# re-estimation designs based on interim analysis conditional power.
diff --git a/tests/testthat/test-independent-test-hGraph.R b/tests/testthat/test-independent-test-hGraph.R
index 8273eb77..12e76183 100644
--- a/tests/testthat/test-independent-test-hGraph.R
+++ b/tests/testthat/test-independent-test-hGraph.R
@@ -1,43 +1,24 @@
-#-------------------------------------------------------------------------------
-# hGraph : hGraph() plots a multiplicity graph defined by user inputs. The graph
-# can also be used with the **gMCPLite** package to evaluate a set of
-# nominal p-values for the tests of the hypotheses in the graph
-#-------------------------------------------------------------------------------
-
-testthat::test_that("test : checking basic graph layout", {
- x <- hGraph()
- save_plot_obj <- save_gg_plot(x)
- local_edition(3)
- expect_snapshot_file(save_plot_obj, "plot_hGraph_1.png")
+testthat::test_that("hGraph: Basic graph layout", {
+ x <- hGraph()
+ vdiffr::expect_doppelganger("basic layout", x)
})
-
-testthat::test_that("test : checking note clockwise ordering", {
+testthat::test_that("hGraph: Note clockwise ordering", {
x <- hGraph(5)
- save_plot_obj <- save_gg_plot(x)
- local_edition(3)
- expect_snapshot_file(save_plot_obj, "plot_hGraph_2.png")
+ vdiffr::expect_doppelganger("clockwise order", x)
})
-
-testthat::test_that("test : Add colors (default is 3 gray shades)", {
+testthat::test_that("hGraph: Add colors (default is 3 gray shades)", {
x <- hGraph(3, fill = 1:3)
- save_plot_obj <- save_gg_plot(x)
- local_edition(3)
- expect_snapshot_file(save_plot_obj, "plot_hGraph_3.png")
+ vdiffr::expect_doppelganger("gray shades", x)
})
-
-testthat::test_that("test : Use a hue palette ", {
+testthat::test_that("hGraph: Use a hue palette", {
x <- hGraph(4, fill = factor(1:4), palette = scales::hue_pal(l = 75)(4))
- save_plot_obj <- save_gg_plot(x)
- local_edition(3)
- expect_snapshot_file(save_plot_obj, "plot_hGraph_4.png")
+ vdiffr::expect_doppelganger("hue palette", x)
})
-
-# different alpha allocation, hypothesis names and transitions
-testthat::test_that("test: different alpha allocation, hypothesis names and transitions", {
+testthat::test_that("hGraph: Different alpha allocation, hypotheses names, and transitions", {
alphaHypotheses <- c(.005, .007, .013)
nameHypotheses <- c("ORR", "PFS", "OS")
m <- matrix(c(
@@ -46,37 +27,35 @@ testthat::test_that("test: different alpha allocation, hypothesis names and tran
1, 0, 0
), nrow = 3, byrow = TRUE)
x <- hGraph(3, alphaHypotheses = alphaHypotheses, nameHypotheses = nameHypotheses, m = m)
- save_plot_obj <- save_gg_plot(x)
- local_edition(3)
- expect_snapshot_file(save_plot_obj, "plot_hGraph_5.png")
-})
+ vdiffr::expect_doppelganger("alpha allocation hypotheses names transitions", x)
+})
# Custom position and size of ellipses, change text to multi-line text
# Adjust box width
# add legend in middle of plot
-testthat::test_that("test: Custom position and size of ellipses, change text to multi-line text", {
+testthat::test_that("hGraph: Custom position and size of ellipses, change text to multi-line text", {
cbPalette <- c(
"#999999", "#E69F00", "#56B4E9", "#009E73",
- "#F0E442", "#0072B2", "#D55E00", "#CC79A7")
+ "#F0E442", "#0072B2", "#D55E00", "#CC79A7"
+ )
x <- hGraph(3,
x = sqrt(0:2), y = c(1, 3, 1.5), size = 6, halfWid = .3,
halfHgt = .3, trhw = 0.6,
palette = cbPalette[2:4], fill = c(1, 2, 2),
legend.position = c(.95, .45), legend.name = "Legend:",
labels = c("Group 1", "Group 2"),
- nameHypotheses = c("H1:\n Long name", "H2:\n Longer name", "H3:\n Longest name"))
-
- save_plot_obj <- save_gg_plot(x)
- local_edition(3)
- expect_snapshot_file(save_plot_obj, "plot_hGraph_6.png")
+ nameHypotheses = c("H1:\n Long name", "H2:\n Longer name", "H3:\n Longest name")
+ )
+
+ vdiffr::expect_doppelganger("custom ellipses multiline", x)
})
+testthat::test_that("hGraph: Number of digits to show for alphaHypotheses", {
+ x <- hGraph(
+ nHypotheses = 3, size = 5, halfWid = 1.25, trhw = 0.25,
+ radianStart = pi / 2, offset = pi / 20, arrowsize = .03, digits = 3
+ )
-testthat::test_that("test: number of digits to show for alphaHypotheses", {
- x <- hGraph(nHypotheses = 3, size = 5, halfWid = 1.25, trhw = 0.25,
- radianStart = pi/2, offset = pi/20, arrowsize = .03, digits = 3)
- save_plot_obj <- save_gg_plot(x)
- local_edition(3)
- expect_snapshot_file(save_plot_obj, "plot_hGraph_7.png")
+ vdiffr::expect_doppelganger("alpha digits", x)
})
diff --git a/tests/testthat/test-independent-test-plot.binomialSPRT.R b/tests/testthat/test-independent-test-plot.binomialSPRT.R
index dada6057..09292a2b 100644
--- a/tests/testthat/test-independent-test-plot.binomialSPRT.R
+++ b/tests/testthat/test-independent-test-plot.binomialSPRT.R
@@ -1,9 +1,4 @@
-# --------------------------------------------
-# Test plot.binomialSPRT function
-#----------------------------------------------
-
-testthat::test_that(desc = "Test: plot.binomialSPRT graphs are correctly rendered ",
- code = {
+testthat::test_that("plot.binomialSPRT: plots are correctly rendered", {
plotBSPRT <- binomialSPRT(
p0 = 0.05,
p1 = 0.25,
@@ -13,17 +8,13 @@ testthat::test_that(desc = "Test: plot.binomialSPRT graphs are correctly rendere
maxn = 35
)
- save_plot_obj <- save_gg_plot(plot.binomialSPRT(plotBSPRT))
-
- local_edition(3)
-
- testthat::expect_snapshot_file(save_plot_obj, "plotbinomialSPRT.png")
+ vdiffr::expect_doppelganger(
+ "binomial SPRT",
+ plot.binomialSPRT(plotBSPRT)
+ )
})
-
-testthat::test_that(desc = "Test: plot.binomialSPRT graphs are correctly rendered,
- plottype = 1 ",
- code = {
+testthat::test_that("plot.binomialSPRT: plots are correctly rendered, plottype = 1", {
plotBSPRT <- binomialSPRT(
p0 = 0.05,
p1 = 0.25,
@@ -33,9 +24,8 @@ testthat::test_that(desc = "Test: plot.binomialSPRT graphs are correctly rendere
maxn = 35
)
- save_plot_obj <- save_gg_plot(plot.binomialSPRT(plotBSPRT, plottype = 1))
-
- local_edition(3)
-
- testthat::expect_snapshot_file(save_plot_obj, "plotbinomialSPRT_plottype_1.png")
+ vdiffr::expect_doppelganger(
+ "binomial SPRT plottype 1",
+ plot.binomialSPRT(plotBSPRT, plottype = 1)
+ )
})
diff --git a/tests/testthat/test-independent-test-plot.gsBinomialExact.R b/tests/testthat/test-independent-test-plot.gsBinomialExact.R
index c808c14e..8e4c1dbf 100644
--- a/tests/testthat/test-independent-test-plot.gsBinomialExact.R
+++ b/tests/testthat/test-independent-test-plot.gsBinomialExact.R
@@ -1,11 +1,5 @@
-# --------------------------------------------
-# Test plot.gsBinomialExact function
-#----------------------------------------------
-
-testthat::test_that(desc = "test: checking plot.gsBinomialExact graphs are
- correctly rendered, plottype=1",
- code = {
- plotBE_plottype_1 <- gsBinomialExact(
+testthat::test_that("plot.gsBinomialExact: plots are correctly rendered, plottype = 1", {
+ x <- gsBinomialExact(
k = 3,
theta = c(0.1, 0.2),
n.I = c(36, 71, 107),
@@ -13,17 +7,14 @@ testthat::test_that(desc = "test: checking plot.gsBinomialExact graphs are
b = c(13, 15, 18)
)
- save_plot_obj <- save_gg_plot(plot.gsBinomialExact(plotBE_plottype_1, plottype = 1))
- local_edition(3)
-
- testthat::expect_snapshot_file(save_plot_obj, "plotBinomialExact_1.png")
+ vdiffr::expect_doppelganger(
+ "binomial exact plottype 1",
+ plot.gsBinomialExact(x, plottype = 1)
+ )
})
-
-testthat::test_that(desc = "test: checking plot.gsBinomialExact graphs are
- correctly rendered, plottype = 2 ",
- code = {
- plotBE_plottype_2 <- gsBinomialExact(
+testthat::test_that("plot.gsBinomialExact: plots are correctly rendered, plottype = 2", {
+ x <- gsBinomialExact(
k = 3,
theta = c(0.1, 0.2),
n.I = c(36, 71, 107),
@@ -31,17 +22,14 @@ testthat::test_that(desc = "test: checking plot.gsBinomialExact graphs are
b = c(13, 15, 18)
)
- save_plot_obj <- save_gg_plot(plot.gsBinomialExact(plotBE_plottype_2, plottype = 2))
- local_edition(3)
-
- testthat::expect_snapshot_file(save_plot_obj, "plotBinomialExact_2.png")
+ vdiffr::expect_doppelganger(
+ "binomial exact plottype 2",
+ plot.gsBinomialExact(x, plottype = 2)
+ )
})
-
-testthat::test_that(desc = "test: checking plot.gsBinomialExact graphs are
- correctly rendered, plottype = 6",
- code = {
- plotBE_plottype_2 <- gsBinomialExact(
+testthat::test_that("plot.gsBinomialExact: plots are correctly rendered, plottype = 6", {
+ x <- gsBinomialExact(
k = 3,
theta = c(0.1, 0.2),
n.I = c(36, 71, 107),
@@ -49,17 +37,14 @@ testthat::test_that(desc = "test: checking plot.gsBinomialExact graphs are
b = c(13, 15, 18)
)
- save_plot_obj <- save_gg_plot(plot.gsBinomialExact(plotBE_plottype_2, plottype = 6))
- local_edition(3)
-
- testthat::expect_snapshot_file(save_plot_obj, "plotBinomialExact_6.png")
+ vdiffr::expect_doppelganger(
+ "binomial exact plottype 6",
+ plot.gsBinomialExact(x, plottype = 6)
+ )
})
-
-testthat::test_that(desc = "test: checking plot.gsBinomialExact graphs are
- correctly rendered, plottype = 3",
- code = {
- plotBE_plottype_2 <- gsBinomialExact(
+testthat::test_that("plot.gsBinomialExact: plots are correctly rendered, plottype = 3", {
+ x <- gsBinomialExact(
k = 3,
theta = c(0.1, 0.2),
n.I = c(36, 71, 107),
@@ -67,18 +52,14 @@ testthat::test_that(desc = "test: checking plot.gsBinomialExact graphs are
b = c(13, 15, 18)
)
- save_plot_obj <- save_gg_plot(plot.gsBinomialExact(plotBE_plottype_2, plottype = 3))
- local_edition(3)
-
- testthat::expect_snapshot_file(save_plot_obj, "plotBinomialExact_3.png")
+ vdiffr::expect_doppelganger(
+ "binomial exact plottype 3",
+ plot.gsBinomialExact(x, plottype = 3)
+ )
})
-
-
-testthat::test_that(desc = "test: checking plot.gsBinomialExact graphs are
- correctly rendered, for plottype set to default",
- code = {
- plot_BE <- gsBinomialExact(
+testthat::test_that("plot.gsBinomialExact: plots are correctly rendered, for plottype set to default", {
+ x <- gsBinomialExact(
k = 3,
theta = c(0.1, 0.2),
n.I = c(36, 71, 107),
@@ -86,8 +67,8 @@ testthat::test_that(desc = "test: checking plot.gsBinomialExact graphs are
b = c(13, 15, 18)
)
- save_plot_obj <- save_gg_plot(plot.gsBinomialExact(plot_BE))
- local_edition(3)
-
- testthat::expect_snapshot_file(save_plot_obj, "plotBinomialExact.png")
-})
\ No newline at end of file
+ vdiffr::expect_doppelganger(
+ "binomial exact plottype default",
+ plot.gsBinomialExact(x)
+ )
+})
diff --git a/tests/testthat/test-independent-test-plot.gsDesign.R b/tests/testthat/test-independent-test-plot.gsDesign.R
index 664dc15f..3c54180c 100644
--- a/tests/testthat/test-independent-test-plot.gsDesign.R
+++ b/tests/testthat/test-independent-test-plot.gsDesign.R
@@ -1,120 +1,133 @@
-# --------------------------------------------
-# Test plot.gsDesign function
-## save_gg_plot() is used for storing plots created using ggplot2 package,
-## whereas save_gr_plot() is used with plots created using graphics package.
-#----------------------------------------------
-
-test_that("Test plot.gsDesign graphs are correctly rendered for plottype 1 and base R plotting package set to TRUE", code = {
+test_that("plot.gsDesign: plots are correctly rendered for plottype 1 and base set to TRUE", {
x <- gsDesign(k = 5, test.type = 2, n.fix = 100)
- local_edition(3)
- save_plot_obj <- save_gr_plot(plot.gsDesign(x, plottype = 1, base = TRUE))
- expect_snapshot_file(save_plot_obj, "plotgsds1.png")
+
+ vdiffr::expect_doppelganger(
+ "plottype 1 base TRUE",
+ plot.gsDesign(x, plottype = 1, base = TRUE)
+ )
})
-test_that("Test plot.gsDesign graphs are correctly rendered for plottype 1 and base R plotting package set to FALSE.", code = {
+test_that("plot.gsDesign: plots are correctly rendered for plottype 1 and base set to FALSE", {
x <- gsDesign(k = 5, test.type = 2, n.fix = 100)
- local_edition(3)
- save_plot_obj <- save_gg_plot(plot.gsDesign(x, plottype = 1, base = FALSE))
- expect_snapshot_file(save_plot_obj, "plotgsds2.png")
-})
+ vdiffr::expect_doppelganger(
+ "plottype 1 base FALSE",
+ plot.gsDesign(x, plottype = 1, base = FALSE)
+ )
+})
-test_that("Test plot.gsDesign graphs are correctly rendered for plottype = power and base R plotting package set to FALSE.", {
+test_that("plot.gsDesign: plots are correctly rendered for plottype = power and base set to FALSE", {
x <- gsDesign(k = 5, test.type = 2, n.fix = 100)
- local_edition(3)
- save_plot_obj <- save_gg_plot(plot.gsDesign(x, plottype = "power", base = FALSE))
- expect_snapshot_file(save_plot_obj, "plot_plotgsds_3.png")
+
+ vdiffr::expect_doppelganger(
+ "plottype power base FALSE",
+ plot.gsDesign(x, plottype = "power", base = FALSE)
+ )
})
-test_that("Test plot.gsDesign graphs are correctly rendered for plottype 2 and base R plotting package set to TRUE", {
+test_that("plot.gsDesign: plots are correctly rendered for plottype 2 and base set to TRUE", {
x <- gsDesign(k = 5, test.type = 2, n.fix = 100)
- local_edition(3)
- save_plot_obj <- save_gr_plot(plot.gsDesign(x, plottype = 2, base = TRUE))
- expect_snapshot_file(save_plot_obj, "plot_plotgsds_4.png")
-})
+ vdiffr::expect_doppelganger(
+ "plottype 2 base TRUE",
+ plot.gsDesign(x, plottype = 2, base = TRUE)
+ )
+})
-test_that("Test plot.gsDesign graphs are correctly rendered for plottype 3 and base R plotting package set to TRUE", {
+test_that("plot.gsDesign: plots are correctly rendered for plottype 3 and base set to TRUE", {
x <- gsDesign(k = 5, test.type = 2, n.fix = 100)
- local_edition(3)
- save_plot_obj <- save_gr_plot(plot.gsDesign(x, plottype = 3, base = TRUE))
- expect_snapshot_file(save_plot_obj, "plot_plotgsds_5.png")
-})
+ vdiffr::expect_doppelganger(
+ "plottype 3 base TRUE",
+ plot.gsDesign(x, plottype = 3, base = TRUE)
+ )
+})
-test_that("Test plot.gsDesign graphs are correctly rendered for plottype 4 and base R plotting package set to FALSE", {
+test_that("plot.gsDesign: graphs are correctly rendered for plottype 4 and base set to FALSE", {
x <- gsDesign(k = 5, test.type = 2, n.fix = 100)
- local_edition(3)
- save_plot_obj <- save_gg_plot(plot.gsDesign(x, plottype = 4, base = FALSE))
- expect_snapshot_file(save_plot_obj, "plot_plotgsds_6.png")
+
+ vdiffr::expect_doppelganger(
+ "plottype 4 base FALSE",
+ plot.gsDesign(x, plottype = 4, base = FALSE)
+ )
})
-test_that("Test plot.gsDesign graphs are correctly rendered for plottype 4 and base R plotting package set to TRUE", {
+test_that("plot.gsDesign: plots are correctly rendered for plottype 4 and base set to TRUE", {
x <- gsDesign(k = 5, test.type = 2, n.fix = 100)
- local_edition(3)
- save_plot_obj <- save_gr_plot(plot.gsDesign(x, plottype = 4, base = TRUE))
- expect_snapshot_file(save_plot_obj, "plot_plotgsds_7.png")
-})
+ vdiffr::expect_doppelganger(
+ "plottype 4 base TRUE",
+ plot.gsDesign(x, plottype = 4, base = TRUE)
+ )
+})
-test_that("Test plot.gsDesign graphs are correctly rendered for plottype 5 and base R plotting package set to TRUE", {
+test_that("plot.gsDesign: plots are correctly rendered for plottype 5 and base set to TRUE", {
x <- gsDesign(k = 5, test.type = 2, n.fix = 100)
- local_edition(3)
- save_plot_obj <- save_gr_plot(plot.gsDesign(x, plottype = 5, base = TRUE))
- expect_snapshot_file(save_plot_obj, "plot_plotgsds_8.png")
-})
+ vdiffr::expect_doppelganger(
+ "plottype 5 base TRUE",
+ plot.gsDesign(x, plottype = 5, base = TRUE)
+ )
+})
-test_that("Test plot.gsDesign graphs are correctly rendered for plottype 6 and base R plotting package set to FALSE", {
+test_that("plot.gsDesign: plots are correctly rendered for plottype 6 and base set to FALSE", {
x <- gsDesign(k = 5, test.type = 2, n.fix = 100)
- local_edition(3)
- save_plot_obj <- save_gg_plot(plot.gsDesign(x, plottype = 6, base = FALSE))
- expect_snapshot_file(save_plot_obj, "plot_plotgsds_9.png")
-})
+ vdiffr::expect_doppelganger(
+ "plottype 6 base FALSE",
+ plot.gsDesign(x, plottype = 6, base = FALSE)
+ )
+})
-test_that("Test plot.gsDesign graphs are correctly rendered for plottype 6 and base R plotting package set to TRUE", {
+test_that("plot.gsDesign: plots are correctly rendered for plottype 6 and base set to TRUE", {
x <- gsDesign(k = 5, test.type = 2, n.fix = 100)
- local_edition(3)
- save_plot_obj <- save_gr_plot(plot.gsDesign(x, plottype = 6, base = TRUE))
- expect_snapshot_file(save_plot_obj, "plot_plotgsds_11.png")
+
+ vdiffr::expect_doppelganger(
+ "plottype 6 base TRUE",
+ plot.gsDesign(x, plottype = 6, base = TRUE)
+ )
})
-test_that("Test plot.gsDesign graphs are correctly rendered for plottype 7 and base R plotting package set to TRUE", {
+test_that("plot.gsDesign: plots are correctly rendered for plottype 7 and base set to TRUE", {
x <- gsDesign(k = 5, test.type = 2, n.fix = 100)
- local_edition(3)
- save_plot_obj <- save_gr_plot(plot.gsDesign(x, plottype = 7, base = TRUE))
- expect_snapshot_file(save_plot_obj, "plot_plotgsds_12.png")
-})
+ vdiffr::expect_doppelganger(
+ "plottype 7 base TRUE",
+ plot.gsDesign(x, plottype = 7, base = TRUE)
+ )
+})
-test_that("Test plot.gsDesign graphs are correctly rendered for gsSurvR and base R plotting package set to TRUE", {
+test_that("plot.gsDesign: plots are correctly rendered for gsSurv objects and base set to TRUE", {
z <- gsSurv(
k = 3, sfl = sfPower, sflpar = .5,
lambdaC = log(2) / 6, hr = .5, eta = log(2) / 40,
gamma = 1, T = 36, minfup = 12
)
- local_edition(3)
- save_plot_obj <- save_gr_plot(plot.gsDesign(z, plottype = 2, base = TRUE))
- expect_snapshot_file(save_plot_obj, "plot_plotgsdsa_3.png")
+ vdiffr::expect_doppelganger(
+ "gsSurv base TRUE",
+ plot.gsDesign(z, plottype = 2, base = TRUE)
+ )
})
-
-test_that("Test plotgsDesign graphs are correctly rendered for gSurv and base R plotting package set to False", {
+test_that("plot.gsDesign: plots are correctly rendered for gSurv objects and base set to FALSE", {
z <- gsSurv(
k = 3, sfl = sfPower, sflpar = .5,
lambdaC = log(2) / 6, hr = .5, eta = log(2) / 40,
gamma = 1, T = 36, minfup = 12
)
- save_plot_obj <- save_gg_plot(plot.gsDesign(z, plottype = 2, base = FALSE))
- local_edition(3)
- expect_snapshot_file(save_plot_obj, "plot_plotgsdsa_4.png")
+
+ vdiffr::expect_doppelganger(
+ "gsSurv base FALSE",
+ plot.gsDesign(z, plottype = 2, base = FALSE)
+ )
})
-test_that("Test plot.gsDesign graphs are correctly rendered for testtype 1 and plottype 2", {
+test_that("plot.gsDesign: plots are correctly rendered for test.type 1 and plottype 2", {
y <- gsDesign(k = 5, test.type = 1, n.fix = 1)
- local_edition(3)
- save_plot_obj <- save_gr_plot(plot.gsDesign(y, plottype = 2, base = TRUE))
- expect_snapshot_file(save_plot_obj, "plot_plotgsdsa_8.png")
+
+ vdiffr::expect_doppelganger(
+ "test type 1 plottype 2",
+ plot.gsDesign(y, plottype = 2, base = TRUE)
+ )
})
diff --git a/tests/testthat/test-independent-test-plot.gsProbability.R b/tests/testthat/test-independent-test-plot.gsProbability.R
index d473a9c6..7237786f 100644
--- a/tests/testthat/test-independent-test-plot.gsProbability.R
+++ b/tests/testthat/test-independent-test-plot.gsProbability.R
@@ -1,72 +1,65 @@
-# --------------------------------------------
-# Test plot.gsProbability function
-## save_gg_plot() is used for storing plots created using ggplot2 package,
-## whereas save_gr_plot() is used with plots created using graphics package.
-#----------------------------------------------
-
x <- gsDesign(k = 5, test.type = 2, n.fix = 100)
+y <- gsProbability(k = 5, theta = seq(0, .5, .025), x$n.I, x$lower$bound, x$upper$bound)
-y <- gsProbability(k = 5, theta = seq(0, .5, .025), x$n.I,
- x$lower$bound, x$upper$bound)
-
-
-test_that("Test plotgsProbability graphs are correctly rendered for plottype 1 and base R plotting package set to TRUE ", {
- local_edition(3)
- save_plot_obj <- save_gr_plot(plot.gsProbability(y, plottype = 1, base = TRUE))
- expect_snapshot_file(save_plot_obj, "plot_plotgsdp_1.png")
+test_that("plot.gsProbability: plots are correctly rendered for plottype 1 and base set to TRUE", {
+ vdiffr::expect_doppelganger(
+ "plottype 1 base TRUE",
+ plot.gsProbability(y, plottype = 1, base = TRUE)
+ )
})
-
-test_that("Test plot gsProbability graphs are correctly rendered for plottype 1 and base R plotting package set to FALSE", {
- save_plot_obj <- save_gg_plot(plot.gsProbability(y, plottype = 1, base = FALSE))
-
- local_edition(3)
- expect_snapshot_file(save_plot_obj, "plot_plotgsdp_2.png")
+test_that("plot.gsProbability: plots are correctly rendered for plottype 1 and base set to FALSE", {
+ vdiffr::expect_doppelganger(
+ "plottype 1 base FALSE",
+ plot.gsProbability(y, plottype = 1, base = FALSE)
+ )
})
-
-test_that("Test plot gsProbability graphs are correctly rendered for plottype power and base R plotting package set to FALSE", {
- save_plot_obj <- save_gg_plot(plot.gsProbability(y, plottype = "power", base = FALSE))
-
- local_edition(3)
- expect_snapshot_file(save_plot_obj, "plot_plotgsdp_3.png")
+test_that("plot.gsProbability: plots are correctly rendered for plottype power and base set to FALSE", {
+ vdiffr::expect_doppelganger(
+ "plottype power base FALSE",
+ plot.gsProbability(y, plottype = "power", base = FALSE)
+ )
})
-
-test_that("Test plot gsProbability graphs are correctly rendered for plottype 2 and base R plotting package set to TRUE", {
- local_edition(3)
- save_plot_obj <- save_gr_plot(plot.gsProbability(y, plottype = 2, base = TRUE))
- expect_snapshot_file(save_plot_obj, "plot_plotgsdp_4.png")
+test_that("plot.gsProbability: plots are correctly rendered for plottype 2 and base set to TRUE", {
+ vdiffr::expect_doppelganger(
+ "plottype 2 base TRUE",
+ plot.gsProbability(y, plottype = 2, base = TRUE)
+ )
})
-
-test_that("Test plot gsProbability graphs are correctly rendered for plottype 4 and base R plotting package set to FALSE", {
- save_plot_obj <- save_gg_plot(plot.gsProbability(y, plottype = 4, base = FALSE))
- local_edition(3)
- expect_snapshot_file(save_plot_obj, "plot_plotgsds_6.png")
+test_that("plot.gsProbability: plots are correctly rendered for plottype 4 and base set to FALSE", {
+ vdiffr::expect_doppelganger(
+ "plottype 4 base FALSE",
+ plot.gsProbability(y, plottype = 4, base = FALSE)
+ )
})
-test_that("Test plot gsProbability graphs are correctly rendered for plottype 4 and base R plotting package set to TRUE", {
- local_edition(3)
- save_plot_obj <- save_gr_plot(plot.gsProbability(x, plottype = 4, base = TRUE))
- expect_snapshot_file(save_plot_obj, "plot_plotgsds_7.png")
+test_that("plot.gsProbability: plots are correctly rendered for plottype 4 and base set to TRUE", {
+ vdiffr::expect_doppelganger(
+ "plottype 4 base TRUE",
+ plot.gsProbability(x, plottype = 4, base = TRUE)
+ )
})
-
-test_that("Test plot gsProbability graphs are correctly rendered for plottype 6 and base R plotting package set to FALSE", {
- save_plot_obj <- save_gg_plot(plot.gsProbability(y, plottype = 6, base = FALSE))
- local_edition(3)
- expect_snapshot_file(save_plot_obj, "plot_plotgsds_9.png")
+test_that("plot.gsProbability: plots are correctly rendered for plottype 6 and base set to FALSE", {
+ vdiffr::expect_doppelganger(
+ "plottype 6 base FALSE",
+ plot.gsProbability(y, plottype = 6, base = FALSE)
+ )
})
-test_that("Test gsProbability graphs are correctly rendered for plottype 6 and base R plotting package set to TRUE", {
- local_edition(3)
- save_plot_obj <- save_gr_plot(plot.gsProbability(y, plottype = 6, base = TRUE))
- expect_snapshot_file(save_plot_obj, "plot_plotgsdpa_1.png")
+test_that("plot.gsProbability: plots are correctly rendered for plottype 6 and base set to TRUE", {
+ vdiffr::expect_doppelganger(
+ "plottype 6 base TRUE",
+ plot.gsProbability(y, plottype = 6, base = TRUE)
+ )
})
-test_that("Test plotgsProbability graphs are correctly rendered for plottype 7 and base R plotting package set to TRUE", {
- local_edition(3)
- save_plot_obj <- save_gr_plot(plot.gsProbability(y, plottype = 7, base = TRUE))
- expect_snapshot_file(save_plot_obj, "plot_plotgsdpa_2.png")
+test_that("plot.gsProbability: plots are correctly rendered for plottype 7 and base set to TRUE", {
+ vdiffr::expect_doppelganger(
+ "plottype 7 base TRUE",
+ plot.gsProbability(y, plottype = 7, base = TRUE)
+ )
})
diff --git a/tests/testthat/test-independent-test-plot.ssrCP.R b/tests/testthat/test-independent-test-plot.ssrCP.R
index 9e59962f..4f082705 100644
--- a/tests/testthat/test-independent-test-plot.ssrCP.R
+++ b/tests/testthat/test-independent-test-plot.ssrCP.R
@@ -1,16 +1,17 @@
-#----------------------
-# plot.ssrCP
-#---------------------
+testthat::test_that("plot.ssrCP: plots are correctly rendered", {
+ ssr_cp_des <- ssrCP(
+ z1 = seq(-3, 3, 0.1), theta = NULL, maxinc = 2,
+ overrun = 0, beta = 0.1, cpadj = c(0.5, 1 - 0.2),
+ x = gsDesign(k = 2, delta = 0.2), z2 = z2NC
+ )
-testthat::test_that("Test: plot.ssrCP graphs are correctly rendered ", {
- ssr.cp.des <- ssrCP(z1 = seq(-3, 3, 0.1), theta = NULL, maxinc = 2,
- overrun = 0, beta = 0.1, cpadj = c(0.5, 1 - 0.2),
- x = gsDesign(k = 2, delta = 0.2), z2 = z2NC)
+ plot_ssr_cp <- function(x) {
+ plot.ssrCP(
+ x = x, z1ticks = NULL,
+ mar = c(7, 4, 4, 4) + 0.1,
+ ylab = "Adapted sample size", xlaboffset = -0.2, lty = 1, col = 1
+ )
+ }
- save_plot_obj <- save_gr_plot(plot.ssrCP(x = ssr.cp.des, z1ticks = NULL,
- mar = c(7, 4, 4, 4) + 0.1,
- ylab = "Adapted sample size", xlaboffset = -0.2, lty = 1, col = 1))
-
- local_edition(3)
- expect_snapshot_file(save_plot_obj, "plot_ssrCP_1.png")
+ vdiffr::expect_doppelganger("ssr CP", plot_ssr_cp(ssr_cp_des))
})
diff --git a/tests/testthat/test-independent-test-plotASN.R b/tests/testthat/test-independent-test-plotASN.R
index e2300f8f..951491bc 100644
--- a/tests/testthat/test-independent-test-plotASN.R
+++ b/tests/testthat/test-independent-test-plotASN.R
@@ -63,17 +63,10 @@ test_that( desc = "check expected sample sizes", code = {
}
)
-
-# save_gg_plot() will be used when storing plot objects created with graphics package.
-
-test_that("Test plotASN graphs for gSurv are correctly rendered ", {
- save_plot_obj <- save_gg_plot(plotASN(x))
- local_edition(3)
- expect_snapshot_file(save_plot_obj, "plot_plotastn_1.png")
+test_that("plotASN: plots for gSurv objects are correctly rendered", {
+ vdiffr::expect_doppelganger("plotASN gSurv", plotASN(x))
})
-test_that("Test plotASN graphs for gsDesign are correctly rendered ", {
- save_plot_obj <- save_gg_plot(plotASN(xx))
- local_edition(3)
- expect_snapshot_file(save_plot_obj, "plot_plotastn_3.png")
+test_that("plotASN: plots for gsDesign objects are correctly rendered", {
+ vdiffr::expect_doppelganger("plotASN gsDesign", plotASN(xx))
})
diff --git a/tests/testthat/test-independent-test-plotBval.R b/tests/testthat/test-independent-test-plotBval.R
index ab4150da..10026857 100644
--- a/tests/testthat/test-independent-test-plotBval.R
+++ b/tests/testthat/test-independent-test-plotBval.R
@@ -47,13 +47,6 @@ test_that(
}
)
-
-
-
-## save_gg_plot() function will be used when storing plot objects created with graphics package.
-
-test_that("Test plotBval graphs are correctly rendered ", {
- save_plot_obj <- save_gg_plot(plotBval(x))
- local_edition(3)
- expect_snapshot_file(save_plot_obj, "plot_plotBval_1.png")
+test_that("plotBval: plots are correctly rendered", {
+ vdiffr::expect_doppelganger("plotBval", plotBval(x))
})
diff --git a/tests/testthat/test-independent-test-plotHR.R b/tests/testthat/test-independent-test-plotHR.R
index ca83c8a9..31976390 100644
--- a/tests/testthat/test-independent-test-plotHR.R
+++ b/tests/testthat/test-independent-test-plotHR.R
@@ -43,9 +43,6 @@ test_that(
}
)
-
-test_that("Test plotHR graphs are correctly rendered ", {
- save_plot_obj <- save_gg_plot(plotHR(xgs))
- local_edition(3)
- expect_snapshot_file(save_plot_obj, "plot_plotHR_1.png")
+test_that("plotHR: plots are correctly rendered", {
+ vdiffr::expect_doppelganger("plotHR", plotHR(xgs))
})
diff --git a/tests/testthat/test-independent-test-plotRR.R b/tests/testthat/test-independent-test-plotRR.R
index 48c241f0..e810e0af 100644
--- a/tests/testthat/test-independent-test-plotRR.R
+++ b/tests/testthat/test-independent-test-plotRR.R
@@ -44,10 +44,6 @@ test_that(
}
)
-
-
-test_that("Test plotRR graphs are correctly rendered ", {
- save_plot_obj <- save_gg_plot(plotRR(x))
- local_edition(3)
- expect_snapshot_file(save_plot_obj, "plot_plotRR_1.png")
+test_that("plotRR: plots are correctly rendered", {
+ vdiffr::expect_doppelganger("plotRR", plotRR(x))
})
diff --git a/tests/testthat/test-independent-test-plotgsCP.R b/tests/testthat/test-independent-test-plotgsCP.R
index 258925d9..c4929f6b 100644
--- a/tests/testthat/test-independent-test-plotgsCP.R
+++ b/tests/testthat/test-independent-test-plotgsCP.R
@@ -33,25 +33,26 @@ test_that(desc = "check plot data values for sample size,",
expect_lte(abs(nplot[2] - x$n.I[2]), 1e-6)
})
-
-test_that(desc = "Test plotgsCP graphs are correctly rendered, test.type = 1",
- code = {
- x <- gsDesign(k = 3, test.type = 1, alpha = 0.025, beta = 0.1,
- delta1 = 0.3, sfu = sfLDOF)
-
- save_plot_obj <- save_gg_plot(plotgsCP(x = x))
- local_edition(3)
- expect_snapshot_file(save_plot_obj, "plotgsCP_1.png")
+test_that("plotgsCP: plots are correctly rendered, test.type = 1", {
+ x <- gsDesign(
+ k = 3, test.type = 1, alpha = 0.025, beta = 0.1,
+ delta1 = 0.3, sfu = sfLDOF
+ )
+
+ vdiffr::expect_doppelganger(
+ "plotgsCP test type 1",
+ plotgsCP(x = x)
+ )
})
+test_that("plotgsCP: plots are correctly rendered, test.type = 2", {
+ x <- gsDesign(
+ k = 3, test.type = 2, alpha = 0.025, beta = 0.1,
+ delta1 = 0.3, sfu = sfLDOF
+ )
-test_that(
- desc = "Test plotgsCP graphs are correctly rendered, test.type = 2",
- code = {
- x <- gsDesign(k = 3, test.type = 2, alpha = 0.025, beta = 0.1,
- delta1 = 0.3, sfu = sfLDOF)
-
- save_plot_obj <- save_gg_plot(plotgsCP(x = x))
- local_edition(3)
- expect_snapshot_file(save_plot_obj, "plotgsCP_2.png")
+ vdiffr::expect_doppelganger(
+ "plotgsCP test type 2",
+ plotgsCP(x = x)
+ )
})
diff --git a/tests/testthat/test-independent-test-plotgsPower.R b/tests/testthat/test-independent-test-plotgsPower.R
index 083a460e..5c91a013 100644
--- a/tests/testthat/test-independent-test-plotgsPower.R
+++ b/tests/testthat/test-independent-test-plotgsPower.R
@@ -30,21 +30,18 @@ test_that(desc = 'check plot data values,
expect_lte(abs(res$Probability[3] - 0.12486698), 1e-3)
})
+test_that("plotgsPower: plots are correctly rendered, test.type = 1", {
+ x <- gsDesign(
+ k = 3, test.type = 1, alpha = 0.025, beta = 0.1,
+ delta1 = 0.3, sfu = sfLDOF
+ )
-
-test_that(desc = 'Test: plotgsPower graphs are correctly rendered,test.type = 1',
- code = {
- x <- gsDesign(k = 3, test.type = 1, alpha = 0.025,beta = 0.1,
- delta1 = 0.3, sfu = sfLDOF)
-
- save_plot_obj <- save_gg_plot( plotgsPower(x = x))
-
- local_edition(3)
-
- expect_snapshot_file(save_plot_obj, "plotgsPower_1.png")
+ vdiffr::expect_doppelganger(
+ "gsPower test type 1",
+ plotgsPower(x = x)
+ )
})
-
test_that(desc = 'check plot data values,
source: Probability Calculations done using East 6.5',
code = {
@@ -90,17 +87,16 @@ test_that(desc = 'check plot data values,
expect_lte(abs(res - 0.99808417), 1e-3)
})
+test_that("plotgsPower: plots are correctly rendered, test.type = 2", {
+ x <- gsDesign(
+ k = 3, test.type = 2, alpha = 0.025,
+ beta = 0.1, delta1 = 0.3, sfu = sfLDOF
+ )
-test_that(desc = 'Test: plotgsPower graphs are correctly rendered,test.type = 1',
- code = {
- x <- gsDesign(k = 3, test.type = 2, alpha = 0.025,
- beta = 0.1, delta1 = 0.3, sfu = sfLDOF)
-
- save_plot_obj <- save_gg_plot(plotgsPower(x = x))
-
- local_edition(3)
-
- expect_snapshot_file(save_plot_obj, "plotgsPower_2.png")
+ vdiffr::expect_doppelganger(
+ "gsPower test type 2",
+ plotgsPower(x = x)
+ )
})
test_that(desc = 'Test: plotgsPower graphs can use offset arg for Future Analysis legend',
diff --git a/tests/testthat/test-independent-test-plotgsZ.R b/tests/testthat/test-independent-test-plotgsZ.R
index 04a89042..5a4fa830 100644
--- a/tests/testthat/test-independent-test-plotgsZ.R
+++ b/tests/testthat/test-independent-test-plotgsZ.R
@@ -51,9 +51,6 @@ test_that(
}
)
-
-test_that("Test plotgsZ graphs are correctly rendered ", {
- save_plot_obj <- save_gg_plot(plotgsZ(x))
- local_edition(3)
- expect_snapshot_file(save_plot_obj, "plot_plotgsz_1.png")
+test_that("plotgsZ: plots are correctly rendered", {
+ vdiffr::expect_doppelganger("plotgsZ", plotgsZ(x))
})
diff --git a/tests/testthat/test-independent-test-plotsf.R b/tests/testthat/test-independent-test-plotsf.R
index 4e6a81e7..229fd375 100644
--- a/tests/testthat/test-independent-test-plotsf.R
+++ b/tests/testthat/test-independent-test-plotsf.R
@@ -31,36 +31,38 @@ test_that(desc = 'check plot data values,
expect_lte(abs(res$spend - 0.00965528), 1e-4)
})
+test_that("plotsf: plots are correctly rendered, test.type = 1", {
+ x <- gsDesign(
+ k = 3, test.type = 1, alpha = 0.025, beta = 0.1,
+ delta1 = 0.3, sfu = sfLDOF
+ )
-test_that(desc = "Test plotsf graphs are correctly rendered,test.type = 1",
- code = {
- x <- gsDesign(k = 3, test.type = 1, alpha = 0.025, beta = 0.1,
- delta1 = 0.3, sfu = sfLDOF)
+ vdiffr::expect_doppelganger(
+ "plotsf test type 1",
+ plotsf(x = x)
+ )
+})
- save_plot_obj <- save_gg_plot(plotsf(x = x))
- local_edition(3)
- expect_snapshot_file(save_plot_obj, "plotsf_1.png")
+test_that("plotsf: plots are correctly rendered, test.type = 5", {
+ x <- gsDesign(
+ k = 3, test.type = 5, alpha = 0.025, beta = 0.1,
+ delta1 = 0.3, sfu = sfLDOF
+ )
+ vdiffr::expect_doppelganger(
+ "plotsf test type 5",
+ plotsf(x = x, base = TRUE)
+ )
})
-test_that(desc = "Test plotsf graphs are correctly rendered,test.type = 5",
- code = {
- x <- gsDesign(k = 3, test.type = 5, alpha = 0.025, beta = 0.1,
- delta1 = 0.3, sfu = sfLDOF)
-
- save_plot_obj <- save_gr_plot(plotsf(x = x, base = TRUE))
- local_edition(3)
- expect_snapshot_file(save_plot_obj, "plotsf_2.png")
-
-})
+test_that("plotgsCP: plots are correctly rendered, test.type = 4", {
+ x <- gsDesign(
+ k = 3, test.type = 4, alpha = 0.025, beta = 0.1,
+ delta1 = 0.3, sfu = sfLDOF
+ )
-test_that(desc = "Test plotgsCP graphs are correctly rendered,test.type = 4",
- code = {
- x <- gsDesign(k = 3, test.type = 4, alpha = 0.025, beta = 0.1,
- delta1 = 0.3, sfu = sfLDOF)
-
- save_plot_obj <- save_gg_plot(plotsf(x = x, base = FALSE))
- local_edition(3)
- expect_snapshot_file(save_plot_obj, "plotsf_3.png")
-
+ vdiffr::expect_doppelganger(
+ "plotgsCP test type 4",
+ plotsf(x = x, base = FALSE)
+ )
})