facebookarchive / ios-snapshot-test-case

Snapshot view unit tests for iOS
MIT License
2.66k stars 253 forks source link

Andrewli/add color tolerance #213

Open thorthugnasty opened 7 years ago

thorthugnasty commented 7 years ago

This change aims to prevent failures caused by inconsistent antialiasing of text, icons, etc. We overload the fb_compareWithImage method with an extra colorTolerance floating point parameter. Now, snapshot tests will not fail when the "euclidean distance" (see code for details) between two pixel's colors are less than the colorTolerance parameter.

facebook-github-bot commented 7 years ago

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks!

If you are contributing on behalf of someone else (eg your employer): the individual CLA is not sufficient - use https://developers.facebook.com/opensource/cla?type=company instead. Contact cla@fb.com if you have any questions.

facebook-github-bot commented 7 years ago

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

jaenthemaen commented 7 years ago

Ran into the same problem and desired solution just yesterday. A merge would be wonderful!

thorthugnasty commented 7 years ago

cc: @nscoding

alanzeino commented 5 years ago

We recently merged a change into the new repo that is similar to this:

https://github.com/uber/ios-snapshot-test-case/commit/8c5bdf35f16bd0bd0a014bba810e89a59bd2d692

I'm not 100% sure if it's the same strategy or not, if it doesn't work for you feel free to PR on the new repo to update the new feature.