Detailed changes
@@ -71,6 +71,7 @@ async fn test_host_disconnect(
let workspace_b =
cx_b.add_window(|cx| Workspace::new(0, project_b.clone(), client_b.app_state.clone(), cx));
let cx_b = &mut VisualTestContext::from_window(*workspace_b, cx_b);
+ let workspace_b_view = workspace_b.root_view(cx_b).unwrap();
let editor_b = workspace_b
.update(cx_b, |workspace, cx| {
@@ -85,8 +86,10 @@ async fn test_host_disconnect(
//TODO: focus
assert!(cx_b.update_view(&editor_b, |editor, cx| editor.is_focused(cx)));
editor_b.update(cx_b, |editor, cx| editor.insert("X", cx));
- //todo(is_edited)
- // assert!(workspace_b.is_edited(cx_b));
+
+ cx_b.update(|cx| {
+ assert!(workspace_b_view.read(cx).is_edited());
+ });
// Drop client A's connection. Collaborators should disappear and the project should not be shown as shared.
server.forbid_connections();
@@ -105,11 +108,11 @@ async fn test_host_disconnect(
// Ensure client B's edited state is reset and that the whole window is blurred.
workspace_b
- .update(cx_b, |_, cx| {
+ .update(cx_b, |workspace, cx| {
assert_eq!(cx.focused(), None);
+ assert!(!workspace.is_edited())
})
.unwrap();
- // assert!(!workspace_b.is_edited(cx_b));
// Ensure client B is not prompted to save edits when closing window after disconnecting.
let can_close = workspace_b
@@ -282,8 +282,7 @@ impl Platform for TestPlatform {
}
fn should_auto_hide_scrollbars(&self) -> bool {
- // todo()
- true
+ false
}
fn write_to_clipboard(&self, item: ClipboardItem) {
@@ -18,7 +18,6 @@ use workspace::{ModalView, Toast, Workspace};
actions!(branches, [OpenRecent]);
pub fn init(cx: &mut AppContext) {
- // todo!() po
cx.observe_new_views(|workspace: &mut Workspace, _| {
workspace.register_action(|workspace, action, cx| {
BranchList::toggle_modal(workspace, action, cx).log_err();
@@ -12,7 +12,7 @@ use serde::Deserialize;
use std::sync::Arc;
use ui::{prelude::*, Button};
-const HANDLE_HITBOX_SIZE: f32 = 4.0;
+pub const HANDLE_HITBOX_SIZE: f32 = 4.0;
const HORIZONTAL_MIN_SIZE: f32 = 80.;
const VERTICAL_MIN_SIZE: f32 = 100.;
@@ -268,15 +268,6 @@ impl Member {
)
})
.into_any()
-
- // let el = div()
- // .flex()
- // .flex_1()
- // .gap_px()
- // .w_full()
- // .h_full()
- // .bg(cx.theme().colors().editor)
- // .children();
}
Member::Axis(axis) => axis
.render(
@@ -852,6 +852,10 @@ impl Workspace {
&self.right_dock
}
+ pub fn is_edited(&self) -> bool {
+ self.window_edited
+ }
+
pub fn add_panel<T: Panel>(&mut self, panel: View<T>, cx: &mut ViewContext<Self>) {
let dock = match panel.position(cx) {
DockPosition::Left => &self.left_dock,
@@ -2055,7 +2059,7 @@ impl Workspace {
_ => bounding_box.center(),
};
- let distance_to_next = 8.; //todo(pane dividers styling)
+ let distance_to_next = pane_group::HANDLE_HITBOX_SIZE;
let target = match direction {
SplitDirection::Left => {