grantmcdermott · GitHub

Do you have some impressionistic sense of how much I can trust the test suite. For example, with this PR I tried 3-4 interactive graphs, 3-4 save to files, and the test suite passes. Is that enough?

Test coverage is pretty thorough, albeit only implemented for Linux (as you probably recall).

In fact, the only place I'd say there are gaps is with the file writing/saving logic, i.e. partly what you're adjusting here :-/
I just wasn't sure how to effectively incorporate this into the tinysnapshot workflow.

Maybe we could try something simple like the following... We'd need to include {png} in Suggests and then add the following test to inst/tinytest/test-misc.R:

# test file saving and dimensions
if (requireNamespace("png", quitely = TRUE)) {
  f = function () {
    tmp_path = tempfile(fileext = ".png")
    tinyplot(
      Sepal.Length ~ Petal.Length, data = iris,
      file = tmp_path, width = 4, height = 4
    )
    obj = png::readPNG(tmp_path, info = TRUE)
    unlink(tmp_path)
    dims = attr(obj, "dim")
    return(dims)
  }
  expect_equal(f(), c(1200, 1200, 4), label = "png_size")
}

Do you mind incorporating this change as part of your PR? I'm happy to merge, assuming this new test passes and given your manual checks too.

Read the original on github.com ↗