lib/nakal/base_screen.rb in nakal-0.1.2 vs lib/nakal/base_screen.rb in nakal-1.0.0
- old
+ new
@@ -25,12 +25,15 @@
@image.crop(x_start, y_start, width_to_consider, height_to_consider)
end
end
def compare screen
- diff_img, diff_metric = self.apply_mask.strip.compare_channel(screen.apply_mask.strip, Magick::RootMeanSquaredErrorMetric)
+ @image.fuzz= 5 * Magick::QuantumRange / 100.0
+ total_pixel = @image.rows * @image.columns
+ diff_img, no_of_pixels_mismatch = self.apply_mask.strip.compare_channel(screen.apply_mask.strip, Magick::AbsoluteErrorMetric)
diff_screen = Nakal.current_platform::Screen.new("#{@name}_diff", :none, diff_img)
- return diff_screen, diff_metric
+ percentage_diff = (no_of_pixels_mismatch/total_pixel)*100
+ return diff_screen,percentage_diff
end
def apply_mask
image_mask_params = Nakal.default_crop_params[Nakal.device_name][image_relative_path.gsub("_current", "")]
return self if image_mask_params.nil?