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/head'
RSpec.describe TTFunk::Table::Head do
let(:font_path) { test_font('NotoSansCJKsc-Thin', :otf) }
let(:font) { TTFunk::File.open(font_path) }
describe 'long_date_time helpers' do
it 'parses the time correctly' do
expect(described_class.from_long_date_time(font.header.created)).to eq(Time.new(2015, 6, 15, 5, 5, 32, 'UTC').utc)
end
it 'encodes the time correctly' do
expect(described_class.to_long_date_time(Time.new(2015, 6, 15, 5, 5, 32, 'UTC'))).to eq(font.header.created)
end
example 'lossless roundrip' do
time = 42
expect(
described_class.to_long_date_time(
described_class.from_long_date_time(time),
),
).to eq time
end
end
end
|