-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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(Object): Fix detection of falsy shadows in Object.needsItsOwnCache method #9469
fix(Object): Fix detection of falsy shadows in Object.needsItsOwnCache method #9469
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just gave a quick glance
Good catch!
Regarding the fix, I suggest extracting all the shadow undefined to a standalone PR, and rebasing this PR ontop of that or the other way around.
I am speaking on behalf of @asturur I am sure.
The fix itself can be simplified regardless to accomadate both undefined/null
Regarding the test, I don't see it runs in node , follow the template e2e/tests/template-with-node
regardless I agree shadow should be undefined and not null |
yes shadow null is weird, let's fix it counting that one day the shadow type will be just an optional, so let's use the But i can't see why this PR balooned up to 30 changed files, let me read everything slowly |
There is a reason why i don't want the visual test and i ll try to be exhaustive. There are testing related reasons first. The bug is that the check on shadow was done on typeof shadow === 'object' and null is an object, so shadow or not shadow was always true. The bug is that the function
returns true when it shouldn't and so i would like to test this. so we need to make an object, any, it doesn't have to be text, and test the output of this function, possibly with a description. describe('needsItsOwnCache', () => {
it('return false for default values', () => {
const rect = new Rect({ width: 100, height: 100 }):
epxect(rect.needsItsOwnCache()).toBe(false);
});
it('return true when a clipPath is present', () => {
...
});
it('return true when paintFirst is stroke and there is a shadow', () => {
...
});
it('return false when paintFirst is stroke and there is no shadow', () => {
...
});
it('any other relevant cases', () => {
...
});
}) On top of this, there are other reasons why i don't think an e2e test is a good idea for this:
I m sorry you made a 30 files PR and i m asking you to go back to a one line PR + a jest test. Then if you want to open a following PR for the type change across files that is fine by me, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i left in a comment the reason for requesting changes
107663d
to
d84ca40
Compare
- Also move qunit tests to jest for needsItsOwnCache
@asturur Understood about the reasons and I appreciate the insight. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After reading comments by @asturur I also agree
Also I would add a test case of paintFirst = fill
You could/should use it.each
since all cases do the same and vary in params
@gloriousjob good job! thanks |
Motivation
@closes #9390
Description
Fix blur that can happen when zooming in on text. This is due to incorrect caching that should refresh instead.
Changes
Update shadow on Objects to have undefined instead of null. Also fix cache check to check for not undefined rather than typeof.
Changing to undefined required having to change several tests which were expecting null and also to use an actual JSON object rather than a parsed string (string parse does not support undefined).
Utilized playwright to have an image compare for the test. I tried reverting the code and saw that it had a 0.02 diff so I used 0.01 to ensure it failed if the old code was present.