Skip to content

Commit 0f81022

Browse files
committed
better many legends test
1 parent 9dee894 commit 0f81022

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,4 @@ Suggests:
4949
RSclient,
5050
broom
5151
LazyData: true
52-
RoxygenNote: 5.0.0
52+
RoxygenNote: 5.0.1

tests/testthat/test-ggplot-legend.R

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,9 @@ test_that("very long legend items", {
103103

104104
# test of legend position
105105
test_that("many legend items", {
106-
many_items <- data.frame(cat1 = sample(x = paste0("Group ", LETTERS[1:12]),
107-
size = 100, replace = TRUE),
108-
cat2 = sample(x = c("foo", "bar", "baz"),
109-
size = 100, replace = TRUE))
110-
p_many_items <- ggplot(many_items, aes(cat2, fill=cat1)) +
111-
geom_bar(position="dodge")
112-
info <- expect_traces(p_many_items, 12, "many legend items")
106+
p <- ggplot(midwest, aes(category, fill= category)) + geom_bar()
107+
info <- expect_traces(p, nlevels(midwest$category), "many legend items")
113108
expect_equal(length(info$layout$annotations), 1)
114-
expected.names <- levels(many_items$cat2)
115109
expect_identical(info$layout$annotations[[1]]$y > 0.5, TRUE)
116110
expect_identical(info$layout$annotations[[1]]$y -
117111
info$layout$legend$y > 0, TRUE)

0 commit comments

Comments
 (0)