Skip to content

Commit

Permalink
Merge pull request #74 from katilingban/dev
Browse files Browse the repository at this point in the history
add test for `theme_wb()`
  • Loading branch information
ernestguevarra authored Mar 12, 2024
2 parents f67369c + fb9b283 commit 97ce910
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions tests/testthat/test-theme_wb.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Tests for theme_wb() -------------------------------------------------------

library(ggplot2)

## Test wb_fonts class ----
testthat::expect_type(wb_fonts, "list")

## Test length of wb fonts ----
testthat::expect_equal(length(wb_fonts), 2)

## Test output of set_wb_font ----
testthat::expect_type(set_wb_font(), "character")
testthat::expect_equal(length(set_wb_font()), 1)

## test theme_paleta() ----

### scatterplot
p <- ggplot(data = mtcars, mapping = aes(x = mpg, y = disp, colour = factor(cyl))) +
geom_point(size = 3) +
scale_colour_manual(
name = "Cylinders",
values = wb_palettes$wb_secondary
)

### Test main plotting api ----
testthat::expect_silent(p + theme_wb())


### Test grid ----
testthat::expect_silent(p + theme_wb(grid = "X"))
testthat::expect_silent(p + theme_wb(grid = "Xx"))
testthat::expect_silent(p + theme_wb(grid = "Y"))
testthat::expect_silent(p + theme_wb(grid = "Yy"))
testthat::expect_silent(p + theme_wb(grid = "XxYy"))
testthat::expect_silent(p + theme_wb(grid = FALSE))

### Test axis ----
testthat::expect_silent(p + theme_wb(axis = TRUE))
testthat::expect_silent(p + theme_wb(axis = "x"))
testthat::expect_silent(p + theme_wb(axis = "y"))
testthat::expect_silent(p + theme_wb(axis = "xy"))

### Test ticks ----
testthat::expect_silent(p + theme_wb(ticks = TRUE))

0 comments on commit 97ce910

Please sign in to comment.