-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from rnabioco/more_tests
* more tests from ggplot2 * vdiffr tests
- Loading branch information
Showing
16 changed files
with
200,751 additions
and
20 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
57,247 changes: 57,247 additions & 0 deletions
57,247
tests/testthat/_snaps/draw-key/character-shape.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28,663 changes: 28,663 additions & 0 deletions
28,663
tests/testthat/_snaps/draw-key/no-linetype.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57,247 changes: 57,247 additions & 0 deletions
57,247
tests/testthat/_snaps/draw-key/numeric-shape.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
79 changes: 79 additions & 0 deletions
79
tests/testthat/_snaps/geom-path-trace/geom-path-group-reorder-trace-position.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
95 changes: 95 additions & 0 deletions
95
tests/testthat/_snaps/geom-path-trace/geom-path-group-reorder.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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,17 @@ | ||
# By default, if vdiffr is not installed, all visual tests are skipped unless | ||
# VDIFFR_RUN_TESTS is explicitly set to "true", which should be the case only on | ||
# a GitHub Actions CI runner with stable version of R. | ||
# From ggplot2 | ||
|
||
if (requireNamespace("vdiffr", quietly = TRUE) && utils::packageVersion("testthat") >= '3.0.3') { | ||
expect_doppelganger <- vdiffr::expect_doppelganger | ||
|
||
# If vdiffr is not available and visual tests are explicitly required, raise error | ||
} else { | ||
if (identical(Sys.getenv("VDIFFR_RUN_TESTS"), "true")) { | ||
stop("vdiffr is not installed") | ||
} | ||
|
||
# Otherwise, assign a dummy function | ||
expect_doppelganger <- function(...) skip("vdiffr is not installed.") | ||
} |
This file contains 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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
# test_that("draw_key_*_trace", { | ||
# p <- ggplot(clusters, aes(UMAP_1, UMAP_2, color = cluster)) | ||
# | ||
# expect_doppelganger("no shape", p + geom_point_trace()) | ||
# expect_doppelganger("numeric shape", p + geom_point_trace(shape = 3)) | ||
# expect_doppelganger("character shape", p + geom_point_trace(shape = "plus")) | ||
# | ||
# expect_doppelganger("no linetype", p + geom_point_trace(key_glyph = draw_key_path_trace)) | ||
# expect_doppelganger("linetype", p + geom_point_trace(key_glyph = draw_key_path_trace, linetype = 2)) | ||
# }) | ||
test_that("draw_key_*_trace", { | ||
p <- ggplot(clusters, aes(UMAP_1, UMAP_2, color = cluster)) | ||
|
||
expect_doppelganger("no shape", p + geom_point_trace(key_glyph = draw_key_point_trace)) | ||
expect_doppelganger("numeric shape", p + geom_point_trace(shape = 3, key_glyph = draw_key_point_trace)) | ||
expect_doppelganger("character shape", p + geom_point_trace(shape = "plus", key_glyph = draw_key_point_trace)) | ||
|
||
expect_doppelganger("no linetype", p + geom_point_trace(key_glyph = draw_key_path_trace)) | ||
expect_doppelganger("linetype", p + geom_point_trace(key_glyph = draw_key_path_trace, linetype = 2)) | ||
}) |
This file contains 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
This file contains 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
This file contains 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,14 @@ | ||
# From ggplot2 | ||
test_that("rbind_dfs keep classes of columns", { | ||
df1 <- data_frame( | ||
integer = seq_len(10), | ||
numeric = as.numeric(seq_len(10)), | ||
character = letters[1:10], | ||
factor = factor(letters[1:10]), | ||
ordered = ordered(letters[1:10]), | ||
date = Sys.Date() | ||
) | ||
|
||
df2 <- rbind_dfs(list(df1[1:5, ], df1[6:10, ])) | ||
expect_equal(df1, df2) | ||
}) |