Skip to content

Commit

Permalink
Update src/image.rs
Browse files Browse the repository at this point in the history
Co-authored-by: Alexander Rohde <[email protected]>
  • Loading branch information
ChrisRega and rohdealx committed Mar 1, 2024
1 parent 3769893 commit d685e55
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,19 @@ pub fn compare_paths<P: AsRef<Path>>(
)))?;
let out_path = (nominal_file_name + "diff_image.png").to_string();
let mut result_diff = report::Difference::new_for_file(&nominal_path, &actual_path);
if result.score < config.threshold {
let out_path_set = if let Some(i) = result.image {
let nominal_file_name =
get_file_name(nominal_path.as_ref()).ok_or(Error::FileNameParsing(format!(
"Could not extract filename from path {:?}",
nominal_path.as_ref()
)))?;
let out_path = (nominal_file_name + "diff_image.png").to_string();
i.save(&out_path)?;
Some(out_path)
} else {
None
};

if result.score < config.threshold {
let out_path_set;
Expand Down

0 comments on commit d685e55

Please sign in to comment.