diff options
author | François Laignel <fengalin@free.fr> | 2022-10-17 20:48:43 +0300 |
---|---|---|
committer | François Laignel <fengalin@mailo.com> | 2022-10-18 13:36:59 +0300 |
commit | 8011eadfd2137b4c21fa8e6dfffe6891cb2be406 (patch) | |
tree | 1db00e75b8cc26362bda0cfc86fd424b27482440 /text/json | |
parent | e66378d2544f9e39acfac18143cfac4afa8ae7ac (diff) |
Use new format constructors
See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1128
Diffstat (limited to 'text/json')
-rw-r--r-- | text/json/tests/json.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/text/json/tests/json.rs b/text/json/tests/json.rs index 1bfe702a..759649b6 100644 --- a/text/json/tests/json.rs +++ b/text/json/tests/json.rs @@ -8,6 +8,8 @@ #![allow(clippy::single_match)] +use gst::prelude::*; + fn init() { use std::sync::Once; static INIT: Once = Once::new(); @@ -31,8 +33,8 @@ fn test_enc() { let buf = { let mut buf = gst::Buffer::from_mut_slice(Vec::from(input)); let buf_ref = buf.get_mut().unwrap(); - buf_ref.set_pts(gst::ClockTime::from_seconds(0)); - buf_ref.set_duration(gst::ClockTime::from_seconds(2)); + buf_ref.set_pts(gst::ClockTime::ZERO); + buf_ref.set_duration(2.seconds()); buf }; @@ -47,7 +49,7 @@ fn test_enc() { let buf = h.pull().expect("Couldn't pull buffer"); assert_eq!(buf.pts(), Some(gst::ClockTime::ZERO)); - assert_eq!(buf.duration(), Some(2 * gst::ClockTime::SECOND)); + assert_eq!(buf.duration(), Some(2.seconds())); let map = buf.map_readable().expect("Couldn't map buffer readable"); assert_eq!( std::str::from_utf8(map.as_ref()), @@ -93,6 +95,6 @@ fn test_parse() { let buf = h.pull().expect("Couldn't pull buffer"); let map = buf.map_readable().expect("Couldn't map buffer readable"); assert_eq!(buf.pts(), Some(gst::ClockTime::ZERO)); - assert_eq!(buf.duration(), Some(2 * gst::ClockTime::SECOND)); + assert_eq!(buf.duration(), Some(2.seconds())); assert_eq!(std::str::from_utf8(map.as_ref()), Ok("{\"foo\":42}")); } |