3da269c3b7
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
46 lines
1.0 KiB
Rust
46 lines
1.0 KiB
Rust
use crate::domain::EvidenceHealth;
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
pub struct WindowSnapshot {
|
|
pub title: String,
|
|
pub class: Option<String>,
|
|
pub health: EvidenceHealth,
|
|
}
|
|
|
|
impl WindowSnapshot {
|
|
pub fn unavailable(reason: impl Into<String>) -> 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()),
|
|
}
|
|
);
|
|
}
|
|
}
|