Skip to content

Commit

Permalink
Add tests for LaTeX alt text
Browse files Browse the repository at this point in the history
  • Loading branch information
capnrefsmmat committed Oct 27, 2024
1 parent db16625 commit 76b9d79
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/testit/test-hooks-latex.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
library(testit)

assert("alt text is included in LaTeX output", {
# no alt text
(hook_plot_tex('foo.pdf', list(fig.align = 'center', fig.show = 'asis')) %==%
'\n\n{\\centering \\includegraphics{foo} \n\n}\n\n')

# alt text
(hook_plot_tex('foo.pdf', list(fig.alt = 'Alt', fig.align = 'center',
fig.show = 'asis')) %==%
'\n\n{\\centering \\includegraphics[,alt={Alt}]{foo} \n\n}\n\n')

# with width
(hook_plot_tex('foo.pdf', list(fig.alt = 'Alt', fig.align = 'center',
fig.show = 'asis', out.width = '\\maxwidth')) %==%
'\n\n{\\centering \\includegraphics[width=\\maxwidth,alt={Alt}]{foo} \n\n}\n\n')
})

0 comments on commit 76b9d79

Please sign in to comment.