Sha256: b17b9b4706edf450b821eb74d20e0865704fdf6ed65e0268743d868eec170c1c

Contents?: true

Size: 1.48 KB

Versions: 14

Compression:

Stored size: 1.48 KB

Contents

require 'spec_helper'

describe FormatParser::TIFFParser do
  describe 'is able to parse all the examples from FastImage' do
    Dir.glob(fixtures_dir + '/TIFF/*.tif').each do |tiff_path|
      it "is able to parse #{File.basename(tiff_path)}" do
        parsed = subject.call(File.open(tiff_path, 'rb'))

        expect(parsed).not_to be_nil
        expect(parsed.nature).to eq(:image)
        expect(parsed.format).to eq(:tif)

        expect(parsed.width_px).to be_kind_of(Integer)
        expect(parsed.width_px).to be > 0

        expect(parsed.height_px).to be_kind_of(Integer)
        expect(parsed.height_px).to be > 0
      end
    end
  end

  describe 'is able to parse all the TIFF exif examples from FastImage' do
    Dir.glob(fixtures_dir + '/exif-orientation-testimages/tiff-*/*.tif').each do |tiff_path|
      it "is able to parse #{File.basename(tiff_path)}" do
        parsed = subject.call(File.open(tiff_path, 'rb'))
        expect(parsed).not_to be_nil

        expect(parsed.orientation).to be_kind_of(Symbol)
        expect(parsed.width_px).to be > 0

        expect(parsed.height_px).to be_kind_of(Integer)
        expect(parsed.height_px).to be > 0
      end
    end
  end

  describe 'is able to return nil when parsing CR2 examples' do
    Dir.glob(fixtures_dir + '/CR2/*.CR2').each do |cr2_path|
      it "is able to return nil when parsing #{File.basename(cr2_path)}" do
        parsed = subject.call(File.open(cr2_path, 'rb'))
        expect(parsed).to be_nil
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
format_parser-0.9.3 spec/parsers/tiff_parser_spec.rb
format_parser-0.9.0 spec/parsers/tiff_parser_spec.rb
format_parser-0.8.0 spec/parsers/tiff_parser_spec.rb
format_parser-0.7.0 spec/parsers/tiff_parser_spec.rb
format_parser-0.6.0 spec/parsers/tiff_parser_spec.rb
format_parser-0.5.2 spec/parsers/tiff_parser_spec.rb
format_parser-0.5.1 spec/parsers/tiff_parser_spec.rb
format_parser-0.5.0 spec/parsers/tiff_parser_spec.rb
format_parser-0.4.0 spec/parsers/tiff_parser_spec.rb
format_parser-0.3.5 spec/parsers/tiff_parser_spec.rb
format_parser-0.3.4 spec/parsers/tiff_parser_spec.rb
format_parser-0.3.3 spec/parsers/tiff_parser_spec.rb
format_parser-0.3.2 spec/parsers/tiff_parser_spec.rb
format_parser-0.3.1 spec/parsers/tiff_parser_spec.rb