Skip to content

Add testthat infrastructure and CI matrix to catch rendering regressions#12

Merged
maflot merged 4 commits into
mainfrom
copilot/improve-testing-infrastructure
Mar 27, 2026
Merged

Add testthat infrastructure and CI matrix to catch rendering regressions#12
maflot merged 4 commits into
mainfrom
copilot/improve-testing-infrastructure

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 27, 2026

v1.1.0 shipped with drawDetails.DiceGrob missing from NAMESPACE, silently rendering every dice plot as a blank panel. No automated tests existed to catch it.

Test suite (tests/testthat/)

  • helper-data.R — shared fixtures: make_simple_data(), make_single_tile_data(n), make_simple_plot(fill_mapped, size_mapped, pip_scale)
  • test-utils.Rmake_offsets() for all n=1–6: structure, coordinate bounds, custom tile dimensions, error cases; create_dice_positions(), scale_dots_discrete(), theme_dice()
  • test-rendering.R — S3 dispatch registration check (the v1.1.0 bug); DiceGrob structure via layer_grob(); all four draw paths (fill/size mapped × unmapped); pip_scale variants (0.5, 0.75, 1.0, NULL); ndots=1–6 pip counts; end-to-end ggsave() to exercise drawDetails
  • test-aesthetics.R — pip colour never NA (unmapped, continuous fill, discrete fill); pip x/y within tile bounds; row-count invariant (no silent drops); tile count matches unique (x, y) pairs

The S3 registration test is the direct regression guard:

test_that("drawDetails.DiceGrob is registered as an S3 method", {
  method <- getS3method("drawDetails", "DiceGrob", optional = TRUE)
  expect_false(is.null(method))
})

CI (.github/workflows/R-CMD-check.yml)

6-cell matrix covering the scenarios that were never tested before release:

OS R ggplot2
Ubuntu release CRAN
Ubuntu oldrel-1 CRAN
Ubuntu release devel (GitHub HEAD)
Ubuntu release 3.4.0 (declared minimum)
Windows release CRAN
macOS release CRAN

Non-CRAN ggplot2 versions are installed via pak after the standard dependency step, overriding the default CRAN install.

DESCRIPTION

Added testthat (>= 3.0.0) to Suggests and Config/testthat/edition: 3.


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI changed the title [WIP] Improve testing infrastructure to catch rendering regressions Add testthat infrastructure and CI matrix to catch rendering regressions Mar 27, 2026
Copilot AI requested a review from maflot March 27, 2026 08:18
maflot added 2 commits March 27, 2026 09:52
Remove unsupported label= arg from expect_s3_class() and info= arg
from expect_no_error(). These are valid on expect_true/expect_equal
but not on all testthat functions. Remove duplicate Suggests/Config
fields in DESCRIPTION.
ggplot2 3.4.0 cannot build from source on R >= 4.5 due to internal R
API changes. The effective minimum is 3.5.2 anyway since legendry
(a hard dependency) requires it. Test minimum version on R oldrel.
@maflot maflot marked this pull request as ready for review March 27, 2026 09:10
@maflot maflot merged commit 719bb27 into main Mar 27, 2026
6 checks passed
@maflot maflot deleted the copilot/improve-testing-infrastructure branch March 27, 2026 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants