This commit is contained in:
Andrew 2023-09-22 14:42:20 +12:00 committed by andrews05
parent 6763eea1e3
commit b808807198
2 changed files with 19 additions and 1 deletions

BIN
tests/files/issue-553.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

View file

@ -4,6 +4,7 @@ use oxipng::*;
use std::fs::remove_file;
use std::path::Path;
use std::path::PathBuf;
use std::sync::Arc;
const GRAYSCALE: u8 = 0;
const RGB: u8 = 2;
@ -30,7 +31,7 @@ fn test_it_converts(
bit_depth_in: BitDepth,
color_type_out: u8,
bit_depth_out: BitDepth,
) {
) -> PngImage {
let input = PathBuf::from(input);
let (output, opts) = custom.unwrap_or_else(|| get_opts(&input));
let png = PngData::new(&input, &opts).unwrap();
@ -71,6 +72,7 @@ fn test_it_converts(
}
remove_file(output).ok();
Arc::try_unwrap(png.raw).unwrap()
}
#[test]
@ -464,3 +466,19 @@ fn issue_426_02() {
BitDepth::One,
);
}
#[test]
fn issue_553() {
let png = test_it_converts(
"tests/files/issue-553.png",
None,
INDEXED,
BitDepth::Eight,
INDEXED,
BitDepth::Eight,
);
match png.ihdr.color_type {
ColorType::Indexed { palette } => assert_eq!(palette.len(), 256),
_ => unreachable!(),
};
}