-
-
Notifications
You must be signed in to change notification settings - Fork 59
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
fix: correctly calculate resize metadata when given w & h #524
fix: correctly calculate resize metadata when given w & h #524
Conversation
🦋 Changeset detectedLatest commit: 2e460ef The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov Report
@@ Coverage Diff @@
## main #524 +/- ##
==========================================
- Coverage 94.68% 93.74% -0.95%
==========================================
Files 32 32
Lines 1073 1103 +30
Branches 217 223 +6
==========================================
+ Hits 1016 1034 +18
- Misses 57 69 +12
Flags with carried forward coverage won't be shown. Click here to find out more.
|
For testing, I wonder if you could refactor out the code for calculating dimensions and then just test that part with a unit test. |
@nick-vincent this PR will need a rebase |
I think I found some additional edge cases, so I went ahead and merged this so that I can add tests for all of them together at once |
Thanks for merging this, @benmccann! Feel free to tag me in the follow-up PR. |
Meant to fix #510
There is an additional case not being handled in
resizeTransform
: If bothwidth
ANDheight
are given, but noaspect
.This case is a bit complicated, because the
fit
needs to be considered and possibly used to recalculate all the values:(See Resizing images in the Sharp docs)
I couldn't find anything in resize.spec.ts testing the metadata, any pointers there?
Quick Checklist