Skip to content

Commit

Permalink
fix test warnings; bump version, update NEWS
Browse files Browse the repository at this point in the history
  • Loading branch information
Enchufa2 committed Jul 11, 2024
1 parent 602c732 commit 689fa1a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: units
Version: 0.8-5.4
Version: 0.8-5.5
Title: Measurement Units for R Vectors
Authors@R: c(person("Edzer", "Pebesma", role = c("aut", "cre"), email = "[email protected]", comment = c(ORCID = "0000-0001-8049-7069")),
person("Thomas", "Mailund", role = "aut", email = "[email protected]"),
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

* Fix incorrect use of `round()` in `%%` and `%/%` methods; #365 @UchidaMizuki

* Fix `ggplot2` deprecation warnings; #367

* Fix `hist()` error; #368

# version 0.8-5

* avoid -Wformat-security warning on CRAN
Expand Down
11 changes: 6 additions & 5 deletions tests/testthat/test_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,15 @@ test_that("base plots work as expected", {

test_that("ggplot2 plots work as expected", {
skip_if_not_installed("vdiffr")
skip_if_not_installed("ggplot2")
skip_if_not_installed("ggplot2", "3.5.0")
library(ggplot2)

iris.u <- iris
iris.u[1:4] <- lapply(iris.u[1:4], function(x) set_units(x, cm))

p0 <- ggplot(iris.u) + aes(Sepal.Length, Sepal.Width, color=Species) +
geom_point() + theme_bw() + theme(legend.position=c(0.6, 0.8))
geom_point() + theme_bw() + theme(legend.position="inside",
legend.position.inside=c(0.6, 0.8))

p1 <- p0 + scale_x_units(unit="m") + scale_y_units(unit="mm")
p2 <- p0 + xlab("some other thing")
Expand All @@ -64,14 +65,14 @@ test_that("ggplot2 plots work as expected", {

test_that("axis transformations do not affect displayed units", {
skip_if_not_installed("vdiffr")
skip_if_not_installed("ggplot2")
skip_if_not_installed("ggplot2", "3.5.0")
library(ggplot2)

df <- data.frame(a = set_units(1:10, "m"))

p0 <- ggplot(df, aes(y=a, x=a)) + geom_point()
p1 <- p0 + scale_x_units(trans='log10') + scale_y_units(trans='sqrt')
p2 <- p0 + scale_x_units(trans="log10", unit="mm")
p1 <- p0 + scale_x_units(transform='log10') + scale_y_units(transform='sqrt')
p2 <- p0 + scale_x_units(transform="log10", unit="mm")

vdiffr::expect_doppelganger("ggplot2 default", p0)
vdiffr::expect_doppelganger("ggplot2 transformed", p1)
Expand Down

0 comments on commit 689fa1a

Please sign in to comment.