mirror of
https://github.com/openai/codex.git
synced 2026-10-21 04:41:48 +00:00
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
This commit is contained in:
@@ -12190,8 +12190,16 @@ mod tests {
|
||||
);
|
||||
|
||||
let count = LARGE_PASTE_CHAR_THRESHOLD; // 1000 in current config
|
||||
let chars: Vec<char> = 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());
|
||||
|
||||
Reference in New Issue
Block a user