diff --git a/src/app.rs b/src/app.rs index 0bec4d4..50d9316 100644 --- a/src/app.rs +++ b/src/app.rs @@ -280,8 +280,11 @@ impl App { let mut last_load_abort: Option = None; let mut last_time: Option = None; - let (clipboard, err) = - &mut ClipboardManager::new(ctx.config.clipboard.clone().unwrap_or_default()); + let (clipboard, err) = &mut if TEST { + ClipboardManager::empty(ctx.config.clipboard.clone().unwrap_or_default()) + } else { + ClipboardManager::new(ctx.config.clipboard.clone().unwrap_or_default()) + }; if let Some(err) = err { ctx.show_error(err); } @@ -551,6 +554,7 @@ impl App { ) { if TEST && Event::FocusLost == *evt { ctx.quit(); + return; } if let Event::Key(KeyEvent { diff --git a/src/clip.rs b/src/clip.rs index b8802ae..7cedf1b 100644 --- a/src/clip.rs +++ b/src/clip.rs @@ -60,6 +60,16 @@ impl ClipboardManager { ) } + pub fn empty(conf: ClipboardConfig) -> (ClipboardManager, Option) { + ( + Self { + clipboard: None, + config: conf, + }, + None, + ) + } + pub fn try_copy(&mut self, content: &String) -> Result<(), String> { if let Some(cmd) = self.config.cmd.clone() { return CommandBuilder::new(cmd)