gstreamer: BusStream tests

This commit is contained in:
Valmir Pretto 2020-01-30 09:30:17 -03:00
parent 7663589d94
commit 6263922b6d
3 changed files with 23 additions and 0 deletions

View file

@ -39,6 +39,7 @@ rustdoc-stripper = { version = "0.1", optional = true }
[dev-dependencies]
ron = "0.5"
serde_json = "1.0"
futures-executor = "0.3.1"
[features]
default = []

View file

@ -312,4 +312,23 @@ mod tests {
_ => unreachable!(),
}
}
#[test]
fn test_bus_stream() {
::init().unwrap();
let bus = Bus::new();
let bus_stream = bus.stream();
let eos_message = ::Message::new_eos().build();
bus.post(&eos_message).unwrap();
let bus_future = bus_stream.into_future();
let (message, _) = futures_executor::block_on(bus_future);
match message.unwrap().view() {
::MessageView::Eos(_) => (),
_ => unreachable!(),
}
}
}

View file

@ -48,6 +48,9 @@ extern crate serde_bytes;
#[macro_use]
extern crate serde_derive;
#[cfg(test)]
extern crate futures_executor;
use glib::translate::{from_glib, from_glib_full};
macro_rules! assert_initialized_main_thread {