补充 WebP 源图转码测试

验证 WebP 输入可转换为 PNG 上传格式
This commit is contained in:
2026-09-12 10:42:15 +08:00
parent fc2f4b71ce
commit afc9ecbd51
@@ -154,6 +154,18 @@ mod tests {
let png = normalize_source_image_to_png(jpeg).expect("convert jpeg");
assert_eq!(&png[..8], b"\x89PNG\r\n\x1a\n");
}
#[test]
fn converts_webp_source_to_png() {
let image = DynamicImage::ImageRgb8(RgbImage::from_pixel(2, 2, Rgb([0, 128, 255])));
let mut webp = Vec::new();
image
.write_to(&mut Cursor::new(&mut webp), ImageFormat::WebP)
.expect("encode webp");
let png = normalize_source_image_to_png(webp).expect("convert webp");
assert_eq!(&png[..8], b"\x89PNG\r\n\x1a\n");
}
}
pub(super) async fn write_processed_image(