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.

Merge branch 'main' into following-tests

Conrad Irwin204ef451d095
diff --cc crates/gpui/src/app/test_context.rs
index cc87147692c,a5f66be09b2..cf6ecb62b6f
--- a/crates/gpui/src/app/test_context.rs
+++ b/crates/gpui/src/app/test_context.rs
@@@ -185,48 -184,9 +184,13 @@@ impl TestAppContext
}
pub fn simulate_window_resize(&self, window_handle: AnyWindowHandle, size: Size<Pixels>) {
- let (mut handlers, scale_factor) = self
- .app
- .borrow_mut()
- .update_window(window_handle, |_, cx| {
- let platform_window = cx.window.platform_window.as_test().unwrap();
- let scale_factor = platform_window.scale_factor();
- match &mut platform_window.bounds {
- WindowBounds::Fullscreen | WindowBounds::Maximized => {
- platform_window.bounds = WindowBounds::Fixed(Bounds {
- origin: Point::default(),
- size: size.map(|pixels| f64::from(pixels).into()),
- });
- }
- WindowBounds::Fixed(bounds) => {
- bounds.size = size.map(|pixels| f64::from(pixels).into());
- }
- }
-
- (
- mem::take(&mut platform_window.handlers.lock().resize),
- scale_factor,
- )
- })
- .unwrap();
-
- for handler in &mut handlers {
- handler(size, scale_factor);
- }
-
- self.app
- .borrow_mut()
- .update_window(window_handle, |_, cx| {
- let platform_window = cx.window.platform_window.as_test().unwrap();
- platform_window.handlers.lock().resize = handlers;
- })
- .unwrap();
+ self.test_window(window_handle).simulate_resize(size);
}
+ pub fn windows(&self) -> Vec<AnyWindowHandle> {
+ self.app.borrow().windows().clone()
+ }
+
pub fn spawn<Fut, R>(&self, f: impl FnOnce(AsyncAppContext) -> Fut) -> Task<R>
where
Fut: Future<Output = R> + 'static,