From 43fc55e542d282ebbb8e1a815821e1aad51d5f96 Mon Sep 17 00:00:00 2001 From: link2xt Date: Tue, 23 Apr 2024 11:53:00 +0000 Subject: [PATCH] test: test recoding RGBA image --- src/blob.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/blob.rs b/src/blob.rs index 19e09af291..a784062dcb 100644 --- a/src/blob.rs +++ b/src/blob.rs @@ -1205,6 +1205,28 @@ mod tests { .unwrap(); } + /// Tests that RGBA PNG can be recoded into JPEG + /// by dropping alpha channel. + #[tokio::test(flavor = "multi_thread", worker_threads = 2)] + async fn test_recode_image_rgba_png_to_jpeg() { + let bytes = include_bytes!("../test-data/image/screenshot-rgba.png"); + + send_image_check_mediaquality( + Viewtype::Image, + Some("1"), + bytes, + "png", + false, // no Exif + 1920, + 1080, + 0, + constants::WORSE_IMAGE_SIZE, + constants::WORSE_IMAGE_SIZE * 1080 / 1920, + ) + .await + .unwrap(); + } + #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_recode_image_huge_jpg() { let bytes = include_bytes!("../test-data/image/screenshot.jpg");