Sha256: 04c901c50290bb5fafc56f4f8024e406b30f9428b9073884e8eaabab00a4c29a

Contents?: true

Size: 1.52 KB

Versions: 1

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

1 entries across 1 versions & 1 rubygems

Version Path
format_parser-0.3.0 spec/parsers/exif_parser_spec.rb