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

Add "point style" image tests #5629

Merged
merged 2 commits into from Jul 29, 2018

Conversation

simonbrunel
Copy link
Member

We are receiving a few PRs related to the point style, so it could be better to replace the old style canvas "mock" context checks by image based unit tests which are easier to maintain and allow more flexibility in the drawing logic since we are not testing the context calls but the final painted result.

Related to #4811 #5180 #5623

@simonbrunel
Copy link
Member Author

Tests didn't run as smooth as I expected, I think the diff come from border aliasing. Anyone on Linux able to screenshot the image diff errors using gulp unittest --watch?

I don't know if Travis allows to store artifact for each build.

etimberg
etimberg previously approved these changes Jul 9, 2018
@benmccann
Copy link
Contributor

@simonbrunel screenshot attached. It fails for me only on Firefox. All tests pass on Chrome.

I wonder though if you can't see how these are failing if that will make it hard for you to develop going forward? What OS are you on and why doesn't it work there? Do we also need to update the developer documentation to mention this?

screenshot from 2018-07-09 22-56-38

Replace the old style canvas "mock" context checks by image based unit tests which are easier to maintain and allow more flexibility in the drawing logic since we are not testing the context calls but the final painted result.
@simonbrunel
Copy link
Member Author

What OS are you on and why doesn't it work there?

@benmccann Win10 but I think it's due to hardware acceleration which is certainly not available on Travis. If I disable it on my machine, then I get the same results as you posted in your last comment. So one solution would be to explicitly disable hardware acceleration when running unit tests and for everyone (not only on Travis). This could also help on images containing text.

I updated this PR with GPU disabled and new fixture images.

@etimberg @benmccann thoughts?

Do we also need to update the developer documentation to mention this?

If we enforce software rendering, I don't think it's needed. However it would be great to port this comment to the docs, maybe in developers/contributing.

@@ -1,4 +1,6 @@
describe('Chart.controllers.bubble', function() {
describe('auto', jasmine.specsFromFixtures('controller.bubble'));
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason we need this describe block but we don't need anything for the element.point tests?

Copy link
Member Author

Choose a reason for hiding this comment

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

There is the same describe('auto') for element.point. It's used to group all it() generated for each .json in the fixture folder under the same "auto" label, so I think it's better to have it:

image

@benmccann
Copy link
Contributor

Cool! Always disabling the GPU seems like a good solution to me

Explicitly disable hardware acceleration to make image diff more stable when ran on Travis and dev machine.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants