Skip to content

Commit

Permalink
Merge pull request #488 from ycphs/gh_issue_485
Browse files Browse the repository at this point in the history
fix warning thrown in (un)groupRows. closes #485
  • Loading branch information
JanMarvin authored Aug 1, 2024
2 parents 89917b6 + a13fa67 commit ab2be82
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
4 changes: 2 additions & 2 deletions R/wrappers.R
Original file line number Diff line number Diff line change
Expand Up @@ -4611,7 +4611,7 @@ groupRows <- function(wb, sheet, rows, hidden = FALSE) {
stop("Hidden should be a logical value (TRUE/FALSE).")
}

if (any(rows) < 1L) {
if (any(rows < 1L)) {
stop("Invalid rows entered (<= 0).")
}

Expand Down Expand Up @@ -4653,7 +4653,7 @@ ungroupRows <- function(wb, sheet, rows) {

sheet <- wb$validateSheet(sheet)

if (any(rows) < 1L) {
if (any(rows < 1L)) {
stop("Invalid rows entered (<= 0).")
}

Expand Down
25 changes: 23 additions & 2 deletions tests/testthat/test-outlines.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,34 @@ test_that("ungroup columns", {

test_that("ungroup rows", {
wb <- createWorkbook()
assign("wb", wb, envir = .GlobalEnv)
addWorksheet(wb, "Sheet 1")
groupRows(wb, "Sheet 1", 1:3, hidden = T)
ungroupRows(wb, "Sheet 1", 1:3)

expect_equal(length(wb$outlineLevels[[1]]), 0L)
rm(wb)
})

test_that("no warnings #485", {

wb <- createWorkbook()
addWorksheet(wb, "Sheet 1")

expect_silent(
groupRows(
rows = c(1),
sheet = "Sheet 1",
wb = wb
)
)

expect_silent(
ungroupRows(
rows = c(1),
sheet = "Sheet 1",
wb = wb
)
)

})


Expand Down

0 comments on commit ab2be82

Please sign in to comment.