context("Setting column widths") test_that("Resetting col widths", { # Write some data to a workbook object. wb <- createWorkbook() addWorksheet(wb, "iris") writeData(wb, "iris", iris) # Set column widths and perform the pre-save operation to prepare col xml # (typically called by `saveWorkbook()`). setColWidths(wb, "iris", cols = 1:2, 12) wb$setColWidths(1) # Set column widths again for a different range inclusive of the previous one, # perform the pre-save operation to prepare col xml, and test for an error # (reported in https://github.com/ycphs/openxlsx/issues/493). setColWidths(wb, "iris", cols = 1:5, 15) expect_error(wb$setColWidths(1), NA) # Test that the resulting col xml meets expectations. expected_col_xml <- c( "1" = "