Skip to content

Commit

Permalink
feat: expose the image matches for every discrepancy
Browse files Browse the repository at this point in the history
That allows specs to have certain tolerance, while retaining ability to preview the subtle differences
for impact analysis
  • Loading branch information
knarewski committed Nov 22, 2024
1 parent 6674099 commit 5a9cf2c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions spec/support/match_reference_image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,15 @@ def debug_data
diff_path: tmp_diff.path,
tolerance: tolerance)
@normalized_mean_error = comparison.normalized_mean_error
return true if @normalized_mean_error <= tolerance

debug_data.expose_from(reference_path: reference_path,
tested_path: tested_path,
diff_path: tmp_diff.path,
file_type: file_type)
false
if @normalized_mean_error > 0
debug_data.expose_from(reference_path: reference_path,
tested_path: tested_path,
diff_path: tmp_diff.path,
file_type: file_type)
end

@normalized_mean_error <= tolerance
ensure
tmp_diff&.close!
end
Expand Down

0 comments on commit 5a9cf2c

Please sign in to comment.