Sha256: 101035574f09823f89bab3c679f2c4a91c1616d9cea7b91853c28a19935392bf

Contents?: true

Size: 1.52 KB

Versions: 9

Compression:

Stored size: 1.52 KB

Contents

require 'spec_helper'

describe FormatParser::EXIFParser do
  
  # ORIENTATIONS = [
  #   :top_left,
  #   :top_right,
  #   :bottom_right,
  #   :bottom_left,
  #   :left_top,
  #   :right_top,
  #   :right_bottom,
  #   :left_bottom
  # ]

  describe 'is able to correctly parse orientation for all the JPEG EXIF examples from FastImage' do
    Dir.glob(fixtures_dir + '/exif-orientation-testimages/jpg/*.jpg').each do |jpeg_path|
      filename = File.basename(jpeg_path)
      it "is able to parse #{filename}" do
        parser = FormatParser::EXIFParser.new(:jpeg, File.open(jpeg_path, 'rb'))
        parser.scan_image_exif
        expect(parser).not_to be_nil

        expect(parser.orientation).to be_kind_of(Symbol)
        # Filenames in this dir correspond with the orientation of the file
        expect(filename.include?(parser.orientation.to_s)).to be true 
      end
    end
  end

  describe 'is able to correctly parse orientation for all the TIFF EXIF examples from FastImage' do
    Dir.glob(fixtures_dir + '/exif-orientation-testimages/tiff-*/*.tif').each do |tiff_path|
      filename = File.basename(tiff_path)
      it "is able to parse #{filename}" do
        parser = FormatParser::EXIFParser.new(:tiff, File.open(tiff_path, 'rb'))
        parser.scan_image_exif
        expect(parser).not_to be_nil

        expect(parser.orientation).to be_kind_of(Symbol)
        # Filenames in this dir correspond with the orientation of the file
        expect(filename.include?(parser.orientation.to_s)).to be true 
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

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