mirror of
https://github.com/storytold/effectcraft.git
synced 2026-10-24 10:09:32 -06:00
Workspaces: leaving Learn closes its tutorials (#272)
The Learn workspace opens the Home screen on its Learn tab, but no other workspace closed it, so after Learn the tutorials stayed over Default, Review and the rest until a project was created or Home was toggled. It wasn't about clicking quickly: any switch away from Learn kept them. Leaving Learn for another workspace now closes the Home screen it opened. Test: ui_panels leaving_the_learn_workspace_closes_its_tutorials (clicks through the workspace tabs: the Home screen and the tutorials show only on Learn). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
11f3736025
commit
02c75fcaf1
@@ -383,16 +383,21 @@ impl EffectcraftApp {
|
||||
}
|
||||
|
||||
pub fn set_workspace(&mut self, name: &str) {
|
||||
self.ui.workspace = name.to_string();
|
||||
self.ui.dock = self.ui.saved_workspaces.get(name).cloned().unwrap_or_else(|| dock::workspace(name));
|
||||
self.ui.floating = self.ui.saved_floating.get(name).cloned().unwrap_or_else(|| dock::workspace_floating(name));
|
||||
self.ui.maximized = None;
|
||||
// Learn: the Home screen's Learn tab (tutorials) in the Composition panel.
|
||||
// Learn: the Home screen's Learn tab (tutorials) in the Composition panel. Leaving it for
|
||||
// another workspace closes the Home screen again: it stayed over every workspace until a
|
||||
// project was created (#272).
|
||||
if name == "Learn" {
|
||||
self.ui.start_screen = true;
|
||||
self.ui.home_learn = true;
|
||||
self.ui.home_templates = false;
|
||||
} else if self.ui.workspace == "Learn" {
|
||||
self.ui.start_screen = false;
|
||||
self.ui.home_learn = false;
|
||||
}
|
||||
self.ui.workspace = name.to_string();
|
||||
self.ui.dock = self.ui.saved_workspaces.get(name).cloned().unwrap_or_else(|| dock::workspace(name));
|
||||
self.ui.floating = self.ui.saved_floating.get(name).cloned().unwrap_or_else(|| dock::workspace_floating(name));
|
||||
self.ui.maximized = None;
|
||||
}
|
||||
|
||||
/// Built-in workspaces followed by the saved ones (Window ▸ Workspace ▸ Save as New Workspace).
|
||||
|
||||
@@ -153,6 +153,20 @@ fn saved_workspace_is_listed_in_the_workspace_menu() {
|
||||
assert_eq!(h.state().ui.dock, saved, "its layout came back");
|
||||
}
|
||||
|
||||
/// Learn opens the Home screen's tutorials; clicking another workspace tab closes them again,
|
||||
/// however quickly the tabs are clicked (they stayed over every workspace, #272).
|
||||
#[test]
|
||||
fn leaving_the_learn_workspace_closes_its_tutorials() {
|
||||
let mut h = harness();
|
||||
for name in ["Learn", "Default", "Learn", "Review", "Learn", "Learn", "Small Screen", "Standard", "Learn", "Default"] {
|
||||
click(&mut h, &format!("header.workspace.{name}"));
|
||||
assert_eq!(h.state().ui.workspace, name);
|
||||
let learn = name == "Learn";
|
||||
assert_eq!(h.state().ui.start_screen, learn, "{name}: the Home screen shows only for Learn");
|
||||
assert_eq!(!h.state().auto.query("home.learn.").is_empty(), learn, "{name}: the tutorials show only for Learn");
|
||||
}
|
||||
}
|
||||
|
||||
/// Headless look at the panels (wgpu offscreen; needs a GPU adapter). Run with
|
||||
/// `PANELS_SNAPSHOT=/abs/dir cargo test -p effectcraft-ui-egui --test ui_panels -- --ignored`.
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user