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(#8083) #8087

Closed
wants to merge 17 commits into from
Closed

test(#8083) #8087

wants to merge 17 commits into from

Conversation

ShaMan123
Copy link
Contributor

@ShaMan123 ShaMan123 commented Jul 27, 2022

This PR adds visual tests to #8083
Merge only after that is merged.

It has tons of goldens, the only file changed is test/visual/generic_rendering.js
Visuals exposed a bug in strokeMiterLimit calculation.

I think we ought to add other scaling and vpt values

@ShaMan123 ShaMan123 closed this Jul 27, 2022
@luizzappa
Copy link
Contributor

@ShaMan123 As the canvas node has a bug with the stroke miter limit calculation, I created this condesandbox to generate the goldens via browser: https://codesandbox.io/s/generate-goldens-stroke-projection-tcn10x . It generates a zipped file.

I added concave cases to the test too

Since I can't commit to this PR, I commited on the pull_8087 branch of this fork here: https://github.com/luizzappa/fabricjs-project-uniform-stroke/tree/pull_8087

A strange behavior is occurring in the tests...

If I just run the stroke projection module tests, they all pass:
http://127.0.0.1:4000/test/visual/?coverage&moduleId=a40b012b

image

But when I run all modules tests at the same time, some 'stroke projection' tests fail:
http://127.0.0.1:4000/test/visual/?coverage&hidepassed

Analyzing the difference in the images, there is a slight distortion at rectangle edges that doesn't happen when we run all the tests:
image

Zooming:
image

The curious thing is that this distortion is present in goldens and also when we only run the tests of the stroke projection module, so these tests do not fail. But when we run all tests of all modules at the same time, this distortion disappears from the canvas, that makes the test fail. It is as if there is some property from a previous test that is spilling over to the stroke projection test.

@ShaMan123
Copy link
Contributor Author

@luizzappa glad to see you back
Hope you had a great vacation
I will look into your comment tomorrow
And with your permission I will update from master (I have upgraded the test suite so it now generates goldens from the browser without hassle - sorry for the work you put into that, hope it wasn't a time sink)

@luizzappa
Copy link
Contributor

Ah cool! I hadn't seen your update on the generation of goldens (actually now that I've looked at the code more calmly, and I've seen that if the golden doesn't exist, it generates it for you.. I thought they were generated externally)

Feel free to update. I ended up splitting the test into concave and convex cases.

Tomorrow we'll take care of it

@luizzappa
Copy link
Contributor

(I have upgraded the test suite so it now generates goldens from the browser without hassle - sorry for the work you put into that, hope it wasn't a time sink)

@ShaMan123, did this update remain after migrating to typescript? I'm trying to run the tests, but it seems to me that the goldens were generated by node (which has that problem with miter-limit)

image

@ShaMan123
Copy link
Contributor Author

Did you open a new PR?

@luizzappa
Copy link
Contributor

Did you open a new PR?

I was working locally. Just opened it here: #8374

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