display.rs

 1use anyhow::{Ok, Result};
 2
 3use crate::{Bounds, DevicePixels, DisplayId, PlatformDisplay, Point};
 4
 5#[derive(Debug)]
 6pub(crate) struct TestDisplay {
 7    id: DisplayId,
 8    uuid: uuid::Uuid,
 9    bounds: Bounds<DevicePixels>,
10}
11
12impl TestDisplay {
13    pub fn new() -> Self {
14        TestDisplay {
15            id: DisplayId(1),
16            uuid: uuid::Uuid::new_v4(),
17            bounds: Bounds::from_corners(
18                Point::default(),
19                Point::new(DevicePixels(1920), DevicePixels(1080)),
20            ),
21        }
22    }
23}
24
25impl PlatformDisplay for TestDisplay {
26    fn id(&self) -> crate::DisplayId {
27        self.id
28    }
29
30    fn uuid(&self) -> Result<uuid::Uuid> {
31        Ok(self.uuid)
32    }
33
34    fn bounds(&self) -> crate::Bounds<crate::DevicePixels> {
35        self.bounds
36    }
37}