@@ -164,19 +164,6 @@ test_that("Complete and non-complete themes interact correctly with ggplot objec
164
164
expect_equal(p $ plot $ theme $ text $ colour , " red" )
165
165
expect_equal(p $ plot $ theme $ text $ face , " italic" )
166
166
167
- # The final calculated plot theme should not blend a complete theme
168
- # with the default theme
169
- default_theme <- theme_gray() + theme(axis.text.x = element_text(colour = " red" ))
170
-
171
- ptheme <- plot_theme(qplot(1 : 3 , 1 : 3 ) + theme_void(), default_theme )
172
- expect_null(ptheme $ axis.text.x )
173
-
174
- ptheme <- plot_theme(qplot(1 : 3 , 1 : 3 ) + theme_gray(), default_theme )
175
- expect_true(is.null(ptheme $ axis.text.x $ colour ) || ptheme $ axis.text.x $ colour != " red" )
176
-
177
- ptheme <- plot_theme(qplot(1 : 3 , 1 : 3 ) + theme(axis.text.y = element_text(colour = " blue" )), default_theme )
178
- expect_equal(ptheme $ axis.text.x $ colour , " red" )
179
- expect_equal(ptheme $ axis.text.y $ colour , " blue" )
180
167
})
181
168
182
169
test_that(" theme(validate=FALSE) means do not validate_element" , {
@@ -238,6 +225,19 @@ test_that("Elements can be merged", {
238
225
)
239
226
})
240
227
228
+ test_that(" Final calculated plot theme should not blend a complete theme with the default theme" , {
229
+ default_theme <- theme_gray() + theme(axis.text.x = element_text(colour = " red" ))
230
+
231
+ ptheme <- plot_theme(qplot(1 : 3 , 1 : 3 ) + theme_void(), default_theme )
232
+ expect_null(ptheme $ axis.text.x )
233
+
234
+ ptheme <- plot_theme(qplot(1 : 3 , 1 : 3 ) + theme_gray(), default_theme )
235
+ expect_true(is.null(ptheme $ axis.text.x $ colour ) || ptheme $ axis.text.x $ colour != " red" )
236
+
237
+ ptheme <- plot_theme(qplot(1 : 3 , 1 : 3 ) + theme(axis.text.y = element_text(colour = " blue" )), default_theme )
238
+ expect_equal(ptheme $ axis.text.x $ colour , " red" )
239
+ expect_equal(ptheme $ axis.text.y $ colour , " blue" )
240
+ })
241
241
242
242
# Visual tests ------------------------------------------------------------
243
243
0 commit comments