forked from mirrors/gstreamer-rs
gstreamer: BusStream tests
This commit is contained in:
parent
7663589d94
commit
6263922b6d
3 changed files with 23 additions and 0 deletions
|
@ -39,6 +39,7 @@ rustdoc-stripper = { version = "0.1", optional = true }
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
ron = "0.5"
|
ron = "0.5"
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
|
futures-executor = "0.3.1"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
|
|
|
@ -312,4 +312,23 @@ mod tests {
|
||||||
_ => unreachable!(),
|
_ => 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!(),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,9 @@ extern crate serde_bytes;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate serde_derive;
|
extern crate serde_derive;
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
extern crate futures_executor;
|
||||||
|
|
||||||
use glib::translate::{from_glib, from_glib_full};
|
use glib::translate::{from_glib, from_glib_full};
|
||||||
|
|
||||||
macro_rules! assert_initialized_main_thread {
|
macro_rules! assert_initialized_main_thread {
|
||||||
|
|
Loading…
Reference in a new issue