diff options
Diffstat (limited to 'crates/libmpv2/src/tests.rs')
-rw-r--r-- | crates/libmpv2/src/tests.rs | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/crates/libmpv2/src/tests.rs b/crates/libmpv2/src/tests.rs index 1e7635d..68753fc 100644 --- a/crates/libmpv2/src/tests.rs +++ b/crates/libmpv2/src/tests.rs @@ -8,6 +8,10 @@ // You should have received a copy of the License along with this program. // If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +#![allow(clippy::bool_assert_comparison)] + +use events::EndFileEvent; + use crate::events::{Event, EventContext, PropertyData}; use crate::mpv_node::MpvNode; use crate::*; @@ -33,6 +37,7 @@ fn initializer() { } #[test] +#[ignore = "The required test-data is missing"] fn properties() { let mpv = Mpv::new().unwrap(); mpv.set_property("volume", 0).unwrap(); @@ -77,6 +82,7 @@ macro_rules! assert_event_occurs { } #[test] +#[ignore = "The required test-data is missing"] fn events() { let mpv = Mpv::new().unwrap(); let mut ev_ctx = EventContext::new(mpv.ctx); @@ -115,7 +121,7 @@ fn events() { assert!(ev_ctx.wait_event(3.).is_none()); mpv.command("loadfile", &["test-data/jellyfish.mp4", "append-play"]) .unwrap(); - assert_event_occurs!(ev_ctx, 10., Ok(Event::StartFile)); + assert_event_occurs!(ev_ctx, 10., Ok(Event::StartFile(_))); assert_event_occurs!( ev_ctx, 10., @@ -136,8 +142,15 @@ fn events() { assert_event_occurs!(ev_ctx, 3., Ok(Event::VideoReconfig)); assert_event_occurs!(ev_ctx, 3., Ok(Event::AudioReconfig)); assert_event_occurs!(ev_ctx, 3., Ok(Event::VideoReconfig)); - assert_event_occurs!(ev_ctx, 3., Ok(Event::EndFile(mpv_end_file_reason::Stop))); - assert_event_occurs!(ev_ctx, 3., Ok(Event::StartFile)); + assert_event_occurs!( + ev_ctx, + 3., + Ok(Event::EndFile(EndFileEvent { + reason: EndFileReason::Stop, + .. + })) + ); + assert_event_occurs!(ev_ctx, 3., Ok(Event::StartFile(_))); assert_event_occurs!( ev_ctx, 3., @@ -155,14 +168,22 @@ fn events() { assert_event_occurs!(ev_ctx, 3., Ok(Event::AudioReconfig)); assert_event_occurs!(ev_ctx, 3., Ok(Event::PlaybackRestart)); assert_event_occurs!(ev_ctx, 3., Ok(Event::AudioReconfig)); - assert_event_occurs!(ev_ctx, 10., Ok(Event::EndFile(mpv_end_file_reason::Eof))); + assert_event_occurs!( + ev_ctx, + 10., + Ok(Event::EndFile(EndFileEvent { + reason: EndFileReason::Eof, + .. + })) + ); assert_event_occurs!(ev_ctx, 3., Ok(Event::AudioReconfig)); assert!(ev_ctx.wait_event(3.).is_none()); } #[test] -fn node_map() -> Result<()> { - let mpv = Mpv::new()?; +#[ignore = "This test is missing the `test-data`"] +fn node_map() { + let mpv = Mpv::new().unwrap(); mpv.command( "loadfile", @@ -171,7 +192,7 @@ fn node_map() -> Result<()> { .unwrap(); thread::sleep(Duration::from_millis(250)); - let audio_params = mpv.get_property::<MpvNode>("audio-params")?; + let audio_params = mpv.get_property::<MpvNode>("audio-params").unwrap(); let params = audio_params.map().unwrap().collect::<HashMap<_, _>>(); assert_eq!(params.len(), 5); @@ -190,8 +211,6 @@ fn node_map() -> Result<()> { let channel_count = params.get("channel-count").unwrap(); assert_eq!(channel_count, &MpvNode::Int64(1)); - - Ok(()) } #[test] |