File: name_index_spec.rb

package info (click to toggle)
ruby-ttfunk 1.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 18,472 kB
  • sloc: ruby: 7,954; makefile: 7
file content (23 lines) | stat: -rw-r--r-- 703 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

require 'spec_helper'
require 'ttfunk/table/cff'

RSpec.describe TTFunk::Table::Cff, 'Name Index' do # rubocop: disable RSpec/DescribeMethod
  let(:font_path) { test_font('NotoSansCJKsc-Thin', :otf) }
  let(:font) { TTFunk::File.open(font_path) }
  let(:name_index) { font.cff.name_index }

  it 'contains the name of the font' do
    expect(name_index.to_a).to eq(['NotoSansCJKsc-Thin'])
  end

  describe '#encode' do
    it 'encodes the index correctly' do
      encoded = name_index.encode
      reconstituted = described_class::Index.new(TestFile.new(StringIO.new(encoded.string)), 0)

      expect(reconstituted.to_a).to eq(['NotoSansCJKsc-Thin'])
    end
  end
end