Detailed changes
@@ -122,7 +122,7 @@ impl TestApp {
pub fn open_window<V: Render + 'static>(
&mut self,
build_view: impl FnOnce(&mut Window, &mut Context<V>) -> V,
- ) -> TestAppWindow<V> {
+ ) -> TestWindow<V> {
let bounds = self.read(|cx| Bounds::maximized(None, cx));
let handle = self.update(|cx| {
cx.open_window(
@@ -135,7 +135,7 @@ impl TestApp {
.unwrap()
});
- TestAppWindow {
+ TestWindow {
handle,
app: self.app.clone(),
platform: self.platform.clone(),
@@ -148,13 +148,13 @@ impl TestApp {
&mut self,
options: WindowOptions,
build_view: impl FnOnce(&mut Window, &mut Context<V>) -> V,
- ) -> TestAppWindow<V> {
+ ) -> TestWindow<V> {
let handle = self.update(|cx| {
cx.open_window(options, |window, cx| cx.new(|cx| build_view(window, cx)))
.unwrap()
});
- TestAppWindow {
+ TestWindow {
handle,
app: self.app.clone(),
platform: self.platform.clone(),
@@ -286,14 +286,14 @@ impl Default for TestApp {
}
/// A test window with inspection and simulation capabilities.
-pub struct TestAppWindow<V> {
+pub struct TestWindow<V> {
handle: WindowHandle<V>,
app: Rc<AppCell>,
platform: Rc<TestPlatform>,
background_executor: BackgroundExecutor,
}
-impl<V: 'static + Render> TestAppWindow<V> {
+impl<V: 'static + Render> TestWindow<V> {
/// Get the window handle.
pub fn handle(&self) -> WindowHandle<V> {
self.handle
@@ -485,7 +485,7 @@ impl<V: 'static + Render> TestAppWindow<V> {
}
}
-impl<V> Clone for TestAppWindow<V> {
+impl<V> Clone for TestWindow<V> {
fn clone(&self) -> Self {
Self {
handle: self.handle,
@@ -4,7 +4,7 @@ use crate::{
Element, Empty, EventEmitter, ForegroundExecutor, Global, InputEvent, Keystroke, Modifiers,
ModifiersChangedEvent, MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, Pixels,
Platform, Point, Render, Result, Size, Task, TestDispatcher, TestPlatform,
- TestScreenCaptureSource, TestWindow, TextSystem, VisualContext, Window, WindowBounds,
+ TestScreenCaptureSource, TestPlatformWindow, TextSystem, VisualContext, Window, WindowBounds,
WindowHandle, WindowOptions, app::GpuiMode,
};
use anyhow::{anyhow, bail};
@@ -220,7 +220,7 @@ impl TestAppContext {
f(&cx)
}
- /// Adds a new window. The Window will always be backed by a `TestWindow` which
+ /// Adds a new window. The Window will always be backed by a `TestPlatformWindow` which
/// can be retrieved with `self.test_window(handle)`
pub fn add_window<F, V>(&mut self, build_window: F) -> WindowHandle<V>
where
@@ -465,8 +465,8 @@ impl TestAppContext {
.unwrap();
}
- /// Returns the `TestWindow` backing the given handle.
- pub(crate) fn test_window(&self, window: AnyWindowHandle) -> TestWindow {
+ /// Returns the `TestPlatformWindow` backing the given handle.
+ pub(crate) fn test_window(&self, window: AnyWindowHandle) -> TestPlatformWindow {
self.app
.borrow_mut()
.windows
@@ -561,7 +561,7 @@ pub(crate) trait PlatformWindow: HasWindowHandle + HasDisplayHandle {
fn update_ime_position(&self, _bounds: Bounds<Pixels>);
#[cfg(any(test, feature = "test-support"))]
- fn as_test(&mut self) -> Option<&mut TestWindow> {
+ fn as_test(&mut self) -> Option<&mut TestPlatformWindow> {
None
}
}
@@ -3,7 +3,7 @@ use crate::{
DummyKeyboardMapper, ForegroundExecutor, Keymap, NoopTextSystem, Platform, PlatformDisplay,
PlatformKeyboardLayout, PlatformKeyboardMapper, PlatformTextSystem, PromptButton,
ScreenCaptureFrame, ScreenCaptureSource, ScreenCaptureStream, SourceMetadata, Task,
- TestDisplay, TestWindow, WindowAppearance, WindowParams, size,
+ TestDisplay, TestPlatformWindow, WindowAppearance, WindowParams, size,
};
use anyhow::Result;
use collections::VecDeque;
@@ -26,7 +26,7 @@ pub(crate) struct TestPlatform {
background_executor: BackgroundExecutor,
foreground_executor: ForegroundExecutor,
- pub(crate) active_window: RefCell<Option<TestWindow>>,
+ pub(crate) active_window: RefCell<Option<TestPlatformWindow>>,
active_display: Rc<dyn PlatformDisplay>,
active_cursor: Mutex<CursorStyle>,
current_clipboard_item: Mutex<Option<ClipboardItem>>,
@@ -196,7 +196,7 @@ impl TestPlatform {
rx
}
- pub(crate) fn set_active_window(&self, window: Option<TestWindow>) {
+ pub(crate) fn set_active_window(&self, window: Option<TestPlatformWindow>) {
let executor = self.foreground_executor();
let previous_window = self.active_window.borrow_mut().take();
self.active_window.borrow_mut().clone_from(&window);
@@ -314,7 +314,7 @@ impl Platform for TestPlatform {
handle: AnyWindowHandle,
params: WindowParams,
) -> anyhow::Result<Box<dyn crate::PlatformWindow>> {
- let window = TestWindow::new(
+ let window = TestPlatformWindow::new(
handle,
params,
self.weak.clone(),
@@ -12,7 +12,7 @@ use std::{
sync::{self, Arc},
};
-pub(crate) struct TestWindowState {
+pub(crate) struct TestPlatformWindowState {
pub(crate) bounds: Bounds<Pixels>,
pub(crate) handle: AnyWindowHandle,
display: Rc<dyn PlatformDisplay>,
@@ -32,9 +32,9 @@ pub(crate) struct TestWindowState {
}
#[derive(Clone)]
-pub(crate) struct TestWindow(pub(crate) Rc<Mutex<TestWindowState>>);
+pub(crate) struct TestPlatformWindow(pub(crate) Rc<Mutex<TestPlatformWindowState>>);
-impl HasWindowHandle for TestWindow {
+impl HasWindowHandle for TestPlatformWindow {
fn window_handle(
&self,
) -> Result<raw_window_handle::WindowHandle<'_>, raw_window_handle::HandleError> {
@@ -42,7 +42,7 @@ impl HasWindowHandle for TestWindow {
}
}
-impl HasDisplayHandle for TestWindow {
+impl HasDisplayHandle for TestPlatformWindow {
fn display_handle(
&self,
) -> Result<raw_window_handle::DisplayHandle<'_>, raw_window_handle::HandleError> {
@@ -50,14 +50,14 @@ impl HasDisplayHandle for TestWindow {
}
}
-impl TestWindow {
+impl TestPlatformWindow {
pub fn new(
handle: AnyWindowHandle,
params: WindowParams,
platform: Weak<TestPlatform>,
display: Rc<dyn PlatformDisplay>,
) -> Self {
- Self(Rc::new(Mutex::new(TestWindowState {
+ Self(Rc::new(Mutex::new(TestPlatformWindowState {
bounds: params.bounds,
display,
platform,
@@ -111,7 +111,7 @@ impl TestWindow {
}
}
-impl PlatformWindow for TestWindow {
+impl PlatformWindow for TestPlatformWindow {
fn bounds(&self) -> Bounds<Pixels> {
self.0.lock().bounds
}
@@ -272,7 +272,7 @@ impl PlatformWindow for TestWindow {
self.0.lock().sprite_atlas.clone()
}
- fn as_test(&mut self) -> Option<&mut TestWindow> {
+ fn as_test(&mut self) -> Option<&mut TestPlatformWindow> {
Some(self)
}