pub struct FakeOs { /* private fields */ }Expand description
A fake system: the answers its dialogs give, and what the handlers did.
Implementations§
Source§impl FakeOs
impl FakeOs
Sourcepub fn answer_dialog(&self, paths: impl IntoIterator<Item = PathBuf>)
pub fn answer_dialog(&self, paths: impl IntoIterator<Item = PathBuf>)
Makes the next dialog answer as if the person chose paths.
Dialogs take the answers in the order they were given. A dialog
other than DialogKind::OpenFiles panics unless paths holds
exactly one path, since the person chooses one there.
Sourcepub fn choose(&self, choice: Choice)
pub fn choose(&self, choice: Choice)
Makes the next message box that waits for a choice answer as if the
person chose choice. Os::tell takes none.
A box panics when its choice is not one of its buttons.
Sourcepub fn messages(&self) -> Vec<ShownMessage>
pub fn messages(&self) -> Vec<ShownMessage>
The message boxes the handlers showed, in order.
Sourcepub fn cancel_dialog(&self)
pub fn cancel_dialog(&self)
Makes the next dialog answer as if the person cancelled it.
Sourcepub fn dialogs(&self) -> Vec<ShownDialog>
pub fn dialogs(&self) -> Vec<ShownDialog>
The dialogs the handlers have shown and the test answered, in order.
Sourcepub fn clipboard_text(&self) -> Option<String>
pub fn clipboard_text(&self) -> Option<String>
The text on the fake clipboard.
Sourcepub fn set_clipboard_text(&self, text: impl Into<String>)
pub fn set_clipboard_text(&self, text: impl Into<String>)
Puts text on the fake clipboard, as another program would.
Sourcepub fn open_windows(&self) -> Vec<Url>
pub fn open_windows(&self) -> Vec<Url>
The pages of the windows the handlers opened and have not closed.
Sourcepub fn window(&self, window: &Window) -> Option<Arranged>
pub fn window(&self, window: &Window) -> Option<Arranged>
How the handlers arranged window, or None once it is closed.
Sourcepub fn focused_window(&self) -> Option<Url>
pub fn focused_window(&self) -> Option<Url>
The page of the window opened or focused last, while it is open.
Sourcepub fn launch(
&self,
dir: impl Into<PathBuf>,
args: impl IntoIterator<Item = OsString>,
)
pub fn launch( &self, dir: impl Into<PathBuf>, args: impl IntoIterator<Item = OsString>, )
Hands args, started in dir, to the Launches
taken from this fake’s Os, as a second start of the application
would.
Sourcepub fn badge(&self) -> u32
pub fn badge(&self) -> u32
The count the handlers last put on the application’s icon, 0 when none is shown.
Sourcepub fn notifications(&self) -> Vec<Notification>
pub fn notifications(&self) -> Vec<Notification>
The notifications the handlers showed, in order.
Sourcepub fn click_notification(&self, index: usize)
pub fn click_notification(&self, index: usize)
Clicks the notification shown indexth from 0, so its
Notified::clicked returns true. A
notification the test does not click returns false once the
FakeOs and every Os from it are dropped.
§Panics
Panics when no notification was shown at index, or it was clicked
already.
Sourcepub fn has_shortcut(&self, shortcut: Shortcut) -> bool
pub fn has_shortcut(&self, shortcut: Shortcut) -> bool
Whether the handlers registered shortcut.
Sourcepub fn press_shortcut(&self, shortcut: Shortcut, press: Press)
pub fn press_shortcut(&self, shortcut: Shortcut, press: Press)
Sourcepub fn click_tray_item(&self, item: &TrayItem)
pub fn click_tray_item(&self, item: &TrayItem)
Clicks item in the tray’s menu, as the person would.
§Panics
Panics when the tray shown, if any, has no such item.
The menus the handlers put in the menu bar last.
Clicks item in the menu bar, as the person would.
§Panics
Panics when no menu of the menu bar holds item.
Sourcepub fn opened_externally(&self) -> Vec<SafeUrl>
pub fn opened_externally(&self) -> Vec<SafeUrl>
The URLs the handlers opened in another program.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FakeOs
impl RefUnwindSafe for FakeOs
impl Send for FakeOs
impl Sync for FakeOs
impl Unpin for FakeOs
impl UnsafeUnpin for FakeOs
impl UnwindSafe for FakeOs
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.