Skip to content

Commit 81658d7

Browse files
committed
Fix callback order in quitting_buffer_size_never_runs_process test
1 parent 50adcd0 commit 81658d7

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎src/tests/processing.rs‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,23 @@ fn quitting_stops_calling_process() {
5656

5757
#[test]
5858
fn quitting_buffer_size_never_runs_process() {
59+
// JACK calls `buffer_size` once before the first `process`. If it quits, `process` must never
60+
// be called.
5961
let (client, _) = crate::Client::new("", crate::ClientOptions::default()).unwrap();
6062
let (send, recv) = std::sync::mpsc::sync_channel(2);
6163
let handler = crate::contrib::ClosureProcessHandler::with_state(
6264
(),
65+
|_, _, _| panic!("buffer_size quit, so process should not be called"),
6366
move |_, _, _| {
64-
send.try_send(true).unwrap();
67+
send.try_send(true).ok();
6568
crate::Control::Quit
6669
},
67-
move |_, _, _| panic!("quit requested, this should not be called"),
6870
);
6971
let ac = client.activate_async((), handler).unwrap();
7072
assert!(recv
7173
.recv_timeout(std::time::Duration::from_secs(1))
7274
.unwrap());
73-
// Give the process handler some time to try to activate.
75+
// Give the process handler some time to try to run.
7476
std::thread::sleep(std::time::Duration::from_millis(500));
7577
ac.deactivate().unwrap();
7678
}

0 commit comments

Comments
 (0)