diff --git a/tests/testthat/_snaps/ssm_plot/many-circle-plots.svg b/tests/testthat/_snaps/ssm_plot/many-circle-plots.svg new file mode 100644 index 0000000..4d6279d --- /dev/null +++ b/tests/testthat/_snaps/ssm_plot/many-circle-plots.svg @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + +0.20 + +0.40 + +90° + +135° + +180° + +225° + +270° + +315° + +360° + +45° + + + + + + + + +Profile + + + + + + + + +PARPD +SCZPD +SZTPD +ASPD +many_circle-plots + + diff --git a/tests/testthat/_snaps/ssm_plot/many-curve-plots.svg b/tests/testthat/_snaps/ssm_plot/many-curve-plots.svg new file mode 100644 index 0000000..e10674e --- /dev/null +++ b/tests/testthat/_snaps/ssm_plot/many-curve-plots.svg @@ -0,0 +1,226 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +SCZPD + + + + + + + + + + +SZTPD + + + + + + + + + + +ASPD + + + + + + + + + + +PARPD + + + + + + + + + + +90° +135° +180° +225° +270° +315° +360° +45° + + + + + + + + +90° +135° +180° +225° +270° +315° +360° +45° +0.0 +0.2 +0.4 + + + +0.0 +0.2 +0.4 + + + +Angle +Score +many_curve-plots + + diff --git a/tests/testthat/_snaps/ssm_plot/single-group-mean-ssm-no-palette.svg b/tests/testthat/_snaps/ssm_plot/single-group-mean-ssm-no-palette.svg new file mode 100644 index 0000000..b6b8ff1 --- /dev/null +++ b/tests/testthat/_snaps/ssm_plot/single-group-mean-ssm-no-palette.svg @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + +1.00 + +2.00 + +90° + +135° + +180° + +225° + +270° + +315° + +360° + +45° + + +single group mean ssm no palette + + diff --git a/tests/testthat/_snaps/ssm_table.md b/tests/testthat/_snaps/ssm_table.md index d57f8a6..2e7a253 100644 --- a/tests/testthat/_snaps/ssm_table.md +++ b/tests/testthat/_snaps/ssm_table.md @@ -4,9 +4,9 @@ ssm_table(res, render = FALSE) Output Profile Elevation X.Value Y.Value - 1 All 0.92 (0.89, 0.95) 0.35 (0.32, 0.38) -0.25 (-0.28, -0.22) + 1 All 0.92 (0.89, 0.94) 0.35 (0.32, 0.38) -0.25 (-0.28, -0.22) Amplitude Displacement Fit - 1 0.43 (0.40, 0.46) 324.3 (320.9, 328.0) 0.878 + 1 0.43 (0.40, 0.46) 324.3 (320.8, 327.8) 0.878 --- @@ -14,5 +14,41 @@ ssm_table(res, drop_xy = TRUE, render = FALSE) Output Profile Elevation Amplitude Displacement Fit - 1 All 0.92 (0.89, 0.95) 0.43 (0.40, 0.46) 324.3 (320.9, 328.0) 0.878 + 1 All 0.92 (0.89, 0.94) 0.43 (0.40, 0.46) 324.3 (320.8, 327.8) 0.878 + +--- + + Code + ssm_table(res, render = TRUE) + Output + + + + + + + + + + + + + + + + + + + + + + + + +
+ Mean-based Structural Summary Statistics with 95% CIs
ProfileElevationX.ValueY.ValueAmplitudeDisplacementFit
All0.92 (0.89, 0.94)0.35 (0.32, 0.38)-0.25 (-0.28, -0.22)0.43 (0.40, 0.46)324.3 (320.8, 327.8)0.878
+ Profile Elevation X.Value Y.Value + 1 All 0.92 (0.89, 0.94) 0.35 (0.32, 0.38) -0.25 (-0.28, -0.22) + Amplitude Displacement Fit + 1 0.43 (0.40, 0.46) 324.3 (320.8, 327.8) 0.878 diff --git a/tests/testthat/test-ssm_plot.R b/tests/testthat/test-ssm_plot.R index 36ced4b..d8e28fe 100644 --- a/tests/testthat/test-ssm_plot.R +++ b/tests/testthat/test-ssm_plot.R @@ -8,7 +8,8 @@ test_that("Single-group mean-based SSM plot is correct", { expect_s3_class(p, "ggplot") vdiffr::expect_doppelganger("single group mean ssm", p) - # TODO: Add tests of transformed data and legend + p2 <- ssm_plot_circle(res, palette = NULL) + vdiffr::expect_doppelganger("single group mean ssm no palette", p2) }) test_that("Single-group correlation-based SSM plot is correct", { @@ -67,3 +68,12 @@ test_that("Removing plots with low fit works as expected", { res <- ssm_analyze(jz2017, scales = 2:9, measures = "OCPD") expect_error(ssm_plot_circle(res, drop_lowfit = TRUE)) }) + +test_that("many plots works as expected", { + data("jz2017") + res <- ssm_analyze(jz2017, scales = 2:9, measures = 10:13) + p <- ssm_plot_circle(res) + vdiffr::expect_doppelganger("many_circle-plots", p) + p2 <- ssm_plot_curve(res) + vdiffr::expect_doppelganger("many_curve-plots", p2) +}) diff --git a/tests/testthat/test-ssm_table.R b/tests/testthat/test-ssm_table.R index 27fd9d7..658ed56 100644 --- a/tests/testthat/test-ssm_table.R +++ b/tests/testthat/test-ssm_table.R @@ -42,8 +42,10 @@ test_that("SSM Table captions are correct", { test_that("ssm_table is correct", { + set.seed(12345) data("jz2017") res <- ssm_analyze(jz2017, scales = 2:9) expect_snapshot(ssm_table(res, render = FALSE)) expect_snapshot(ssm_table(res, drop_xy = TRUE, render = FALSE)) + expect_snapshot(ssm_table(res, render = TRUE)) })