Bind recording controls and status updates to the selected take

This commit is contained in:
omar committed 2026-11-27 10:37:07 +03:00
1 parent 59166106f2
commit 9a518bda66
13 files changed
+773 -190

No files matched your search

+30
View File
@@ -99,6 +99,36 @@ fn cli(args: &[&std::ffi::OsStr]) -> (i32, Value) {
(out.status.code().unwrap(), v)
}
#[test]
fn invalid_recording_commands_leave_destination_and_status_untouched() {
let profile = TempDir::new("recording-protocol");
let destination = profile.0.join("takes");
std::fs::create_dir(&destination).unwrap();
let existing = destination.join("existing.wav");
std::fs::write(&existing, b"previous take").unwrap();
let mut core = Core::start(&profile.0);
for (cmd, args) in [
("recording_start", json!({"directory":destination,"mode":4})),
("recording_stop", json!({"force":true})),
("recording_pause", json!({"track_id":0})),
("recording_resume", json!({"track_id":0})),
("recording_status", json!({"session":0})),
("recording_info", json!({"track_id":0})),
("recording_waveform", json!({"track_id":0,"from_bucket":-1})),
] {
let (reply, events) = core.request(cmd, cmd, args);
assert_eq!(reply["error"]["code"], "bad_request", "{cmd}: {reply}");
assert!(!events.iter().any(|e| e["event"].as_str().is_some_and(|s| s.starts_with("recording_"))), "{cmd}: {events:?}");
}
let (reply, _) = core.request("status", "recording_status", json!({}));
assert_eq!(reply["result"], json!({"isRecording":false,"isPaused":false}));
let (reply, _) = core.request("info", "recording_info", json!({}));
assert_eq!(reply["result"], json!({"isRecording":false}));
core.shutdown();
assert_eq!(std::fs::read(existing).unwrap(), b"previous take");
assert_eq!(std::fs::read_dir(destination).unwrap().count(), 1);
}
#[test]
fn identity_lifecycle_over_stdio() {
let dir = TempDir::new("life");