T5.1.1: PriorityMode default = AudioFirst, QualityProfile backward-compat JSON, SetPriorityMode roundtrip
This commit is contained in:
@@ -1274,6 +1274,7 @@ pub enum HangupReason {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::PriorityMode;
|
||||
|
||||
#[test]
|
||||
fn quality_report_from_path_stats_basic() {
|
||||
@@ -2788,4 +2789,26 @@ mod tests {
|
||||
_ => panic!("wrong variant"),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn set_priority_mode_roundtrip() {
|
||||
let original = SignalMessage::SetPriorityMode {
|
||||
version: 1,
|
||||
mode: PriorityMode::Balanced,
|
||||
};
|
||||
|
||||
let json = serde_json::to_string(&original).unwrap();
|
||||
let decoded: SignalMessage = serde_json::from_str(&json).unwrap();
|
||||
match decoded {
|
||||
SignalMessage::SetPriorityMode { version, mode } => {
|
||||
assert_eq!(version, 1);
|
||||
assert_eq!(mode, PriorityMode::Balanced);
|
||||
}
|
||||
_ => panic!("wrong variant"),
|
||||
}
|
||||
|
||||
let bin = bincode::serialize(&original).unwrap();
|
||||
let decoded: SignalMessage = bincode::deserialize(&bin).unwrap();
|
||||
assert!(matches!(decoded, SignalMessage::SetPriorityMode { .. }));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,3 +22,13 @@ pub enum PriorityMode {
|
||||
/// Proportional split (~15 % audio, ~85 % video).
|
||||
Balanced,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn priority_mode_default_is_audio_first() {
|
||||
assert_eq!(PriorityMode::default(), PriorityMode::AudioFirst);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user