BlueGit

ict rusty-teams

test(calling): hook arming follows the device track on each OS

Windows Auto never uses the Pulse device track, so should_arm_hook is
false there. The tests now assert that instead of assuming Linux.

metis Joachim Mild · pushed by metis

Authored 2026-11-15 · 2 weeks ago

Hash
dcb909a82ea2b05664f84b1082fda8191106d817
Parent
8a38c07e
1 file changed +9 −12
crates/calling/src/noise_stage.rs +9 −12
@@ -439,10 +439,12 @@ mod tests {
439 439 fn linux_auto_arms_the_hook_and_other_modes_do_not() {
440 440 clear();
441 441 let auto = MicSettings::default();
442 assert!(should_arm_hook(auto, true));
442 // Windows never uses the device track, so Auto stays in MicChain even when
443 // the caller says the device track is outgoing. Linux and macOS arm the hook.
444 assert_eq!(should_arm_hook(auto, true), auto.uses_device_track());
443 445 assert!(!should_arm_hook(auto, false), "MicChain / computer sound");
444 446 apply_for_outgoing(auto, true);
445 assert!(hook_armed());
447 assert_eq!(hook_armed(), auto.uses_device_track());
446 448
447 449 let low = MicSettings {
448 450 noise_suppression: NoiseSuppression::Low,
@@ -496,17 +498,12 @@ mod tests {
496 498 #[test]
497 499 fn hook_and_mic_chain_never_arm_together() {
498 500 let auto = MicSettings::default();
499 // Device track outgoing → hook, no MicChain ml path for Linux Auto.
500 assert!(should_arm_hook(auto, true));
501 assert!(
502 auto.ml_noise_suppression() && auto.uses_device_track(),
503 "Linux Auto: hook owns DeepFilterNet"
504 );
501 // Device track outgoing arms the hook only where Auto stays on Pulse/CoreAudio.
502 assert_eq!(should_arm_hook(auto, true), auto.uses_device_track());
503 assert!(auto.ml_noise_suppression());
504 assert!(auto.uses_device_track_on(false));
505 assert!(!auto.uses_device_track_on(true));
505 506 // Software outgoing → MicChain may run ml, hook stays off.
506 507 assert!(!should_arm_hook(auto, false));
507 assert!(
508 auto.ml_noise_suppression() && !should_arm_hook(auto, false),
509 "software path: MicChain only"
510 );
511 508 }
512 509 }
@@ -439,10 +439,12 @@ mod tests {
439 fn linux_auto_arms_the_hook_and_other_modes_do_not() {
439 fn linux_auto_arms_the_hook_and_other_modes_do_not() {
440 clear();
440 clear();
441 let auto = MicSettings::default();
441 let auto = MicSettings::default();
442 assert!(should_arm_hook(auto, true));
442 // Windows never uses the device track, so Auto stays in MicChain even when
443 // the caller says the device track is outgoing. Linux and macOS arm the hook.
444 assert_eq!(should_arm_hook(auto, true), auto.uses_device_track());
443 assert!(!should_arm_hook(auto, false), "MicChain / computer sound");
445 assert!(!should_arm_hook(auto, false), "MicChain / computer sound");
444 apply_for_outgoing(auto, true);
446 apply_for_outgoing(auto, true);
445 assert!(hook_armed());
447 assert_eq!(hook_armed(), auto.uses_device_track());
446
448
447 let low = MicSettings {
449 let low = MicSettings {
448 noise_suppression: NoiseSuppression::Low,
450 noise_suppression: NoiseSuppression::Low,
@@ -496,17 +498,12 @@ mod tests {
496 #[test]
498 #[test]
497 fn hook_and_mic_chain_never_arm_together() {
499 fn hook_and_mic_chain_never_arm_together() {
498 let auto = MicSettings::default();
500 let auto = MicSettings::default();
499 // Device track outgoing → hook, no MicChain ml path for Linux Auto.
501 // Device track outgoing arms the hook only where Auto stays on Pulse/CoreAudio.
500 assert!(should_arm_hook(auto, true));
502 assert_eq!(should_arm_hook(auto, true), auto.uses_device_track());
501 assert!(
503 assert!(auto.ml_noise_suppression());
502 auto.ml_noise_suppression() && auto.uses_device_track(),
504 assert!(auto.uses_device_track_on(false));
503 "Linux Auto: hook owns DeepFilterNet"
505 assert!(!auto.uses_device_track_on(true));
504 );
505 // Software outgoing → MicChain may run ml, hook stays off.
506 // Software outgoing → MicChain may run ml, hook stays off.
506 assert!(!should_arm_hook(auto, false));
507 assert!(!should_arm_hook(auto, false));
507 assert!(
508 auto.ml_noise_suppression() && !should_arm_hook(auto, false),
509 "software path: MicChain only"
510 );
511 }
508 }
512}
509}