mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-26 03:21:03 +00:00
gstreamer/serde: Update for glib::Date API changes
This commit is contained in:
parent
3428e5c0c7
commit
03f928ee0c
4 changed files with 12 additions and 12 deletions
|
@ -123,7 +123,7 @@ impl TryFrom<DateTimeVariants> for Date {
|
|||
month,
|
||||
y.try_into()
|
||||
.map_err(|_| glib::bool_error!("Out of range `year` for `Date`"))?,
|
||||
)))
|
||||
)?))
|
||||
}
|
||||
_ => Err(glib::bool_error!(
|
||||
"Incompatible variant for `Date` (expecting \"YMD\")"
|
||||
|
|
|
@ -178,7 +178,7 @@ mod tests {
|
|||
.field("f2", &String::from("bcd"))
|
||||
.field("f3", &123i32)
|
||||
.field("fraction", &Fraction::new(1, 2))
|
||||
.field("date", &Date::new_dmy(19, DateMonth::August, 2019))
|
||||
.field("date", &Date::new_dmy(19, DateMonth::August, 2019).unwrap())
|
||||
.field(
|
||||
"date_time",
|
||||
&DateTime::new(2f32, 2019, 8, 19, 13, 34, 42f64).unwrap(),
|
||||
|
@ -236,7 +236,7 @@ mod tests {
|
|||
("f1", &"abc"),
|
||||
("f2", &"bcd"),
|
||||
("f3", &123),
|
||||
("date", &Date::new_dmy(19, DateMonth::August, 2019)),
|
||||
("date", &Date::new_dmy(19, DateMonth::August, 2019).unwrap()),
|
||||
(
|
||||
"date_time",
|
||||
&DateTime::new(2f32, 2019, 8, 19, 13, 34, 42f64).unwrap()
|
||||
|
@ -258,7 +258,7 @@ mod tests {
|
|||
.field("f2", &"bcd".to_owned())
|
||||
.field("f3", &123i32)
|
||||
.field("fraction", &Fraction::new(1, 2))
|
||||
.field("date", &Date::new_dmy(19, DateMonth::August, 2019))
|
||||
.field("date", &Date::new_dmy(19, DateMonth::August, 2019).unwrap())
|
||||
.field(
|
||||
"date_time",
|
||||
&DateTime::new(2f32, 2019, 8, 19, 13, 34, 42f64).unwrap(),
|
||||
|
|
|
@ -341,7 +341,7 @@ mod tests {
|
|||
tags.add::<Bitrate>(&96_000, TagMergeMode::Append); // u32
|
||||
tags.add::<TrackGain>(&1f64, TagMergeMode::Append); // f64
|
||||
tags.add::<Date>(
|
||||
&glib::Date::new_dmy(28, glib::DateMonth::May, 2018),
|
||||
&glib::Date::new_dmy(28, glib::DateMonth::May, 2018).unwrap(),
|
||||
TagMergeMode::Append,
|
||||
);
|
||||
tags.add::<DateTime>(
|
||||
|
@ -491,7 +491,7 @@ mod tests {
|
|||
);
|
||||
assert_eq!(
|
||||
tags.get_index::<Date>(0).unwrap().get().unwrap(),
|
||||
glib::Date::new_dmy(28, glib::DateMonth::May, 2018)
|
||||
glib::Date::new_dmy(28, glib::DateMonth::May, 2018).unwrap()
|
||||
);
|
||||
assert_eq!(
|
||||
tags.get_index::<DateTime>(0).unwrap().get().unwrap(),
|
||||
|
@ -532,7 +532,7 @@ mod tests {
|
|||
);
|
||||
assert_eq!(
|
||||
tags.get_index::<Date>(0).unwrap().get().unwrap(),
|
||||
glib::Date::new_dmy(28, glib::DateMonth::May, 2018)
|
||||
glib::Date::new_dmy(28, glib::DateMonth::May, 2018).unwrap()
|
||||
);
|
||||
assert_eq!(
|
||||
tags.get_index::<DateTime>(0).unwrap().get().unwrap(),
|
||||
|
@ -561,7 +561,7 @@ mod tests {
|
|||
tags.add::<Bitrate>(&96_000, TagMergeMode::Append); // u32
|
||||
tags.add::<TrackGain>(&1f64, TagMergeMode::Append); // f64
|
||||
tags.add::<Date>(
|
||||
&glib::Date::new_dmy(28, glib::DateMonth::May, 2018),
|
||||
&glib::Date::new_dmy(28, glib::DateMonth::May, 2018).unwrap(),
|
||||
TagMergeMode::Append,
|
||||
);
|
||||
tags.add::<DateTime>(
|
||||
|
|
|
@ -364,7 +364,7 @@ mod tests {
|
|||
let value_12 = Fraction::new(1, 2);
|
||||
let value_str = "test str";
|
||||
let value_str_none: Option<&str> = None;
|
||||
let value_date = Date::new_dmy(19, DateMonth::August, 2019);
|
||||
let value_date = Date::new_dmy(19, DateMonth::August, 2019).unwrap();
|
||||
let value_date_none: Option<Date> = None;
|
||||
|
||||
let array = Array::new(&[
|
||||
|
@ -555,7 +555,7 @@ mod tests {
|
|||
assert!(slice[3].get::<String>().expect("slice[3]").is_none());
|
||||
|
||||
assert_eq!(
|
||||
Date::new_dmy(19, DateMonth::August, 2019),
|
||||
Date::new_dmy(19, DateMonth::August, 2019).unwrap(),
|
||||
slice[4].get::<Date>().expect("slice[4]").unwrap()
|
||||
);
|
||||
|
||||
|
@ -582,7 +582,7 @@ mod tests {
|
|||
assert!(slice[3].get::<String>().expect("slice[3]").is_none());
|
||||
|
||||
assert_eq!(
|
||||
Date::new_dmy(19, DateMonth::August, 2019),
|
||||
Date::new_dmy(19, DateMonth::August, 2019).unwrap(),
|
||||
slice[4].get::<Date>().expect("slice[4]").unwrap()
|
||||
);
|
||||
|
||||
|
@ -628,7 +628,7 @@ mod tests {
|
|||
let value_12 = Fraction::new(1, 2);
|
||||
let value_str = "test str";
|
||||
let value_str_none: Option<&str> = None;
|
||||
let value_date = Date::new_dmy(19, DateMonth::August, 2019);
|
||||
let value_date = Date::new_dmy(19, DateMonth::August, 2019).unwrap();
|
||||
let value_date_none: Option<Date> = None;
|
||||
|
||||
let array = Array::new(&[
|
||||
|
|
Loading…
Reference in a new issue