Panics · P26 Media: live positions and trims peg to the media, gone choices clear, rails with no width and huge waveforms hold, subtitle times refuse overflow
This commit is contained in:
1 parent
829ef681ba
commit
078a2d19d8
14 files changed
+279
-88
No files matched your search
+20
-4
@@ -180,10 +180,11 @@ impl DeviceSelector {
|
||||
/// The device in use, by key.
|
||||
pub fn chosen(mut self, key: impl Into<SharedString>) -> Self {
|
||||
let key = key.into();
|
||||
assert!(
|
||||
self.devices.iter().any(|device| device.key == key),
|
||||
"no device {key}"
|
||||
);
|
||||
if !self.devices.iter().any(|device| device.key == key) {
|
||||
log::error!("device selector: no device {key}; none chosen");
|
||||
self.chosen = None;
|
||||
return self;
|
||||
}
|
||||
self.chosen = Some(key);
|
||||
self
|
||||
}
|
||||
@@ -225,3 +226,18 @@ impl RenderOnce for DeviceSelector {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{Device, DeviceKind, DeviceSelector};
|
||||
|
||||
#[test]
|
||||
fn a_device_gone_from_the_list_leaves_none_chosen() {
|
||||
let device = Device {
|
||||
key: "a".into(),
|
||||
name: "Device a".into(),
|
||||
};
|
||||
let selector = DeviceSelector::new("mics", DeviceKind::Microphone, [device]);
|
||||
assert_eq!(selector.chosen("a").chosen("gone").chosen, None);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user