//! Module-path coverage for client-side H.264 decoder selection. //! //! Scope: include the client decoder selection helper directly. //! Targets: `client/src/video_support.rs`. //! Why: operator decoder overrides should fall back cleanly on machines with //! different GStreamer plugin sets. #[path = "../../client/src/video_support.rs"] mod video_support; use serial_test::serial; use temp_env::with_var; #[test] #[serial] fn decoder_override_accepts_decodebin_without_factory_lookup() { with_var("LESAVKA_H264_DECODER", Some("decodebin"), || { assert_eq!(video_support::pick_h264_decoder(), "decodebin"); }); } #[test] #[serial] fn decoder_override_accepts_buildable_element() { with_var("LESAVKA_H264_DECODER", Some("fakesink"), || { assert_eq!(video_support::pick_h264_decoder(), "fakesink"); }); } #[test] #[serial] fn decoder_override_ignores_blank_or_unknown_values() { with_var("LESAVKA_H264_DECODER", Some(" "), || { assert!(!video_support::pick_h264_decoder().trim().is_empty()); }); with_var("LESAVKA_H264_DECODER", Some("not-a-real-decoder"), || { assert!(!video_support::pick_h264_decoder().trim().is_empty()); }); } #[test] #[serial] #[cfg(coverage)] fn decoder_selection_falls_back_when_no_factory_can_build() { with_var("TEST_DISABLE_H264_DECODER_FACTORY", Some("1"), || { with_var("LESAVKA_H264_DECODER", Some("fakesink"), || { assert_eq!(video_support::pick_h264_decoder(), "decodebin"); }); }); with_var("TEST_FAIL_GST_INIT", Some("1"), || { with_var("LESAVKA_H264_DECODER", None::<&str>, || { assert_eq!(video_support::pick_h264_decoder(), "decodebin"); }); }); }