@@ -18,9 +18,15 @@ test_that("scale_*_paletteer_binned correctly assigns colors", {
18
18
ggplot2 :: geom_raster() +
19
19
scale_fill_paletteer_binned(" scico::berlin" )
20
20
21
- expect_equal(ggplot2 :: layer_data(p1 )$ colour , c(" #65A6E1" , " #183E4F" , " #CC7D72" ))
22
- expect_equal(ggplot2 :: layer_data(p2 )$ colour , c(" #65A6E1" , " #183E4F" , " #CC7D72" ))
23
- expect_equal(ggplot2 :: layer_data(p3 )$ fill , c(" #65A6E1" , " #183E4F" , " #CC7D72" ))
21
+ colours <- if (utils :: packageVersion(" ggplot2" ) < " 3.5.0" ) {
22
+ c(" #65A6E1" , " #183E4F" , " #CC7D72" )
23
+ } else {
24
+ c(" #519FD2" , " #13313E" , " #BB6C60" )
25
+ }
26
+
27
+ expect_equal(ggplot2 :: layer_data(p1 )$ colour , colours )
28
+ expect_equal(ggplot2 :: layer_data(p2 )$ colour , colours )
29
+ expect_equal(ggplot2 :: layer_data(p3 )$ fill , colours )
24
30
})
25
31
26
32
test_that(" scale_*_paletteer_binned correctly used direction" , {
@@ -49,12 +55,25 @@ test_that("scale_*_paletteer_binned correctly used direction", {
49
55
ggplot2 :: geom_raster() +
50
56
scale_fill_paletteer_binned(" scico::berlin" , direction = - 1 )
51
57
52
- expect_equal(ggplot2 :: layer_data(p1 )$ colour , c(" #65A6E1" , " #183E4F" , " #CC7D72" ))
53
- expect_equal(ggplot2 :: layer_data(p2 )$ colour , c(" #65A6E1" , " #183E4F" , " #CC7D72" ))
54
- expect_equal(ggplot2 :: layer_data(p3 )$ fill , c(" #65A6E1" , " #183E4F" , " #CC7D72" ))
55
- expect_equal(ggplot2 :: layer_data(p4 )$ colour , c(" #CC7D72" , " #4B1501" , " #65A6E1" ))
56
- expect_equal(ggplot2 :: layer_data(p5 )$ colour , c(" #CC7D72" , " #4B1501" , " #65A6E1" ))
57
- expect_equal(ggplot2 :: layer_data(p6 )$ fill , c(" #CC7D72" , " #4B1501" , " #65A6E1" ))
58
+ colours <- if (utils :: packageVersion(" ggplot2" ) < " 3.5.0" ) {
59
+ c(" #65A6E1" , " #183E4F" , " #CC7D72" )
60
+ } else {
61
+ c(" #519FD2" , " #13313E" , " #BB6C60" )
62
+ }
63
+
64
+ expect_equal(ggplot2 :: layer_data(p1 )$ colour , colours )
65
+ expect_equal(ggplot2 :: layer_data(p2 )$ colour , colours )
66
+ expect_equal(ggplot2 :: layer_data(p3 )$ fill , colours )
67
+
68
+ colours <- if (utils :: packageVersion(" ggplot2" ) < " 3.5.0" ) {
69
+ c(" #CC7D72" , " #4B1501" , " #65A6E1" )
70
+ } else {
71
+ c(" #BB6C60" , " #3F1200" , " #519FD2" )
72
+ }
73
+
74
+ expect_equal(ggplot2 :: layer_data(p4 )$ colour , colours )
75
+ expect_equal(ggplot2 :: layer_data(p5 )$ colour , colours )
76
+ expect_equal(ggplot2 :: layer_data(p6 )$ fill , colours )
58
77
})
59
78
60
79
test_that(" scale_*_paletteer_binned works with quoted palettes" , {
0 commit comments