DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
Merge PR #1500: rename a swatch in place
aionggef06cc61639e
diff --cc ROADMAP.mdindex 52bfb0f3b,d558648ac..a5e781227--- a/ROADMAP.md+++ b/ROADMAP.md@@@ -460,36 -443,7 +460,37 @@@ Newest first- **2026-10-16** · Lock Guides and Lock Column Guides are commands in View ▸ Grids & Guides (`view.lockGuides`, ⌥⌘;, and `view.lockColumnGuides`), so the control channel and MCP reach them. Lock Column Guides is an undo step, is saved with the document, on in new ones, and read from and written to IDML's `ColumnGuideLocked`, which export always wrote as locked (#1096). No readiness percentage change.- **2026-10-16** · IDML: a page keeps column guides that were dragged off centre (InDesign's Custom columns). They were divided evenly on import, so the gutter sprang back to the middle; the imported positions now place the columns, with the canvas guides, snapping and text placement following them, and they are written back on export. Layout › Margins and Columns re-divides them evenly when the count or gutter changes, as InDesign's does. No readiness percentage change.- **2026-10-16** · IDML: custom column positions are checked before they are used (#1096). A set must give two edges per column, ascending from the left margin to the right one; any other (a wrong count, unsorted or non-numeric values, a list longer than 216 columns allow, or positions left behind by a margin or page-size change) is the even split, in the canvas, on import and on export, instead of columns drawn outside the margins. No readiness percentage change.+- **2026-10-21** · Paragraph Border and Paragraph Shading link their four sides as InDesign's: the stroke weights, offsets and corners have the "Make all settings the same" link, on when the four are the same, so a side typed in sets all four; with the link off a side is set alone (a border with only a thick left side). Found in the Learn Skills Daily course, chapter 40. No readiness percentage change.+- **2026-10-21** · Paragraph rules have InDesign's Type (solid, thick/thin stripes, dashed, dotted, straight hash, wavy, or a stroke style of the document), Gap Color and Gap Tint, and Keep In Frame (rule above); the Paragraph Rules page is laid out as InDesign's (Weight and Type, Color and Tint, Gap Color and Gap Tint, Width and Offset, Left and Right Indent). IDML reads and writes them (`RuleAboveType`, `RuleBelowGapColor`, `KeepRuleAboveInFrame`…). Found in the Learn Skills Daily course, chapter 20. No readiness percentage change.+- **2026-10-21** · New Character Style with text selected starts from what the text has of its own over its paragraph style, as InDesign's ("[None] + Bold + color"), and Apply Style to Selection gives the text the new style, with no override left. A new style's dialog is titled New Paragraph Style / New Character Style. `type.selectionAttrs` reports the text's own character attributes (`ownChars`). Found in the Learn Skills Daily course, chapter 22. No readiness percentage change.+- **2026-10-21** · New Paragraph Style with text selected starts from it, as InDesign's (Based On [No Paragraph Style], every setting of the text that differs) and Apply Style to Selection gives the paragraph the new style; General has Next Style and Reset To Base; Basic Character Formats is in two columns (Size | Leading, Kerning | Tracking, Case | Position). `style.paragraph.edit` honours `nextStyle` (it was ignored) and takes `resetToBase`. Found in the Learn Skills Daily course, chapter 20. No readiness percentage change.+- **2026-10-21** · Find/Change has InDesign's Change Format. Specify Attributes opens Change Format Settings: Style Options (the character and paragraph style to apply, [Any Style] for none), then Basic and Advanced Character Formats, Character Color, OpenType Features, Underline and Strikethrough Options. The box shows the format ("Character Style: eggs"), and Change All gives it to the changed text. With a Change Format and nothing in Change to, the found text stays and is only formatted, as InDesign's (an ⓘ beside Change to says so). `find.change` takes `charStyle` and `paraStyle`. Found in the Learn Skills Daily course, chapter 22. No readiness percentage change.+- **2026-10-21** · Preferences › Interface follows InDesign's: Appearance has a Color Theme swatch per interface theme (a click shows it at once, Cancel goes back) and Panels sets the Tools panel to a single or double column; UI Size moves to a UI Scaling section of its own. Interface held only UI Size, and the theme could be changed only from the Window menu. Found in the Learn Skills Daily course, chapter 26. No readiness percentage change.+- **2026-10-21** · Preferences › File Handling shows Number of Recent Items to Display as a whole number ("20"; it read "20.0"). Found in the Learn Skills Daily course, chapter 26. No readiness percentage change.+- **2026-10-21** · Insert Pages… opens InDesign's dialog: Pages, Insert (After Page, Before Page, At Start of Document, At End of Document) with the page by name, and Parent ([None] or a parent), set to the page in view and its parent. It was a form asking for a page index and a parent id, and pages could not go before the first page; `layout.pages.insert` takes `before` (0: at the start). Found in the Learn Skills Daily course, chapter 25. No readiness percentage change.+- **2026-10-21** · Spelling (Check Spelling and Dynamic Spelling) no longer flags everyday words the bundled hyphenation word list lacks: "we", "us", "if", titles such as "Mr", and words such as email, online, website, database, desktop and download, with their plurals and other forms. Contractions typed with a typographer's apostrophe (don’t, we’re), which Use Typographer's Quotes produces by default, count like their straight-apostrophe forms. Dynamic Spelling used to underline most words of an ordinary sentence. Found in the Learn Skills Daily course, chapter 26. No readiness percentage change.+- **2026-10-21** · While a parent is shown, the status bar's page box and Properties › Page name it ("A-Parent") instead of page 1, as InDesign's; their lists have the parents after the pages, and choosing one shows that parent (a page leaves the parents). Found in the Learn Skills Daily course, chapter 25. No readiness percentage change.+- **2026-10-21** · Effects dialog: the Angle field of the shadows, Bevel and Emboss, Satin and Gradient Feather has InDesign's dial beside it, its radius pointing where the light comes from; a click or drag on it sets the angle. Found in the Learn Skills Daily course, chapter 14. No readiness percentage change.+- **2026-10-21** · A double-click on a Fill or Stroke chip of Properties › Appearance opens the Color Picker with its colour, as in InDesign (a click still opens the swatches); for selected text, its own chips open it for the text. Found in the Learn Skills Daily course, chapter 23. No readiness percentage change.+- **2026-10-20** · Properties › Appearance: with several text frames selected, the Fill and Stroke popups offer Apply To Frame or Text, as with one frame, so their text can be coloured at once, as in InDesign. No readiness percentage change.+- **2026-10-20** · Properties › Appearance: the arrow beside Opacity opens a slider under the field, as in InDesign, instead of the Effects panel; a drag shows the opacity live and is one undo step (the Opacity link still opens Effects). No readiness percentage change.+- **2026-10-20** · Properties › Frame Fitting has InDesign's Auto-Fit checkbox and Options button (Frame Fitting Options); the app's checkboxes are now named and ticked-or-not for screen readers. No readiness percentage change.+- **2026-10-20** · Properties › Text Wrap shows the four wrap offsets under the wrap buttons, with the link that makes them the same, as InDesign's Properties panel does (greyed with no wrap). No readiness percentage change.+- **2026-10-21** · Properties › Bullets and Numbering › Options opens the Bullets and Numbering dialog for the selected paragraphs, as InDesign's, instead of the Paragraph panel. Found in the Learn Skills Daily course, chapter 21. No readiness percentage change.+- **2026-10-20** · Properties › Appearance: the corner shape list shows each shape's glyph beside its name, drawn as InDesign draws them (Fancy has its own glyph now), and the stroke type list shows each type's line; both dropdowns are named for screen readers. No readiness percentage change.+- **2026-10-21** · Properties › Align: the Align To button shows what the objects align to, one glyph each for the selection, the key object, the margins, the page and the spread, as InDesign's. Found in the Learn Skills Daily course, chapter 12. No readiness percentage change.+- **2026-10-20** · Object › Corner Options opens a Corner Options dialog laid out as InDesign's: each corner's size and shape, the link button that makes all four the same, and Preview. The Corner link in Properties › Appearance opens it too (it opened a Rectangle size dialog). No readiness percentage change.+- **2026-10-20** · The Object menu is in InDesign's order and groups; Paths has Join, Open Path and Close Path (Convert Shape lists only shapes, as InDesign's does) and a Convert Point submenu (Plain, Corner, Smooth, Symmetrical) is added. No readiness percentage change.+- **2026-10-20** · Layout › Create Guides puts its guides on both pages of the spread in view, as InDesign does; "This page" in Apply to narrows them to one page. No readiness percentage change.+- **2026-10-21** · Object › Fitting › Clear Frame Fitting Options (`object.clearFittingOptions`): the frames' auto-fit, crop amounts and reference point go back to their defaults, and the picture stays where it is. The Fitting submenu is grouped as InDesign's. Found in the Learn Skills Daily course, chapter 11. No readiness percentage change.+- **2026-10-21** · Swatches panel rows show InDesign's columns, drawn in code: a crossed pencil on the swatches that can't be edited ([None], [Registration], [Black]), the colour type (process or spot) and the colour mode (CMYK, RGB, Gray, or [None]'s and [Registration]'s own glyphs), in place of a lock and "CMYK" text. Tint reads 100 with nothing selected. No readiness percentage change.+- **2026-10-21** · With a gradient fill or stroke, the Color panel shows the stop selected in the Gradient panel (the stop before a selected midpoint) with its values, and its C/M/Y/K or R/G/B sliders and spectrum colour that stop, keeping the others, as in InDesign. It showed "[None] — choose a colour on the ramp", and a spectrum click replaced the whole gradient with a flat colour. Found in the Learn Skills Daily course, chapter 24. No readiness percentage change.+- **2026-10-20** · A new document's Swatches panel lists InDesign's defaults: [None], [Registration], [Paper], [Black] and six process colours (C=100, M=100, Y=100, C=15 M=100 Y=100, C=75 M=5 Y=100, C=100 M=90 Y=10); the extra M=100 Y=100, C=100 Y=100 and C=100 M=100 swatches are gone. No readiness percentage change.+- **2026-10-21** · The readout beside the cursor while drawing or measuring ("W: 3.13 cm") is InDesign's light grey box with white text, measured from the tutorials' frames; High Contrast keeps it black. It was a dark translucent box. No readiness percentage change.+- **2026-10-20** · Drawing a frame or shape shows its width and height in the document's ruler units, to two decimals and on two lines ("W: 6.08 cm", "H: 6.08 cm"), as InDesign does; it was always whole points. No readiness percentage change.+- **2026-10-20** · Type tool: a drag that starts in an empty frame draws a new text frame over it, as in InDesign; a click still turns the frame into a text frame. No readiness percentage change.+- **2026-10-20** · Measures in centimetres show four decimals, as InDesign's fields do (a 1p gutter reads 0.4233 cm, not 0.423 cm). No readiness percentage change.+ - **2026-10-21** · Swatches panel: a swatch is renamed in place, as in InDesign: click it, then click its name again (a slow double-click), type, and Enter (Escape keeps the name). Everything that uses it follows; a double-click still opens Swatch Options, and [None], [Registration], [Paper] and [Black] keep their names. Found in the Learn Skills Daily course, chapter 23. No readiness percentage change.- **2026-10-21** · Properties › Character and Paragraph: ••• (More Options) expands the section in place, as InDesign's: Character adds vertical and horizontal scale, baseline shift, skew, language and OpenType, and All Caps, Small Caps, Superscript, Subscript, Underline and Strikethrough; Paragraph adds the left, right, first line and last line indents, space before and after, the drop cap's lines and characters, Align to Baseline Grid and Hyphenate. It used to open the Character or Paragraph panel; the language field moved under ••• as in InDesign. Found in the Learn Skills Daily course, chapter 16. No readiness percentage change.- **2026-10-21** · The text Control panel has InDesign's two modes: A (Character Formatting Controls: font and style, size and leading, All Caps/Superscript/Underline and Small Caps/Subscript/Strikethrough, kerning and tracking, vertical and horizontal scale, baseline shift and skew, character style and language) and ¶ (Paragraph Formatting Controls: the nine alignments, left/first line and right/last line indents, space before and after, the drop cap's lines and characters, paragraph style, Hyphenate and Align to Baseline Grid). It used to show a fixed mix of both. Found in the Learn Skills Daily course, chapter 16. No readiness percentage change.- **2026-10-20** · With the Type tool, the Control panel's font size, leading and tracking fields have a spinner and a list of common values, as in InDesign (auto leading in parentheses). No readiness percentage change.diff --cc crates/ui-egui/src/panels/swatches.rsindex c934d6b19,789474bbe..680391e03--- a/crates/ui-egui/src/panels/swatches.rs+++ b/crates/ui-egui/src/panels/swatches.rs@@@ -11,8 -11,17 +11,18 @@@ pub fn show(app: &mut DesignApp, ui: &mlet t = Tokens::get(ui.ctx());let Some(st) = app.session.active() else { return };let doc = st.doc.clone();+ // Another document (switched to, or moved to this one's place by a close) drops a rename in+ // place: a swatch of the same name there isn't the one being renamed.+ let uid = st.uid;+ if ui.data(|d| d.get_temp::<u64>(egui::Id::unique(RENAME_DOC))) != Some(uid) {+ ui.data_mut(|d| {+ d.remove_temp::<(String, String)>(egui::Id::unique(RENAMING));+ d.remove_temp::<(String, f64)>(egui::Id::unique(RENAME_CLICK));+ d.insert_temp(egui::Id::unique(RENAME_DOC), uid);+ });+ }- let target = super::color_target(app);+ // With nothing selected, the proxy, Tint field and highlighted row are those of new shapes.+ let target = super::color_target_or_defaults(app);header(app, ui, &doc, target.as_ref());// The row of the colour in front of the proxy is highlighted.let fill_cur = target.map(|(fill, _, stroke, _)| if app.ui.stroke_front { stroke } else { fill });@@@ -436,27 -356,26 +494,39 @@@ fn swatch_rowlet (c, g) = crate::widgets::swatch_colors(doc, &sw.name, 1.0);let chip = egui::Rect::from_min_size(row.min + vec2(4.0 + indent, 3.0), vec2(16.0, 16.0));crate::widgets::paint_chip(ui.painter(), chip, c, g);- ui.painter().text(row.min + vec2(28.0 + indent, 11.0), egui::Align2::LEFT_CENTER, &sw.name, egui::FontId::proportional(12.5), t.text);+ let name_rect = egui::Rect::from_min_max(row.min + vec2(26.0 + indent, 1.0), egui::pos2(row.max.x - 72.0, row.max.y - 1.0));+ if !rename_field(app, ui, sw, name_rect) {+ ui.painter().text(row.min + vec2(28.0 + indent, 11.0), egui::Align2::LEFT_CENTER, &sw.name, egui::FontId::proportional(12.5), t.text);+ }- // Type indicators: spot dot / process square, colour mode.- let kind = swatch_kind_label(&app.ui.language, &sw.value);- if sw.locked {- icons::paint(ui.painter(), egui::Rect::from_min_size(egui::pos2(row.max.x - 64.0, row.min.y + 4.0), vec2(13.0, 13.0)), "lock", t.text_dim);+ // InDesign's columns on the right: not editable, colour type, colour mode.+ let col = |k: f32| egui::Rect::from_min_size(egui::pos2(row.max.x - 19.0 - 18.0 * k, row.min.y + 4.5), vec2(13.0, 13.0));+ if marks.not_editable {+ paint_not_editable(ui.painter(), col(2.0), t.text_dim);+ }+ if let Some(kind) = marks.kind {+ paint_color_type(ui.painter(), col(1.0), kind, t.text_dim);+ }+ if let Some(mode) = marks.mode {+ paint_mode(ui.painter(), col(0.0), mode, t.text_dim);+ }+ let label = match &sw.value {+ SwatchValue::Gradient { .. } => crate::i18n::tr(&app.ui.language, "Gradient").to_string(),+ SwatchValue::Tint { tint, .. } => format!("{:.0}%", tint * 100.0),+ _ => String::new(),+ };+ if !label.is_empty() {+ ui.painter().text(row.right_center() - vec2(6.0, 0.0), egui::Align2::RIGHT_CENTER, label, egui::FontId::proportional(10.5), t.text_dim);}- ui.painter().text(row.right_center() - vec2(6.0, 0.0), egui::Align2::RIGHT_CENTER, kind, egui::FontId::proportional(10.5), t.text_dim);if resp.clicked() && !resp.double_clicked() {+ // A click on the name of the swatch picked already renames it in place, as InDesign's+ // (a slow double-click), unless it turns into a double-click.+ let picked = ui.data(|d| d.get_temp::<String>(egui::Id::unique(PICKED))).is_some_and(|p| p == sw.name);+ // A click on another swatch cancels a rename still waiting.+ ui.data_mut(|d| d.remove_temp::<(String, f64)>(egui::Id::unique(RENAME_CLICK)));+ if picked && !sw.locked && resp.interact_pointer_pos().is_some_and(|p| name_rect.contains(p)) {+ let now = ui.input(|i| i.time);+ ui.data_mut(|d| d.insert_temp(egui::Id::unique(RENAME_CLICK), (sw.name.clone(), now)));+ }ui.data_mut(|d| d.insert_temp(egui::Id::unique(PICKED), sw.name.clone()));let _ = super::apply_swatch(app, app.ui.stroke_front, &sw.name, None);}@@@ -1608,6 -1361,147 +1693,150 @@@ mod swatches_header_testsassert!(h.state().session.doc().unwrap().doc.swatch("Brand").is_none());}- /// The course's chapter 23: a swatch added as "C=14 M=8 Y=95 K=0" is renamed in the panel by- /// clicking it, then clicking its name again: the name becomes a field, and Enter renames the- /// swatch (and what uses it). A double-click still opens Swatch Options, Escape keeps the name,- /// and [Black] can't be renamed.+ /// A rename in place belongs to its document: with another one active, a swatch of the same+ /// name there gets no field, and nothing is renamed.+ #[test]+ fn a_rename_in_place_ends_with_its_document() {+ let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());+ app.run("file.new", json!({})).unwrap();+ let color = json!({"color": {"c": 14, "m": 8, "y": 95, "k": 0}});+ let name = app.run("swatch.create", color.clone()).unwrap()["name"].as_str().unwrap().to_string();+ let mut h = Harness::builder().with_size(vec2(300.0, 520.0)).build_ui_state(+ |ui, app: &mut DesignApp| {+ let id = egui::Id::unique("rename_test_fonts");+ if ui.data(|d| d.get_temp::<bool>(id)).is_none() {+ crate::theme::install_fonts(ui.ctx(), "");+ ui.data_mut(|d| d.insert_temp(id, true));+ return;+ }+ super::show(app, ui);+ },+ app,+ );+ h.run_steps(3);+ let fields = h.query_all_by_role(egui::accesskit::Role::TextInput).count();+ let renaming = egui::Id::unique(super::RENAMING);+ h.ctx.data_mut(|d| d.insert_temp(renaming, (name.clone(), "Typed".to_string())));+ h.run_steps(2);+ assert!(h.query_all_by_role(egui::accesskit::Role::TextInput).count() > fields, "the name is a field");+ // Another document with a swatch of the same name.+ h.state_mut().run("file.new", json!({})).unwrap();+ h.state_mut().run("swatch.create", color).unwrap();+ h.run_steps(3);+ assert!(h.ctx.data(|d| d.get_temp::<(String, String)>(renaming)).is_none(), "the rename is dropped");+ let doc = &h.state().session.active().unwrap().doc;+ assert!(doc.swatch(&name).is_some() && doc.swatch("Typed").is_none());+ }+++ /// The course's chapter 23: a swatch added as "C=14 M=8 Y=95 K=0" is renamed in the panel by++ /// clicking it, then clicking its name again: the name becomes a field, and Enter renames the++ /// swatch (and what uses it). A double-click still opens Swatch Options, Escape keeps the name,++ /// and [Black] can't be renamed.+ #[test]+ fn a_second_click_on_the_picked_swatch_renames_it_in_place() {+ use egui::accesskit::Role;+ let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());+ app.run("file.new", json!({})).unwrap();+ app.run("frame.create", json!({"rect": [36, 36, 200, 200], "content": "unassigned"})).unwrap();+ let added = app.run("swatch.create", json!({"color": {"c": 14, "m": 8, "y": 95, "k": 0}})).unwrap()["name"].as_str().unwrap().to_string();+ assert_eq!(added, "C=14 M=8 Y=95 K=0");+ // Frames 50 ms apart: the double-click time is six of them.+ let mut h = Harness::builder().with_size(vec2(300.0, 520.0)).with_step_dt(0.05).build_ui_state(+ |ui, app: &mut DesignApp| {+ let id = egui::Id::unique("test_fonts");+ if ui.data(|d| d.get_temp::<bool>(id)).is_none() {+ crate::theme::install_fonts(ui.ctx(), "");+ ui.data_mut(|d| d.insert_temp(id, true));+ return;+ }+ show(app, ui);+ },+ app,+ );+ h.run_steps(3);+ // The panel's own fields (Tint); renaming adds one.+ let fields = h.query_all_by_role(Role::TextInput).count();+ let field = |h: &Harness<'_, DesignApp>| h.query_all_by_role(Role::TextInput).count() > fields;+ let has = |h: &Harness<'_, DesignApp>, n: &str| h.state().session.doc().unwrap().doc.swatch(n).is_some();- let name_at = |h: &Harness<'_, DesignApp>, label: &str| h.get_by_label(label).rect().left_center() + vec2(40.0, 0.0);++ let name_at = |h: &Harness<'_, DesignApp>, name: &str| {++ let row = h.query_all_by(|n| n.label().is_some_and(|l| names_swatch(&l, name))).next().expect("the swatch's row");++ row.rect().left_center() + vec2(40.0, 0.0)++ };+ let click = |h: &mut Harness<'_, DesignApp>, at: egui::Pos2| {+ h.hover_at(at);+ h.event(egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed: true, modifiers: egui::Modifiers::NONE });+ h.event(egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed: false, modifiers: egui::Modifiers::NONE });+ h.step();+ };+ // A click on the name: applied, and picked.+ let at = name_at(&h, &added);+ click(&mut h, at);+ h.run_steps(10);+ assert_eq!(items(h.state())[0].fill.swatch, added);+ assert!(!field(&h));+ // Again, after the double-click time: the name is a field, with the name selected.+ click(&mut h, at);+ h.run_steps(10);+ assert!(field(&h), "the name is a field");+ h.event(egui::Event::Text("Lemon Yellow Sun".into()));+ h.step();+ h.key_press(egui::Key::Enter);+ h.run_steps(3);+ assert!(has(&h, "Lemon Yellow Sun") && !has(&h, &added));+ assert_eq!(items(h.state())[0].fill.swatch, "Lemon Yellow Sun", "what uses it follows");+ // Escape keeps the name.+ let at = name_at(&h, "Lemon Yellow Sun");+ h.run_steps(10);+ click(&mut h, at);+ h.run_steps(10);+ assert!(field(&h));+ h.event(egui::Event::Text("Sour".into()));+ h.step();+ h.key_press(egui::Key::Escape);+ h.run_steps(3);+ assert!(has(&h, "Lemon Yellow Sun") && !field(&h));+ // A double-click on it opens Swatch Options, and doesn't rename.+ h.run_steps(20);+ click(&mut h, at);+ click(&mut h, at);+ h.run_steps(10);+ assert_eq!(h.state().ui.dialog.as_ref().map(|d| d.id.as_str()), Some("swatchOptions"));+ assert!(!field(&h), "no rename");+ // [Black] keeps its name.+ h.state_mut().ui.dialog = None;+ h.run_steps(20);+ let at = name_at(&h, "[Black]");+ click(&mut h, at);+ h.run_steps(10);+ click(&mut h, at);+ h.run_steps(10);+ assert!(!field(&h));+ // A click on another swatch while the rename waits: that one is picked, and nothing+ // renames.+ let picked = |h: &Harness<'_, DesignApp>| h.ctx.data(|d| d.get_temp::<String>(egui::Id::unique(super::PICKED)));+ let (lemon, paper) = (name_at(&h, "Lemon Yellow Sun"), name_at(&h, "[Paper]"));+ h.run_steps(20);+ click(&mut h, lemon);+ h.run_steps(10);+ click(&mut h, lemon);+ click(&mut h, paper);+ h.run_steps(10);+ assert!(!field(&h), "the waiting rename is cancelled");+ assert_eq!(picked(&h).as_deref(), Some("[Paper]"));+ // Renaming, a click on another swatch renames, and picks that one (for Delete Swatch).+ click(&mut h, lemon);+ h.run_steps(10);+ click(&mut h, lemon);+ h.run_steps(10);+ assert!(field(&h));+ h.event(egui::Event::Text("Lemon".into()));+ h.step();+ click(&mut h, paper);+ h.run_steps(5);+ assert!(has(&h, "Lemon") && !field(&h));+ assert_eq!(picked(&h).as_deref(), Some("[Paper]"), "the swatch clicked stays picked");+ }+#[test]fn the_tint_field_keeps_each_objects_own_swatch() {let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());