-
Notifications
You must be signed in to change notification settings - Fork 378
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
Avoid testing floats for equality in PhotoViewController #135
Conversation
@skyline75489, can you verify whether this approach fixes the issue you reported in #133? If so, I'd prefer this to the two-step comparison you outlined in that issue; this approach seems easier to read. |
if (self.scalingImageView.zoomScale >= self.scalingImageView.maximumZoomScale) { | ||
|
||
if ((self.scalingImageView.zoomScale - self.scalingImageView.maximumZoomScale) >= 0.0) { |
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.
The change looks fine. However commenting out the if clause entirely causes no unit test failures. Expand the test coverage to include this?
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.
That's a good point, but I don't think we have any test coverage for the UIKit
stuff in general so that becomes a much bigger task
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.
@cdzombak I don't think this works. I've been in a situation where self.scalingImageView.zoomScale
is slightly smaller than self.scalingImageView.maximumZoomScale
(well, not really small but strict-float-comparison small). That's why I add the ABS
to deal with it.
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.
@skyline75489 ah, that makes sense. thanks!
👍 |
Avoid testing floats for equality in PhotoViewController
closes #133