Start work on handling multibuffers properly when closing unsaved buffers

This commit is contained in:
Max Brunsfeld 2022-05-22 16:48:33 -07:00
parent 21206800bc
commit fbd589b589
12 changed files with 581 additions and 421 deletions

View file

@ -521,12 +521,27 @@ impl TestAppContext {
.downcast_mut::<platform::test::Window>()
.unwrap();
let mut done_tx = test_window
.last_prompt
.take()
.pending_prompts
.borrow_mut()
.pop_front()
.expect("prompt was not called");
let _ = done_tx.try_send(answer);
}
pub fn has_pending_prompt(&self, window_id: usize) -> bool {
let mut state = self.cx.borrow_mut();
let (_, window) = state
.presenters_and_platform_windows
.get_mut(&window_id)
.unwrap();
let test_window = window
.as_any_mut()
.downcast_mut::<platform::test::Window>()
.unwrap();
let prompts = test_window.pending_prompts.borrow_mut();
!prompts.is_empty()
}
#[cfg(any(test, feature = "test-support"))]
pub fn leak_detector(&self) -> Arc<Mutex<LeakDetector>> {
self.cx.borrow().leak_detector()