Skip to content

Commit

Permalink
Add 3mf test
Browse files Browse the repository at this point in the history
  • Loading branch information
gyscos committed Sep 13, 2024
1 parent ccc247d commit a1e85da
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -557,4 +557,29 @@ mod tests {

assert_ne!(0, size);
}

#[test]
fn cube_3mf() {
let img_filename = "cube-3mf.png".to_string();
let config = Config {
stl_filename: "test_data/cube.3mf".to_string(),
img_filename: img_filename.clone(),
format: image::ImageOutputFormat::Png,
..Default::default()
};

match fs::remove_file(&img_filename) {
Ok(_) => (),
Err(ref error) if error.kind() == ErrorKind::NotFound => (),
Err(_) => {
panic!("Couldn't clean files before testing");
}
}

render_to_file(&config).expect("Error in render function");

let size = fs::metadata(img_filename).expect("No file created").len();

assert_ne!(0, size);
}
}
Binary file added test_data/cube.3mf
Binary file not shown.

0 comments on commit a1e85da

Please sign in to comment.