diff --git a/tests/files/max_size.png b/tests/files/max_size.png new file mode 100644 index 00000000..7c7f12ce Binary files /dev/null and b/tests/files/max_size.png differ diff --git a/tests/flags.rs b/tests/flags.rs index de6afbde..ca2f9766 100644 --- a/tests/flags.rs +++ b/tests/flags.rs @@ -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] #[cfg(feature = "zopfli")] fn zopfli_mode() {