From 171ae66d7411759d384de8147f5ce9c3a6ae988f Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Mon, 17 Aug 2026 16:27:29 +0000 Subject: [PATCH] Use simulated time in the long typing test (#39026) ## Why The 1,000-character human-like typing test waited on the wall clock after every keypress, making the test unnecessarily slow. ## What changed Advance an injected timestamp by the recommended paste flush delay and flush the paste-burst detector explicitly after each character. This preserves the coverage that slow typing appears directly without creating a paste placeholder, without sleeping between keypresses. GitOrigin-RevId: 0c1beb40283f7d73a381cd221725ab4227c8e233 --- codex-rs/tui/src/bottom_pane/chat_composer.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/codex-rs/tui/src/bottom_pane/chat_composer.rs b/codex-rs/tui/src/bottom_pane/chat_composer.rs index 647d9100a3..29bffa9f13 100644 --- a/codex-rs/tui/src/bottom_pane/chat_composer.rs +++ b/codex-rs/tui/src/bottom_pane/chat_composer.rs @@ -12190,8 +12190,16 @@ mod tests { ); let count = LARGE_PASTE_CHAR_THRESHOLD; // 1000 in current config - let chars: Vec = vec!['z'; count]; - type_chars_humanlike(&mut composer, &chars); + let mut now = Instant::now(); + let step = ChatComposer::recommended_paste_flush_delay(); + for _ in 0..count { + let _ = composer.handle_input_basic_with_time( + KeyEvent::new(KeyCode::Char('z'), KeyModifiers::NONE), + now, + ); + now += step; + let _ = composer.handle_paste_burst_flush(now); + } assert_eq!(composer.draft.textarea.text(), "z".repeat(count)); assert!(composer.draft.pending_pastes.is_empty());