diff --git a/tests/integration_tests/event_property_parser.rs b/tests/integration_tests/event_property_parser.rs index 9eb296c..11f50ec 100644 --- a/tests/integration_tests/event_property_parser.rs +++ b/tests/integration_tests/event_property_parser.rs @@ -115,7 +115,7 @@ async fn graceful_shutdown( #[test(tokio::test)] #[cfg(target_family = "unix")] async fn test_highlevel_event_pause() -> Result<(), MpvError> { - let (proc, mpv) = spawn_headless_mpv().await?; + let (proc, mpv) = spawn_mpv(true).await?; mpv.observe_property(MPV_CHANNEL_ID, "pause").await?; @@ -144,7 +144,7 @@ async fn test_highlevel_event_pause() -> Result<(), MpvError> { #[test(tokio::test)] #[cfg(target_family = "unix")] async fn test_highlevel_event_volume() -> Result<(), MpvError> { - let (proc, mpv) = spawn_headless_mpv().await?; + let (proc, mpv) = spawn_mpv(true).await?; mpv.observe_property(1337, "volume").await?; let events = mpv.get_event_stream().await; @@ -174,7 +174,7 @@ async fn test_highlevel_event_volume() -> Result<(), MpvError> { #[test(tokio::test)] #[cfg(target_family = "unix")] async fn test_highlevel_event_mute() -> Result<(), MpvError> { - let (proc, mpv) = spawn_headless_mpv().await?; + let (proc, mpv) = spawn_mpv(true).await?; mpv.observe_property(1337, "mute").await?; let events = mpv.get_event_stream().await; @@ -202,7 +202,7 @@ async fn test_highlevel_event_mute() -> Result<(), MpvError> { #[test(tokio::test)] #[cfg(target_family = "unix")] async fn test_highlevel_event_duration() -> Result<(), MpvError> { - let (proc, mpv) = spawn_headless_mpv().await?; + let (proc, mpv) = spawn_mpv(true).await?; mpv.observe_property(1337, "duration").await?; diff --git a/tests/integration_tests/misc.rs b/tests/integration_tests/misc.rs index 2f73b71..4f98832 100644 --- a/tests/integration_tests/misc.rs +++ b/tests/integration_tests/misc.rs @@ -5,7 +5,7 @@ use super::*; #[tokio::test] #[cfg(target_family = "unix")] async fn test_get_mpv_version() -> Result<(), MpvError> { - let (mut proc, mpv) = spawn_headless_mpv().await.unwrap(); + let (mut proc, mpv) = spawn_mpv(true).await.unwrap(); let version: String = mpv.get_property("mpv-version").await?.unwrap(); assert!(version.starts_with("mpv")); @@ -18,7 +18,7 @@ async fn test_get_mpv_version() -> Result<(), MpvError> { #[tokio::test] #[cfg(target_family = "unix")] async fn test_set_property() -> Result<(), MpvError> { - let (mut proc, mpv) = spawn_headless_mpv().await.unwrap(); + let (mut proc, mpv) = spawn_mpv(true).await.unwrap(); mpv.set_property("pause", true).await.unwrap(); let paused: bool = mpv.get_property("pause").await?.unwrap(); assert!(paused); @@ -32,7 +32,7 @@ async fn test_set_property() -> Result<(), MpvError> { #[tokio::test] #[cfg(target_family = "unix")] async fn test_get_unavailable_property() -> Result<(), MpvError> { - let (mut proc, mpv) = spawn_headless_mpv().await.unwrap(); + let (mut proc, mpv) = spawn_mpv(true).await.unwrap(); let time_pos = mpv.get_property::("time-pos").await; assert_eq!(time_pos, Ok(None)); @@ -45,7 +45,7 @@ async fn test_get_unavailable_property() -> Result<(), MpvError> { #[tokio::test] #[cfg(target_family = "unix")] async fn test_get_nonexistent_property() -> Result<(), MpvError> { - let (mut proc, mpv) = spawn_headless_mpv().await.unwrap(); + let (mut proc, mpv) = spawn_mpv(true).await.unwrap(); let nonexistent = mpv.get_property::("nonexistent").await; match nonexistent { diff --git a/tests/integration_tests/util.rs b/tests/integration_tests/util.rs index fbedd11..4f218e0 100644 --- a/tests/integration_tests/util.rs +++ b/tests/integration_tests/util.rs @@ -34,7 +34,7 @@ pub fn get_test_asset(file_name: &str) -> String { } #[cfg(target_family = "unix")] -pub async fn spawn_headless_mpv() -> Result<(Child, Mpv), MpvError> { +pub async fn spawn_mpv(headless: bool) -> Result<(Child, Mpv), MpvError> { let socket_path_str = format!("/tmp/mpv-ipc-{}", uuid::Uuid::new_v4()); let socket_path = Path::new(&socket_path_str); @@ -42,8 +42,11 @@ pub async fn spawn_headless_mpv() -> Result<(Child, Mpv), MpvError> { let process_handle = Command::new("mpv") .arg("--no-config") .arg("--idle") - .arg("--no-video") - .arg("--no-audio") + .args(if headless { + vec!["--no-video", "--no-audio"] + } else { + vec![] + }) .arg(format!( "--input-ipc-server={}", &socket_path.to_str().unwrap()