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.
This commit is contained in:
dotCooCoo committed 2026-11-27 18:00:50 -08:00
1 parent a996a37bec
commit b3d19b5760
1 file changed
+3 -3
+3 -3
View File
@@ -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()));