Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

test: fix Windows recording harness compilation

Richie McIlroyfa3c3af435f0
diff --git a/crates/recording/src/feeds/microphone.rs b/crates/recording/src/feeds/microphone.rs
index 16ca756f3..cef3f91aa 100644
--- a/crates/recording/src/feeds/microphone.rs
+++ b/crates/recording/src/feeds/microphone.rs
@@ -4022,9 +4022,7 @@ mod recording_reconnect_ownership_tests {
#[cfg(all(test, windows))]
mod recording_subscription_tests {
use super::*;
- use crate::output_pipeline::{
- AudioFrame, AudioMuxer, Muxer, OutputPipeline, TaskPool, new_health_channel,
- };
+ use crate::output_pipeline::{AudioFrame, AudioMuxer, Muxer, OutputPipeline, TaskPool};
fn config() -> SupportedStreamConfig {
SupportedStreamConfig::new(
@@ -4078,7 +4076,7 @@ mod recording_subscription_tests {
fn attach(subscription: Arc<RecordingSubscription>) -> AttachRecordingSubscription {
let (sender, _receiver) = flume::bounded(4);
- let (health_tx, _health_rx) = new_health_channel();
+ let (health_tx, _health_rx) = tokio::sync::mpsc::channel(4);
AttachRecordingSubscription {
subscription,
sender,
diff --git a/crates/recording/src/output_pipeline/core.rs b/crates/recording/src/output_pipeline/core.rs
index e6dff0223..a9ac1ac20 100644
--- a/crates/recording/src/output_pipeline/core.rs
+++ b/crates/recording/src/output_pipeline/core.rs
@@ -8572,7 +8572,9 @@ mod build_scope_tests {
.await
.unwrap();
probe.cancel.cancel();
- let error = pipeline.stop().await.unwrap_err();
+ let Err(error) = pipeline.stop().await else {
+ panic!("video stop should fail");
+ };
assert!(format!("{error:#}").contains("video stop fault"));
assert_eq!(probe.alive.load(Ordering::Acquire), 0);
}
@@ -8704,9 +8706,12 @@ mod build_scope_tests {
});
ready.await.unwrap();
assert!(!task.is_finished());
+ assert!(scope.idle_report().is_none());
release.send(()).unwrap();
let error = task.await.unwrap().unwrap_err();
assert!(format!("{error:#}").contains("StartCapture failed"));
+ let report = scope.idle_report().expect("cleanup should be joined");
+ assert!(report.quiescent);
}
#[tokio::test]
diff --git a/crates/recording/src/studio_recording.rs b/crates/recording/src/studio_recording.rs
index ba920a8d9..02d47394d 100644
--- a/crates/recording/src/studio_recording.rs
+++ b/crates/recording/src/studio_recording.rs
@@ -4158,7 +4158,7 @@ mod tests {
recording_dir: temp.path().to_owned(),
terminal: Arc::new(WindowsStudioTerminal::default()),
actor_ref: actor_ref.clone(),
- capture_target: ScreenCaptureTarget::CameraOnly,
+ capture_target: screen_capture::ScreenCaptureTarget::CameraOnly,
done_fut,
};
let report = handle.stop_with_intent(StudioStopIntent::Preserve).await;
@@ -4260,7 +4260,7 @@ mod tests {
recording_dir.join("content/segments"),
recording_dir.join("content/cursors"),
RecordingBaseInputs {
- capture_target: ScreenCaptureTarget::CameraOnly,
+ capture_target: screen_capture::ScreenCaptureTarget::CameraOnly,
capture_system_audio: false,
mic_feed: None,
camera_feed: None,
@@ -4310,12 +4310,11 @@ mod tests {
let (actor, screen_tx) = failing_requested_actor(temp.path(), role).await;
let completion = actor.completion_tx.subscribe();
let actor = Actor::spawn(actor);
- let result = if cancel {
- actor.ask(Cancel).await
+ if cancel {
+ assert!(actor.ask(Cancel).await.is_err());
} else {
- actor.ask(Stop).await.map(|_| ())
- };
- assert!(result.is_err());
+ assert!(actor.ask(Stop).await.is_err());
+ }
assert!(completion.borrow().as_ref().is_some_and(Result::is_err));
assert!(matches!(
RecordingMeta::load_for_project(temp.path())
@@ -4349,7 +4348,7 @@ mod tests {
recording_dir: temp.path().to_owned(),
terminal: Arc::new(WindowsStudioTerminal::default()),
actor_ref: actor_ref.clone(),
- capture_target: ScreenCaptureTarget::CameraOnly,
+ capture_target: screen_capture::ScreenCaptureTarget::CameraOnly,
done_fut,
};
let report = handle.stop_with_intent(first).await;
@@ -4502,7 +4501,7 @@ mod windows_cancel_tests {
PathBuf::new(),
PathBuf::new(),
RecordingBaseInputs {
- capture_target: ScreenCaptureTarget::CameraOnly,
+ capture_target: screen_capture::ScreenCaptureTarget::CameraOnly,
capture_system_audio: false,
mic_feed: None,
camera_feed: None,