mirror of
https://github.com/storytold/soundcraft.git
synced 2026-10-26 19:46:47 -06:00
Opening, creating, closing or reverting a session in the middle of a take dropped the recorder: the take was written to disk but never added to any session. Quitting mid-take did the same, and on_exit didn't finish the take either. New, Open, Close, Revert and Quit now wait for the take: the engine refuses them with "stop recording first", and their menu items are greyed out while recording, as is Recover in the recovery window. Any exit that still happens mid-take (closing the window, the system quitting the app, a remote quit) finishes the take first and keeps the session, take included, in the autosave folder for the next launch.
22 lines
815 B
Rust
22 lines
815 B
Rust
//! A take being recorded is never replaced or quit away from.
|
|
use serde_json::json;
|
|
use soundcraft_engine::{Engine, EngineError};
|
|
|
|
#[test]
|
|
fn nothing_replaces_or_quits_a_session_while_it_records() {
|
|
let mut e = Engine::default();
|
|
e.transport.recording = true;
|
|
for (id, params) in [
|
|
("session.new", json!({})),
|
|
("session.open", json!({"path": "Song.scraft"})),
|
|
("session.close", json!({})),
|
|
("session.revert", json!({})),
|
|
("app.quit", json!({})),
|
|
] {
|
|
assert!(matches!(e.execute(id, ¶ms), Err(EngineError::Disabled(_, why)) if why == "stop recording first"), "{id}");
|
|
}
|
|
assert!(e.execute("track.new", &json!({})).is_ok(), "editing goes on");
|
|
e.transport.recording = false;
|
|
assert!(e.execute("session.close", &json!({})).is_ok());
|
|
}
|