Sha256: b1c17c25542e9b849232a824baac961e395e309822468ef4331f1f2d47b3cb1a
Contents?: true
Size: 1.38 KB
Versions: 1
Compression:
Stored size: 1.38 KB
Contents
require 'spec_helper' describe FormatParser::EXIFParser do let(:subject) do Object.new.tap { |o| o.extend FormatParser::EXIFParser } 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 result = subject.exif_from_tiff_io(File.open(tiff_path, 'rb')) expect(result).not_to be_nil expect(result.orientation_sym).to be_kind_of(Symbol) # Filenames in this dir correspond with the orientation of the file expect(filename).to include(result.orientation_sym.to_s) end end end describe 'IOExt' do it 'supports readbyte' do io = FormatParser::EXIFParser::IOExt.new(StringIO.new('hello')) expect(io.readbyte).to eq(104) end it 'supports getbyte' do io = FormatParser::EXIFParser::IOExt.new(StringIO.new('hello')) expect(io.getbyte).to eq(104) end it 'supports seek modes' do io = FormatParser::EXIFParser::IOExt.new(StringIO.new('hello')) io.seek(1, IO::SEEK_SET) io.seek(1, IO::SEEK_CUR) expect(io.read(1)).to eq('l') io.seek(-1, IO::SEEK_END) expect(io.read(1)).to eq('o') io.seek(1) expect(io.read(1)).to eq('e') end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
format_parser-0.16.1 | spec/parsers/exif_parser_spec.rb |