diff --git a/crates/color-ui/src/ui/picker_dialog.rs b/crates/color-ui/src/ui/picker_dialog.rs index 5a3189854..0efddc297 100644 --- a/crates/color-ui/src/ui/picker_dialog.rs +++ b/crates/color-ui/src/ui/picker_dialog.rs @@ -136,6 +136,7 @@ enum Title { /// the app takes the colour with [`take_add_to_swatches`](Self::take_add_to_swatches). /// - **Preview:** [`current`](Self::current) follows every edit, so an app that previews reads it each pass through /// `DialogHost::get_by_id` and shows it live; Cancel is the app's cue to put the old colour back. +#[derive(craft_ui::contract::Pattern)] pub struct ColorPickerDialog { id: DialogId, /// Which of several pickers of the same key this is ([`instance`](Self::instance)). @@ -658,6 +659,14 @@ impl StackDialog for ColorPickerDialog { } }); self.current = held.same().copied(); + if self.layout == ColorPickerDialogLayout::Tabbed { + eprintln!( + "DIAG the_tabbed_colors_dialog_opens_on_its_tab_and_answers_from_either_page: held same={} picked={:?} closed={:?}", + self.current.is_some(), + shown.output.picked, + shown.output.closed + ); + } let (picked, closed) = (shown.output.picked, shown.output.closed); let ok = (picked == Some(0) || closed == Some(CloseReason::Enter)) && self.current.is_some(); diff --git a/crates/color-ui/tests/it/picker.rs b/crates/color-ui/tests/it/picker.rs index aa38193be..6af3d1dc9 100644 --- a/crates/color-ui/tests/it/picker.rs +++ b/crates/color-ui/tests/it/picker.rs @@ -210,7 +210,17 @@ fn the_tabbed_colors_dialog_opens_on_its_tab_and_answers_from_either_page() { assert_eq!(dialog_field(&dialogs, "model"), Some(serde_json::json!(RgbModel.id())), "the field names the model shown"); assert!(fixture.by_label("Red").is_some(), "and the compact rows show that model's channels"); + eprintln!( + "DIAG the_tabbed_colors_dialog_opens_on_its_tab_and_answers_from_either_page: before typing current={:?} open={}", + dialog_color(&dialogs), + dialogs.borrow().get::().is_some() + ); type_into(&mut fixture, "Hex color", "336699"); + eprintln!( + "DIAG the_tabbed_colors_dialog_opens_on_its_tab_and_answers_from_either_page: after typing current={:?} open={}", + dialog_color(&dialogs), + dialogs.borrow().get::().is_some() + ); assert_eq!(dialog_color(&dialogs).as_deref(), Some("#336699"), "a hex typed on Custom is the colour"); let set = dialogs.borrow_mut().set_json_field(&ctx, id, "tab", serde_json::json!("standard"));