Inline test-only AppContext
methods
This commit is contained in:
parent
eb2cce98a7
commit
6c931ab9da
2 changed files with 7 additions and 20 deletions
|
@ -72,14 +72,16 @@ impl TestAppContext {
|
|||
}
|
||||
|
||||
pub fn dispatch_action<A: Action>(&self, window_id: usize, action: A) {
|
||||
let mut cx = self.cx.borrow_mut();
|
||||
if let Some(view_id) = cx.windows.get(&window_id).and_then(|w| w.focused_view_id) {
|
||||
cx.handle_dispatch_action_from_effect(window_id, Some(view_id), &action);
|
||||
}
|
||||
self.cx
|
||||
.borrow_mut()
|
||||
.update_window(window_id, |window| {
|
||||
window.handle_dispatch_action_from_effect(window.focused_view_id(), &action);
|
||||
})
|
||||
.expect("window not found");
|
||||
}
|
||||
|
||||
pub fn dispatch_global_action<A: Action>(&self, action: A) {
|
||||
self.cx.borrow_mut().dispatch_global_action(action);
|
||||
self.cx.borrow_mut().dispatch_global_action_any(&action);
|
||||
}
|
||||
|
||||
pub fn dispatch_keystroke(&mut self, window_id: usize, keystroke: Keystroke, is_held: bool) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue