File: dsig_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 (29 lines) | stat: -rw-r--r-- 770 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# frozen_string_literal: true

require 'spec_helper'
require 'ttfunk/table/dsig'

RSpec.describe TTFunk::Table::Dsig do
  let(:font_path) { test_font('NotoSansCJKsc-Thin', :otf) }
  let(:font) { TTFunk::File.open(font_path) }
  let(:dsig_table) { font.digital_signature }

  describe '.encode' do
    let(:encoded) { described_class.encode(dsig_table) }
    let(:reconstituted) do
      described_class.new(TestFile.new(StringIO.new(encoded)))
    end

    it 'includes the same version information' do
      expect(reconstituted.version).to eq(dsig_table.version)
    end

    it 'zeroes out the flags' do
      expect(reconstituted.flags).to eq(0)
    end

    it 'removes all signature records' do
      expect(reconstituted.signatures).to be_empty
    end
  end
end