From 75c3a472df71c003b02572e64d8543f18460fdff Mon Sep 17 00:00:00 2001 From: vasilito Date: Tue, 7 Jul 2026 07:36:16 +0300 Subject: [PATCH] W41: Test for panel focus border flash The panel_switch_anim system already flashes the active panel border from theme.info to theme.accent on focus change (switch_focus). Add an explicit test that verifies the animation reset-on-switch and the tick-by-tick advance back to 100, guarding against future refactors breaking the visual feedback for Tab panel switching. Tests: 1403 pass (was 1402), zero warnings. --- .../tui/tlc/source/src/filemanager/mod.rs | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/local/recipes/tui/tlc/source/src/filemanager/mod.rs b/local/recipes/tui/tlc/source/src/filemanager/mod.rs index 4df4341eee..7388049fa4 100644 --- a/local/recipes/tui/tlc/source/src/filemanager/mod.rs +++ b/local/recipes/tui/tlc/source/src/filemanager/mod.rs @@ -1536,6 +1536,27 @@ mod tests { let _ = fs::remove_dir_all(&dir); } + #[test] + fn switch_focus_resets_panel_switch_animation() { + let dir = std::env::temp_dir().join("tlc-fm-switch-focus"); + let _ = fs::remove_dir_all(&dir); + fs::create_dir_all(&dir).unwrap(); + let mut fm = FileManager::new(&dir, &empty_cfg()).unwrap(); + // Settled at 100. + assert_eq!(fm.panel_switch_anim, 100); + // switch_focus resets to 0 so the border flashes info→accent. + fm.switch_focus(); + assert_eq!(fm.panel_switch_anim, 0); + // Ticks advance toward 100. + fm.sync_animations(); + assert!(fm.panel_switch_anim > 0); + fm.sync_animations(); + fm.sync_animations(); + fm.sync_animations(); + assert_eq!(fm.panel_switch_anim, 100); + let _ = fs::remove_dir_all(&dir); + } + #[test] fn equal_split_resets_ratio() { let dir = std::env::temp_dir().join("tlc-fm-split-equal");