From b727190da5fb29a75c1610da71adb28249c6e4d4 Mon Sep 17 00:00:00 2001 From: Hocuri Date: Thu, 10 Jun 2021 19:17:44 +0200 Subject: [PATCH] test low media quality a little more --- src/blob.rs | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/blob.rs b/src/blob.rs index d13a33343..9f1e41407 100644 --- a/src/blob.rs +++ b/src/blob.rs @@ -952,8 +952,7 @@ mod tests { ) .await .unwrap(); - - assert_correct_rotataion(&img_rotated); + assert_correct_rotation(&img_rotated); let mut bytes = vec![]; img_rotated @@ -970,18 +969,35 @@ mod tests { ) .await .unwrap(); + assert_correct_rotation(&img_rotated); - assert_correct_rotataion(&img_rotated); + let img_rotated = send_image_check_mediaquality( + Some("1"), + &bytes, + BALANCED_IMAGE_SIZE * 1800 / 2000, + BALANCED_IMAGE_SIZE, + 0, + WORSE_IMAGE_SIZE * 1800 / 2000, + WORSE_IMAGE_SIZE, + ) + .await + .unwrap(); + assert_correct_rotation(&img_rotated); let bytes = include_bytes!("../test-data/image/rectangle200x180-rotated.jpg"); let img_rotated = send_image_check_mediaquality(Some("0"), bytes, 200, 180, 270, 180, 200) .await .unwrap(); + assert_correct_rotation(&img_rotated); - assert_correct_rotataion(&img_rotated); + let bytes = include_bytes!("../test-data/image/rectangle200x180-rotated.jpg"); + let img_rotated = send_image_check_mediaquality(Some("1"), bytes, 200, 180, 270, 180, 200) + .await + .unwrap(); + assert_correct_rotation(&img_rotated); } - fn assert_correct_rotataion(img: &DynamicImage) { + fn assert_correct_rotation(img: &DynamicImage) { // The test images are black in the bottom left corner after correctly applying // the EXIF orientation