Skip to content

Conversation

@dataquine
Copy link
Collaborator

Initial addition of testthat test suite with tests for

  • generate_palette()
  • rgba_to_hex()
  • view_palette()

The testing uncovered a couple of edge cases that have failing tests so would suggest these would be candidates for fixing first.

Running the test suite generates a PDF which seems to contain the plots that end up in the plot window.
tests/testthat/Rplots.pdf

The {vdiffr} package is used for visual regression tests for view_palette().
N.B. due to the use of {vdiffr} the base requirement for R version has been set to at least 4.1.0 - don't know if that would be an issue for any current users?

  • Some changes as recommended by applying the results of the {goodpractice} package to the code. I'm using a qa folder locally to try out various code quality checkers.
  • Some minor changes to .R code for text formatting/whitespace.

Reformat and Replace T or F as recommended by {goodpractice}
"avoid 'T' and 'F', as they are just variables which are set to the
logicals 'TRUE' and 'FALSE' by default, but are not reserved words and hence can be overwritten by the user.  Hence, one should always use 'TRUE' and 'FALSE' for the logicals."
Using vdiffr requires R >= 4.1. We are using the new snapshot features so make vdiffr version a recent one.
These SVG files are generated by {vdiffr} and cached in the _snaps directory for snapshot usage.
Recommended by {goodpractice} to avoid situations where length(x) would be zero creating 1:0
avoid 1:length(...), 1:nrow(...), 1:ncol(...), 1:NROW(...) and 1:NCOL(...) expressions. They are error prone and result 1:0 if the expression on the right hand side is zero. Use seq_len() or seq_along() instead.
Test if an create a plot showing all the colours in the palette on the same row. This test makes use of {vdiffr} for visual regression testing.
Text reformat and replace usage of T with TRUE as recommended by {goodpractice}
This PDF seems to be auto generated when there is code that creates plots in plot window e.g.  generate_palette with view_palette = TRUE
@dataquine
Copy link
Collaborator Author

Added tests for helper_functions.R also additional tests for generate_palette to cover missing or empty modification parameter

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