| 1 |
library(testit) |
| 2 |
|
| 3 |
assert("alt text is included in LaTeX output", { |
| 4 |
# no alt text |
| 5 |
(hook_plot_tex('foo.pdf', list(fig.align = 'center', fig.show = 'asis')) %==% |
| 6 |
'\n\n{\\centering \\includegraphics{foo} \n\n}\n\n') |
| 7 |
|
| 8 |
# alt text |
| 9 |
(hook_plot_tex('foo.pdf', list(fig.alt = 'Alt', fig.align = 'center', |
| 10 |
fig.show = 'asis')) %==% |
| 11 |
'\n\n{\\centering \\includegraphics[alt={Alt}]{foo} \n\n}\n\n') |
| 12 |
|
| 13 |
# with width |
| 14 |
(hook_plot_tex('foo.pdf', list(fig.alt = 'Alt', fig.align = 'center', |
| 15 |
fig.show = 'asis', out.width = '\\maxwidth')) %==% |
| 16 |
'\n\n{\\centering \\includegraphics[width=\\maxwidth,alt={Alt}]{foo} \n\n}\n\n') |
| 17 |
}) |