test(audio): honor platform support in direct-route assertions
cx
This commit is contained in:
3 files changed
+18
-6
No files matched your search
@@ -1211,10 +1211,16 @@ mod tests {
|
||||
audio.backend_type = Some(AudioBackendType::Alsa);
|
||||
audio.output_device = Some("front:CARD=USB,DEV=0".to_string());
|
||||
audio.alsa_plugin = Some(AlsaPlugin::Hw);
|
||||
assert!(uses_alsa_direct_route(&audio));
|
||||
assert_eq!(
|
||||
uses_alsa_direct_route(&audio),
|
||||
cfg!(target_os = "linux")
|
||||
);
|
||||
|
||||
audio.alsa_plugin = Some(AlsaPlugin::PlugHw);
|
||||
assert!(uses_alsa_direct_route(&audio));
|
||||
assert_eq!(
|
||||
uses_alsa_direct_route(&audio),
|
||||
cfg!(target_os = "linux")
|
||||
);
|
||||
|
||||
audio.alsa_plugin = Some(AlsaPlugin::Pcm);
|
||||
assert!(!uses_alsa_direct_route(&audio));
|
||||
|
||||
@@ -234,14 +234,14 @@ mod tests {
|
||||
// hw = the bit-perfect direct path: engine set_volume is a no-op.
|
||||
s.alsa_plugin = Some(AlsaPlugin::Hw);
|
||||
s.alsa_hardware_volume = false;
|
||||
assert!(volume_locked(&s));
|
||||
assert_eq!(volume_locked(&s), cfg!(target_os = "linux"));
|
||||
// ...unless the DAC's own mixer is driven instead.
|
||||
s.alsa_hardware_volume = true;
|
||||
assert!(!volume_locked(&s));
|
||||
// plughw still runs the AlsaDirect engine -> still inert.
|
||||
s.alsa_hardware_volume = false;
|
||||
s.alsa_plugin = Some(AlsaPlugin::PlugHw);
|
||||
assert!(volume_locked(&s));
|
||||
assert_eq!(volume_locked(&s), cfg!(target_os = "linux"));
|
||||
// Pcm opts out of the direct engine (CPAL/rodio) -> software volume.
|
||||
s.alsa_plugin = Some(AlsaPlugin::Pcm);
|
||||
assert!(!volume_locked(&s));
|
||||
|
||||
@@ -3586,14 +3586,20 @@ mod local_tab_order_tests {
|
||||
audio.backend_type = Some(AudioBackendType::Alsa);
|
||||
audio.output_device = Some("front:CARD=USB,DEV=0".to_string());
|
||||
audio.alsa_plugin = Some(AlsaPlugin::Hw);
|
||||
assert!(requires_alsa_direct_unity(&audio));
|
||||
assert_eq!(
|
||||
requires_alsa_direct_unity(&audio),
|
||||
cfg!(target_os = "linux")
|
||||
);
|
||||
|
||||
audio.alsa_hardware_volume = true;
|
||||
assert!(!requires_alsa_direct_unity(&audio));
|
||||
audio.alsa_hardware_volume = false;
|
||||
|
||||
audio.alsa_plugin = Some(AlsaPlugin::PlugHw);
|
||||
assert!(requires_alsa_direct_unity(&audio));
|
||||
assert_eq!(
|
||||
requires_alsa_direct_unity(&audio),
|
||||
cfg!(target_os = "linux")
|
||||
);
|
||||
audio.alsa_plugin = Some(AlsaPlugin::Pcm);
|
||||
assert!(!requires_alsa_direct_unity(&audio));
|
||||
|
||||
|
||||
Reference in new issue
Block a user