use crate::domain::EvidenceHealth; #[derive(Clone, Debug, PartialEq, Eq)] pub struct WindowSnapshot { pub title: String, pub class: Option, pub health: EvidenceHealth, } impl WindowSnapshot { pub fn unavailable(reason: impl Into) -> Self { Self { title: "none".to_string(), class: None, health: EvidenceHealth::Unavailable(reason.into()), } } } #[cfg(target_os = "windows")] mod windows; #[cfg(target_os = "windows")] pub use windows::*; #[cfg(target_os = "linux")] mod linux; #[cfg(target_os = "linux")] pub use linux::*; #[cfg(test)] mod tests { use super::*; #[test] fn unavailable_snapshot_records_reason_without_evidence() { assert_eq!( WindowSnapshot::unavailable("no active window"), WindowSnapshot { title: "none".to_string(), class: None, health: EvidenceHealth::Unavailable("no active window".to_string()), } ); } }