diff --git a/NEWS.md b/NEWS.md index 61aa4ed..55ff00e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # ggthemes (development version) +- Updated tests. +- Removed `legend.title.align` and `legend.text.align` from themes. - Remove deprecated `n3alt` argument from `tremmel_shape_pal`. Use `alt` instead. - Deprecate `scale_shape_circlefill` and `circlefill_shape_pal`. The unicode characters used to represent circles in the scale are too often different sizes. Will be removed diff --git a/R/economist.R b/R/economist.R index 8263acc..53d93c7 100644 --- a/R/economist.R +++ b/R/economist.R @@ -172,9 +172,7 @@ theme_economist <- function(base_size = 10, base_family = "sans", legend.key.height = NULL, legend.key.width = NULL, legend.text = element_text(size = rel(1.25)), - legend.text.align = NULL, legend.title = element_text(size = rel(1), hjust = 0), - legend.title.align = NULL, legend.position = "top", legend.direction = NULL, legend.justification = "center", diff --git a/R/stata.R b/R/stata.R index 7ceb655..f1cf1ca 100644 --- a/R/stata.R +++ b/R/stata.R @@ -86,8 +86,7 @@ theme_stata_base <- function(base_size = 11, base_family = "sans") { legend.text = element_text(size = rel(relsz["medsmall"])), legend.text.align = NULL, ## See textboxstyle leg_title - legend.title = element_text(size = rel(relsz["large"]), hjust = 0), - legend.title.align = 0.5, + legend.title = element_text(size = rel(relsz["large"]), hjust = 0.5), legend.position = "bottom", legend.direction = NULL, legend.justification = "center", diff --git a/tests/testthat/helper-utils.R b/tests/testthat/helper-utils.R index bc1fa29..83acbc6 100644 --- a/tests/testthat/helper-utils.R +++ b/tests/testthat/helper-utils.R @@ -17,3 +17,10 @@ expect_hexcolor <- function(object) { invisible(act$val) } + +expect_equal_scale <- function(x, y, ...) { + x <- as.list(x) + y <- as.list(y) + x$call <- y$call <- NULL + expect_equal(x, y, ...) +} diff --git a/tests/testthat/test-canva.R b/tests/testthat/test-canva.R index a112b52..2fe10ef 100644 --- a/tests/testthat/test-canva.R +++ b/tests/testthat/test-canva.R @@ -22,7 +22,7 @@ test_that("scale_colour_canva works", { }) test_that("scale_color_canva works", { - expect_equal(scale_color_canva(), scale_colour_canva()) + expect_equal_scale(scale_color_canva(), scale_colour_canva()) }) test_that("scale_colour_canva works", { diff --git a/tests/testthat/test-colorblind.R b/tests/testthat/test-colorblind.R index c055d42..f0cfab5 100644 --- a/tests/testthat/test-colorblind.R +++ b/tests/testthat/test-colorblind.R @@ -14,7 +14,7 @@ test_that("scale_colour_colorblind works", { }) test_that("scale_color_canva works", { - expect_equal(scale_color_colorblind(), scale_colour_colorblind()) + expect_equal_scale(scale_color_colorblind(), scale_colour_colorblind()) }) test_that("scale_fill_colorblind works", { diff --git a/tests/testthat/test-economist.R b/tests/testthat/test-economist.R index de98faf..c0f5370 100644 --- a/tests/testthat/test-economist.R +++ b/tests/testthat/test-economist.R @@ -19,7 +19,7 @@ test_that("economist_pal raises warning with large number", { }) test_that("scale_colour_economist equals scale_color_economist", { - expect_equal(scale_color_economist(), scale_colour_economist()) + expect_equal_scale(scale_color_economist(), scale_colour_economist()) }) test_that("scale_colour_economist works", { diff --git a/tests/testthat/test-few.R b/tests/testthat/test-few.R index 949ce49..56e6926 100644 --- a/tests/testthat/test-few.R +++ b/tests/testthat/test-few.R @@ -45,7 +45,7 @@ test_that("scale_colour_few works", { }) test_that("scale_color_few works", { - expect_equal(scale_color_few(), scale_colour_few()) + expect_equal_scale(scale_color_few(), scale_colour_few()) }) test_that("scale_fill_few works", { diff --git a/tests/testthat/test-gdocs.R b/tests/testthat/test-gdocs.R index 7b39522..f1d533e 100644 --- a/tests/testthat/test-gdocs.R +++ b/tests/testthat/test-gdocs.R @@ -16,7 +16,7 @@ test_that("scale_colour_gdocs works", { }) test_that("scale_color_gdocs works", { - expect_equal(scale_color_gdocs(), scale_colour_gdocs()) + expect_equal_scale(scale_color_gdocs(), scale_colour_gdocs()) }) test_that("theme_gdocs works", { diff --git a/tests/testthat/test-hc.R b/tests/testthat/test-hc.R index c8f3377..6b076a8 100644 --- a/tests/testthat/test-hc.R +++ b/tests/testthat/test-hc.R @@ -17,7 +17,7 @@ test_that("scale_colour_hc works", { }) test_that("scale_color_hc works", { - expect_equal(scale_colour_hc(), scale_color_hc()) + expect_equal_scale(scale_colour_hc(), scale_color_hc()) }) test_that("scale_fill_hc works", { diff --git a/tests/testthat/test-solarized.R b/tests/testthat/test-solarized.R index 9dfecda..e8ce641 100644 --- a/tests/testthat/test-solarized.R +++ b/tests/testthat/test-solarized.R @@ -13,7 +13,7 @@ test_that("scale_colour_solarized works", { }) test_that("scale_color_solarized works", { - expect_equal(scale_colour_solarized(), scale_color_solarized()) + expect_equal_scale(scale_colour_solarized(), scale_color_solarized()) }) test_that("scale_fill_solarized works", { diff --git a/tests/testthat/test-stata.R b/tests/testthat/test-stata.R index 4c21b97..39208ef 100644 --- a/tests/testthat/test-stata.R +++ b/tests/testthat/test-stata.R @@ -14,7 +14,7 @@ test_that("scale_colour_stata works", { }) test_that("scale_color_stata works", { - expect_equal(scale_colour_stata(), scale_color_stata()) + expect_equal_scale(scale_colour_stata(), scale_color_stata()) }) test_that("scale_fill_stata works", {