h7x4
650507e680
This brings several changes with it: - `Mpv::get_property` now returns `Option`s in case `data` is nonexistent. There could be cases where this is different from `MpvDataType::Null` and `MpvDataType::MinusOne`. - `MpvError` now implements `PartialEq`
31 lines
791 B
Rust
31 lines
791 B
Rust
use mpvipc::{MpvError, MpvExt};
|
|
|
|
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 version: String = mpv.get_property("mpv-version").await?.unwrap();
|
|
assert!(version.starts_with("mpv"));
|
|
|
|
mpv.kill().await.unwrap();
|
|
proc.kill().await.unwrap();
|
|
|
|
Ok(())
|
|
}
|
|
|
|
#[tokio::test]
|
|
#[cfg(target_family = "unix")]
|
|
async fn test_set_property() -> Result<(), MpvError> {
|
|
let (mut proc, mpv) = spawn_headless_mpv().await.unwrap();
|
|
mpv.set_property("pause", true).await.unwrap();
|
|
let paused: bool = mpv.get_property("pause").await?.unwrap();
|
|
assert!(paused);
|
|
|
|
mpv.kill().await.unwrap();
|
|
proc.kill().await.unwrap();
|
|
|
|
Ok(())
|
|
}
|