Renable caps value-array unit test

This commit is contained in:
Sebastian Dröge 2017-07-28 16:56:27 +01:00
parent 3bc0687025
commit b5d8b44725
2 changed files with 8 additions and 9 deletions

View file

@ -359,6 +359,7 @@ unsafe impl Send for CapsRef {}
mod tests { mod tests {
use super::*; use super::*;
use Fraction; use Fraction;
use Array;
#[test] #[test]
fn test_simple() { fn test_simple() {
@ -371,15 +372,13 @@ mod tests {
("bool", &true), ("bool", &true),
("string", &"bla"), ("string", &"bla"),
("fraction", &Fraction::new(1, 2)), ("fraction", &Fraction::new(1, 2)),
//("array", vec![1.into(), 2.into()].into()), ("array", &Array::new(&[&1, &2])),
], ],
); );
assert_eq!( assert_eq!(
caps.to_string(), caps.to_string(),
"foo/bar, int=(int)12, bool=(boolean)true, string=(string)bla, fraction=(fraction)1/2" "foo/bar, int=(int)12, bool=(boolean)true, string=(string)bla, fraction=(fraction)1/2, array=(int)< 1, 2 >"
); //, \ );
// array=(int)< 1, 2 >"
//);
let s = caps.get_structure(0).unwrap(); let s = caps.get_structure(0).unwrap();
assert_eq!( assert_eq!(
@ -390,8 +389,8 @@ mod tests {
("int", &12), ("int", &12),
("bool", &true), ("bool", &true),
("string", &"bla"), ("string", &"bla"),
("fraction", &Fraction::new(1, 2)) ("fraction", &Fraction::new(1, 2)),
//("array", vec![1.into(), 2.into()].into()), ("array", &Array::new(&[&1, &2])),
], ],
).as_ref() ).as_ref()
); );

View file

@ -457,7 +457,7 @@ impl<'a> FromValueOptional<'a> for Array<'a> {
impl<'a> SetValue for Array<'a> { impl<'a> SetValue for Array<'a> {
unsafe fn set_value(v: &mut Value, a: &Self) { unsafe fn set_value(v: &mut Value, a: &Self) {
for value in a.as_slice() { for value in a.as_slice() {
ffi::gst_value_array_append_and_take_value(v.to_glib_none_mut().0, value.to_glib_full() as *mut _); ffi::gst_value_array_append_value(v.to_glib_none_mut().0, value.to_glib_none().0);
} }
} }
} }
@ -517,7 +517,7 @@ impl<'a> FromValueOptional<'a> for List<'a> {
impl<'a> SetValue for List<'a> { impl<'a> SetValue for List<'a> {
unsafe fn set_value(v: &mut Value, a: &Self) { unsafe fn set_value(v: &mut Value, a: &Self) {
for value in a.as_slice() { for value in a.as_slice() {
ffi::gst_value_list_append_and_take_value(v.to_glib_none_mut().0, value.to_glib_full() as *mut _); ffi::gst_value_list_append_value(v.to_glib_none_mut().0, value.to_glib_none().0);
} }
} }
} }