Skip to content

Commit 6efe4de

Browse files
committed
avoid recalcitrant visual test
1 parent 1cf5af1 commit 6efe4de

File tree

2 files changed

+13
-89
lines changed

2 files changed

+13
-89
lines changed

tests/testthat/_snaps/guide-old/dummy-old-s3-guide.svg

Lines changed: 0 additions & 81 deletions
This file was deleted.

tests/testthat/test-guide-old.R

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,33 @@ test_that("old S3 guides can be implemented", {
55
guide_circle <- function() {
66
structure(
77
list(available_aes = c("x", "y"), position = "bottom"),
8-
class = c("guide", "circle")
8+
class = c("guide", "circle_guide")
99
)
1010
}
1111

1212
registerS3method(
1313
"guide_train",
14-
"circle",
14+
"circle_guide",
1515
function(guide, ...) guide
1616
)
1717
registerS3method(
1818
"guide_transform",
19-
"circle",
19+
"circle_guide",
2020
function(guide, ...) guide
2121
)
2222
registerS3method(
2323
"guide_merge",
24-
"circle",
24+
"circle_guide",
2525
function(guide, ...) guide
2626
)
2727
registerS3method(
2828
"guide_geom",
29-
"circle",
29+
"circle_guide",
3030
function(guide, ...) guide
3131
)
3232
registerS3method(
3333
"guide_gengrob",
34-
"circle",
34+
"circle_guide",
3535
function(guide, ...) {
3636
absoluteGrob(
3737
gList(circleGrob()),
@@ -47,10 +47,15 @@ test_that("old S3 guides can be implemented", {
4747
expect_length(my_guides$guides, 1)
4848
expect_s3_class(my_guides$guides[[1]], "guide")
4949

50-
expect_doppelganger(
51-
"dummy old s3 guide",
50+
gt <- ggplotGrob(
5251
ggplot(mtcars, aes(disp, mpg)) +
5352
geom_point() +
5453
my_guides
5554
)
55+
56+
axis <- gtable_filter(gt, "axis-b")$grobs[[1]]
57+
expect_s3_class(
58+
axis$children[[1]],
59+
"circle"
60+
)
5661
})

0 commit comments

Comments
 (0)