test/unit/generator/pdf/document/test_font.rb in thinreports-0.8.2 vs test/unit/generator/pdf/document/test_font.rb in thinreports-0.9.0
- old
+ new
@@ -9,62 +9,56 @@
def teardown
# Reset font settings
Thinreports.configure do |c|
c.fallback_fonts = []
- c.generator.pdf.eudc_fonts = []
end
end
def test_setup_fonts
pdf = document.pdf
Font::BUILTIN_FONTS.each do |name, font|
assert_equal font, pdf.font_families[name]
end
- Font::PRAWN_BUINTIN_FONT_ARIASES.each do |alias_font, original_font|
+ Font::PRAWN_BUINTIN_FONT_ALIASES.each do |alias_font, original_font|
assert_equal pdf.font_families[alias_font],
pdf.font_families[original_font]
end
assert_equal Font::DEFAULT_FALLBACK_FONTS, pdf.fallback_fonts[-2..-1]
end
def test_setup_fonts_with_custom_fallback_fonts
Thinreports.configure do |c|
c.fallback_fonts = []
- c.generator.pdf.eudc_fonts = []
end
assert_equal Font::DEFAULT_FALLBACK_FONTS,
document.pdf.fallback_fonts
Thinreports.configure do |c|
c.fallback_fonts = 'IPAGothic'
- c.generator.pdf.eudc_fonts = []
end
assert_equal ['IPAGothic'] + Font::DEFAULT_FALLBACK_FONTS,
document.pdf.fallback_fonts
Thinreports.configure do |c|
c.fallback_fonts = ['IPAMincho']
- c.generator.pdf.eudc_fonts = [data_file('font.ttf')]
end
- assert_equal ['Custom-fallback-font0', 'IPAMincho'] + Font::DEFAULT_FALLBACK_FONTS,
+ assert_equal ['IPAMincho'] + Font::DEFAULT_FALLBACK_FONTS,
document.pdf.fallback_fonts
Thinreports.configure do |c|
- c.generator.pdf.eudc_fonts = [data_file('font.ttf')]
- c.fallback_fonts = ['IPAMincho', 'IPAMincho', data_file('font.ttf')]
+ c.fallback_fonts = ['IPAMincho', data_file('font.ttf')]
end
- assert_equal ['Custom-fallback-font0', 'IPAMincho'] + Font::DEFAULT_FALLBACK_FONTS,
+ assert_equal ['IPAMincho', 'Custom-fallback-font1'] + Font::DEFAULT_FALLBACK_FONTS,
document.pdf.fallback_fonts
end
def test_setup_fonts_with_unknown_custom_fallback_fonts
Thinreports.configure do |c|
c.fallback_fonts = ['/path/to/unknown.ttf']
- c.generator.pdf.eudc_fonts = []
end
assert_raises Thinreports::Errors::FontFileNotFound do
create_document
end