Add max_size tests

This commit is contained in:
Andrew 2025-09-23 08:34:27 +12:00
parent 13a0b6ec45
commit 3ec0b8219d
2 changed files with 13 additions and 0 deletions

BIN
tests/files/max_size.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

View file

@ -634,6 +634,19 @@ fn scale_16() {
); );
} }
#[test]
fn max_size() {
let result = oxipng::optimize(
&"tests/files/max_size.png".into(),
&OutFile::None,
&Options {
max_decompressed_size: Some(150_000),
..Options::default()
},
);
assert!(matches!(result, Err(PngError::InflatedDataTooLong(_))));
}
#[test] #[test]
#[cfg(feature = "zopfli")] #[cfg(feature = "zopfli")]
fn zopfli_mode() { fn zopfli_mode() {