diff --git a/R/rtf_nrow.R b/R/rtf_nrow.R index c53bf051..833f76cb 100644 --- a/R/rtf_nrow.R +++ b/R/rtf_nrow.R @@ -47,7 +47,7 @@ rtf_nline_vector <- function(text, strwidth, size) { index <- strwidth / size > 1 n_row <- rep(1, length(text)) - if (any(index)) { + if (any(na.omit(index))) { l <- length(text) if (length(strwidth) < l) { diff --git a/tests/testthat/test-independent-testing-rtf_nrow.R b/tests/testthat/test-independent-testing-rtf_nrow.R index 3e26b548..185947b9 100644 --- a/tests/testthat/test-independent-testing-rtf_nrow.R +++ b/tests/testthat/test-independent-testing-rtf_nrow.R @@ -75,7 +75,7 @@ cellsize <- matrix(width, nrow = nrow(tbl), ncol = ncol(tbl), byrow = TRUE) - pa # rtf_nline_vector example nline_vector <- rtf_nline_vector( - text = c("title 1", "this is a sentence for title 2"), + text = c("title 1", "this is a sentence for title 2", NA), strwidth = c( strwidth("title 1", units = "inches"), strwidth("this is a sentence for title 2", units = "inches") @@ -116,7 +116,6 @@ test_that("test if rtf_nline_vector() return to correct numbers", { expect_equal(nline_vector[2], 6) }) - test_that("test if rtf_nline_matrix() return to correct numbers", { # maximum lines for first row