Skip to content

Commit

Permalink
Merge pull request #34 from VolumeGraphics/update-cargo-deps
Browse files Browse the repository at this point in the history
Update Cargo.toml and bump version to 0.3.0
  • Loading branch information
ChrisRega committed Jun 6, 2023
2 parents 54ba160 + b0b1719 commit 9dba1a0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
run: cargo test --release --verbose
- name: Run check
run: cargo check --verbose
- name: Run clippy
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description = "A flexible rule-based file and folder comparison tool and crate i
repository = "https://github.com/VolumeGraphics/havocompare"
homepage = "https://github.com/VolumeGraphics/havocompare"
documentation = "https://docs.rs/havocompare"
version = "0.3.0-beta1"
version = "0.3.0"
edition = "2021"
license = "MIT"
authors = ["Volume Graphics GmbH"]
Expand All @@ -27,7 +27,7 @@ schemars_derive = "0.8"
thiserror = "1.0"
regex = "1.6"
image = "0.24"
image-compare = "0.3.0-beta1"
image-compare = "0.3.0"
tracing = "0.1"
tracing-subscriber = "0.3"
serde_json = "1.0"
Expand Down
11 changes: 4 additions & 7 deletions src/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use schemars_derive::JsonSchema;
use serde::{Deserialize, Serialize};
use std::path::{Path, PathBuf};
use thiserror::Error;
use tracing::{error, info};
use tracing::error;

#[derive(JsonSchema, Deserialize, Serialize, Debug)]
/// Image comparison config options
Expand Down Expand Up @@ -55,12 +55,9 @@ pub fn compare_paths<P: AsRef<Path>>(
let out_path = (nominal_file_name + "diff_image.png").to_string();

if result.score < config.threshold {
if let Some(color_map) = result.image.as_ref().map(|i| i.to_color_map()) {
info!("Writing diff image to: {}", out_path.as_str());
color_map.save(PathBuf::from(&out_path))?;
} else {
error!("Algorithm did not produce compare-image, so we cannot save it.");
}
let color_map = result.image.to_color_map();
color_map.save(PathBuf::from(&out_path))?;

let error_message = format!(
"Diff for image {} was not met, expected {}, found {}",
nominal_path.as_ref().to_string_lossy(),
Expand Down

0 comments on commit 9dba1a0

Please sign in to comment.