From b3d19b57603db470dffcf1d1867f76cc08e4522b Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 27 Nov 2026 18:00:50 -0800 Subject: [PATCH] Clipboard: the Wayland pipe tests send with no idle limit a_read_stops_at_its_limit and a_copys_data_is_sent_through_the_pipe_and_closed send more than a pipe holds through a default `Sends`, whose idle limit is the app's 2 s `IDLE_WAIT`. When the test thread took more than 2 s between reads, the send gave up: the first test then got the bytes sent so far instead of the "larger than 2 MiB" error, and the second got only part of the data. Both tests now send through `Sends { idle: LONG, .. }`, as pastes_that_read_nothing_hold_a_few_sends_at_most does, so each send ends when the reader takes the data or closes the pipe. The second test still checks that a default `Sends` uses `IDLE_WAIT`. Every assertion is kept. --- apps/vectorcraft/src/clipboard.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/vectorcraft/src/clipboard.rs b/apps/vectorcraft/src/clipboard.rs index ff7f27dc71..5af8604bea 100644 --- a/apps/vectorcraft/src/clipboard.rs +++ b/apps/vectorcraft/src/clipboard.rs @@ -3123,7 +3123,7 @@ mod wayland { assert_eq!(read_capped(pipe_with(&[0u8; 9], true).0, 8, Duration::ZERO), Err("the clipboard's data is larger than 0 MiB".to_string())); // More than a pipe holds, from an app that is still sending. let (from, to) = std::io::pipe().unwrap(); - assert!(Sends::default().start(to, vec![0u8; (2 << 20) + 1].into())); + assert!(Sends { idle: LONG, ..Sends::default() }.start(to, vec![0u8; (2 << 20) + 1].into())); assert_eq!(read_capped(from, 2 << 20, LONG), Err("the clipboard's data is larger than 2 MiB".to_string())); // A pipe that can't be read: the write end. let (_, to) = std::io::pipe().unwrap(); @@ -3177,8 +3177,8 @@ mod wayland { #[test] fn a_copys_data_is_sent_through_the_pipe_and_closed() { - let sends = Sends::default(); - assert_eq!(sends.idle, IDLE_WAIT); + assert_eq!(Sends::default().idle, IDLE_WAIT); + let sends = Sends { idle: LONG, ..Sends::default() }; let (from, to) = std::io::pipe().unwrap(); let data: Arc<[u8]> = vec![7u8; 300_000].into(); assert!(sends.start(to, data.clone()));