Make tests less noisy (#12463)
When running the tests for linux, I found a lot of benign errors getting logged. This PR cuts down some of the noise from unnecessary workspace serialization and SVG renders Release Notes: - N/A
This commit is contained in:
parent
bdf627ce07
commit
5a149b970c
36 changed files with 216 additions and 172 deletions
|
@ -172,7 +172,7 @@ pub trait Item: FocusableView + EventEmitter<Self::Event> {
|
|||
fn set_nav_history(&mut self, _: ItemNavHistory, _: &mut ViewContext<Self>) {}
|
||||
fn clone_on_split(
|
||||
&self,
|
||||
_workspace_id: WorkspaceId,
|
||||
_workspace_id: Option<WorkspaceId>,
|
||||
_: &mut ViewContext<Self>,
|
||||
) -> Option<View<Self>>
|
||||
where
|
||||
|
@ -287,7 +287,7 @@ pub trait ItemHandle: 'static + Send {
|
|||
fn boxed_clone(&self) -> Box<dyn ItemHandle>;
|
||||
fn clone_on_split(
|
||||
&self,
|
||||
workspace_id: WorkspaceId,
|
||||
workspace_id: Option<WorkspaceId>,
|
||||
cx: &mut WindowContext,
|
||||
) -> Option<Box<dyn ItemHandle>>;
|
||||
fn added_to_pane(
|
||||
|
@ -437,7 +437,7 @@ impl<T: Item> ItemHandle for View<T> {
|
|||
|
||||
fn clone_on_split(
|
||||
&self,
|
||||
workspace_id: WorkspaceId,
|
||||
workspace_id: Option<WorkspaceId>,
|
||||
cx: &mut WindowContext,
|
||||
) -> Option<Box<dyn ItemHandle>> {
|
||||
self.update(cx, |item, cx| item.clone_on_split(workspace_id, cx))
|
||||
|
@ -528,7 +528,6 @@ impl<T: Item> ItemHandle for View<T> {
|
|||
{
|
||||
pane
|
||||
} else {
|
||||
log::error!("unexpected item event after pane was dropped");
|
||||
return;
|
||||
};
|
||||
|
||||
|
@ -883,7 +882,7 @@ pub mod test {
|
|||
}
|
||||
|
||||
pub struct TestItem {
|
||||
pub workspace_id: WorkspaceId,
|
||||
pub workspace_id: Option<WorkspaceId>,
|
||||
pub state: String,
|
||||
pub label: String,
|
||||
pub save_count: usize,
|
||||
|
@ -964,7 +963,7 @@ pub mod test {
|
|||
|
||||
pub fn new_deserialized(id: WorkspaceId, cx: &mut ViewContext<Self>) -> Self {
|
||||
let mut this = Self::new(cx);
|
||||
this.workspace_id = id;
|
||||
this.workspace_id = Some(id);
|
||||
this
|
||||
}
|
||||
|
||||
|
@ -1081,7 +1080,7 @@ pub mod test {
|
|||
|
||||
fn clone_on_split(
|
||||
&self,
|
||||
_workspace_id: WorkspaceId,
|
||||
_workspace_id: Option<WorkspaceId>,
|
||||
cx: &mut ViewContext<Self>,
|
||||
) -> Option<View<Self>>
|
||||
where
|
||||
|
|
|
@ -119,7 +119,7 @@ impl Item for SharedScreen {
|
|||
|
||||
fn clone_on_split(
|
||||
&self,
|
||||
_workspace_id: WorkspaceId,
|
||||
_workspace_id: Option<WorkspaceId>,
|
||||
cx: &mut ViewContext<Self>,
|
||||
) -> Option<View<Self>> {
|
||||
let track = self.track.upgrade()?;
|
||||
|
|
|
@ -588,7 +588,7 @@ pub struct Workspace {
|
|||
window_edited: bool,
|
||||
active_call: Option<(Model<ActiveCall>, Vec<Subscription>)>,
|
||||
leader_updates_tx: mpsc::UnboundedSender<(PeerId, proto::UpdateFollowers)>,
|
||||
database_id: WorkspaceId,
|
||||
database_id: Option<WorkspaceId>,
|
||||
app_state: Arc<AppState>,
|
||||
dispatching_keystrokes: Rc<RefCell<Vec<Keystroke>>>,
|
||||
_subscriptions: Vec<Subscription>,
|
||||
|
@ -622,7 +622,7 @@ impl Workspace {
|
|||
const MAX_PADDING: f32 = 0.4;
|
||||
|
||||
pub fn new(
|
||||
workspace_id: WorkspaceId,
|
||||
workspace_id: Option<WorkspaceId>,
|
||||
project: Model<Project>,
|
||||
app_state: Arc<AppState>,
|
||||
cx: &mut ViewContext<Self>,
|
||||
|
@ -795,13 +795,15 @@ impl Workspace {
|
|||
if let Some(display) = cx.display() {
|
||||
if let Some(display_uuid) = display.uuid().log_err() {
|
||||
let window_bounds = cx.window_bounds();
|
||||
cx.background_executor()
|
||||
.spawn(DB.set_window_open_status(
|
||||
workspace_id,
|
||||
SerializedWindowBounds(window_bounds),
|
||||
display_uuid,
|
||||
))
|
||||
.detach_and_log_err(cx);
|
||||
if let Some(database_id) = workspace_id {
|
||||
cx.background_executor()
|
||||
.spawn(DB.set_window_open_status(
|
||||
database_id,
|
||||
SerializedWindowBounds(window_bounds),
|
||||
display_uuid,
|
||||
))
|
||||
.detach_and_log_err(cx);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.bounds_save_task_queued.take();
|
||||
|
@ -956,7 +958,12 @@ impl Workspace {
|
|||
let window = if let Some(window) = requesting_window {
|
||||
cx.update_window(window.into(), |_, cx| {
|
||||
cx.replace_root_view(|cx| {
|
||||
Workspace::new(workspace_id, project_handle.clone(), app_state.clone(), cx)
|
||||
Workspace::new(
|
||||
Some(workspace_id),
|
||||
project_handle.clone(),
|
||||
app_state.clone(),
|
||||
cx,
|
||||
)
|
||||
});
|
||||
})?;
|
||||
window
|
||||
|
@ -994,7 +1001,7 @@ impl Workspace {
|
|||
move |cx| {
|
||||
cx.new_view(|cx| {
|
||||
let mut workspace =
|
||||
Workspace::new(workspace_id, project_handle, app_state, cx);
|
||||
Workspace::new(Some(workspace_id), project_handle, app_state, cx);
|
||||
workspace.centered_layout = centered_layout;
|
||||
workspace
|
||||
})
|
||||
|
@ -3464,9 +3471,12 @@ impl Workspace {
|
|||
pub fn on_window_activation_changed(&mut self, cx: &mut ViewContext<Self>) {
|
||||
if cx.is_window_active() {
|
||||
self.update_active_view_for_followers(cx);
|
||||
cx.background_executor()
|
||||
.spawn(persistence::DB.update_timestamp(self.database_id()))
|
||||
.detach();
|
||||
|
||||
if let Some(database_id) = self.database_id {
|
||||
cx.background_executor()
|
||||
.spawn(persistence::DB.update_timestamp(database_id))
|
||||
.detach();
|
||||
}
|
||||
} else {
|
||||
for pane in &self.panes {
|
||||
pane.update(cx, |pane, cx| {
|
||||
|
@ -3506,7 +3516,7 @@ impl Workspace {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn database_id(&self) -> WorkspaceId {
|
||||
pub fn database_id(&self) -> Option<WorkspaceId> {
|
||||
self.database_id
|
||||
}
|
||||
|
||||
|
@ -3566,6 +3576,10 @@ impl Workspace {
|
|||
}
|
||||
|
||||
fn serialize_workspace_internal(&self, cx: &mut WindowContext) -> Task<()> {
|
||||
let Some(database_id) = self.database_id() else {
|
||||
return Task::ready(());
|
||||
};
|
||||
|
||||
fn serialize_pane_handle(pane_handle: &View<Pane>, cx: &WindowContext) -> SerializedPane {
|
||||
let (items, active) = {
|
||||
let pane = pane_handle.read(cx);
|
||||
|
@ -3701,7 +3715,7 @@ impl Workspace {
|
|||
let docks = build_serialized_docks(self, cx);
|
||||
let window_bounds = Some(SerializedWindowBounds(cx.window_bounds()));
|
||||
let serialized_workspace = SerializedWorkspace {
|
||||
id: self.database_id,
|
||||
id: database_id,
|
||||
location,
|
||||
center_group,
|
||||
window_bounds,
|
||||
|
@ -3944,9 +3958,11 @@ impl Workspace {
|
|||
|
||||
pub fn toggle_centered_layout(&mut self, _: &ToggleCenteredLayout, cx: &mut ViewContext<Self>) {
|
||||
self.centered_layout = !self.centered_layout;
|
||||
cx.background_executor()
|
||||
.spawn(DB.set_centered_layout(self.database_id, self.centered_layout))
|
||||
.detach_and_log_err(cx);
|
||||
if let Some(database_id) = self.database_id() {
|
||||
cx.background_executor()
|
||||
.spawn(DB.set_centered_layout(database_id, self.centered_layout))
|
||||
.detach_and_log_err(cx);
|
||||
}
|
||||
cx.notify();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue