Skip to content

Commit

Permalink
src: settings, stream: Fix VideoSourceLocal constructed in tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
joaoantoniocardoso committed Aug 31, 2022
1 parent 02b8ef1 commit ed5aea0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/settings/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ mod tests {
use crate::stream::types::{
CaptureConfiguration, StreamInformation, VideoCaptureConfiguration,
};
use crate::video::video_source_local::LocalSourceDevice;
use crate::video::{
types::{FrameInterval, VideoEncodeType, VideoSourceType},
video_source_local::{VideoSourceLocal, VideoSourceLocalType},
Expand Down Expand Up @@ -267,7 +268,10 @@ mod tests {
},
video_source: VideoSourceType::Local(VideoSourceLocal {
name: "Fake Potato Test Video Source Camera".into(),
device_path: "/dev/potatovideo".into(),
devices: vec![LocalSourceDevice {
path: "/dev/potatovideo".into(),
encodings: vec![VideoEncodeType::H264],
}],
typ: VideoSourceLocalType::Usb("usb-0420:08:47.42-77".into()),
}),
}];
Expand Down
16 changes: 15 additions & 1 deletion src/stream/stream_backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ fn create_stream(
mod tests {
use super::*;
use crate::stream::types::CaptureConfiguration;
use crate::video::video_source_local::LocalSourceDevice;
use crate::video::{
types::FrameInterval,
video_source_local::{VideoSourceLocal, VideoSourceLocalType},
Expand Down Expand Up @@ -327,11 +328,16 @@ mod tests {
},
video_source: VideoSourceType::Local(VideoSourceLocal {
name: "PotatoCam".into(),
device_path: "/dev/video42".into(),
devices: vec![LocalSourceDevice {
path: "/dev/video42".into(),
encodings: vec![video_encode_type.clone()],
}],
typ: VideoSourceLocalType::Usb("TestPotatoCam".into()),
}),
});

dbg!(&stream);

assert!(stream.is_ok());
stream.unwrap()
}
Expand All @@ -353,6 +359,8 @@ mod tests {
StreamType::UDP(video_stream_udp) => video_stream_udp.pipeline(),
_any_other_stream_type => panic!("Failed to create UDP stream: {stream:?}."),
};
dbg!(&pipeline);
dbg!(&expected_pipeline);
assert_eq!(&pipeline, expected_pipeline);
}
}
Expand All @@ -374,6 +382,8 @@ mod tests {
StreamType::RTSP(video_stream_rtsp) => video_stream_rtsp.pipeline(),
_any_other_stream_type => panic!("Failed to create RTSP stream: {stream:?}."),
};
dbg!(&pipeline);
dbg!(&expected_pipeline);
assert_eq!(&pipeline, expected_pipeline);
}
}
Expand Down Expand Up @@ -463,6 +473,8 @@ mod tests {
StreamType::WEBRTC(video_stream_webrtc) => video_stream_webrtc.pipeline(),
_any_other_stream_type => panic!("Failed to create WebRTC stream: {stream:?}."),
};
dbg!(&pipeline);
dbg!(&expected_pipeline);
assert_eq!(&pipeline, expected_pipeline);
}
}
Expand All @@ -484,6 +496,8 @@ mod tests {
StreamType::WEBRTC(video_stream_webrtc) => video_stream_webrtc.pipeline(),
_any_other_stream_type => panic!("Failed to create WebRTC stream: {stream:?}."),
};
dbg!(&pipeline);
dbg!(&expected_pipeline);
assert_eq!(&pipeline, expected_pipeline);
}
}
Expand Down

0 comments on commit ed5aea0

Please sign in to comment.