diff --git a/frontends/rioterm/src/context/mod.rs b/frontends/rioterm/src/context/mod.rs index 09343c366..5e7ebc1a2 100644 --- a/frontends/rioterm/src/context/mod.rs +++ b/frontends/rioterm/src/context/mod.rs @@ -181,7 +181,42 @@ pub struct ContextManager { pub titles: ContextManagerTitles, } -pub fn create_mock_context( +pub fn create_dead_context( + event_proxy: T, + window_id: WindowId, + route_id: usize, + rich_text_id: usize, + dimension: ContextDimension, +) -> Context { + let terminal = Crosswords::new( + dimension, + CursorShape::Block, + event_proxy, + window_id, + route_id, + ); + let terminal: Arc>> = Arc::new(FairMutex::new(terminal)); + let (sender, _receiver) = corcovado::channel::channel(); + + Context { + route_id, + #[cfg(not(target_os = "windows"))] + main_fd: Arc::new(-1), + #[cfg(not(target_os = "windows"))] + shell_pid: 1, + messenger: Messenger::new(sender), + renderable_content: RenderableContent::new(Cursor::default()), + terminal, + rich_text_id, + dimension, + ime: Ime::new(), + } +} + +#[cfg(test)] +pub fn create_mock_context< + T: rio_backend::event::EventListener + Clone + std::marker::Send + 'static, +>( event_proxy: T, window_id: WindowId, route_id: usize, @@ -210,7 +245,8 @@ pub fn create_mock_context ContextManager { window_id, ); - create_mock_context( + create_dead_context( event_proxy.clone(), window_id, route_id,