lib/capybara/screenshot/diff/image_compare.rb in capybara-screenshot-diff-0.9.1 vs lib/capybara/screenshot/diff/image_compare.rb in capybara-screenshot-diff-0.10.0
- old
+ new
@@ -1,10 +1,12 @@
require 'chunky_png'
module Capybara
module Screenshot
module Diff
+ # Compare two images and determine if they are equal, different, or within som comparison
+ # range considering color values and difference area size.
class ImageCompare
include ChunkyPNG::Color
attr_reader :annotated_new_file_name, :annotated_old_file_name, :new_file_name,
:old_file_name
@@ -19,13 +21,14 @@
@annotated_old_file_name = "#{new_file_name.chomp('.png')}_0.png~"
@annotated_new_file_name = "#{new_file_name.chomp('.png')}_1.png~"
reset
end
+ # Resets the calculated data about the comparison with regard to the "new_image".
+ # Data about the original image is kept.
def reset
@max_color_distance = @color_distance_limit ? 0 : nil
@left = @top = @right = @bottom = nil
- @_old_filesize = nil
end
# Compare the two image files and return `true` or `false` as quickly as possible.
# Return falsish if the old file does not exist or the image dimensions do not match.
def quick_equal?