Merge pull request #15507 from NaufalDzz/fix/issue-15489

Menus: Window › Contextual Task Bar tick follows the bar (#15489)
This commit is contained in:
David Mann authored and GitHub committed 2026-11-19 00:18:51 +01:00
commit 4d3db4138a
2 files changed
+22

No files matched your search

+4
View File
@@ -98,6 +98,10 @@ pub(crate) fn state_hash(app: &PhotocraftApp, input: Option<u64>) -> u64 {
(&ui.recent_files, &app.workspaces.set.current, app.ui.palette.open, ui.transform.is_some(), ui.text_edit.is_some(), app.dialog_count()).hash(&mut h);
// Cut and Copy are enabled while the typed text has a selection.
ui.text_edit.as_ref().map(|e| e.anchor != e.caret).hash(&mut h);
// The Window bars' ticks; the Contextual Task Bar's Hide bar and `ui.set` change them without a menu click (#15489).
// Not the task bar's place, which moves every frame of a drag.
let p = &ui.panels;
(p.options_bar, p.status_bar, p.menu_bar, p.context_task_bar).hash(&mut h);
(app.discard.is_some(), crate::distort_ui::modal_workspace(app)).hash(&mut h);
crate::prefs_ui::recording(app).hash(&mut h);
// The rows show the keymap's chords; the keymap follows these from the frame they change.
@@ -219,3 +219,21 @@ fn opening_or_closing_a_workspace_without_input_rebuilds_the_menus() {
app.framework.dialogs.cancel_by_id(&ctx, id);
assert_eq!(state_hash(&app, None), closed, "and come back when it is cancelled");
}
/// The Contextual Task Bar's tick follows the bar when its Hide bar or `ui.set` turns it off without a menu click
/// (#15489).
#[test]
fn the_task_bar_tick_follows_the_bar_hidden_without_a_menu_click() {
let (mut h, synced, _) = harness(true);
let ticked = |synced: &Synced| {
let bar = synced.borrow().last().cloned().expect("menus synced");
bar.find(&CommandRef::new("window.panel.contextualTaskBar")).and_then(|it| it.kind.checked())
};
assert_eq!(ticked(&synced), Some(true));
h.state_mut().ui.panels.context_task_bar = false;
h.run_steps(2);
assert_eq!(ticked(&synced), Some(false), "unticked once the bar is hidden");
h.state_mut().ui.panels.context_task_bar = true;
h.run_steps(2);
assert_eq!(ticked(&synced), Some(true), "ticked again once it shows");
}