Skip to content

Commit dfe38fd

Browse files
committed
test(render/animated_figlet_morph): park until process uptime clears the 260ms fade window so render_morph deterministically takes the crossfade-out branch instead of the fade-in path a fast suite would otherwise hit
1 parent d588376 commit dfe38fd

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

‎src/render/animated_figlet_morph.rs‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,16 @@ mod tests {
404404
let body = text_body();
405405
let registry = Registry::with_builtins();
406406
let theme = Theme::default();
407-
let elapsed = elapsed_since_start_ms().max(1);
407+
// The fade-OUT branch only runs once process uptime clears the 260ms fade window;
408+
// before that `render_morph` takes the fade-IN branch instead. Park until uptime is
409+
// past it so this test deterministically exercises the crossfade-out path that a fast
410+
// suite would otherwise skip. Process uptime is monotonic, so once past 320ms a render
411+
// with `phase_len = uptime + 200` is guaranteed to land inside phase 0's fade-out zone.
412+
process_start();
413+
while elapsed_since_start_ms() < 320 {
414+
thread::sleep(Duration::from_millis(20));
415+
}
416+
let elapsed = elapsed_since_start_ms();
408417
let phase_len = elapsed.saturating_add(200);
409418
let duration_ms = phase_len as u64 * DEFAULT_SEQUENCE.len() as u64;
410419
let opts = RenderOptions {

0 commit comments

Comments
 (0)