Get app running and test passing after gpui App+Platform restructure

This commit is contained in:
Max Brunsfeld
2021-04-09 16:56:32 -07:00
parent 4ecc17b1bb
commit 079050541f
17 changed files with 719 additions and 749 deletions
+18 -10
View File
@@ -9,7 +9,7 @@ pub use workspace::*;
pub use workspace_view::*;
use crate::{settings::Settings, watch};
use gpui::{App, MutableAppContext};
use gpui::MutableAppContext;
use std::path::PathBuf;
pub fn init(app: &mut MutableAppContext) {
@@ -64,10 +64,10 @@ mod tests {
#[test]
fn test_open_paths_action() {
App::test((), |mut app| async move {
App::test((), |app| {
let settings = settings::channel(&app.font_cache()).unwrap().1;
init(&mut app);
init(app);
let dir = temp_tree(json!({
"a": {
@@ -94,7 +94,7 @@ mod tests {
settings: settings.clone(),
},
);
assert_eq!(app.window_ids().len(), 1);
assert_eq!(app.window_ids().count(), 1);
app.dispatch_global_action(
"workspace:open_paths",
@@ -103,11 +103,19 @@ mod tests {
settings: settings.clone(),
},
);
assert_eq!(app.window_ids().len(), 1);
let workspace_view_1 = app.root_view::<WorkspaceView>(app.window_ids()[0]).unwrap();
workspace_view_1.read(&app, |view, app| {
assert_eq!(view.workspace.as_ref(app).worktrees().len(), 2);
});
assert_eq!(app.window_ids().count(), 1);
let workspace_view_1 = app
.root_view::<WorkspaceView>(app.window_ids().next().unwrap())
.unwrap();
assert_eq!(
workspace_view_1
.as_ref(app)
.workspace
.as_ref(app)
.worktrees()
.len(),
2
);
app.dispatch_global_action(
"workspace:open_paths",
@@ -119,7 +127,7 @@ mod tests {
settings: settings.clone(),
},
);
assert_eq!(app.window_ids().len(), 2);
assert_eq!(app.window_ids().count(), 2);
});
}
}