diff --git a/CLAUDE.md b/CLAUDE.md index bc7f0b67..ea650582 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -143,8 +143,11 @@ Non-snapshot tests (logical assertions, error checks, etc.) run fine on any plat This is a known quirk — don't worry about these specific persistent failures. However, if you see more than ~3 snapshot failures, something real is likely broken and needs investigation. ### Running Tests + +The canonical test workflow is to open the devcontainer and run `make testall`. Do not attempt to run the full test suite outside the devcontainer — snapshot tests will fail due to font/rendering differences, and even non-snapshot tests may pull in snapshot comparisons. + ```bash -# Via Makefile +# Via Makefile (inside devcontainer) make testall # Run all tests make testone testfile="inst/tinytest/test-legend.R" # Run single test file diff --git a/R/tinyplot.R b/R/tinyplot.R index f27cf80f..e15b1193 100644 --- a/R/tinyplot.R +++ b/R/tinyplot.R @@ -995,6 +995,7 @@ tinyplot.default = function( .bp = environment(.h)[["base_par"]] if (is.list(.bp)) .tpars = modifyList(.tpars, .bp) } + if (!is.null(.tpars[["mar"]])) .theme_mar = .tpars[["mar"]] # Detect outer-legend sides (order: bottom, left, top, right). .lgnd_pos = settings$legend_args[["x"]] diff --git a/inst/tinytest/_tinysnapshot/tinytheme_dynmar_mar_override.svg b/inst/tinytest/_tinysnapshot/tinytheme_dynmar_mar_override.svg new file mode 100644 index 00000000..94c2b225 --- /dev/null +++ b/inst/tinytest/_tinysnapshot/tinytheme_dynmar_mar_override.svg @@ -0,0 +1,80 @@ + + + + + + + + + + + + + +Custom mar override +Index +0:10 + + + + + + +2 +4 +6 +8 +10 + + + + + + + +0 +2 +4 +6 +8 +10 + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inst/tinytest/test-tinytheme.R b/inst/tinytest/test-tinytheme.R index f71f8338..9584c772 100644 --- a/inst/tinytest/test-tinytheme.R +++ b/inst/tinytest/test-tinytheme.R @@ -178,3 +178,12 @@ f = function() { plt_add(type = "b") } expect_snapshot_plot(f, label = "ephemeral_default_theme_add") + +# User mar override respected under dynmar (#587) +f = function() { + tinytheme("dynamic", mar = c(5, 5, 5, 5)) + plt(0:10, main = "Custom mar override") + box("inner", lty = 2) + tinytheme() +} +expect_snapshot_plot(f, label = "tinytheme_dynmar_mar_override")