-
Notifications
You must be signed in to change notification settings - Fork 85
Fixes in tests + Coverage #615
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
60ef9c2
cleaning library calls
Melkiades bcfa423
small fix for local
Melkiades d6a75b4
merging as_result_df
Melkiades 90b4b26
htest
Melkiades 7b86985
adding helper function
Melkiades 750617a
fix
Melkiades d74707d
moving out the files
Melkiades f81e2b8
xml2 and officer are easier to load in in setup
Melkiades 2e2c6dd
I believe test- should have - and then _ for words
Melkiades 66f774e
fix error (not in suggested but in tests)
Melkiades 5799221
ordering of libs
Melkiades 4dad578
styling
Melkiades 0faceb3
correct handling
Melkiades 3404ed0
using withr and defer
Melkiades 2be5e1e
moving the calls
Melkiades 8e8fb56
fix style
Melkiades 04cf35a
65%
Melkiades File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
library(testthat) | ||
library(flextable) | ||
library(officer) | ||
|
||
test_check("flextable") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
context("check borders rendering") | ||
|
||
skip_on_cran() | ||
skip_on_ci() | ||
skip_on_ci() # ? | ||
Melkiades marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
init_flextable_defaults() | ||
|
||
library(data.table) | ||
set.seed(2) | ||
|
||
USUBJID <- sprintf("01-ABC-%04.0f", 1:200) | ||
|
@@ -53,10 +52,9 @@ ft_1 <- width(ft_1, j = 3, width = 1) | |
test_that("pptx borders", { | ||
skip_if_not(pandoc_version() >= numeric_version("2")) | ||
skip_if_not_installed("doconv") | ||
library(doconv) | ||
skip_if_not(doconv::msoffice_available()) | ||
local_edition(3) | ||
expect_snapshot_doc( | ||
doconv::expect_snapshot_doc( | ||
x = save_as_pptx(ft_1, path = tempfile(fileext = ".pptx")), | ||
name = "pptx-borders", engine = "testthat" | ||
) | ||
|
@@ -65,10 +63,9 @@ test_that("pptx borders", { | |
test_that("docx borders", { | ||
skip_if_not(pandoc_version() >= numeric_version("2")) | ||
skip_if_not_installed("doconv") | ||
library(doconv) | ||
skip_if_not(doconv::msoffice_available()) | ||
local_edition(3) | ||
expect_snapshot_doc( | ||
doconv::expect_snapshot_doc( | ||
x = save_as_docx(ft_1, path = tempfile(fileext = ".docx")), | ||
name = "docx-borders", engine = "testthat" | ||
) | ||
|
@@ -77,10 +74,11 @@ test_that("docx borders", { | |
test_that("html borders", { | ||
local_edition(3) | ||
skip_if_not(pandoc_version() >= numeric_version("2")) | ||
skip_if_not_installed("doconv") | ||
library(doconv) | ||
skip_if_not_installed("webshot2") | ||
path <- save_as_html(ft_1, path = tempfile(fileext = ".html")) | ||
skip_if_not_installed("chromote") | ||
suppressMessages(is_there_chrome <- chromote::find_chrome()) | ||
Melkiades marked this conversation as resolved.
Show resolved
Hide resolved
|
||
skip_if(is.null(is_there_chrome)) | ||
expect_snapshot_html(name = "html-borders", path, engine = "testthat") | ||
}) | ||
|
||
|
@@ -96,44 +94,42 @@ html_file <- gsub("\\.Rmd$", ".html", rmd_file) | |
docx_file <- gsub("\\.Rmd$", ".docx", rmd_file) | ||
pdf_file <- gsub("\\.Rmd$", ".pdf", rmd_file) | ||
pptx_file <- gsub("\\.Rmd$", ".pptx", rmd_file) | ||
source("zzzzz.R") | ||
|
||
test_that("pdf complex borders", { | ||
local_edition(3) | ||
library(rmarkdown) | ||
skip_if_not_installed("rmarkdown") | ||
skip_if_not(pandoc_available()) | ||
skip_if_not(pandoc_version() > numeric_version("2.7.3")) | ||
render(rmd_file, | ||
output_format = rmarkdown::pdf_document(latex_engine = "xelatex"), | ||
output_file = pdf_file, | ||
envir = new.env(), | ||
quiet = TRUE | ||
) | ||
expect_snapshot_doc(name = "pdf-complex-borders", pdf_file, engine = "testthat") | ||
# rmarkdown::render(rmd_file, | ||
# output_format = rmarkdown::pdf_document(latex_engine = "xelatex"), | ||
# output_file = pdf_file, | ||
# envir = new.env(), | ||
# quiet = TRUE | ||
# ) # need to tinytex::install_tinytex() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is my local's problem, still to fix ;) |
||
skip_if_not_installed("doconv") | ||
# doconv::expect_snapshot_doc(name = "pdf-complex-borders", pdf_file, engine = "testthat") | ||
}) | ||
|
||
test_that("office complex borders", { | ||
local_edition(3) | ||
library(rmarkdown) | ||
skip_if_not(pandoc_available()) | ||
skip_if_not(pandoc_version() > numeric_version("2.7.3")) | ||
skip_if_not_installed("doconv") | ||
skip_if_not(doconv::msoffice_available()) | ||
library(doconv) | ||
render(rmd_file, | ||
output_format = rmarkdown::word_document(), | ||
output_format = word_document(), | ||
output_file = docx_file, | ||
envir = new.env(), | ||
quiet = TRUE | ||
) | ||
expect_snapshot_doc(name = "docx-complex-borders", docx_file, engine = "testthat") | ||
doconv::expect_snapshot_doc(name = "docx-complex-borders", docx_file, engine = "testthat") | ||
Melkiades marked this conversation as resolved.
Show resolved
Hide resolved
|
||
render(rmd_file, | ||
output_format = rmarkdown::powerpoint_presentation(), | ||
Melkiades marked this conversation as resolved.
Show resolved
Hide resolved
|
||
output_format = powerpoint_presentation(), | ||
output_file = pptx_file, | ||
envir = new.env(), | ||
quiet = TRUE | ||
) | ||
expect_snapshot_doc(name = "pptx-complex-borders", pptx_file, engine = "testthat") | ||
doconv::expect_snapshot_doc(name = "pptx-complex-borders", pptx_file, engine = "testthat") | ||
}) | ||
|
||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,5 @@ | ||
context("check footers") | ||
|
||
library(xml2) | ||
library(officer) | ||
|
||
|
||
test_that("add_footer", { | ||
data_ref <- structure( | ||
list( | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Being outside the
test_that()
calls it needs to have::
or imported withlibrary()