summaryrefslogtreecommitdiff
path: root/spec/font_spec.rb
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2020-01-23 02:02:44 -0700
committerDan Allen <dan.j.allen@gmail.com>2020-01-23 02:02:44 -0700
commit77a3bc0a76a48088936f551f8149c224f40871e6 (patch)
treec0b7cc517f2f0b55263f316ff81c8fd58b49b2f8 /spec/font_spec.rb
parent7c528a16fd2508374fae65b5fdd1f354945328a2 (diff)
if path of missing font is absolute, don't suggest that it was not found in the fontsdir
Diffstat (limited to 'spec/font_spec.rb')
-rw-r--r--spec/font_spec.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/font_spec.rb b/spec/font_spec.rb
index a9dbf392..656674ab 100644
--- a/spec/font_spec.rb
+++ b/spec/font_spec.rb
@@ -107,6 +107,39 @@ describe 'Asciidoctor::PDF::Converter - Font' do
(expect fonts).to have_size 1
(expect fonts[0][:BaseFont]).to end_with '+NotoSerif'
end
+
+ it 'should throw error if font with relative path cannot be found in GEM_FONTS_DIR' do
+ pdf_theme = {
+ font_catalog: {
+ 'NoSuchFont' => {
+ 'normal' => 'no-such-font.ttf',
+ },
+ },
+ }
+ expect { to_pdf 'content', pdf_theme: pdf_theme }.to raise_exception Errno::ENOENT, /no-such-font\.ttf not found in GEM_FONTS_DIR$/
+ end
+
+ it 'should throw error if font with relative path cannot be found in custom font dirs' do
+ pdf_theme = {
+ font_catalog: {
+ 'NoSuchFont' => {
+ 'normal' => 'no-such-font.ttf',
+ },
+ },
+ }
+ expect { to_pdf 'content', attribute_overrides: { 'pdf-fontsdir' => 'here,there' }, pdf_theme: pdf_theme }.to raise_exception Errno::ENOENT, /no-such-font\.ttf not found in here or there$/
+ end
+
+ it 'should throw error if font with absolute path cannot be found in custom font dirs' do
+ pdf_theme = {
+ font_catalog: {
+ 'NoSuchFont' => {
+ 'normal' => (font_path = fixture_file 'no-such-font.ttf'),
+ },
+ },
+ }
+ expect { to_pdf 'content', pdf_theme: pdf_theme }.to raise_exception Errno::ENOENT, /#{Regexp.escape font_path} not found$/
+ end
end
context 'Kerning' do