Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Report precent difference when using a tolerance #149

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ultramiraculous
Copy link

When using a tolerance, report the % difference to the console on failure + add a key to the NSError with the percent.

I had to refactor the UIImage categories to separate out the part where we calculate the percent difference. As-written it might be a little faster if the images are the same when using a tolerance, because it tries to do memcmp before it calculates the percent.

Fixes #109

CGImageGetBytesPerRow(self.CGImage),
CGImageGetColorSpace(self.CGImage),
(CGBitmapInfo)kCGImageAlphaPremultipliedLast);

Copy link
Contributor

Choose a reason for hiding this comment

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

nice, remove extra line

@nscoding
Copy link
Contributor

so good! Some nit's here and there but thank for working on this.

@ultramiraculous
Copy link
Author

Updated the commit w/ the nits taken care of.

@ultramiraculous
Copy link
Author

Actually I just realized (by noticing a warning I missed) why that float was initialized. The compiler warns that percentDifference may not be initialized (even though it definitely is) down when we format the error string.

@nscoding
Copy link
Contributor

@ultramiraculous yes you are right, 0 will do right?

@ultramiraculous
Copy link
Author

@nscoding, yup I switched it to 0.0 in the last update. Rebasing so the tests pass.

@ghost
Copy link

ghost commented Jul 12, 2016

Thank you for your pull request. As you may know, we require contributors to sign our Contributor License Agreement, and we don't seem to have you on file and listed as active anymore. In order for us to review and merge your code, please email [email protected] with your details so we can update your status.

1 similar comment
@ghost
Copy link

ghost commented Jul 13, 2016

Thank you for your pull request. As you may know, we require contributors to sign our Contributor License Agreement, and we don't seem to have you on file and listed as active anymore. In order for us to review and merge your code, please email [email protected] with your details so we can update your status.

@ultramiraculous
Copy link
Author

@nscoding I completely missed that this PR was still open. You should tell @jamesgpearce the bot is being spammy, but in this case I guess it helped me remember it.

Is it still worthwhile to get this passing?

@ghost ghost added the CLA Signed label Aug 2, 2016
@ghost
Copy link

ghost commented Aug 2, 2016

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants