1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
RSpec.describe Magick::Image, '#profile!' do
it 'works' do
image = described_class.new(20, 20)
profile = described_class.read(IMAGE_WITH_PROFILE).first.color_profile
result = image.profile!('*', nil)
expect(result).to be(image)
expect { image.profile!('icc', profile) }.not_to raise_error
expect { image.profile!('iptc', 'xxx') }.not_to raise_error
expect { image.profile!('icc', nil) }.not_to raise_error
expect { image.profile!('iptc', nil) }.not_to raise_error
expect { image.profile!('test', 'foobarbaz') }.to raise_error(ArgumentError)
image.freeze
expect { image.profile!('icc', 'xxx') }.to raise_error(FrozenError)
expect { image.profile!('*', nil) }.to raise_error(FrozenError)
end
it 'delete exif when nil given as profile' do
image = described_class.read(IMAGE_WITH_PROFILE).first
expect(image.get_exif_by_number).to be_kind_of(Hash)
expect(image.get_exif_by_number(305)).to eq({ 305 => "Adobe Photoshop CS Macintosh" })
image.profile!('*', nil)
blob = image.to_blob
new_image = described_class.from_blob(blob).first
expect(new_image.get_exif_by_number).to eq({})
end
end
|