Sha256: 75f1830aa42ad2fdda4eb48c3324fae85abb70ea560d5a7513c9d87fd95e548d

Contents?: true

Size: 966 Bytes

Versions: 3

Compression:

Stored size: 966 Bytes

Contents

require 'helper'

class TestAfm < Minitest::Test
  
  def setup
    @font = AFM::Font.new(File.join(File.dirname(__FILE__), 'fixtures', 'Vera.afm'))
  end  
  
  def test_should_set_metadata
    assert_equal "BitstreamVeraSans-Roman", @font.metadata['FontName']
    assert_equal "BitstreamVeraSans-Roman", @font['FontName']
  end

  def test_should_set_char_metrics
    assert_equal 400, @font.char_metrics['exclam'][:wx]
    assert_equal [85, -131, 310, 758], @font.char_metrics['parenleft'][:boundingbox]
  end

  def test_should_set_char_metrics_by_code
    assert_equal 400, @font.char_metrics_by_code[33][:wx]
    assert_equal [85, -131, 310, 758], @font.char_metrics_by_code[40][:boundingbox]
  end
  
  def test_should_get_char_metrics_by_char
    assert_equal 400, @font.metrics_for("!")[:wx]
  end
  
  def test_open_font_with_alternative_method
    assert !AFM::Font.from_file(File.join(File.dirname(__FILE__), 'fixtures', 'Vera.afm')).nil?
  end
    
end

Version data entries

3 entries across 2 versions & 2 rubygems

Version Path
embulk-input-druginfo_interview_form-0.1.0 vendor/bundle/ruby/2.4.0/gems/afm-0.2.2/test/test_afm.rb
embulk-input-druginfo_interview_form-0.1.0 vendor/bundle/ruby/2.5.0/gems/afm-0.2.2/test/test_afm.rb
afm-0.2.2 test/test_afm.rb