diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ae836f..67d3955 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Support for visual image comparison in specs - Automated visual comparison of images in specs, also serving as a record of exact rendering behaviour - Development scripts for performing benchmarks +- Basic test coverage for transparency support ### Changed - Extracted image operations to separate files within a dedicated module diff --git a/spec/fixtures/match-with-transparency.png b/spec/fixtures/match-with-transparency.png new file mode 100644 index 0000000..f9dbf6b Binary files /dev/null and b/spec/fixtures/match-with-transparency.png differ diff --git a/spec/fixtures/reference_images/match-multiple-operations-and-straighten.jpg b/spec/fixtures/reference_images/match-multiple-operations-and-straighten.jpg new file mode 100644 index 0000000..5a53df8 Binary files /dev/null and b/spec/fixtures/reference_images/match-multiple-operations-and-straighten.jpg differ diff --git a/spec/fixtures/reference_images/match-multiple-operations.jpg b/spec/fixtures/reference_images/match-multiple-operations.jpg new file mode 100644 index 0000000..e793f70 Binary files /dev/null and b/spec/fixtures/reference_images/match-multiple-operations.jpg differ diff --git a/spec/morandi_spec.rb b/spec/morandi_spec.rb index af0b734..924590b 100644 --- a/spec/morandi_spec.rb +++ b/spec/morandi_spec.rb @@ -421,6 +421,38 @@ expect(created_file_sizes.sort).to eq(files_in_increasing_quality_order) end end + + context 'with transparent png input' do + let(:file_in) { 'spec/fixtures/match-with-transparency.png' } + let(:options) do + { + 'gamma' => 1.1, + 'fx' => 'sepia', + 'crop' => [10, 2, 600, 840] + } + end + + it 'applies transformations' do + process_image + + expect(File).to exist(file_out) + expect(processed_image_type).to eq('jpeg') + expect(file_out).to match_reference_image('match-multiple-operations') + end + + context 'with straighten option' do + # Tested explicitly, because morandi happens to handle transparency differently when using straighten + let(:options) { super().merge('straighten' => 2) } + + it 'applies transformations' do + process_image + + expect(File).to exist(file_out) + expect(processed_image_type).to eq('jpeg') + expect(file_out).to match_reference_image('match-multiple-operations-and-straighten') + end + end + end end context 'pixbuf processor' do