Visual Studio Code, rebuilt in Rust
Rust
use std::path::Path;
use std::sync::{Arc, Mutex};
use config::registry::Registry;
use config::service::Settings;
use exthost::scan::scan_extension;
use gpui::TestAppContext;
use crate::host_sync::HostSync;
use crate::languages::Languages;
use crate::theme::load_theme;
use crate::workbench::Workbench;
use crate::workbench::layout::Part;
use crate::workbench::view_panes::{OUTLINE_VIEW, PaneContainer, TIMELINE_VIEW};
#[gpui::test]
fn focus_view_commands_open_the_explorer_pane_and_focus_it(cx: &mut TestAppContext) {
let app_root = Path::new(env!("VSCODE_SRC")).to_path_buf();
let themes = scan_extension(&app_root.join("extensions/theme-defaults"), true).unwrap();
let theme = load_theme(&[themes], "Dark Modern").unwrap();
let dir = std::env::temp_dir().join(format!("vsrustium-focus-view-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&dir);
std::fs::create_dir_all(&dir).unwrap();
let workspace = config::workspace::Workspace::folder(dir.clone());
let settings = Arc::new(Mutex::new(Settings::load(Registry::with_extensions(&[]), dir.join("User"), Some(workspace.clone()))));
let (workbench, cx) = cx.add_window_view(|_, cx| Workbench::new(theme, app_root.clone(), Some(workspace), Languages::new(&[]), settings, HostSync::new(std::sync::mpsc::channel().0), cx));
cx.update(|window, cx| {
window.activate_window();
drop(window.draw(cx));
});
cx.run_until_parked();
for view in [TIMELINE_VIEW, OUTLINE_VIEW] {
workbench.update_in(cx, |workbench, window, cx| _ = workbench.execute_command(&format!("{view}.focus"), vec![], window, cx));
cx.run_until_parked();
workbench.update_in(cx, |workbench, window, _| {
assert!(workbench.view_pane_expanded(PaneContainer::Explorer, view), "{view} expanded");
if view == TIMELINE_VIEW {
assert!(workbench.timeline.focus.is_focused(window), "{view} focused");
} else {
assert!(workbench.timeline.focus.is_focused(window), "no editor: the outline shows a message and its hidden tree takes no focus");
}
});
}
let reference: serde_json::Value = serde_json::from_str(include_str!("../../command_palette/reference-commands.json")).unwrap();
let built_in = ["workbench.explorer.fileView.focus", "workbench.view.search.focus", "workbench.scm.focus", "workbench.view.testing.focus", "workbench.views.extensions.installed.focus", "workbench.action.problems.focus"];
workbench.read_with(cx, |workbench, _| {
for id in built_in {
assert!(reference["commandPalette"].as_array().unwrap().iter().any(|item| item["id"] == id), "{id} is a reference command");
assert!(workbench.commands.get(id).is_some(), "{id} registered");
}
});
}
/// paneCompositeBar.ts shows every side bar container in the activity bar wherever it sits: with
/// `workbench.activityBar.location` `top`, an extension's `viewsContainers.activitybar` entry appears in the side bar's
/// header from startup and after an install, titled from package.nls.json, and its tab opens the container.
#[gpui::test]
fn the_top_activity_bar_shows_contributed_containers(cx: &mut TestAppContext) {
let app_root = Path::new(env!("VSCODE_SRC")).to_path_buf();
let themes = scan_extension(&app_root.join("extensions/theme-defaults"), true).unwrap();
let theme = load_theme(&[themes], "Dark Modern").unwrap();
let fixtures = Path::new(env!("CARGO_MANIFEST_DIR")).join("../../../port/fixtures/extensions/activity-bar-containers");
let containers = scan_extension(&fixtures.join("vscode-containers"), false).unwrap();
let todo_tree = scan_extension(&fixtures.join("todo-tree"), false).unwrap();
let dir = std::env::temp_dir().join(format!("vsrustium-top-activity-bar-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&dir);
std::fs::create_dir_all(&dir).unwrap();
let workspace = config::workspace::Workspace::folder(dir.clone());
let settings = Arc::new(Mutex::new(Settings::load(Registry::with_extensions(&[]), dir.join("User"), Some(workspace.clone()))));
let (workbench, cx) = cx.add_window_view(|_, cx| {
let mut workbench = Workbench::new(theme, app_root.clone(), Some(workspace), Languages::new(&[]), settings, HostSync::new(std::sync::mpsc::channel().0), cx);
workbench.update_setting("workbench.activityBar.location", serde_json::json!("top"));
workbench.set_tree_views(std::slice::from_ref(&containers));
workbench
});
let containers_id = "workbench.view.extension.containersView";
let todo_tree_id = "workbench.view.extension.todo-tree-container";
cx.update(|window, cx| drop(window.draw(cx)));
assert!(cx.debug_bounds("workbench.view.explorer").is_some(), "the top activity bar shows the built-in containers");
assert!(cx.debug_bounds(containers_id).is_some(), "a container of an extension scanned at startup shows");
assert!(cx.debug_bounds(todo_tree_id).is_none());
workbench.update(cx, |workbench, cx| workbench.set_running_extensions(vec![containers, todo_tree], cx));
cx.update(|window, cx| drop(window.draw(cx)));
assert!(cx.debug_bounds(todo_tree_id).is_some(), "a container of an extension installed at runtime shows");
workbench.read_with(cx, |workbench, _| {
let titles: Vec<_> = workbench.activity_bar_containers().into_iter().filter(|(id, _)| id.starts_with("workbench.view.extension.")).collect();
assert_eq!(titles, [(containers_id, "Containers"), (todo_tree_id, "TODOs")]);
});
// paneCompositeBar.ts draws an extension's icon file as a 16px mask centered in its action label, as a codicon.
let codicon = cx.debug_bounds("codicon-explorer-view-icon").unwrap();
let explorer = cx.debug_bounds("workbench.view.explorer").unwrap();
let icon = cx.debug_bounds("uri-icon-workbench.view.extension.containersView").unwrap();
let tab = cx.debug_bounds(containers_id).unwrap();
assert_eq!((icon.origin - tab.origin, icon.size), (codicon.origin - explorer.origin, codicon.size));
let tab = tab.center();
cx.simulate_click(tab, gpui::Modifiers::none());
cx.run_until_parked();
workbench.read_with(cx, |workbench, _| assert_eq!(workbench.side_bar_view, crate::workbench::search_view::SideBarView::Contributed(containers_id)));
let _ = std::fs::remove_dir_all(&dir);
}
/// viewsExtensionPoint.ts registers an activity bar container's views in a `ViewPaneContainer`: each is a pane with a
/// header, `"visibility": "collapsed"` starts it collapsed, its collapsed state goes to workspace storage, and a view
/// moved into the container joins the panes.
#[gpui::test]
fn a_contributed_container_draws_its_views_as_panes(cx: &mut TestAppContext) {
let app_root = Path::new(env!("VSCODE_SRC")).to_path_buf();
let themes = scan_extension(&app_root.join("extensions/theme-defaults"), true).unwrap();
let theme = load_theme(&[themes], "Dark Modern").unwrap();
let fixtures = Path::new(env!("CARGO_MANIFEST_DIR")).join("../../../port/fixtures/extensions/activity-bar-containers");
let containers = scan_extension(&fixtures.join("vscode-containers"), false).unwrap();
let dir = std::env::temp_dir().join(format!("vsrustium-contributed-panes-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&dir);
std::fs::create_dir_all(&dir).unwrap();
let workspace = config::workspace::Workspace::folder(dir.clone());
let settings = Arc::new(Mutex::new(Settings::load(Registry::with_extensions(&[]), dir.join("User"), Some(workspace.clone()))));
let (workbench, cx) = cx.add_window_view(|_, cx| {
let mut workbench = Workbench::new(theme, app_root.clone(), Some(workspace), Languages::new(&[]), settings, HostSync::new(std::sync::mpsc::channel().0), cx);
workbench.set_tree_views(std::slice::from_ref(&containers));
workbench
});
let containers_id = "workbench.view.extension.containersView";
let container = PaneContainer::Contributed(containers_id);
workbench.update_in(cx, |workbench, window, cx| _ = workbench.execute_command(containers_id, vec![], window, cx));
cx.update(|window, cx| drop(window.draw(cx)));
cx.run_until_parked();
let networks = "vscode-containers.views.networks";
workbench.read_with(cx, |workbench, _| {
let ids = workbench.panes(container).view.as_ref().expect("laid out").ids().to_vec();
assert_eq!(ids, ["vscode-containers.views.containers", "vscode-containers.views.images", "vscode-containers.views.registries", networks, "vscode-containers.views.volumes", "vscode-containers.views.dockerContexts", "vscode-containers.views.help"]);
assert!(workbench.view_pane_expanded(container, "vscode-containers.views.images"));
assert!(!workbench.view_pane_expanded(container, networks), "\"visibility\": \"collapsed\"");
});
let header = cx.debug_bounds("pane-header-vscode-containers.views.networks").expect("each view has a pane header").center();
cx.simulate_click(header, gpui::Modifiers::none());
cx.run_until_parked();
workbench.read_with(cx, |workbench, _| {
assert!(workbench.view_pane_expanded(container, networks), "a header click expands the pane");
let stored: serde_json::Value = serde_json::from_str(&workbench.workspace_storage.lock().unwrap().get("workbench.view.extension.containersView.state").expect("stored")).unwrap();
assert_eq!(stored[networks]["collapsed"], false);
});
workbench.update(cx, |workbench, cx| workbench.move_view_to_container(OUTLINE_VIEW, containers_id, cx));
cx.update(|window, cx| drop(window.draw(cx)));
workbench.read_with(cx, |workbench, _| assert!(workbench.panes(container).view.as_ref().unwrap().ids().contains(&OUTLINE_VIEW), "a moved view joins the container's panes"));
assert!(cx.debug_bounds("pane-header-outline").is_some());
let _ = std::fs::remove_dir_all(&dir);
}
/// viewContainerModel.ts: a view's descriptor `collapsed` holds in any container, so a `"visibility": "collapsed"` view
/// of a container moved to the panel starts as a collapsed pane there too.
#[gpui::test]
fn a_collapsed_view_stays_collapsed_in_the_panel(cx: &mut TestAppContext) {
let app_root = Path::new(env!("VSCODE_SRC")).to_path_buf();
let theme = load_theme(&[scan_extension(&app_root.join("extensions/theme-defaults"), true).unwrap()], "Dark Modern").unwrap();
let fixtures = Path::new(env!("CARGO_MANIFEST_DIR")).join("../../../port/fixtures/extensions/activity-bar-containers");
let containers = scan_extension(&fixtures.join("vscode-containers"), false).unwrap();
let (workbench, cx) = cx.add_window_view(|_, cx| {
let mut workbench = Workbench::new(theme, app_root.clone(), None, Languages::new(&[]), crate::default_settings(), HostSync::new(std::sync::mpsc::channel().0), cx);
workbench.set_tree_views(std::slice::from_ref(&containers));
workbench
});
let containers_id = "workbench.view.extension.containersView";
workbench.update_in(cx, |workbench, window, cx| {
_ = workbench.execute_command(&format!("moveViewContainerTo{}", crate::workbench::view_locations::location_code(crate::workbench::layout::Part::Panel)), vec![serde_json::json!(containers_id)], window, cx);
workbench.open_panel_view(containers_id, cx);
});
cx.update(|window, cx| drop(window.draw(cx)));
let container = crate::workbench::view_locations::pane_container(containers_id);
workbench.read_with(cx, |workbench, _| {
assert!(workbench.view_pane_expanded(container, "vscode-containers.views.images"));
assert!(!workbench.view_pane_expanded(container, "vscode-containers.views.networks"), "\"visibility\": \"collapsed\"");
});
// paneviewlet.css `.pane.horizontal:not(.expanded) > .pane-header > .icon`: only the collapsed strip draws the icon.
assert!(cx.debug_bounds("pane-icon-vscode-containers.views.networks").is_some());
assert!(cx.debug_bounds("pane-icon-vscode-containers.views.images").is_none());
}
/// viewDescriptorService.ts `moveViewsWithoutSaving`: a view moved into a side bar container comes in expanded
/// (`ViewVisibilityState.Expand`); a workspace without a stored state for it there, `views.customizations` being per
/// profile, starts it with its descriptor's `collapsed` (viewContainerModel.ts `add`).
#[gpui::test]
fn a_moved_collapsed_view_keeps_its_descriptor_collapsed_in_another_workspace(cx: &mut TestAppContext) {
let app_root = Path::new(env!("VSCODE_SRC")).to_path_buf();
let fixtures = Path::new(env!("CARGO_MANIFEST_DIR")).join("../../../port/fixtures/extensions/activity-bar-containers");
let containers = scan_extension(&fixtures.join("vscode-containers"), false).unwrap();
let networks = "vscode-containers.views.networks";
let explorer = PaneContainer::Explorer;
let build = |profile_storage: Option<Arc<Mutex<storage::Storage>>>, cx: &mut gpui::Context<Workbench>| {
let theme = load_theme(&[scan_extension(&app_root.join("extensions/theme-defaults"), true).unwrap()], "Dark Modern").unwrap();
let mut workbench = Workbench::new(theme, app_root.clone(), None, Languages::new(&[]), crate::default_settings(), HostSync::new(std::sync::mpsc::channel().0), cx);
if let Some(profile_storage) = profile_storage {
workbench.profile_storage = profile_storage;
}
workbench.set_tree_views(std::slice::from_ref(&containers));
workbench
};
let (workbench, window) = cx.add_window_view(|_, cx| build(None, cx));
workbench.update(window, |workbench, cx| {
workbench.move_view_to_container(networks, crate::workbench::view_locations::EXPLORER_CONTAINER, cx);
workbench.layout_view_panes(700., cx);
assert!(workbench.view_pane_expanded(explorer, networks), "a moved view comes in expanded");
});
let profile_storage = workbench.read_with(window, |workbench, _| workbench.profile_storage.clone());
let (workbench, window) = cx.add_window_view(|_, cx| build(Some(profile_storage), cx));
workbench.update(window, |workbench, cx| {
workbench.layout_view_panes(700., cx);
assert!(workbench.panes(explorer).view.as_ref().expect("laid out").ids().contains(&networks));
assert!(!workbench.view_pane_expanded(explorer, networks), "\"visibility\": \"collapsed\"");
});
}
/// testing.contribution.ts: Testing is a `ViewPaneContainer` whose Test Explorer, shown once a controller registers,
/// comes first (order -999), with the views extensions contribute to `test` as panes after it. A contributed view alone
/// shows the container and merges into it, titled "Testing" as in the reference.
#[gpui::test]
fn testing_draws_contributed_views_as_panes_after_the_test_explorer(cx: &mut TestAppContext) {
let app_root = Path::new(env!("VSCODE_SRC")).to_path_buf();
let themes = scan_extension(&app_root.join("extensions/theme-defaults"), true).unwrap();
let theme = load_theme(&[themes], "Dark Modern").unwrap();
let dir = std::env::temp_dir().join(format!("vsrustium-testing-panes-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&dir);
let extension_dir = dir.join("extension");
std::fs::create_dir_all(&extension_dir).unwrap();
let manifest = serde_json::json!({ "name": "test-views", "publisher": "port", "version": "0.0.1", "engines": { "vscode": "*" }, "contributes": { "views": { "test": [{ "id": "port.testView", "name": "Test Sample" }] } } });
std::fs::write(extension_dir.join("package.json"), manifest.to_string()).unwrap();
let extension = scan_extension(&extension_dir, false).unwrap();
let workspace = config::workspace::Workspace::folder(dir.clone());
let settings = Arc::new(Mutex::new(Settings::load(Registry::with_extensions(&[]), dir.join("User"), Some(workspace.clone()))));
let (workbench, cx) = cx.add_window_view(|_, cx| {
let mut workbench = Workbench::new(theme, app_root.clone(), Some(workspace), Languages::new(&[]), settings, HostSync::new(std::sync::mpsc::channel().0), cx);
workbench.set_tree_views(std::slice::from_ref(&extension));
workbench
});
workbench.update_in(cx, |workbench, window, cx| _ = workbench.execute_command("workbench.view.testing", vec![], window, cx));
cx.update(|window, cx| drop(window.draw(cx)));
cx.run_until_parked();
let container = PaneContainer::Contributed(crate::workbench::view_locations::TESTING_CONTAINER);
workbench.read_with(cx, |workbench, _| {
assert_eq!(workbench.panes(container).view.as_ref().expect("laid out").ids(), ["port.testView"]);
assert!(workbench.activity_bar_containers().contains(&("workbench.view.testing", "Testing")), "a contributed view shows Testing");
});
assert!(cx.debug_bounds("pane-header-port.testView").is_none(), "a single view merges into the container");
workbench.update(cx, |workbench, cx| {
workbench.testing.controllers.insert("port".into(), crate::workbench::testing_service::Controller { label: "Port".into(), capabilities: 0 });
cx.notify();
});
cx.update(|window, cx| drop(window.draw(cx)));
workbench.read_with(cx, |workbench, _| {
let ids = workbench.panes(container).view.as_ref().expect("laid out").ids().to_vec();
assert_eq!(ids, [crate::workbench::testing_view::TESTING_VIEW, "port.testView"]);
});
assert!(cx.debug_bounds("pane-header-workbench.view.testing").is_some(), "the Test Explorer has a pane header beside another view");
assert!(cx.debug_bounds("pane-header-port.testView").is_some());
let _ = std::fs::remove_dir_all(&dir);
}
/// viewsService.ts `registerOpenViewContainerAction`: an extension's side bar container is "View: Show <title>" in the
/// Command Palette while one of its views is active (`viewContainer.<id>.enabled`).
#[gpui::test]
fn an_extension_container_is_shown_from_the_command_palette(cx: &mut TestAppContext) {
let app_root = Path::new(env!("VSCODE_SRC")).to_path_buf();
let themes = scan_extension(&app_root.join("extensions/theme-defaults"), true).unwrap();
let theme = load_theme(&[themes], "Dark Modern").unwrap();
let fixture = Path::new(env!("CARGO_MANIFEST_DIR")).join("../../../port/fixtures/extensions/contributed-panes");
let extension = scan_extension(&fixture, false).unwrap();
let (workbench, cx) = cx.add_window_view(|_, cx| {
let mut workbench = Workbench::new(theme, app_root.clone(), None, Languages::new(&[]), crate::default_settings(), HostSync::new(std::sync::mpsc::channel().0), cx);
workbench.set_tree_views(std::slice::from_ref(&extension));
workbench.set_tree_views(std::slice::from_ref(&extension));
workbench
});
workbench.update_in(cx, |workbench, window, cx| drop(workbench.execute_command("workbench.action.showCommands", Vec::new(), window, cx)));
cx.run_until_parked();
let labels = workbench.read_with(cx, |workbench, _| workbench.quick_inputs.current().unwrap().rows.iter().map(|row| row.item.label.clone()).collect::<Vec<_>>());
// set_tree_views runs twice, as after an install: the entry is not doubled.
assert_eq!(labels.iter().filter(|label| *label == "View: Show Port Panes").count(), 1, "{labels:?}");
// viewsService.ts `registerFocusViewAction`, categorized by the view's container.
for label in ["Port Panes: Focus on First View", "Port Panel: Focus on Panel First View", "Testing: Focus on Test Sample View"] {
assert_eq!(labels.iter().filter(|shown| *shown == label).count(), 1, "{label}: {labels:?}");
}
// views.ts `registerViewContainer` gives the container an open command, so its item menu opens with Configure Keybinding.
workbench.update_in(cx, |workbench, window, cx| drop(workbench.execute_command("workbench.action.closeQuickOpen", Vec::new(), window, cx)));
workbench.update_in(cx, |workbench, window, cx| workbench.show_composite_context_menu("workbench.view.extension.portPanes", Part::SideBar, gpui::Bounds::default(), window, cx));
workbench.read_with(cx, |workbench, _| {
let menu = workbench.context_menu.as_ref().expect("a context menu shows");
let crate::menus::MenuAction::Command { id, title, .. } = &menu.levels[0].actions[0] else { panic!("a command first") };
assert_eq!((title.as_str(), id.as_str()), ("Configure Keybinding", "configureKeybinding/workbench.view.extension.portPanes"));
});
}
/// compositeBar.ts `CompositeDragAndDrop.drop` opens a container dropped on the panel focused (`openComposite(id, true)`):
/// a contributed one on its first view, outlined over its message (treeView.ts `updateContentAreas`), Extensions on
/// its search box.
#[gpui::test]
fn a_container_dropped_on_the_panel_opens_focused(cx: &mut TestAppContext) {
let app_root = Path::new(env!("VSCODE_SRC")).to_path_buf();
let theme = load_theme(&[scan_extension(&app_root.join("extensions/theme-defaults"), true).unwrap()], "Dark Modern").unwrap();
let fixture = Path::new(env!("CARGO_MANIFEST_DIR")).join("../../../port/fixtures/extensions/contributed-panes");
let extension = scan_extension(&fixture, false).unwrap();
let (workbench, cx) = cx.add_window_view(|_, cx| {
let mut workbench = Workbench::new(theme, app_root.clone(), None, Languages::new(&[]), crate::default_settings(), HostSync::new(std::sync::mpsc::channel().0), cx);
workbench.set_tree_views(std::slice::from_ref(&extension));
workbench
});
cx.update(|window, cx| {
window.activate_window();
drop(window.draw(cx));
});
workbench.update_in(cx, |workbench, window, cx| workbench.drop_composite("workbench.view.extension.portPanes", Part::Panel, None, window, cx));
cx.update(|window, cx| drop(window.draw(cx)));
workbench.update_in(cx, |workbench, window, _| assert!(workbench.tree_views.focus["portPanes.first"].is_focused(window)));
assert!(cx.debug_bounds("tree-view-outline-portPanes.first").is_some());
assert!(cx.debug_bounds("tree-view-outline-portPanes.second").is_none());
workbench.update_in(cx, |workbench, window, cx| workbench.drop_composite(crate::workbench::extensions_view::VIEWLET_ID, Part::Panel, None, window, cx));
workbench.update_in(cx, |workbench, window, _| assert!(workbench.extensions_viewlet.search_focus.is_focused(window)));
cx.update(|window, cx| drop(window.draw(cx)));
assert!(cx.debug_bounds("pane-header-workbench.views.extensions.installed").is_some());
}
/// viewsExtensionPoint.ts `viewsContainers.panel`: the container is a panel tab, not an activity bar item, its views
/// draw as panes under the container's "...", and viewsService.ts `OpenViewContainerAction` "View: Toggle <title>"
/// opens it, then closes it from inside the panel.
#[gpui::test]
fn an_extension_panel_container_is_a_panel_tab(cx: &mut TestAppContext) {
let app_root = Path::new(env!("VSCODE_SRC")).to_path_buf();
let themes = scan_extension(&app_root.join("extensions/theme-defaults"), true).unwrap();
let theme = load_theme(&[themes], "Dark Modern").unwrap();
let fixture = Path::new(env!("CARGO_MANIFEST_DIR")).join("../../../port/fixtures/extensions/contributed-panes");
let extension = scan_extension(&fixture, false).unwrap();
let (workbench, cx) = cx.add_window_view(|_, cx| {
let mut workbench = Workbench::new(theme, app_root.clone(), None, Languages::new(&[]), crate::default_settings(), HostSync::new(std::sync::mpsc::channel().0), cx);
workbench.set_tree_views(std::slice::from_ref(&extension));
workbench
});
let container = "workbench.view.extension.portPanel";
workbench.read_with(cx, |workbench, _| {
let tab = workbench.part_tabs(Part::Panel).into_iter().find(|tab| tab.id == container).expect("a panel tab");
assert_eq!((tab.title, tab.view), ("Port Panel", "portPanel.first"));
assert!(workbench.activity_bar_containers().iter().all(|(id, _)| *id != container));
assert_eq!(workbench.container_location(container), Part::Panel);
});
workbench.update_in(cx, |workbench, window, cx| drop(workbench.execute_command("workbench.action.showCommands", Vec::new(), window, cx)));
cx.run_until_parked();
let labels = workbench.read_with(cx, |workbench, _| workbench.quick_inputs.current().unwrap().rows.iter().map(|row| row.item.label.clone()).collect::<Vec<_>>());
assert!(labels.iter().any(|label| label == "View: Toggle Port Panel"), "{labels:?}");
workbench.update_in(cx, |workbench, window, cx| drop(workbench.execute_command("workbench.action.closeQuickOpen", Vec::new(), window, cx)));
workbench.update_in(cx, |workbench, window, cx| drop(workbench.execute_command(container, Vec::new(), window, cx)));
cx.update(|window, cx| {
window.activate_window();
drop(window.draw(cx));
});
cx.run_until_parked();
workbench.read_with(cx, |workbench, _| {
assert_eq!(workbench.active_panel_id(), Some(container));
assert!(workbench.is_view_visible("portPanel.first") && workbench.is_view_visible("portPanel.second"));
assert!(workbench.tree_view_body_visible("portPanel.first"));
});
workbench.update(cx, |workbench, cx| {
let more = workbench.action_bar_focus(container, "more", cx);
assert!(workbench.drawn_action_bar_items(container).contains(&more), "the container's \"...\" draws in the panel title");
});
workbench.update_in(cx, |workbench, window, cx| drop(workbench.execute_command(container, Vec::new(), window, cx)));
workbench.read_with(cx, |workbench, _| assert!(!workbench.is_part_visible(Part::Panel)));
}