Skip to content

Commit 8f1f9c4

Browse files
committed
Better test
1 parent 4a7030c commit 8f1f9c4

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

tests/testthat/tests-config.R

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,35 @@ test_that("non-existant type hits error", {
3232
})
3333

3434
test_that("config temp", {
35+
orig.par <- par(no.readonly = TRUE)
3536
df <- data.frame(x = 1:10, y=1:10, z = seq(2,20,2))
3637

3738
gsp <- gsplot(config.file = system.file("extdata", "lineScatter.yaml", package = "gsplot")) %>%
3839
lines(df$x, df$y, col="red", legend.name = "points") %>%
3940
legend()
4041
expect_true(gsp$global$config$config.file)
42+
expect_equal(par(no.readonly = TRUE)$lwd, orig.par$lwd)
43+
gsp
4144
expect_equal(par(no.readonly = TRUE)$lwd, 0.8)
4245

4346
gspDef <- gsplot() %>%
4447
lines(df$x, df$y, col="red", legend.name = "points")
4548
expect_false(gspDef$global$config$config.file)
46-
expect_equal(par(no.readonly = TRUE)$lwd, 1)
49+
expect_equal(par(no.readonly = TRUE)$lwd, orig.par$lwd)
4750

4851
loadConfig(system.file("extdata", "lineScatter.yaml", package = "gsplot"))
52+
expect_equal(par(no.readonly = TRUE)$lwd, orig.par$lwd)
53+
4954
gsp <- gsplot() %>%
5055
lines(df$x, df$y, col="red", legend.name = "points")
56+
expect_equal(par(no.readonly = TRUE)$lwd, orig.par$lwd)
5157
expect_false(gsp$global$config$config.file)
5258
expect_equal(gsp$side.1$axis$lwd, 0.8)
59+
gsp
60+
expect_equal(par(no.readonly = TRUE)$lwd, 0.8)
5361

5462
loadConfig()
63+
expect_equal(par(no.readonly = TRUE)$lwd, orig.par$lwd)
5564
gspDef2 <- gsplot() %>%
5665
lines(df$x, df$y, col="red", legend.name = "points")
5766
expect_false(gspDef2$global$config$config.file)

0 commit comments

Comments
 (0)