Skip to content

Commit

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

library(ggplot2)

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

## Test length of paleta fonts ----
testthat::expect_equal(length(acdc_fonts), 4)

## Test output of set_paleta_font ----
testthat::expect_type(set_acdc_font(), "character")
testthat::expect_equal(length(set_acdc_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 = acdc_palettes$acdc_secondary
) +
labs(
title = "Light ACDC Theme",
subtitle = "Using the Africa CDC secondary palette",
)

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

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

testthat::expect_silent(p + theme_acdc_light(grid = "X"))
testthat::expect_silent(p + theme_acdc_light(grid = "Xx"))
testthat::expect_silent(p + theme_acdc_light(grid = "Y"))
testthat::expect_silent(p + theme_acdc_light(grid = "Yy"))
testthat::expect_silent(p + theme_acdc_light(grid = "XxYy"))
testthat::expect_silent(p + theme_acdc_light(grid = FALSE))


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

testthat::expect_silent(p + theme_acdc_light(axis = TRUE))
testthat::expect_silent(p + theme_acdc_light(axis = "x"))
testthat::expect_silent(p + theme_acdc_light(axis = "y"))
testthat::expect_silent(p + theme_acdc_light(axis = "xy"))

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

0 comments on commit 5ea1e5b

Please sign in to comment.