pub struct FakeDesktop { /* private fields */ }Expand description
Observable, cloneable fake desktop backed by a HashMap.
Implementations§
Source§impl FakeDesktop
impl FakeDesktop
pub fn real_icons_visible(&self) -> bool
pub fn new() -> Self
Sourcepub fn add_icon(&self, snap: IconSnapshot)
pub fn add_icon(&self, snap: IconSnapshot)
Add or replace an icon.
Sourcepub fn remove_icon(&self, id: &IconId) -> bool
pub fn remove_icon(&self, id: &IconId) -> bool
Remove an icon (simulates the user deleting it while an animation is running).
pub fn icon_count(&self) -> usize
Sourcepub fn position_of(&self, id: &IconId) -> Option<Point>
pub fn position_of(&self, id: &IconId) -> Option<Point>
Look up the current position of one icon.
Sourcepub fn commit_log(&self) -> Vec<Vec<(IconId, Point)>>
pub fn commit_log(&self) -> Vec<Vec<(IconId, Point)>>
Take a copy of the commit log so far. Does not clear it.
Sourcepub fn set_next_list_error(&self, err: DesktopError)
pub fn set_next_list_error(&self, err: DesktopError)
Cause the next list_icons call to fail with this error.
Sourcepub fn set_monitors(&self, monitors: Vec<MonitorInfo>)
pub fn set_monitors(&self, monitors: Vec<MonitorInfo>)
Replace the simulated monitor layout. Useful for testing multi-monitor placement without needing a real second display.
pub fn set_desktop_info(&self, desktop: DesktopInfo)
Sourcepub fn set_next_overlay_error(&self, err: DesktopError)
pub fn set_next_overlay_error(&self, err: DesktopError)
Cause the next begin_overlay_session call to fail with this
error. Used by tests to exercise the engine’s overlay-unavailable
fallback path.
Sourcepub fn overlay_active(&self) -> bool
pub fn overlay_active(&self) -> bool
Whether an overlay session is currently open.
Sourcepub fn last_overlay_plans(&self) -> Vec<IconRenderPlan>
pub fn last_overlay_plans(&self) -> Vec<IconRenderPlan>
Snapshot of the plans handed to the most recent successful
begin_overlay_session call.
Sourcepub fn last_overlay_render_options(&self) -> OverlayRenderOptions
pub fn last_overlay_render_options(&self) -> OverlayRenderOptions
Snapshot of the render options handed to the most recent
successful begin_overlay_session call. Defaults to
all_enabled before any session has opened.
Sourcepub fn overlay_frame_log(&self) -> Vec<Vec<(IconId, Point)>>
pub fn overlay_frame_log(&self) -> Vec<Vec<(IconId, Point)>>
Snapshot of every commit_overlay_frame call in order.
pub fn visual_frame_log(&self) -> Vec<Vec<IconFrame>>
Sourcepub fn overlay_finalize_log(&self) -> Vec<Vec<(IconId, Point)>>
pub fn overlay_finalize_log(&self) -> Vec<Vec<(IconId, Point)>>
Snapshot of every finalize_overlay_session call in order.
Sourcepub fn queue_commit_error(&self, err: DesktopError)
pub fn queue_commit_error(&self, err: DesktopError)
Queue an error to be returned from the next
commit_overlay_frame call. Multiple queued errors are
consumed in FIFO order.
Useful for exercising the engine’s
DesktopError::OverlayCancelled path from tests.
Trait Implementations§
Source§impl Clone for FakeDesktop
impl Clone for FakeDesktop
Source§fn clone(&self) -> FakeDesktop
fn clone(&self) -> FakeDesktop
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FakeDesktop
impl Debug for FakeDesktop
Source§impl Default for FakeDesktop
impl Default for FakeDesktop
Source§fn default() -> FakeDesktop
fn default() -> FakeDesktop
Source§impl DesktopBackend for FakeDesktop
impl DesktopBackend for FakeDesktop
fn list_icons(&mut self) -> Result<Vec<IconSnapshot>, DesktopError>
fn get_flags(&mut self) -> Result<u32, DesktopError>
fn apply_flags(&mut self, mask: u32, values: u32) -> Result<(), DesktopError>
Source§fn set_positions(
&mut self,
moves: &[(IconId, Point)],
) -> Result<Vec<IconId>, DesktopError>
fn set_positions( &mut self, moves: &[(IconId, Point)], ) -> Result<Vec<IconId>, DesktopError>
(id, new_position) moves. Returns the ids the
backend could not resolve (i.e. icons that vanished or were never
on the desktop).Source§fn list_monitors(&mut self) -> Result<Vec<MonitorInfo>, DesktopError>
fn list_monitors(&mut self) -> Result<Vec<MonitorInfo>, DesktopError>
list_icons and
set_positions.Source§fn desktop_info(
&mut self,
_icons: &[IconSnapshot],
) -> Result<DesktopInfo, DesktopError>
fn desktop_info( &mut self, _icons: &[IconSnapshot], ) -> Result<DesktopInfo, DesktopError>
Source§fn begin_overlay_session(
&mut self,
plans: &[IconRenderPlan],
render_options: OverlayRenderOptions,
) -> Result<(), DesktopError>
fn begin_overlay_session( &mut self, plans: &[IconRenderPlan], render_options: OverlayRenderOptions, ) -> Result<(), DesktopError>
plans. Read moreSource§fn commit_overlay_frame(
&mut self,
positions: &[(IconId, Point)],
) -> Result<(), DesktopError>
fn commit_overlay_frame( &mut self, positions: &[(IconId, Point)], ) -> Result<(), DesktopError>
positions. Read moreSource§fn discard_overlay_session(&mut self)
fn discard_overlay_session(&mut self)
Source§fn commit_visual_frame(
&mut self,
frame: &[IconFrame],
) -> Result<(), DesktopError>
fn commit_visual_frame( &mut self, frame: &[IconFrame], ) -> Result<(), DesktopError>
fn poll_overlay_session(&mut self) -> Result<(), DesktopError>
fn set_real_icons_visible(&mut self, visible: bool) -> Result<(), DesktopError>
Source§fn finalize_overlay_session(
&mut self,
final_positions: &[(IconId, Point)],
) -> Result<FinalCommitOutcome, DesktopError>
fn finalize_overlay_session( &mut self, final_positions: &[(IconId, Point)], ) -> Result<FinalCommitOutcome, DesktopError>
Source§fn validate_prepared_session(&mut self) -> Result<(), DesktopError>
fn validate_prepared_session(&mut self) -> Result<(), DesktopError>
fn prepare_scene_renderer( &mut self, _canvas: Canvas, _plans: &[IconRenderPlan], _options: OverlayRenderOptions, ) -> Result<Box<dyn SceneRenderer>, DesktopError>
fn capture_overlay( &mut self, _seconds: f64, ) -> Result<CapturedFrame, DesktopError>
Source§fn render_overlay_snapshot(
&mut self,
width_px: u32,
height_px: u32,
dpi_scale: f32,
positions: &[(IconId, Point)],
render_options: OverlayRenderOptions,
) -> Result<SnapshotFrame, DesktopError>
fn render_overlay_snapshot( &mut self, width_px: u32, height_px: u32, dpi_scale: f32, positions: &[(IconId, Point)], render_options: OverlayRenderOptions, ) -> Result<SnapshotFrame, DesktopError>
HWND, DirectComposition target, or
the real desktop. Safe to call at any time, including while a
begin_overlay_session is
active on another animation. Read more