Bring back zed.rs tests (#3907)

At present 3 tests still fail; 2 are related to keymap issues that (I
believe) @maxbrunsfeld is working on. The other one
(`test_open_paths_action`) I'll look into. edit: done
This PR also fixes workspace unregistration, as we've put the code to do
that behind `debug_assert`
(https://github.com/zed-industries/zed/pull/3907/files#diff-041673bbd1947a35d45945636c0055429dfc8b5985faf93f8a8a960c9ad31e28L649).
Release Notes:
- N/A
This commit is contained in:
Piotr Osiewicz 2024-01-08 12:29:54 +01:00 committed by GitHub
parent d475f1373a
commit 53564fb269
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 2132 additions and 1869 deletions

View file

@ -18,7 +18,7 @@ pub struct TestWindowState {
pub(crate) edited: bool,
platform: Weak<TestPlatform>,
sprite_atlas: Arc<dyn PlatformAtlas>,
pub(crate) should_close_handler: Option<Box<dyn FnMut() -> bool>>,
input_callback: Option<Box<dyn FnMut(InputEvent) -> bool>>,
active_status_change_callback: Option<Box<dyn FnMut(bool)>>,
resize_callback: Option<Box<dyn FnMut(Size<Pixels>, f32)>>,
@ -44,7 +44,7 @@ impl TestWindow {
sprite_atlas: Arc::new(TestAtlas::new()),
title: Default::default(),
edited: false,
should_close_handler: None,
input_callback: None,
active_status_change_callback: None,
resize_callback: None,
@ -117,6 +117,9 @@ impl TestWindow {
self.0.lock().input_handler = Some(input_handler);
}
pub fn edited(&self) -> bool {
self.0.lock().edited
}
}
impl PlatformWindow for TestWindow {
@ -235,8 +238,8 @@ impl PlatformWindow for TestWindow {
self.0.lock().moved_callback = Some(callback)
}
fn on_should_close(&self, _callback: Box<dyn FnMut() -> bool>) {
unimplemented!()
fn on_should_close(&self, callback: Box<dyn FnMut() -> bool>) {
self.0.lock().should_close_handler = Some(callback);
}
fn on_close(&self, _callback: Box<dyn FnOnce()>) {