Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

test: pin the Instant system audio entry to the microphone timeline

Richie McIlroya841eed984bb
diff --git a/crates/verify/src/report.rs b/crates/verify/src/report.rs
index 9ecabe828..c35b36d83 100644
--- a/crates/verify/src/report.rs
+++ b/crates/verify/src/report.rs
@@ -646,14 +646,17 @@ mod tests {
);
}
#[test]
- fn instant_system_offset_expectation_requires_its_exact_signature() {
+ fn instant_system_audio_expectation_requires_the_microphone_timeline() {
let entries = cap_verify_expect::parse(include_str!("../expectations.toml")).unwrap();
let entries: Vec<_> = entries
.iter()
- .filter(|entry| entry.class == "sync-system" && entry.flaky)
+ .filter(|entry| {
+ entry.class == "sync-system" && entry.case == "export/instant/output/mp4/native"
+ })
.collect();
- assert_eq!(entries.len(), 2);
- let metrics = |offset, mic| {
+ assert_eq!(entries.len(), 1);
+ assert!(!entries[0].flaky);
+ let metrics = |offset: f64, mic: f64| {
BTreeMap::from([
("count".into(), cap_verify_expect::Range::at(1.0)),
("offset-ms".into(), cap_verify_expect::Range::at(offset)),
@@ -665,38 +668,20 @@ mod tests {
])
};
let accepts = |metrics: &BTreeMap<String, cap_verify_expect::Range>| {
- entries
- .iter()
- .any(|entry| cap_verify_expect::within(&entry.bound, Some(metrics)).is_ok())
+ cap_verify_expect::within(&entries[0].bound, Some(metrics)).is_ok()
};
- for (offset, mic) in [(-46.1, 13.9), (7.8, 14.5), (-47.1, 13.9), (8.8, 14.5)] {
+ for (offset, mic) in [(14.0, 14.0), (13.3, 13.3), (15.4, 15.0)] {
assert!(accepts(&metrics(offset, mic)));
}
- for (offset, mic) in [
- (-47.2, 13.9),
- (-45.0, 13.9),
- (6.7, 14.5),
- (8.9, 14.5),
- (-25.0, 35.0),
- (-56.0, 4.0),
- (0.0, 14.5),
- ] {
+ // The -60 ms and -6.7 ms mixer modes, and system audio off the mic.
+ for (offset, mic) in [(-46.1, 13.9), (7.8, 14.5), (16.0, 14.5), (14.0, 35.0)] {
assert!(!accepts(&metrics(offset, mic)));
}
- for required in ["mic-offset-ms", "system-minus-mic-ms"] {
- let mut absent = metrics(-46.1, 13.9);
- absent.remove(required);
- assert!(!accepts(&absent));
- }
- for entry in &entries {
- assert!(entry.matches("export/instant/output/mp4/native", "macos"));
+ let mut absent = metrics(14.0, 14.0);
+ absent.remove("system-minus-mic-ms");
+ assert!(!accepts(&absent));
+ for platform in ["macos", "windows", "linux"] {
+ assert!(entries[0].matches("export/instant/output/mp4/native", platform));
}
- assert_eq!(
- entries
- .iter()
- .filter(|entry| entry.matches("export/instant/output/mp4/native", "linux"))
- .count(),
- 1
- );
}
}