@@ -523,7 +523,9 @@ mod tests {
523523 // crop_y=0.6 → raw y = round(0.6 * 5) = 3 (odd).
524524 // For I420 the origin must be rounded down to even: (2, 2).
525525 let result = compute_src_crop ( 10 , 10 , 0.6 , 0.6 , 2.0 , PixelFormat :: I420 ) ;
526- let ( x, y, w, h) = result. expect ( "I420 crop should succeed" ) ;
526+ let Some ( ( x, y, w, h) ) = result else {
527+ panic ! ( "I420 crop should return Some" ) ;
528+ } ;
527529 assert_eq ! ( x % 2 , 0 , "I420 crop x must be even, got {x}" ) ;
528530 assert_eq ! ( y % 2 , 0 , "I420 crop y must be even, got {y}" ) ;
529531 assert_eq ! ( w, 5 ) ;
@@ -534,7 +536,9 @@ mod tests {
534536 fn compute_src_crop_aligns_odd_origin_for_nv12 ( ) {
535537 // Same geometry as above but with NV12.
536538 let result = compute_src_crop ( 10 , 10 , 0.6 , 0.6 , 2.0 , PixelFormat :: Nv12 ) ;
537- let ( x, y, w, h) = result. expect ( "NV12 crop should succeed" ) ;
539+ let Some ( ( x, y, w, h) ) = result else {
540+ panic ! ( "NV12 crop should return Some" ) ;
541+ } ;
538542 assert_eq ! ( x % 2 , 0 , "NV12 crop x must be even, got {x}" ) ;
539543 assert_eq ! ( y % 2 , 0 , "NV12 crop y must be even, got {y}" ) ;
540544 assert_eq ! ( w, 5 ) ;
@@ -545,7 +549,9 @@ mod tests {
545549 fn compute_src_crop_preserves_odd_origin_for_rgba ( ) {
546550 // For RGBA8 there is no chroma subsampling — odd origins are fine.
547551 let result = compute_src_crop ( 10 , 10 , 0.6 , 0.6 , 2.0 , PixelFormat :: Rgba8 ) ;
548- let ( x, y, _, _) = result. expect ( "RGBA crop should succeed" ) ;
552+ let Some ( ( x, y, _, _) ) = result else {
553+ panic ! ( "RGBA crop should return Some" ) ;
554+ } ;
549555 assert_eq ! ( x, 3 , "RGBA crop x should remain 3 (odd is fine)" ) ;
550556 assert_eq ! ( y, 3 , "RGBA crop y should remain 3 (odd is fine)" ) ;
551557 }
@@ -555,7 +561,9 @@ mod tests {
555561 // When the raw origin is already even, alignment is a no-op.
556562 // crop_x=0.0 → x = 0 (even), crop_y=0.0 → y = 0 (even).
557563 let result = compute_src_crop ( 10 , 10 , 0.0 , 0.0 , 2.0 , PixelFormat :: I420 ) ;
558- let ( x, y, _, _) = result. expect ( "I420 even-origin crop should succeed" ) ;
564+ let Some ( ( x, y, _, _) ) = result else {
565+ panic ! ( "I420 even-origin crop should return Some" ) ;
566+ } ;
559567 assert_eq ! ( x, 0 ) ;
560568 assert_eq ! ( y, 0 ) ;
561569 }
0 commit comments