Sha256: 2b3138547bec01c464c8cabbfdf26cf8894a67afb4970fc797ecbd244f6549a3

Contents?: true

Size: 1003 Bytes

Versions: 75

Compression:

Stored size: 1003 Bytes

Contents

# -*- encoding: utf-8 -*-

require 'test_helper'
require 'hexapdf/font/encoding/base'

describe HexaPDF::Font::Encoding::Base do
  before do
    @base = HexaPDF::Font::Encoding::Base.new
    @base.code_to_name[65] = :A
  end

  it "returns nil for the encoding_name" do
    assert_nil(@base.encoding_name)
  end

  describe "name" do
    it "returns a mapped code" do
      assert_equal(:A, @base.name(65))
    end

    it "returns .notdef for an unmapped code" do
      assert_equal(:'.notdef', @base.name(66))
    end
  end

  describe "unicode" do
    it "returns the unicode value of the code" do
      assert_equal("A", @base.unicode(65))
    end

    it "returns an empty string for an unmapped code" do
      assert_nil(@base.unicode(66))
    end
  end

  describe "code" do
    it "returns the code for an existing glyph name" do
      assert_equal(65, @base.code(:A))
    end

    it "returns nil if the glyph name is not referenced" do
      assert_nil(@base.code(:Unknown))
    end
  end
end

Version data entries

75 entries across 75 versions & 1 rubygems

Version Path
hexapdf-1.1.1 test/hexapdf/font/encoding/test_base.rb
hexapdf-1.1.0 test/hexapdf/font/encoding/test_base.rb
hexapdf-1.0.3 test/hexapdf/font/encoding/test_base.rb
hexapdf-1.0.2 test/hexapdf/font/encoding/test_base.rb
hexapdf-1.0.1 test/hexapdf/font/encoding/test_base.rb
hexapdf-1.0.0 test/hexapdf/font/encoding/test_base.rb
hexapdf-0.47.0 test/hexapdf/font/encoding/test_base.rb
hexapdf-0.46.0 test/hexapdf/font/encoding/test_base.rb
hexapdf-0.45.0 test/hexapdf/font/encoding/test_base.rb
hexapdf-0.44.0 test/hexapdf/font/encoding/test_base.rb
hexapdf-0.41.0 test/hexapdf/font/encoding/test_base.rb
hexapdf-0.40.0 test/hexapdf/font/encoding/test_base.rb
hexapdf-0.39.1 test/hexapdf/font/encoding/test_base.rb
hexapdf-0.39.0 test/hexapdf/font/encoding/test_base.rb
hexapdf-0.38.0 test/hexapdf/font/encoding/test_base.rb
hexapdf-0.37.2 test/hexapdf/font/encoding/test_base.rb
hexapdf-0.37.1 test/hexapdf/font/encoding/test_base.rb
hexapdf-0.37.0 test/hexapdf/font/encoding/test_base.rb
hexapdf-0.36.0 test/hexapdf/font/encoding/test_base.rb
hexapdf-0.35.1 test/hexapdf/font/encoding/test_base.rb