about summary refs log tree commit diff stats
path: root/crates/libmpv2/src/tests.rs
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-10-14 20:59:32 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-10-14 21:02:12 +0200
commitbaffdf885aab7490e1024a73f8ee3ce35817c586 (patch)
treec2775b605b27cf9293dfdd2e2b933f5c3def26d8 /crates/libmpv2/src/tests.rs
parentbuild(scripts/mkdb.sh): Update to use new sql schema path (diff)
downloadyt-baffdf885aab7490e1024a73f8ee3ce35817c586.tar.gz
yt-baffdf885aab7490e1024a73f8ee3ce35817c586.zip
test(treewide): Fix, so they compile and ignore
The tests are just not in an ideal state right now. Running them via
`cargo test` still works, but the `yt_dlp` test simply seem to deadlock?
Diffstat (limited to '')
-rw-r--r--crates/libmpv2/src/tests.rs37
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]