From 2c3f3894dd24b1ee75349292ffe1d94dd2d431fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Fri, 9 Oct 2026 05:55:06 -0400 Subject: [PATCH] ElyShow: the large-layer test checks the shape lands past the first piece (R2.20) --- crates/ely-lok/src/client/tests/motion.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crates/ely-lok/src/client/tests/motion.rs b/crates/ely-lok/src/client/tests/motion.rs index f1b5b54..8d21dfc 100644 --- a/crates/ely-lok/src/client/tests/motion.rs +++ b/crates/ely-lok/src/client/tests/motion.rs @@ -253,6 +253,16 @@ fn a_layer_larger_than_one_frame_arrives_in_pieces() { let bytes = w as usize * h as usize * 4; assert!(bytes > crate::ipc::MAX_FRAME, "one layer of {bytes} bytes"); assert!(layers.list.iter().all(|layer| layer.pixels.len() == bytes), "every layer arrives whole"); + // The rectangle lands where the kernel put it. + let objects = show::objects(&worker.values(&doc, show::OBJECTS).expect("reads")).expect("parses"); + let shape = objects.objects.iter().find(|o| o.selected).expect("the new rectangle"); + let want = ((shape.rect.1 + shape.rect.3 / 2) as f64 / 120000.0 * f64::from(h)) as usize; + let row = |layer: &show::Layer, y: usize| layer.pixels[y * w as usize * 4..(y + 1) * w as usize * 4].chunks(4).any(|px| px[3] != 0); + let inked = |layer: &show::Layer| (0..h as usize).filter(|y| row(layer, *y)).collect::>(); + assert!(want > 16 * 1024 * 1024 / (w as usize * 4), "the shape lies past the first piece"); + let around = want - 20..want + 20; + let found = layers.list.iter().map(inked).any(|rows| around.clone().all(|y| rows.contains(&y)) && rows.len() < h as usize); + assert!(found, "no layer inks rows {around:?}"); } #[test]