mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-12-29 11:30:39 +00:00
gstreamer: Assert that FromValueOptional works as expected
Fails without the preceding patch.
This commit is contained in:
parent
dca2cc1c5d
commit
29710d9970
2 changed files with 25 additions and 0 deletions
|
@ -474,3 +474,18 @@ lazy_static! {
|
|||
pub static ref CAPS_FEATURES_MEMORY_SYSTEM_MEMORY: CapsFeatures =
|
||||
CapsFeatures::new(&[*CAPS_FEATURE_MEMORY_SYSTEM_MEMORY]);
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_from_value_optional() {
|
||||
::init().unwrap();
|
||||
|
||||
let a = glib::value::Value::from(None::<&CapsFeatures>);
|
||||
assert!(a.get::<CapsFeatures>().unwrap().is_none());
|
||||
let b = glib::value::Value::from(&CapsFeatures::new_empty());
|
||||
assert!(b.get::<CapsFeatures>().unwrap().is_some());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -837,4 +837,14 @@ mod tests {
|
|||
|
||||
assert_eq!(a, s.to_string());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_from_value_optional() {
|
||||
::init().unwrap();
|
||||
|
||||
let a = glib::value::Value::from(None::<&Structure>);
|
||||
assert!(a.get::<Structure>().unwrap().is_none());
|
||||
let b = glib::value::Value::from(&Structure::from_string(&"foo").unwrap());
|
||||
assert!(b.get::<Structure>().unwrap().is_some());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue