-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also track one change in äggplot2' 3.5.1
- Loading branch information
Showing
6 changed files
with
201 additions
and
12 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
Binary file not shown.
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,99 @@ | ||
context("draw_key_label_s") | ||
|
||
test_that("Returns expected value", { | ||
|
||
test.data <- data.frame(x = 1, | ||
y = 5, | ||
label = "a", | ||
angle = 0, | ||
colour = "red", | ||
fill = "white", | ||
alpha = 0.5, | ||
vjust = 0.5, | ||
hjust = 0.5) | ||
|
||
test.params.01 <- list(colour.target = "all", | ||
alpha.target = "all", | ||
default.colour = "black", | ||
default.alpha = 1 | ||
) | ||
|
||
set.seed(1) | ||
obj.01 <- draw_key_label_s(data = test.data, | ||
params = test.params.01, | ||
size = 4) | ||
# expect_known_value(unname(obj.01), | ||
# "draw-key-label-s-01") | ||
expect_is(obj.01, "gTree") | ||
expect_length(obj.01, 5) | ||
expect_named(obj.01, c("name", "gp", "vp", "children", "childrenOrder")) | ||
|
||
|
||
test.params.02 <- list(colour.target = "text", | ||
alpha.target = "none", | ||
default.colour = "grey30", | ||
default.alpha = 1 | ||
) | ||
|
||
set.seed(1) | ||
obj.02 <- draw_key_label_s(data = test.data, | ||
params = test.params.02, | ||
size = 4) | ||
# expect_known_value(unname(obj.02), | ||
# "draw-key-label-s-02") | ||
expect_is(obj.02, "gTree") | ||
expect_length(obj.02, 5) | ||
expect_named(obj.02, c("name", "gp", "vp", "children", "childrenOrder")) | ||
|
||
test.params.03 <- list(colour.target = "text", | ||
alpha.target = "none", | ||
default.colour = "grey30", | ||
default.alpha = 0 | ||
) | ||
|
||
set.seed(1) | ||
obj.03 <- draw_key_label_s(data = test.data, | ||
params = test.params.03, | ||
size = 4) | ||
# expect_known_value(unname(obj.03), | ||
# "draw-key-label-s-03") | ||
expect_is(obj.03, "gTree") | ||
expect_length(obj.03, 5) | ||
expect_named(obj.03, c("name", "gp", "vp", "children", "childrenOrder")) | ||
|
||
test.params.04 <- list(colour.target = "box", | ||
alpha.target = "none", | ||
default.colour = "grey30", | ||
default.alpha = 0 | ||
) | ||
|
||
set.seed(1) | ||
obj.04 <- draw_key_label_s(data = test.data, | ||
params = test.params.04, | ||
size = 4) | ||
# expect_known_value(unname(obj.04), | ||
# "draw-key-label-s-04") | ||
expect_is(obj.04, "gTree") | ||
expect_length(obj.04, 5) | ||
expect_named(obj.04, c("name", "gp", "vp", "children", "childrenOrder")) | ||
|
||
test.params.05 <- list(colour.target = c("segment", "text"), | ||
alpha.target = "none", | ||
default.colour = "grey30", | ||
default.alpha = 1 | ||
) | ||
|
||
set.seed(1) | ||
obj.05 <- draw_key_label_s(data = test.data, | ||
params = test.params.05, | ||
size = 4) | ||
# expect_known_value(unname(obj.05), | ||
# "draw-key-label-s-05") | ||
expect_is(obj.05, "gTree") | ||
expect_length(obj.05, 5) | ||
expect_named(obj.05, c("name", "gp", "vp", "children", "childrenOrder")) | ||
|
||
|
||
|
||
}) | ||
|
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,65 @@ | ||
context("draw_key_text_s") | ||
|
||
test_that("Returns expected value", { | ||
|
||
test.data <- data.frame(x = 1, | ||
y = 5, | ||
label = "a", | ||
angle = 0, | ||
colour = "red", | ||
alpha = 0.5, | ||
vjust = 0.5, | ||
hjust = 0.5) | ||
|
||
test.params.01 <- list(colour.target = "all", | ||
alpha.target = "all", | ||
default.colour = "black", | ||
default.alpha = 1 | ||
) | ||
|
||
# names of grob members seem to change randomly from run to run | ||
# set.seed() and unname() do not seem to help! | ||
set.seed(1) | ||
obj.01 <- draw_key_text_s(data = test.data, | ||
params = test.params.01, | ||
size = 4) | ||
# expect_known_value(unname(obj.01), | ||
# "draw-key-text-s-01") | ||
expect_is(obj.01, "titleGrob") | ||
expect_length(obj.01, 7) | ||
expect_named(obj.01, c("widths", "heights", "name", "gp", "vp", "children", "childrenOrder")) | ||
|
||
test.params.02 <- list(colour.target = "text", | ||
alpha.target = "none", | ||
default.colour = "grey30", | ||
default.alpha = 1 | ||
) | ||
|
||
set.seed(1) | ||
obj.02 <- draw_key_text_s(data = test.data, | ||
params = test.params.02, | ||
size = 4) | ||
# expect_known_value(unname(obj.02), | ||
# "draw-key-text-s-02") | ||
expect_is(obj.02, "titleGrob") | ||
expect_length(obj.02, 7) | ||
expect_named(obj.02, c("widths", "heights", "name", "gp", "vp", "children", "childrenOrder")) | ||
|
||
test.params.03 <- list(colour.target = "text", | ||
alpha.target = "none", | ||
default.colour = "grey30", | ||
default.alpha = 0 | ||
) | ||
|
||
set.seed(1) | ||
obj.03 <- draw_key_text_s(data = test.data, | ||
params = test.params.03, | ||
size = 4) | ||
# expect_known_value(unname(obj.03), | ||
# "draw-key-text-s-03") | ||
expect_is(obj.03, "titleGrob") | ||
expect_length(obj.03, 7) | ||
expect_named(obj.03, c("widths", "heights", "name", "gp", "vp", "children", "childrenOrder")) | ||
|
||
}) | ||
|
Binary file not shown.