Skip to content

Commit 6a08f2d

Browse files
committed
add test
1 parent e6afd5c commit 6a08f2d

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

tests/testthat/test-geom-.R

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,34 @@ test_that("aesthetic checking in geom throws correct errors", {
66
expect_snapshot_error(check_aesthetics(aes, 4))
77
})
88

9+
test_that("get_geom_defaults can use various sources", {
10+
11+
test <- get_geom_defaults(geom_point)
12+
expect_equal(test$colour, "black")
13+
14+
test <- get_geom_defaults(geom_point(colour = "red"))
15+
expect_equal(test$colour, "red")
16+
17+
test <- get_geom_defaults("point")
18+
expect_equal(test$colour, "black")
19+
20+
test <- get_geom_defaults(GeomPoint, theme(geom = element_geom("red")))
21+
expect_equal(test$colour, "red")
22+
})
23+
924
test_that("geom defaults can be set and reset", {
1025
l <- geom_point()
1126
orig <- l$geom$default_aes$colour
12-
test <- l$geom$use_defaults(data_frame0())
27+
test <- get_geom_defaults(l)
1328
expect_equal(test$colour, "black")
1429

1530
inv <- update_geom_defaults("point", list(colour = "red"))
16-
test <- l$geom$use_defaults(data_frame0())
31+
test <- get_geom_defaults(l)
1732
expect_equal(test$colour, "red")
1833
expect_equal(inv$colour, orig)
1934

2035
inv <- update_geom_defaults("point", NULL)
21-
test <- l$geom$use_defaults(data_frame0())
36+
test <- get_geom_defaults(l)
2237
expect_equal(test$colour, "black")
2338
expect_equal(inv$colour, "red")
2439
})

0 commit comments

Comments
 (0)