WIP: add test_seek
This commit is contained in:
parent
77d4e80eec
commit
633fd4b41c
35
tests/integration_tests/highlevel_api.rs
Normal file
35
tests/integration_tests/highlevel_api.rs
Normal file
@ -0,0 +1,35 @@
|
||||
use super::util::{get_test_asset, spawn_mpv};
|
||||
|
||||
use mpvipc_async::{
|
||||
MpvError, MpvExt, PlaylistAddOptions, PlaylistAddTypeOptions, SeekOptions, Switch,
|
||||
};
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(target_family = "unix")]
|
||||
async fn test_seek() -> Result<(), MpvError> {
|
||||
let (mut proc, mpv) = spawn_mpv(false).await.unwrap();
|
||||
mpv.playlist_add(
|
||||
&get_test_asset("black-background-30s-480p.mp4"),
|
||||
PlaylistAddTypeOptions::File,
|
||||
PlaylistAddOptions::Append,
|
||||
)
|
||||
.await?;
|
||||
|
||||
mpv.set_playback(Switch::On).await?;
|
||||
mpv.set_playback(Switch::Off).await?;
|
||||
|
||||
// TODO: wait for property "seekable" to be true
|
||||
|
||||
mpv.seek(10.0, SeekOptions::Relative).await?;
|
||||
let time_pos: f64 = mpv.get_property("time-pos").await?.unwrap();
|
||||
assert_eq!(time_pos, 10.0);
|
||||
|
||||
mpv.seek(5.0, SeekOptions::Relative).await?;
|
||||
let time_pos: f64 = mpv.get_property("time-pos").await?.unwrap();
|
||||
assert_eq!(time_pos, 15.0);
|
||||
|
||||
mpv.kill().await.unwrap();
|
||||
proc.kill().await.unwrap();
|
||||
|
||||
Ok(())
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
mod event_property_parser;
|
||||
mod highlevel_api;
|
||||
mod misc;
|
||||
mod util;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user