Add feature tests for EXIF strip
This commit is contained in:
parent
826b5f715e
commit
cafec3c926
|
@ -86,3 +86,34 @@ Feature: Responsive image generation
|
||||||
When I run Jekyll
|
When I run Jekyll
|
||||||
Then the file "_site/assets/resized/exif-rotation-100x50.jpeg" should exist
|
Then the file "_site/assets/resized/exif-rotation-100x50.jpeg" should exist
|
||||||
Then the file "_site/assets/resized/progressive-100x50.jpeg" should exist
|
Then the file "_site/assets/resized/progressive-100x50.jpeg" should exist
|
||||||
|
|
||||||
|
Scenario: Images should not be stripped of EXIF info by default
|
||||||
|
Given I have a responsive_image configuration with:
|
||||||
|
"""
|
||||||
|
template: _includes/responsive-image.html
|
||||||
|
sizes:
|
||||||
|
- width: 100
|
||||||
|
"""
|
||||||
|
And I have a file "index.html" with:
|
||||||
|
"""
|
||||||
|
{% responsive_image path: assets/exif-rotation.jpeg %}
|
||||||
|
"""
|
||||||
|
When I run Jekyll
|
||||||
|
Then the file "_site/assets/resized/exif-rotation-100x50.jpeg" should exist
|
||||||
|
Then the image "_site/assets/resized/exif-rotation-100x50.jpeg" should have an EXIF orientation
|
||||||
|
|
||||||
|
Scenario: Images can be stripped of EXIF info
|
||||||
|
Given I have a responsive_image configuration with:
|
||||||
|
"""
|
||||||
|
template: _includes/responsive-image.html
|
||||||
|
sizes:
|
||||||
|
- width: 100
|
||||||
|
strip: true
|
||||||
|
"""
|
||||||
|
And I have a file "index.html" with:
|
||||||
|
"""
|
||||||
|
{% responsive_image path: assets/exif-rotation.jpeg %}
|
||||||
|
"""
|
||||||
|
When I run Jekyll
|
||||||
|
Then the file "_site/assets/resized/exif-rotation-100x50.jpeg" should exist
|
||||||
|
Then the image "_site/assets/resized/exif-rotation-100x50.jpeg" should have no EXIF orientation
|
||||||
|
|
|
@ -65,6 +65,18 @@ Then /^the image "(.+)" should be interlaced$/ do |path|
|
||||||
img.destroy!
|
img.destroy!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Then /^the image "(.+)" should have an EXIF orientation$/ do |path|
|
||||||
|
img = Magick::Image::read(path).first
|
||||||
|
assert_not_equal img.orientation.to_i, 0
|
||||||
|
img.destroy!
|
||||||
|
end
|
||||||
|
|
||||||
|
Then /^the image "(.+)" should have no EXIF orientation$/ do |path|
|
||||||
|
img = Magick::Image::read(path).first
|
||||||
|
assert_equal img.orientation.to_i, 0
|
||||||
|
img.destroy!
|
||||||
|
end
|
||||||
|
|
||||||
def write_file(path, contents)
|
def write_file(path, contents)
|
||||||
File.open(path, 'w') do |f|
|
File.open(path, 'w') do |f|
|
||||||
f.write(contents)
|
f.write(contents)
|
||||||
|
|
Loading…
Reference in New Issue