lib/capybara/screenshot/diff/image_compare.rb in capybara-screenshot-diff-0.14.2 vs lib/capybara/screenshot/diff/image_compare.rb in capybara-screenshot-diff-0.15.0

- old
+ new

@@ -9,16 +9,17 @@ include ChunkyPNG::Color attr_reader :annotated_new_file_name, :annotated_old_file_name, :new_file_name, :old_file_name def initialize(new_file_name, old_file_name = nil, dimensions: nil, color_distance_limit: nil, - area_size_limit: nil, shift_distance_limit: nil) + area_size_limit: nil, shift_distance_limit: nil, skip_area: nil) @new_file_name = new_file_name @color_distance_limit = color_distance_limit @area_size_limit = area_size_limit @shift_distance_limit = shift_distance_limit @dimensions = dimensions + @skip_area = skip_area @old_file_name = old_file_name || "#{new_file_name}~" @annotated_old_file_name = "#{new_file_name.chomp('.png')}_0.png~" @annotated_new_file_name = "#{new_file_name.chomp('.png')}_1.png~" reset end @@ -272,9 +273,10 @@ end bottom end def same_color?(old_img, new_img, x, y) + return true if @skip_area && @skip_area[0] <= x && x <= @skip_area[2] && @skip_area[1] <= y && y <= @skip_area[3] color_distance = color_distance_at(new_img, old_img, x, y, shift_distance_limit: @shift_distance_limit) if !@max_color_distance || color_distance > @max_color_distance @max_color_distance = color_distance end