Sha256: 9832a3678371130749b4dd6c2e091f031b61829e443eae58d5f893f0ac4dea39

Contents?: true

Size: 1.07 KB

Versions: 8

Compression:

Stored size: 1.07 KB

Contents

require 'spec_helper'

describe FormatParser::DPXParser do
  describe 'with Depix example files' do
    Dir.glob(fixtures_dir + '/dpx/*.*').each do |dpx_path|
      it "is able to parse #{File.basename(dpx_path)}" do
        parsed = subject.information_from_io(File.open(dpx_path, 'rb'))

        expect(parsed).not_to be_nil
        expect(parsed.file_nature).to eq(:image)
        expect(parsed.file_type).to eq(:dpx)

        # If we have an error in the struct offsets these values are likely to become
        # the maximum value of a 4-byte uint, which is way higher
        expect(parsed.width_px).to be_kind_of(Integer)
        expect(parsed.width_px).to be_between(0, 2048)
        expect(parsed.height_px).to be_kind_of(Integer)
        expect(parsed.height_px).to be_between(0, 4000)
      end
    end

    it 'correctly reads pixel dimensions' do
      fi = File.open(fixtures_dir + '/dpx/026_FROM_HERO_TAPE_5-3-1_MOV.0029.dpx', 'rb')
      parsed = subject.information_from_io(fi)
      expect(parsed.width_px).to eq(1920)
      expect(parsed.height_px).to eq(1080)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
format_parser-0.1.7 spec/parsers/dpx_parser_spec.rb
format_parser-0.1.6 spec/parsers/dpx_parser_spec.rb
format_parser-0.1.5 spec/parsers/dpx_parser_spec.rb
format_parser-0.1.4 spec/parsers/dpx_parser_spec.rb
format_parser-0.1.3 spec/parsers/dpx_parser_spec.rb
format_parser-0.1.2 spec/parsers/dpx_parser_spec.rb
format_parser-0.1.1 spec/parsers/dpx_parser_spec.rb
format_parser-0.1.0 spec/parsers/dpx_parser_spec.rb