-
Notifications
You must be signed in to change notification settings - Fork 43
test: add regression tests for issue #279 (facet_wrap spacing with custom height) #288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ANAMASGARD
wants to merge
12
commits into
master
Choose a base branch
from
fix-issue-279-facet-height-spacing
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+33
−3
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
e2211ad
test: add regression test for issue #279 facet_wrap spacing
ANAMASGARD 31acddd
Merge branch 'master' into fix-issue-279-facet-height-spacing
ANAMASGARD a659929
fix #279: set SVG display:block to eliminate inline whitespace below …
ANAMASGARD 260c26f
Merge branch 'master' into fix-issue-279-facet-height-spacing
ANAMASGARD 98f7efa
fix CI: use robust SVG id extraction to avoid matrix dimension error
ANAMASGARD f4b796e
Merge branch 'master' into fix-issue-279-facet-height-spacing
ANAMASGARD 3d0a90f
Merge branch 'master' into fix-issue-279-facet-height-spacing
tdhock 74c745a
Merge branch 'master' into fix-issue-279-facet-height-spacing
ANAMASGARD 74b3f42
Merge branch 'master' into fix-issue-279-facet-height-spacing
ANAMASGARD e19b3b5
test: addresses Sir tdhock review comments for issue #279
ANAMASGARD c48f242
ci: trigger GitHub Actions
ANAMASGARD acce7a2
Merge branch 'master' into fix-issue-279-facet-height-spacing
ANAMASGARD File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
tests/testthat/test-issue-279-facet-wrap-custom-height-spacing.R
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| test_that("facet_wrap SVG height is proportional to theme_animint height, no excess space (#279)", { | ||
| skip_on_cran() | ||
| task_data <- data.frame( | ||
| x = rep(1:5, 5), | ||
| y = rep(1:5, 5), | ||
| task_id = rep(c("sonar", "spam", "vowel", "waveform", "zip"), each = 5) | ||
| ) | ||
| n_facets <- length(unique(task_data$task_id)) | ||
| base_plot <- ggplot() + | ||
| geom_point(aes(x, y), data = task_data) + | ||
| facet_wrap(~ task_id, ncol = 1) + | ||
| theme_bw() | ||
| viz_list <- list( | ||
| default = list(plot = base_plot), | ||
| custom = list(plot = base_plot + theme_animint(height = 600)) | ||
| ) | ||
| info_list <- lapply(viz_list, animint2HTML) | ||
| h_list <- lapply(info_list, function(info) { | ||
| svg_node <- XML::getNodeSet(info$html, "//svg[contains(@id,'plot_plot')]") | ||
| expect_equal(length(svg_node), 1L) | ||
| as.numeric(XML::xmlAttrs(svg_node[[1]])[["height"]]) | ||
| }) | ||
| # SVG height must not scale as height * n_facets (regression from issue #279) | ||
| expect_lt(h_list$default, 400 * n_facets) | ||
| expect_lt(h_list$custom, 600 * n_facets, | ||
| label = "SVG height should not be 600*num_facets — regression from issue #279") | ||
| expect_gt(h_list$custom, h_list$default) | ||
| }) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.