Skip to main content

FakeServicesHandle

Struct FakeServicesHandle 

Source
pub struct FakeServicesHandle { /* private fields */ }
Expand description

The test’s side of FakeServices.

Implementations§

Source§

impl FakeServicesHandle

Source

pub fn clipboard(&self) -> Option<String>

Source

pub fn set_clipboard(&self, text: &str)

Puts text on the fake clipboard, as if copied from another app.

Source

pub fn take_alert(&self) -> Option<PendingAlert>

The oldest alert still waiting for an answer.

Source

pub fn take_open_file(&self) -> Option<PendingOpen>

Source

pub fn take_save_file(&self) -> Option<PendingSave>

Source

pub fn take_trash(&self) -> Option<PendingTrash>

The oldest request to trash items. Nothing has been moved: the test does what it wants the platform to have done, then answers.

Source

pub fn take_launch(&self) -> Option<PendingLaunch>

The oldest request to open something in another app.

Source

pub fn notifications(&self) -> Vec<Notification>

The notifications showing, oldest first: those withdrawn or clicked are gone, and one replaced by another with its id is where it was, with the new text.

Source

pub fn set_notification_error(&self, error: Option<ServiceError>)

Makes notify fail with error from now on (Cancelled: the user turned the app’s notifications off; Unavailable: nothing to show them), or show them again with None.

Source

pub fn click_notification(&self, id: &str) -> bool

Clicks the notification with this id, as the user would: it goes from the list and the app hears of it. Returns false if there’s none.

Source

pub fn pending_requests(&self) -> usize

Requests of any kind still waiting for an answer.

Source

pub fn menu(&self) -> Option<MenuBarData>

The menus the app installed.

Source

pub fn window_menu(&self, window: NodeId) -> Option<MenuBarData>

A window’s own menus (a MenuBar in its content), without the app’s.

Source

pub fn menu_item(&self, path: &[&str]) -> Option<MenuItemData>

The item at path, e.g. ["File", "Open Recent", "notes.txt"]: a menu, its submenus, then the item’s title. Looks in the app’s menus, then in each window’s.

Source

pub fn choose_menu_item(&self, path: &[&str]) -> bool

Chooses the item at path (see menu_item), like a click or its shortcut would. Returns false if there is no such item or it is disabled.

Source§

impl FakeServicesHandle

Source

pub fn tray(&self) -> Option<TrayData>

The tray icon the app shows, if any.

Source

pub fn tray_item(&self, path: &[&str]) -> Option<MenuItemData>

The tray menu’s item at path: its submenus, then the item’s title.

Source

pub fn choose_tray_item(&self, path: &[&str]) -> bool

Chooses the tray menu’s item at path, as a click on it would. Returns false if there is no such item or it is disabled.

Source

pub fn set_tray_host(&self, running: bool)

The tray’s host goes away (false, as when a Linux panel quits) or comes back: the app hears whether its icon shows.

Trait Implementations§

Source§

impl Clone for FakeServicesHandle

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.