Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Ensure focus_in and focus_out fire on window activation (#3993)

Conrad Irwin5dff458014ef
diff --cc crates/collab/src/tests/test_server.rs
index 6d8bb05d670,4f3634c7b1f..2b2bb3a6a42
--- a/crates/collab/src/tests/test_server.rs
+++ b/crates/collab/src/tests/test_server.rs
@@@ -664,20 -617,11 +664,23 @@@ impl TestClient
project: &Model<Project>,
cx: &'a mut TestAppContext,
) -> (View<Workspace>, &'a mut VisualTestContext) {
- cx.add_window_view(|cx| Workspace::new(0, project.clone(), self.app_state.clone(), cx))
+ cx.add_window_view(|cx| {
+ cx.activate_window();
+ Workspace::new(0, project.clone(), self.app_state.clone(), cx)
+ })
}
+
+ pub fn active_workspace<'a>(
+ &'a self,
+ cx: &'a mut TestAppContext,
+ ) -> (View<Workspace>, &'a mut VisualTestContext) {
+ let window = cx.update(|cx| cx.active_window().unwrap().downcast::<Workspace>().unwrap());
+
+ let view = window.root_view(cx).unwrap();
+ let cx = Box::new(VisualTestContext::from_window(*window.deref(), cx));
+ // it might be nice to try and cleanup these at the end of each test.
+ (view, Box::leak(cx))
+ }
}
impl Drop for TestClient {