Skip to content

Commit

Permalink
set larger tolerance
Browse files Browse the repository at this point in the history
  • Loading branch information
heike committed Jan 29, 2024
1 parent 36d6e8f commit e51132f
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions tests/testthat/test-ggparallel.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
save_png <- function(code, width = 400, height = 400) {
path <- tempfile(fileext = ".png")
png(path, width = width, height = height)
on.exit(dev.off())
code

path
}

test_that("ggparallel works", {
load(system.file("mtcars.rda", package="ggparallel")) # loads object test_mtcars_plot
built_saved <- ggplot2::ggplot_build(test_mtcars_plot)
Expand All @@ -23,10 +32,11 @@ test_that("ggparallel hammocks work", {

titanic <- as.data.frame(Titanic)
titanic_plot <- ggparallel(names(titanic)[c(1,4,2,3)], titanic, weight=1, asp=0.5,
method="hammock", ratio=0.2, order=c(0,0))
method="hammock", ratio=0.2, order=c(0,0))
build_now <- ggplot2::ggplot_build(titanic_plot)
# titanic_hammock <- build_now$data
# save(titanic_hammock, file="inst/titanic_hammock.rda")
# titanic_hammock <- build_now$data
# save(titanic_hammock, file="inst/titanic_hammock.rda")

expect_identical(titanic_hammock, build_now$data)
expect_equal(titanic_hammock, build_now$data, tolerance=1e-4)
})

0 comments on commit e51132f

Please sign in to comment.