forked from mirrors/gstreamer-rs
gstreamer: taglist: improve Debug implementation
This commit is contained in:
parent
64c09353b7
commit
0c9158f404
1 changed files with 24 additions and 1 deletions
|
@ -586,7 +586,13 @@ impl Eq for TagList {}
|
||||||
|
|
||||||
impl fmt::Debug for TagListRef {
|
impl fmt::Debug for TagListRef {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
f.debug_tuple("TagList").field(&self.to_string()).finish()
|
let mut debug = f.debug_struct("TagList");
|
||||||
|
|
||||||
|
for (key, value) in self.iter() {
|
||||||
|
debug.field(key, &value);
|
||||||
|
}
|
||||||
|
|
||||||
|
debug.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1353,4 +1359,21 @@ mod tests {
|
||||||
|
|
||||||
format!("{}", TagList::new());
|
format!("{}", TagList::new());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_debug() {
|
||||||
|
crate::init().unwrap();
|
||||||
|
|
||||||
|
let mut tags = TagList::new();
|
||||||
|
assert_eq!(format!("{:?}", tags), "TagList");
|
||||||
|
{
|
||||||
|
let tags = tags.get_mut().unwrap();
|
||||||
|
tags.add::<Title>(&"some title", TagMergeMode::Append);
|
||||||
|
tags.add::<Duration>(&(ClockTime::SECOND * 120), TagMergeMode::Append);
|
||||||
|
}
|
||||||
|
assert_eq!(
|
||||||
|
format!("{:?}", tags),
|
||||||
|
"TagList { title: (gchararray) \"some title\", duration: (guint64) 120000000000 }"
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue