Tidy some issue tests

This commit is contained in:
Andrew 2023-09-22 14:42:28 +12:00 committed by andrews05
parent b808807198
commit 0b3302316b
2 changed files with 18 additions and 31 deletions

View file

Before

Width:  |  Height:  |  Size: 68 B

After

Width:  |  Height:  |  Size: 68 B

View file

@ -89,36 +89,17 @@ fn issue_29() {
#[test] #[test]
fn issue_42() { fn issue_42() {
let input = PathBuf::from("tests/files/issue_42.png"); let input = "tests/files/issue-42.png";
let (output, mut opts) = get_opts(&input); let (output, mut opts) = get_opts(Path::new(input));
opts.interlace = Some(Interlacing::Adam7); opts.interlace = Some(Interlacing::Adam7);
test_it_converts(
let png = PngData::new(&input, &opts).unwrap(); input,
Some((output, opts)),
assert_eq!(png.raw.ihdr.interlaced, Interlacing::None); GRAYSCALE_ALPHA,
assert_eq!(png.raw.ihdr.color_type, ColorType::GrayscaleAlpha); BitDepth::Eight,
assert_eq!(png.raw.ihdr.bit_depth, BitDepth::Eight); GRAYSCALE_ALPHA,
BitDepth::Eight,
match oxipng::optimize(&InFile::Path(input), &output, &opts) { );
Ok(_) => (),
Err(x) => panic!("{}", x),
};
let output = output.path().unwrap();
assert!(output.exists());
let png = match PngData::new(output, &opts) {
Ok(x) => x,
Err(x) => {
remove_file(output).ok();
panic!("{}", x)
}
};
assert_eq!(png.raw.ihdr.interlaced, Interlacing::Adam7);
assert_eq!(png.raw.ihdr.color_type, ColorType::GrayscaleAlpha);
assert_eq!(png.raw.ihdr.bit_depth, BitDepth::Eight);
remove_file(output).ok();
} }
#[test] #[test]
@ -324,8 +305,14 @@ fn issue_113() {
#[test] #[test]
fn issue_129() { fn issue_129() {
let input = "tests/files/issue-129.png"; test_it_converts(
test_it_converts(input, None, RGB, BitDepth::Eight, INDEXED, BitDepth::Eight); "tests/files/issue-129.png",
None,
RGB,
BitDepth::Eight,
INDEXED,
BitDepth::Eight,
);
} }
#[test] #[test]