Skip to content

Commit

Permalink
test: include specs for processing transparent images
Browse files Browse the repository at this point in the history
The match image was created using Gimp and Smoke Brushes attributed to webdesignerlab.com
and downloaded from myphotoshopbrushes.com . Brush was licensed free of charge for personal/commercial
use with no attribution required.
  • Loading branch information
knarewski committed Nov 11, 2024
1 parent 6176a6d commit 1ec2e02
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Binary file added spec/fixtures/match-with-transparency.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions spec/morandi_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1ec2e02

Please sign in to comment.