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.
This commit is contained in:
2026-07-07 07:36:16 +03:00
parent 8de0308b6e
commit 75c3a472df
@@ -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");