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 21, 2024
1 parent a06e957 commit 4e18e4d
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 4e18e4d

Please sign in to comment.