lib/capybara/screenshot/diff/image_compare.rb in capybara-screenshot-diff-0.13.1 vs lib/capybara/screenshot/diff/image_compare.rb in capybara-screenshot-diff-0.14.0
- old
+ new
@@ -280,15 +280,11 @@
end
color_matches = color_distance == 0 || (@color_distance_limit && @color_distance_limit > 0 &&
color_distance <= @color_distance_limit)
return color_matches if !@shift_distance_limit || @max_shift_distance == Float::INFINITY
- shift_distance =
- if color_matches
- 0
- else
- shift_distance_at(new_img, old_img, x, y, color_distance_limit: @color_distance_limit)
- end
+ shift_distance = (color_matches && 0) ||
+ shift_distance_at(new_img, old_img, x, y, color_distance_limit: @color_distance_limit)
if shift_distance && (@max_shift_distance.nil? || shift_distance > @max_shift_distance)
@max_shift_distance = shift_distance
end
color_matches
end