Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: specs for transparency support #31

Merged
merged 3 commits into from
Nov 11, 2024
Merged

test: specs for transparency support #31

merged 3 commits into from
Nov 11, 2024

Conversation

knarewski
Copy link
Contributor

Background
I'm prototyping libvips-based Morandi on a separate branch in hope of improving its memory profile and performance.

Problems
The transparency support is not tested and therefore subject to regressions

Solutions
Add basic test coverage for transparency

Notes

  • I added two test cases, because currently morandi handles transparency differently depending on presence of straighten option
  • The other differently handled option is cropping outside of image boundaries, where the image is currently blended with white; I decided it's sufficient to stay at 2 test cases though to show that the behaviour can be surprising
  • I also expanded visual image matcher to suggest the relevant command when the reference image doesn't exist

Screenshot

image
A screenshot showing the outputs of new specs (and the inconsistency in handling transparency)

…venient

Now it is sufficient to specify a reference name, and the matcher will detect that it does not exist and
suggest an initialisation command
…to .rubocop.yml

.rubocop_todo.yml should not exist, but if it does it should contain only exceptions pending for correction
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.
Copy link
Contributor

@MrLukeSmith MrLukeSmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's an interesting behaviour difference ( although possibly expected, I'm not actually sure what "straighten" should do under the hood 😅 ).

@knarewski
Copy link
Contributor Author

Thanks for review!

I believe it's just an accidental side effect of our implementation of straighten :) . The operation is rotating image by a given angle, then zooming in to fill the entire target area (to avoid leaving black background created in the corners by rotation). We're then "repainting" the relevant part of the zoomed image onto a new image. Perhaps this operation is what applies the transparency instead of stripping it :)

@knarewski knarewski merged commit 1ec2e02 into master Nov 11, 2024
15 checks passed
@knarewski knarewski deleted the test-transparency branch November 11, 2024 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants