Don't refcount window handles
This commit is contained in:
parent
afcc0d621b
commit
485c0a482e
20 changed files with 83 additions and 163 deletions
|
@ -4196,14 +4196,14 @@ mod tests {
|
|||
);
|
||||
});
|
||||
assert_eq!(
|
||||
cx.current_window_title(window.id()).as_deref(),
|
||||
cx.current_window_title(window.window_id()).as_deref(),
|
||||
Some("one.txt — root1")
|
||||
);
|
||||
|
||||
// Add a second item to a non-empty pane
|
||||
workspace.update(cx, |workspace, cx| workspace.add_item(Box::new(item2), cx));
|
||||
assert_eq!(
|
||||
cx.current_window_title(window.id()).as_deref(),
|
||||
cx.current_window_title(window.window_id()).as_deref(),
|
||||
Some("two.txt — root1")
|
||||
);
|
||||
project.read_with(cx, |project, cx| {
|
||||
|
@ -4222,7 +4222,7 @@ mod tests {
|
|||
.await
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
cx.current_window_title(window.id()).as_deref(),
|
||||
cx.current_window_title(window.window_id()).as_deref(),
|
||||
Some("one.txt — root1")
|
||||
);
|
||||
project.read_with(cx, |project, cx| {
|
||||
|
@ -4242,14 +4242,14 @@ mod tests {
|
|||
.await
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
cx.current_window_title(window.id()).as_deref(),
|
||||
cx.current_window_title(window.window_id()).as_deref(),
|
||||
Some("one.txt — root1, root2")
|
||||
);
|
||||
|
||||
// Remove a project folder
|
||||
project.update(cx, |project, cx| project.remove_worktree(worktree_id, cx));
|
||||
assert_eq!(
|
||||
cx.current_window_title(window.id()).as_deref(),
|
||||
cx.current_window_title(window.window_id()).as_deref(),
|
||||
Some("one.txt — root2")
|
||||
);
|
||||
}
|
||||
|
@ -4285,9 +4285,9 @@ mod tests {
|
|||
});
|
||||
let task = workspace.update(cx, |w, cx| w.prepare_to_close(false, cx));
|
||||
cx.foreground().run_until_parked();
|
||||
cx.simulate_prompt_answer(window.id(), 2 /* cancel */);
|
||||
cx.simulate_prompt_answer(window.window_id(), 2 /* cancel */);
|
||||
cx.foreground().run_until_parked();
|
||||
assert!(!cx.has_pending_prompt(window.id()));
|
||||
assert!(!cx.has_pending_prompt(window.window_id()));
|
||||
assert!(!task.await.unwrap());
|
||||
}
|
||||
|
||||
|
@ -4346,10 +4346,10 @@ mod tests {
|
|||
assert_eq!(pane.items_len(), 4);
|
||||
assert_eq!(pane.active_item().unwrap().id(), item1.id());
|
||||
});
|
||||
assert!(cx.has_pending_prompt(window.id()));
|
||||
assert!(cx.has_pending_prompt(window.window_id()));
|
||||
|
||||
// Confirm saving item 1.
|
||||
cx.simulate_prompt_answer(window.id(), 0);
|
||||
cx.simulate_prompt_answer(window.window_id(), 0);
|
||||
cx.foreground().run_until_parked();
|
||||
|
||||
// Item 1 is saved. There's a prompt to save item 3.
|
||||
|
@ -4360,10 +4360,10 @@ mod tests {
|
|||
assert_eq!(pane.items_len(), 3);
|
||||
assert_eq!(pane.active_item().unwrap().id(), item3.id());
|
||||
});
|
||||
assert!(cx.has_pending_prompt(window.id()));
|
||||
assert!(cx.has_pending_prompt(window.window_id()));
|
||||
|
||||
// Cancel saving item 3.
|
||||
cx.simulate_prompt_answer(window.id(), 1);
|
||||
cx.simulate_prompt_answer(window.window_id(), 1);
|
||||
cx.foreground().run_until_parked();
|
||||
|
||||
// Item 3 is reloaded. There's a prompt to save item 4.
|
||||
|
@ -4374,10 +4374,10 @@ mod tests {
|
|||
assert_eq!(pane.items_len(), 2);
|
||||
assert_eq!(pane.active_item().unwrap().id(), item4.id());
|
||||
});
|
||||
assert!(cx.has_pending_prompt(window.id()));
|
||||
assert!(cx.has_pending_prompt(window.window_id()));
|
||||
|
||||
// Confirm saving item 4.
|
||||
cx.simulate_prompt_answer(window.id(), 0);
|
||||
cx.simulate_prompt_answer(window.window_id(), 0);
|
||||
cx.foreground().run_until_parked();
|
||||
|
||||
// There's a prompt for a path for item 4.
|
||||
|
@ -4480,7 +4480,7 @@ mod tests {
|
|||
&[ProjectEntryId::from_proto(0)]
|
||||
);
|
||||
});
|
||||
cx.simulate_prompt_answer(window.id(), 0);
|
||||
cx.simulate_prompt_answer(window.window_id(), 0);
|
||||
|
||||
cx.foreground().run_until_parked();
|
||||
left_pane.read_with(cx, |pane, cx| {
|
||||
|
@ -4489,7 +4489,7 @@ mod tests {
|
|||
&[ProjectEntryId::from_proto(2)]
|
||||
);
|
||||
});
|
||||
cx.simulate_prompt_answer(window.id(), 0);
|
||||
cx.simulate_prompt_answer(window.window_id(), 0);
|
||||
|
||||
cx.foreground().run_until_parked();
|
||||
close.await.unwrap();
|
||||
|
@ -4549,7 +4549,7 @@ mod tests {
|
|||
item.read_with(cx, |item, _| assert_eq!(item.save_count, 2));
|
||||
|
||||
// Deactivating the window still saves the file.
|
||||
cx.simulate_window_activation(Some(window.id()));
|
||||
cx.simulate_window_activation(Some(window.window_id()));
|
||||
item.update(cx, |item, cx| {
|
||||
cx.focus_self();
|
||||
item.is_dirty = true;
|
||||
|
@ -4591,7 +4591,7 @@ mod tests {
|
|||
pane.update(cx, |pane, cx| pane.close_items(cx, move |id| id == item_id))
|
||||
.await
|
||||
.unwrap();
|
||||
assert!(!cx.has_pending_prompt(window.id()));
|
||||
assert!(!cx.has_pending_prompt(window.window_id()));
|
||||
item.read_with(cx, |item, _| assert_eq!(item.save_count, 5));
|
||||
|
||||
// Add the item again, ensuring autosave is prevented if the underlying file has been deleted.
|
||||
|
@ -4612,7 +4612,7 @@ mod tests {
|
|||
let _close_items =
|
||||
pane.update(cx, |pane, cx| pane.close_items(cx, move |id| id == item_id));
|
||||
deterministic.run_until_parked();
|
||||
assert!(cx.has_pending_prompt(window.id()));
|
||||
assert!(cx.has_pending_prompt(window.window_id()));
|
||||
item.read_with(cx, |item, _| assert_eq!(item.save_count, 5));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue