2015-12-27 05:11:05 +11:00
|
|
|
Feature: Responsive image generation
|
|
|
|
Scenario: Resizing images
|
|
|
|
Given I have a responsive_image configuration with:
|
|
|
|
"""
|
|
|
|
template: _includes/responsive-image.html
|
|
|
|
sizes:
|
|
|
|
- width: 100
|
|
|
|
"""
|
2016-09-02 17:53:29 +10:00
|
|
|
And I have a file "index.html" with "{% responsive_image path: assets/everybody-loves-jalapeño-pineapple-cornbread.png alt: Foobar %}"
|
2015-12-27 05:11:05 +11:00
|
|
|
When I run Jekyll
|
2016-09-02 17:53:29 +10:00
|
|
|
Then the image "assets/resized/everybody-loves-jalapeño-pineapple-cornbread-100x50.png" should have the dimensions "100x50"
|
2016-09-26 05:23:06 +10:00
|
|
|
And the file "_site/assets/resized/everybody-loves-jalapeño-pineapple-cornbread-100x50.png" should exist
|
2015-12-27 05:11:05 +11:00
|
|
|
|
|
|
|
Scenario: Handling subdirectories
|
|
|
|
Given I have a responsive_image configuration with:
|
|
|
|
"""
|
|
|
|
template: _includes/responsive-image.html
|
2015-12-28 09:41:04 +11:00
|
|
|
output_path_format: assets/resized/%{dirname}/%{filename}-%{width}.%{extension}
|
2015-12-27 05:11:05 +11:00
|
|
|
sizes:
|
|
|
|
- width: 100
|
|
|
|
"""
|
|
|
|
And I have a file "index.html" with:
|
|
|
|
"""
|
2016-09-02 17:53:29 +10:00
|
|
|
{% responsive_image path: assets/everybody-loves-jalapeño-pineapple-cornbread.png %}
|
2015-12-27 05:11:05 +11:00
|
|
|
{% responsive_image path: assets/subdir/test.png %}
|
2016-09-02 17:53:29 +10:00
|
|
|
{% responsive_image path: assets/everybody-loves-jalapeño-pineapple-cornbread.png cache: true %}
|
2015-12-27 05:11:05 +11:00
|
|
|
"""
|
|
|
|
When I run Jekyll
|
2016-09-02 17:53:29 +10:00
|
|
|
Then the file "assets/resized/everybody-loves-jalapeño-pineapple-cornbread-100.png" should exist
|
2016-09-26 05:23:06 +10:00
|
|
|
And the file "_site/assets/resized/everybody-loves-jalapeño-pineapple-cornbread-100.png" should exist
|
2015-12-28 09:41:04 +11:00
|
|
|
And the file "assets/resized/subdir/test-100.png" should exist
|
2016-09-26 05:23:06 +10:00
|
|
|
And the file "_site/assets/resized/subdir/test-100.png" should exist
|
|
|
|
|
2016-12-28 21:14:13 +11:00
|
|
|
Scenario: Honouring source image interlace mode
|
|
|
|
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/progressive.jpeg %}"
|
|
|
|
When I run Jekyll
|
|
|
|
Then the image "assets/resized/progressive-100x50.jpeg" should be interlaced
|
|
|
|
|
2016-09-26 05:23:06 +10:00
|
|
|
Scenario: Honouring Jekyll 'source' configuration
|
2016-09-28 04:59:35 +10:00
|
|
|
Given I have copied my site to "my-site-copy/src"
|
2016-09-26 05:23:06 +10:00
|
|
|
And I have a configuration with:
|
|
|
|
"""
|
2016-09-28 04:59:35 +10:00
|
|
|
source: my-site-copy/src
|
2016-09-26 05:23:06 +10:00
|
|
|
responsive_image:
|
2016-10-12 07:21:11 +11:00
|
|
|
base_path: assets
|
2016-09-26 05:23:06 +10:00
|
|
|
template: _includes/responsive-image.html
|
2016-09-28 04:59:35 +10:00
|
|
|
output_path_format: assets/resized/%{dirname}/%{width}/%{basename}
|
2016-09-26 05:23:06 +10:00
|
|
|
sizes:
|
|
|
|
- width: 100
|
|
|
|
"""
|
2016-09-28 04:59:35 +10:00
|
|
|
And I have a file "my-site-copy/src/index.html" with "{% responsive_image path: assets/subdir/test.png %}"
|
2016-09-26 05:23:06 +10:00
|
|
|
When I run Jekyll
|
2016-10-12 07:21:11 +11:00
|
|
|
Then the image "my-site-copy/src/assets/resized/subdir/100/test.png" should have the dimensions "100x50"
|
|
|
|
And the file "_site/assets/resized/subdir/100/test.png" should exist
|
2017-03-13 01:14:53 +11:00
|
|
|
|
|
|
|
Scenario: Images can be auto-rotated based on EXIF rotation
|
|
|
|
Given I have a responsive_image configuration with:
|
|
|
|
"""
|
|
|
|
template: _includes/responsive-image.html
|
|
|
|
sizes:
|
|
|
|
- width: 100
|
|
|
|
auto_rotate: 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-100x200.jpeg" should exist
|
|
|
|
|
|
|
|
Scenario: Images aren't auto-rotated 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 %}
|
|
|
|
{% responsive_image path: assets/progressive.jpeg %}
|
|
|
|
"""
|
|
|
|
When I run Jekyll
|
|
|
|
Then the file "_site/assets/resized/exif-rotation-100x50.jpeg" should exist
|
|
|
|
Then the file "_site/assets/resized/progressive-100x50.jpeg" should exist
|
2018-01-19 12:13:21 +11:00
|
|
|
|
|
|
|
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
|