DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
Merge PR #1606: Paragraph Shading and Border pages
aiongg89ef0e3d8146
diff --cc ROADMAP.mdindex 337df15e6,08948f1a3..5aa34b1b3--- a/ROADMAP.md+++ b/ROADMAP.md@@@ -422,9 -411,9 +422,10 @@@ Newest first- **2026-10-24** · Optical Margin Alignment per story with a size (`story.options {opticalMargin, opticalMarginSize}`, off by default): when it is on, the story's paragraphs hang punctuation and letter edges by amounts set for that type size, except paragraphs with Ignore Optical Margin (`ignoreOpticalMargin` in `type.para` and paragraph styles). Table cells and footnotes don't take the story setting yet. When it is off, the per-paragraph switch still hangs at the text's own size. IDML imports and exports both (`StoryPreference/@OpticalMarginAlignment`, `@OpticalMarginSize`, `IgnoreEdgeAlignment`) (#947). No readiness percentage change.- **2026-10-24** · Text frames: a custom baseline grid's Relative To (Text Frame Options › Baseline Options, `object.textFrameOptions {baselineGrid: {relativeTo}}`, IDML `BaselineFrameGridRelativeOption`) measures the grid's start from the top of the page, the top margin, the top of the frame or its top inset. Text Frame Options had no custom baseline grid controls, imports dropped the setting and every frame grid started from the page top, so grid-aligned text in a frame measured from its own top sat on the wrong lines. No readiness percentage change.- **2026-10-24** · Paragraph Style Options › Indents and Spacing has an Align to Grid menu: None, All Lines or First Line Only. It shows the style's current setting. A First Line Only style could be set only in the CJK Grid Settings section, which shows only with CJK features on, or through commands. No readiness percentage change.+- **2026-10-24** · A guide pulled out of a ruler keeps the resize cursor across it until it is dropped; the tool's cursor took over as soon as the pointer left the ruler, so the drag looked as if it had stopped. No readiness percentage change.- **2026-10-24** · Anchored text frames, such as marginal notes, compose where their host story places them: they align to the baseline grid at that position, and page-number markers and spine-relative alignment inside them read the host's page. They composed against a grid measured from their stored position and on no page, so a note set to Only Align First Line to Grid could sit a fraction of a line off the body text's grid line. No readiness percentage change.- **2026-10-24** · Tables: a gradient swatch in a cell fill draws as a gradient on the canvas and in PDF, in one gradient space for the whole table, so it runs across cells without restarting. Cells showed the gradient's first stop as a solid colour. No readiness percentage change.+ - **2026-10-22** · Paragraph Style Options › Paragraph Shading and Paragraph Border are laid out as InDesign's: headed with the page's name; Tint is a spinner with InDesign's presets and has Overprint beside it (shading, border and gap; a new attribute each, kept through IDML; PDF export warns it doesn't overprint yet); Corner Size and Shape is InDesign's two-by-two grid of corner icons, sizes and shape menus showing each shape's glyph, with the link in the middle; offsets and weights have spinners. Found in the Learn Skills Daily course, chapter 41. No readiness percentage change.- **2026-10-24** · New documents start with Hyphenate Capitalized Words, Hyphenate Last Word and Hyphenate Across Column off in [Basic Paragraph], as in InDesign. Opened and imported files keep the values they carry. No readiness percentage change.- **2026-10-24** · The baseline grid's Relative To setting applies: with Top Margin, the grid starts at each page's own top margin in text composition, on the canvas and for snapping. It started at the page top, so grid-aligned text sat on the wrong lines and a page could fit one line fewer. No readiness percentage change.- **2026-10-24** · Custom-positioned anchored objects honour Relative to Spine (`anchored.options {spineRelative}`, IDML `SpineRelative`): the settings describe a left-hand page and mirror on a right-hand page, so marginal notes stay in the outside margin on both pages of a spread. On right-hand pages they took the left-hand placement and landed in the inside margin, across the spine or over the body text. No readiness percentage change.diff --cc crates/ui-egui/src/dialogs.rsindex f6302ddd5,2beb7fe17..2c146013e--- a/crates/ui-egui/src/dialogs.rs+++ b/crates/ui-egui/src/dialogs.rs@@@ -5567,29 -4695,54 +5579,53 @@@ fn para_corners(lang: &str, ui: &mut eglet linked = linked(d, key, corners.iter().all(|c| *c == corners[0]));let mut changed = None;let mut relinked = false;- egui::Grid::new(("pscorners", key)).num_columns(4).spacing([8.0, 6.0]).show(ui, |ui| {- for (i, label) in ["Top Left:", "Top Right:", "Bottom Right:", "Bottom Left:"].into_iter().enumerate() {- let Some(c) = corners.get_mut(i) else { continue };- crate::rtl::label(ui, crate::i18n::tr(lang, label));- if let Some(v) = crate::widgets::measure(ui, &format!("ps{key}{i}"), Some(c.size), units, 70.0) {- c.size = if v.is_finite() { v.clamp(0.0, 10_000.0) } else { 0.0 };- changed = Some(i);- }- craft_ui::ComboBox::from_id_salt(("pscornershape", key, i))- .selected_text(crate::rtl::widget(ui, crate::i18n::tr(lang, c.shape.label())))- .width(130.0)- .show_ui(ui, |ui| {- for shape in CornerShape::ALL {- if ui.selectable_label(c.shape == shape, crate::rtl::widget(ui, crate::i18n::tr(lang, shape.label()))).clicked() {- c.shape = shape;- changed = Some(i);- }- }+ let mut corner = |ui: &mut egui::Ui, i: usize, icon: &str, tip: &str, changed: &mut Option<usize>| {+ let Some(c) = corners.get_mut(i) else { return };+ let tip = crate::i18n::tr(lang, tip);+ let (r, resp) = ui.allocate_exact_size(egui::vec2(18.0, 18.0), egui::Sense::hover());+ crate::icons::paint(ui.painter(), r, icon, crate::theme::Tokens::get(ui.ctx()).icon);+ resp.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Label, true, tip));+ resp.on_hover_text(tip);+ let id = format!("ps{key}{i}");+ if let Some(v) = crate::widgets::NumField::measure(&id, Some(c.size), units).width(84.0).spinner().range(0.0, 10_000.0).show(ui) {+ c.size = if v.is_finite() { v.clamp(0.0, 10_000.0) } else { 0.0 };+ *changed = Some(i);+ }+ let shape_label = crate::i18n::tr(lang, "Corner Shape");+ let shown = c.shape;- let resp = crate::panels::properties::preview_dropdown(ui, 52.0, shape_label, |p, r| {- crate::panels::properties::paint_corner_shape(p, r.shrink(2.0), shown, egui::Color32::BLACK)- });++ let resp = crate::panels::properties::corner_shape_button(ui, shown, 52.0);++ resp.widget_info(|| egui::WidgetInfo::labeled(egui::Role::ComboBox, true, shape_label));+ egui::Popup::menu(&resp).show(|ui| {+ for shape in CornerShape::ALL {+ let row = crate::panels::properties::preview_row(ui, c.shape == shape, crate::i18n::tr(lang, shape.label()), 22.0, |p, r, ink| {+ crate::panels::properties::paint_corner_shape(p, r, shape, ink)});+ if row.clicked() {+ c.shape = shape;+ *changed = Some(i);+ ui.close();+ }+ }+ });+ };+ egui::Grid::new(("pscorners", key)).num_columns(3).spacing([14.0, 6.0]).show(ui, |ui| {+ for (row, [(li, licon, ltip), (ri, ricon, rtip)]) in [+ [(0, "corner-tl", "Top Left Corner"), (1, "corner-tr", "Top Right Corner")],+ [(3, "corner-bl", "Bottom Left Corner"), (2, "corner-br", "Bottom Right Corner")],+ ]+ .into_iter()+ .enumerate()+ {+ ui.horizontal(|ui| corner(ui, li, licon, ltip, &mut changed));// Linked again, the four take Top Left's size and shape.- if i == 0 && link_toggle(lang, ui, d, key, linked) {- relinked = true;+ if row == 0 {+ if link_toggle(lang, ui, d, key, linked) {+ relinked = true;+ }+ } else {+ ui.label("");}+ ui.horizontal(|ui| corner(ui, ri, ricon, rtip, &mut changed));ui.end_row();}});diff --cc crates/ui-egui/src/dialogs/tests.rsindex e3e271a7e,333cdab6a..41aa98257--- a/crates/ui-egui/src/dialogs/tests.rs+++ b/crates/ui-egui/src/dialogs/tests.rs@@@ -3612,846 -3598,53 +3612,897 @@@ fn paragraph_border_sides_and_corners_lassert_eq!(style.para.border_weights, Some([3.0, 10.0, 3.0, 3.0]));}+ /// The course's chapter 41: Paragraph Shading as InDesign's. The page is headed with its name;+ /// the tint has Overprint beside it; the corners are a two-by-two grid whose shape menus show+ /// the shapes. The lesson rounds the top two corners at 10 pt, unlinked, and moves the+ /// offsets.+ #[test]+ fn paragraph_shading_page_is_laid_out_as_indesigns() {+ use designcraft_geom::corners::CornerShape;+ use egui_kittest::kittest::Queryable;+ let (app, _) = ruled_paragraph();+ let mut h = crate::test_window::open(app, egui::vec2(1400.0, 900.0));+ h.state_mut().app.ui.dialog =+ Some(Dialog::new("paragraphStyleOptions", json!({"name": "Ruled Child", "section": "shading", "p.shadingOn": true})));+ h.run_steps(4);+ let field = |h: &egui_kittest::Harness<'static, crate::test_window::Window>, key: &str| {+ h.state().app.ui.dialog.as_ref().and_then(|d| d.fields.get(&format!("p.{key}")).cloned()).unwrap_or_default()+ };+ assert!(h.get_all_by_label("Paragraph Shading").count() >= 2, "the section list and the page's heading");+ h.get_by_label("Overprint").click();+ h.run_steps(2);+ assert_eq!(field(&h, "shadingOverprint"), json!(true));+ // The corners' link (0) and the offsets' (1).+ let link = |h: &egui_kittest::Harness<'static, crate::test_window::Window>, n: usize| {+ let links: Vec<egui::Rect> = h.get_all_by_label("Make all settings the same").map(|n| n.rect()).collect();+ assert_eq!(links.len(), 2, "corners and offsets each have a link");+ links[n].center()+ };+ let at = link(&h, 0);+ crate::test_window::click_at(&mut h, at);+ for (corner, nth) in [("Top Left Corner", 0), ("Top Right Corner", 1)] {+ retype_beside(&mut h, corner, 0, "10 pt");+ h.get_all_by_label("Corner Shape").nth(nth).unwrap().click();+ h.run_steps(2);+ h.get_by_label("Rounded").click();+ h.run_steps(2);+ }+ let corners: [designcraft_geom::corners::Corner; 4] = serde_json::from_value(field(&h, "shadingCorners")).unwrap();+ assert_eq!(+ corners.map(|c| (c.shape, c.size)),+ [(CornerShape::Rounded, 10.0), (CornerShape::Rounded, 10.0), (CornerShape::None, 0.0), (CornerShape::None, 0.0)]+ );+ // The offsets, unlinked: Top alone.+ let at = link(&h, 1);+ crate::test_window::click_at(&mut h, at);+ retype_beside(&mut h, "Top:", 0, "3 pt");+ assert_eq!(field(&h, "shadingOffsets"), json!([3.0, 0.0, 0.0, 0.0]));+ confirm(&mut h.state_mut().app).unwrap();+ let style = h.state().app.session.doc().unwrap().doc.styles.para("Ruled Child").cloned().unwrap();+ assert_eq!((style.para.shading_on, style.para.shading_overprint), (Some(true), Some(true)));+ assert_eq!(style.para.shading_corners.map(|c| c[1].shape), Some(CornerShape::Rounded));+ }+++/// Paragraph Rules › Color offers Text Color above the swatches, so a rule set to a swatch can+/// go back to it; Gap Color lists only swatches.+#[test]+fn the_rule_colour_menu_offers_text_color() {+ let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());+ app.run("file.new", json!({})).unwrap();+ let doc = app.session.doc().unwrap().doc.clone();+ let menu = |ctx: &egui::Context, text: Option<&str>, click: Option<egui::Pos2>| {+ let mut picked = None;+ let mut labels = Vec::new();+ let mut events = Vec::new();+ if let Some(pos) = click {+ events.push(egui::Event::PointerMoved(pos));+ events.push(egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed: true, modifiers: Default::default() });+ events.push(egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed: false, modifiers: Default::default() });+ }+ let input =+ egui::RawInput { screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(600.0, 600.0))), events, ..Default::default() };+ let mut out = ctx.run_ui(input, |ui| {+ picked = swatch_menu_with(ui, &doc, "m", "[Black]", 130.0, text);+ });+ out.textures_delta.clear();+ for s in out.shapes {+ if let egui::Shape::Text(t) = s.shape {+ labels.push((t.galley.job.text.clone(), t.visual_bounding_rect().center()));+ }+ }+ (picked, labels)+ };+ for text in [Some("Text Color"), None] {+ let ctx = egui::Context::default();+ let (_, labels) = menu(&ctx, text, None);+ let combo = labels.iter().find(|(t, _)| t == "[Black]").unwrap().1;+ menu(&ctx, text, Some(combo));+ let (_, labels) = menu(&ctx, text, None);+ let item = labels.iter().find(|(t, _)| t == "Text Color").map(|l| l.1);+ assert_eq!(item.is_some(), text.is_some(), "{labels:?}");+ if let Some(pos) = item {+ let (picked, _) = menu(&ctx, text, Some(pos));+ assert_eq!(picked.as_deref(), Some(designcraft_doc::TEXT_COLOR));+ }+ }+}++/// The course's chapter 20: a paragraph style's rule below becomes wavy, 3 pt, with a gap+/// colour, from Paragraph Rules › Type and Gap Color.+#[test]+fn paragraph_style_rules_take_a_type_and_a_gap_colour() {+ let (mut app, _) = ruled_paragraph();+ let ctx = egui::Context::default();+ app.ui.dialog = Some(Dialog::new("paragraphStyleOptions", json!({"name": "Ruled Child", "section": "rules", "rule": "ruleBelow"})));+ draw(&mut app, &ctx);+ if let Some(d) = app.ui.dialog.as_mut() {+ d.fields.insert("p.ruleBelow.type".into(), json!({"kind": "wavy"}));+ d.fields.insert("p.ruleBelow.weight".into(), json!(3.0));+ d.fields.insert("p.ruleBelow.gapColor".into(), json!("[Paper]"));+ }+ draw(&mut app, &ctx);+ confirm(&mut app).unwrap();+ let r = app.session.doc().unwrap().doc.styles.resolve_para_style("Ruled Child").0.rule_below;+ assert_eq!((r.kind, r.weight, r.gap_color.as_str()), (designcraft_doc::StrokeType::Wavy, 3.0, "[Paper]"));+}++/// A rule's Gap Tint shows 100% at its default (the rule's JSON leaves a full gap tint out).+#[test]+fn a_rules_default_gap_tint_shows_100() {+ use egui_kittest::kittest::Queryable;+ let (mut app, _) = ruled_paragraph();+ app.run(+ "style.paragraph.edit",+ json!({"name": "Ruled Child", "para": {"ruleBelow": {"type": {"kind": "dashed", "pattern": [4.0, 2.0]}, "gapColor": "[Paper]"}}}),+ )+ .unwrap();+ let mut h = crate::test_window::open(app, egui::vec2(1400.0, 900.0));+ h.state_mut().app.ui.dialog = Some(Dialog::new("paragraphStyleOptions", json!({"name": "Ruled Child", "section": "rules", "rule": "ruleBelow"})));+ h.run_steps(4);+ let label = h.get_by_label("Gap Tint:").rect();+ let field = h+ .get_all_by(|n| n.role() == egui::accesskit::Role::TextInput)+ .filter(|n| n.rect().center().x > label.max.x && (n.rect().center().y - label.center().y).abs() < 8.0)+ .min_by(|a, b| a.rect().min.x.total_cmp(&b.rect().min.x))+ .and_then(|n| n.value());+ assert_eq!(field.as_deref(), Some("100%"));+}++/// The course's chapter 20: the "Recipe Categories" title formatted on the page (size, All+/// Caps, tracking, space after), then New Paragraph Style from it: the dialog starts from the+/// text, and with Apply Style to Selection the paragraph takes the new style. Next Style and+/// Reset To Base are set from General.+#[test]+fn a_new_paragraph_style_starts_from_the_selected_text() {+ let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());+ app.run("file.new", json!({})).unwrap();+ let f = app.run("frame.create", json!({"rect": [36, 36, 400, 300], "content": "text", "text": "Egg Recipes\rBoil them."})).unwrap();+ app.run("text.select", json!({"story": f["story"], "anchor": 0, "focus": 11})).unwrap();+ app.run("type.char", json!({"attrs": {"size": 20, "capitalization": "allCaps", "tracking": 50}})).unwrap();+ app.run("type.para", json!({"attrs": {"spaceAfter": 6}})).unwrap();+ open_new_style(&mut app, true);+ let d = app.ui.dialog.clone().unwrap();+ assert_eq!(+ (d.fields["c.size"].clone(), d.fields["c.capitalization"].clone(), d.fields["p.spaceAfter"].clone()),+ (json!(20.0), json!("allCaps"), json!(6.0))+ );+ assert!(d.b("apply") && !d.fields.contains_key("c.fontFamily"), "only what differs from [No Paragraph Style]");+ if let Some(d) = app.ui.dialog.as_mut() {+ d.fields.insert("rename".into(), json!("Recipe Categories"));+ d.fields.insert("nextStyle".into(), json!(designcraft_doc::BASIC_PARAGRAPH));+ }+ confirm(&mut app).unwrap();+ let a = app.run("type.selectionAttrs", json!({})).unwrap();+ assert_eq!(a["paragraphStyle"], "Recipe Categories", "applied to the selection");+ assert_eq!(a["paraOverrides"].as_u64().unwrap_or(0) + a["charOverrides"].as_u64().unwrap_or(0), 0);+ let style = |app: &DesignApp| app.session.doc().unwrap().doc.styles.para("Recipe Categories").cloned().unwrap();+ assert_eq!(style(&app).next_style.as_deref(), Some(designcraft_doc::BASIC_PARAGRAPH));+ assert_eq!(style(&app).chars.size, Some(20.0));+ // Reset To Base: the style keeps nothing of its own, apart from the edits made then.+ app.ui.dialog = Some(Dialog::new("paragraphStyleOptions", json!({"name": "Recipe Categories", "basedOn": designcraft_doc::BASIC_PARAGRAPH})));+ if let Some(d) = app.ui.dialog.as_mut() {+ d.fields.insert("resetToBase".into(), json!(true));+ d.fields.insert("c.tracking".into(), json!(10.0));+ }+ confirm(&mut app).unwrap();+ let s = style(&app);+ assert_eq!((s.chars.size, s.chars.tracking, s.para.space_after), (None, Some(10.0), None), "{s:?}");+ assert_eq!(s.based_on.as_deref(), Some(designcraft_doc::BASIC_PARAGRAPH));+}++/// The course's chapter 22: "eggs" made bold and red on the page, then New Character Style+/// from it. The dialog is titled as InDesign's, starts from what the text has of its own+/// over its paragraph style ("[None] + Bold + color"), and Apply Style to Selection gives the+/// text the style, with no override left.+#[test]+fn a_new_character_style_starts_from_the_selected_text() {+ use egui_kittest::{Harness, kittest::Queryable};+ let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());+ app.run("file.new", json!({})).unwrap();+ let f = app.run("frame.create", json!({"rect": [36, 36, 400, 300], "content": "text", "text": "Drop eggs into boiling water."})).unwrap();+ app.run("text.select", json!({"story": f["story"], "anchor": 0, "focus": 29})).unwrap();+ app.run("style.paragraph.create", json!({"name": "Recipe", "chars": {"size": 14}})).unwrap();+ app.run("style.paragraph.apply", json!({"name": "Recipe"})).unwrap();+ app.run("text.select", json!({"story": f["story"], "anchor": 5, "focus": 9})).unwrap();+ app.run("type.char", json!({"attrs": {"fontStyle": "Bold", "fill": "C=15 M=100 Y=100 K=0"}})).unwrap();+ open_new_style(&mut app, false);+ let d = app.ui.dialog.clone().unwrap();+ assert_eq!((d.fields["c.fontStyle"].clone(), d.fields["c.fill"].clone()), (json!("Bold"), json!("C=15 M=100 Y=100 K=0")));+ assert!(d.b("apply"));+ let mut h = Harness::builder().with_size(egui::vec2(1000.0, 700.0)).build_ui_state(+ |ui, app: &mut DesignApp| {+ let key = egui::Id::unique("new_character_style_test_fonts");+ if ui.data(|d| d.get_temp::<bool>(key)).is_none() {+ crate::theme::install_fonts(ui.ctx(), "");+ ui.data_mut(|d| d.insert_temp(key, true));+ return;+ }+ show(app, ui.ctx());+ },+ app,+ );+ h.run_steps(4);+ for l in ["New Character Style", "Apply Style to Selection"] {+ assert!(h.query_by_label(l).is_some(), "{l}");+ }+ let app = h.state_mut();+ if let Some(d) = app.ui.dialog.as_mut() {+ d.fields.insert("rename".into(), json!("eggs"));+ }+ confirm(app).unwrap();+ let style = app.session.doc().unwrap().doc.styles.char_style("eggs").cloned().unwrap();+ assert_eq!((style.chars.font_style.as_deref(), style.chars.fill.as_deref()), (Some("Bold"), Some("C=15 M=100 Y=100 K=0")));+ assert_eq!(style.chars.size, None, "the size is the paragraph style's, not the text's own");+ let a = app.run("type.selectionAttrs", json!({})).unwrap();+ assert_eq!((a["characterStyle"].clone(), a["charOverrides"].clone()), (json!("eggs"), json!(0)), "applied to the selection");+}++/// A Based On changed in the dialog (without Reset To Base) is what the fields are checked+/// against: the style's own settings over the new parent.+#[test]+fn a_changed_based_on_is_what_the_fields_are_checked_against() {+ let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());+ app.run("file.new", json!({})).unwrap();+ app.run("style.paragraph.create", json!({"name": "Loose", "para": {"wordSpaceMin": 1.2, "wordSpaceDesired": 1.3}})).unwrap();+ app.run("style.paragraph.create", json!({"name": "Child", "basedOn": "Loose"})).unwrap();+ let mut d = Dialog::new("paragraphStyleOptions", json!({"name": "Child"}));+ d.fields.insert("p.wordSpaceDesired".into(), json!(1.0));+ assert!(check_paragraph_style_justification(&app, &d).is_err(), "below Loose's minimum");+ d.fields.insert("basedOn".into(), json!(designcraft_doc::BASIC_PARAGRAPH));+ assert_eq!(check_paragraph_style_justification(&app, &d), Ok(()), "[Basic Paragraph]'s minimum is lower");+}++/// With Reset To Base, the justification fields are checked against the base style (the+/// style's own minimum no longer applies), and Preview shows the reset on the page.+#[test]+fn reset_to_base_checks_and_previews_against_the_base() {+ let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());+ app.run("file.new", json!({})).unwrap();+ let f = app.run("frame.create", json!({"rect": [36, 36, 400, 300], "content": "text", "text": "Loose words"})).unwrap();+ app.run("text.select", json!({"story": f["story"], "anchor": 0, "focus": 5})).unwrap();+ app.run("style.paragraph.create", json!({"name": "Loose", "basedOn": designcraft_doc::BASIC_PARAGRAPH, "para": {"wordSpaceMin": 1.2, "wordSpaceDesired": 1.3}, "chars": {"size": 30}}))+ .unwrap();+ app.run("style.paragraph.apply", json!({"name": "Loose"})).unwrap();+ let mut d = Dialog::new("paragraphStyleOptions", json!({"name": "Loose"}));+ d.fields.insert("p.wordSpaceDesired".into(), json!(1.1));+ assert!(check_paragraph_style_justification(&app, &d).is_err(), "below the style's own minimum");+ d.fields.insert("resetToBase".into(), json!(true));+ assert_eq!(check_paragraph_style_justification(&app, &d), Ok(()), "the base's minimum is 100%");+ d.fields.insert("preview".into(), json!(true));+ style_options_preview(&mut app, &mut d);+ assert_eq!(d.fields[PREVIEWED]["resetToBase"], true);+ let size = app.run("type.selectionAttrs", json!({})).unwrap()["chars"]["size"].clone();+ assert_eq!(size, json!(12.0), "the page shows the style reset to its base");+ app.session.cancel_interaction();+}++/// The course's chapter 22: Find/Change › Change Format. "eggs", case sensitive, nothing in+/// Change to; Change Format Settings › Style Options sets Character Style "eggs", and the box+/// shows it (with Change to's ⓘ). Escape leaves the settings, not Find/Change. Change All+/// gives every lowercase "eggs" the style and keeps the words; the trash clears the format.+#[test]+fn find_change_gives_the_found_text_a_change_format() {+ use egui_kittest::{Harness, kittest::Queryable};+ let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());+ app.run("file.new", json!({})).unwrap();+ let text = "Poached Eggs\nBreak eggs; cook until eggs are set.";+ let f = app.run("frame.create", json!({"rect": [36, 36, 400, 300], "content": "text", "text": text})).unwrap();+ let sid = designcraft_doc::StoryId(f["story"].as_u64().unwrap());+ app.run("style.character.create", json!({"name": "eggs", "chars": {"fontStyle": "Bold"}})).unwrap();+ app.run("app.findChange", json!({})).unwrap();+ if let Some(d) = app.ui.dialog.as_mut() {+ d.fields.insert("find".into(), json!("eggs"));+ d.fields.insert("caseSensitive".into(), json!(true));+ }+ let mut h = Harness::builder().with_size(egui::vec2(1200.0, 900.0)).build_ui_state(+ |ui, app: &mut DesignApp| {+ let key = egui::Id::unique("change_format_test_fonts");+ if ui.data(|d| d.get_temp::<bool>(key)).is_none() {+ crate::theme::install_fonts(ui.ctx(), "");+ ui.data_mut(|d| d.insert_temp(key, true));+ return;+ }+ show(app, ui.ctx());+ },+ app,+ );+ h.run_steps(4);+ const TIP: &str = "With a Change Format and nothing in Change to, the found text stays and is only formatted";+ assert!(h.query_by_label("Change Format:").is_some());+ assert!(h.query_by_label(TIP).is_none(), "no ⓘ without a Change Format");+ h.get_by_label("Specify attributes to change").click();+ h.run_steps(3);+ // Style Options is the section's name in the list and its heading.+ for l in ["Change Format Settings", "Style Options", "Basic Character Formats", "Character Color"] {+ assert!(h.query_all_by_label(l).next().is_some(), "{l}");+ }+ // Style Options › Character Style: eggs.+ h.get_all_by_value("[Any Style]").next().unwrap().click();+ h.run_steps(3);+ h.get_by_label("eggs").click();+ h.run_steps(3);+ h.get_all_by_label(" OK ").last().unwrap().click();+ h.run_steps(3);+ let field = |h: &Harness<'_, DesignApp>, k: &str| h.state().ui.dialog.as_ref().unwrap().fields.get(k).cloned();+ assert_eq!((field(&h, CHANGE_FORMAT), field(&h, FORMAT_EDIT)), (Some(json!({"charStyle": "eggs"})), None));+ assert!(h.query_by_label("Character Style: eggs").is_some(), "the box shows it");+ assert!(h.query_by_label(TIP).is_some(), "Change to's ⓘ");+ // Escape closes Change Format Settings only, and keeps the Change Format.+ h.get_by_label("Specify attributes to change").click();+ h.run_steps(3);+ h.key_press(egui::Key::Escape);+ h.run_steps(3);+ assert_eq!(h.state().ui.dialog.as_ref().map(|d| d.id.as_str()), Some("findChange"));+ assert_eq!((field(&h, CHANGE_FORMAT), field(&h, FORMAT_EDIT)), (Some(json!({"charStyle": "eggs"})), None));+ // Change All: the words stay, every lowercase "eggs" has the style.+ h.get_by_label("Change All").click();+ h.run_steps(3);+ assert_eq!(field(&h, "status"), Some(json!("2 replacement(s) made")));+ let story = h.state().session.doc().unwrap().doc.story(sid).cloned().unwrap();+ assert_eq!(story.text, text);+ assert_eq!(+ [8, 19, 36].map(|at| story.format_after(at).style.clone()),+ [designcraft_doc::NO_CHAR_STYLE.to_string(), "eggs".into(), "eggs".into()]+ );+ // The trash clears it (the second: the first is the Find Format's).+ h.get_all_by_label("Clear specified attributes").nth(1).unwrap().click();+ h.run_steps(3);+ assert_eq!(field(&h, CHANGE_FORMAT), None);+ assert!(h.query_by_label(TIP).is_none());+}++/// What Change Format Settings sets goes to find.change: a paragraph style and character+/// attributes as well as a character style; the box sums them up.+#[test]+fn a_change_format_goes_with_change_all() {+ let mut d = Dialog::new("findChange", json!({"find": "cook"}));+ d.fields.insert(CHANGE_FORMAT.into(), json!({"charStyle": "eggs", "paraStyle": "Method", "chars": {"underline": true}}));+ let p = find_change_params(&d);+ assert_eq!((p["charStyle"].clone(), p["paraStyle"].clone(), p["attrs"].clone()), (json!("eggs"), json!("Method"), json!({"underline": true})));+ assert_eq!(format_summary("en", d.fields.get(CHANGE_FORMAT)), "Character Style: eggs + Paragraph Style: Method + Underline: on");+ assert!(find_change_params(&Dialog::new("findChange", json!({"find": "cook"}))).get("attrs").is_none());+ // A Find Format goes with every search.+ d.fields.insert(FIND_FORMAT.into(), json!({"paraStyle": "Method"}));+ assert_eq!(find_change_params(&d)["findFormat"], json!({"paraStyle": "Method"}));+}++/// Find/Change › Find Format, as InDesign's: Find Format Settings sets the character style the+/// found text must have, the box shows it with Find what's ⓘ, and Count counts only "eggs" in+/// it; with nothing in Find what, Find Next finds the text in the style; the first trash clears+/// it.+#[test]+fn find_format_finds_only_text_with_it() {+ use egui_kittest::{Harness, kittest::Queryable};+ let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());+ app.run("file.new", json!({})).unwrap();+ let f = app.run("frame.create", json!({"rect": [36, 36, 400, 300], "content": "text", "text": "Break eggs; cook eggs."})).unwrap();+ app.run("style.character.create", json!({"name": "eggs", "chars": {"fontStyle": "Bold"}})).unwrap();+ app.run("text.select", json!({"story": f["story"], "anchor": 6, "focus": 10})).unwrap();+ app.run("style.character.apply", json!({"name": "eggs"})).unwrap();+ app.run("text.select", json!({"story": f["story"], "anchor": 0, "focus": 0})).unwrap();+ app.run("app.findChange", json!({})).unwrap();+ if let Some(d) = app.ui.dialog.as_mut() {+ d.fields.insert("find".into(), json!("eggs"));+ }+ let mut h = Harness::builder().with_size(egui::vec2(1200.0, 900.0)).build_ui_state(+ |ui, app: &mut DesignApp| {+ let key = egui::Id::unique("find_format_test_fonts");+ if ui.data(|d| d.get_temp::<bool>(key)).is_none() {+ crate::theme::install_fonts(ui.ctx(), "");+ ui.data_mut(|d| d.insert_temp(key, true));+ return;+ }+ show(app, ui.ctx());+ },+ app,+ );+ h.run_steps(4);+ const TIP: &str = "With a Find Format, only text that has it is found; with nothing in Find what, all text that has it";+ assert!(h.query_by_label("Find Format:").is_some() && h.query_by_label(TIP).is_none());+ h.get_by_label("Specify attributes to find").click();+ h.run_steps(3);+ assert!(h.query_by_label("Find Format Settings").is_some());+ h.get_all_by_value("[Any Style]").next().unwrap().click();+ h.run_steps(3);+ h.get_by_label("eggs").click();+ h.run_steps(3);+ h.get_all_by_label(" OK ").last().unwrap().click();+ h.run_steps(3);+ let field = |h: &Harness<'_, DesignApp>, k: &str| h.state().ui.dialog.as_ref().unwrap().fields.get(k).cloned();+ assert_eq!((field(&h, FIND_FORMAT), field(&h, CHANGE_FORMAT)), (Some(json!({"charStyle": "eggs"})), None));+ assert!(h.query_by_label("Character Style: eggs").is_some() && h.query_by_label(TIP).is_some());+ h.get_by_label("Count").click();+ h.run_steps(3);+ assert_eq!(field(&h, "status"), Some(json!("1 match(es)")), "only the \"eggs\" in the style");+ // Nothing in Find what: the text in the style.+ h.state_mut().ui.dialog.as_mut().unwrap().fields.insert("find".into(), json!(""));+ h.run_steps(2);+ h.get_by_label("Find Next").click();+ h.run_steps(3);+ let sel = h.state().session.doc().unwrap().selection.text.unwrap();+ assert_eq!(sel.range(), 6..10);+ // The first trash is the Find Format's.+ h.get_all_by_label("Clear specified attributes").next().unwrap().click();+ h.run_steps(3);+ assert_eq!(field(&h, FIND_FORMAT), None);+}++/// The course's chapter 26: Preferences › Interface as InDesign's. A Color Theme swatch shows+/// its theme at once and Cancel goes back; OK keeps the theme and the Tools panel's columns.+/// UI Size is in a UI Scaling section of its own.+#[test]+fn preferences_interface_sets_the_color_theme_and_tools_panel() {+ use crate::theme::Brightness;+ use egui::accesskit::Role;+ use egui_kittest::{Harness, kittest::Queryable};+ let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());+ app.run("file.new", json!({})).unwrap();+ let opened = app.ui.brightness;+ let open = |app: &mut DesignApp| {+ app.run("app.preferences", json!({})).unwrap();+ app.ui.dialog.as_mut().unwrap().fields.insert("section".into(), json!("interface"));+ };+ open(&mut app);+ let mut h = Harness::builder().with_size(egui::vec2(1100.0, 760.0)).build_ui_state(+ |ui, app: &mut DesignApp| {+ let key = egui::Id::unique("prefs_interface_test_fonts");+ if ui.data(|d| d.get_temp::<bool>(key)).is_none() {+ crate::theme::install_fonts(ui.ctx(), "");+ ui.data_mut(|d| d.insert_temp(key, true));+ return;+ }+ show(app, ui.ctx());+ },+ app,+ );+ h.run_steps(3);+ let swatch = |h: &Harness<'_, DesignApp>, name: &str| h.get_by(|n| n.role() == Role::RadioButton && n.label().as_deref() == Some(name)).click();+ for l in ["Appearance", "Color Theme:", "Panels", "Tools Panel:"] {+ assert!(h.query_by_label(l).is_some(), "{l}");+ }+ // A click shows the theme at once; Cancel goes back.+ swatch(&h, "Light");+ h.run_steps(3);+ assert_eq!(h.state().ui.brightness, Brightness::Light);+ h.get_by_label("Cancel").click();+ h.run_steps(3);+ assert!(h.state().ui.dialog.is_none());+ assert_eq!(h.state().ui.brightness, opened, "Cancel goes back to the theme Preferences opened with");+ // OK keeps the theme and the Tools panel's columns.+ open(h.state_mut());+ h.run_steps(3);+ swatch(&h, "Dark");+ h.run_steps(2);+ h.get_by(|n| n.role() == Role::ComboBox && n.value().as_deref() == Some("Single Column")).click();+ h.run_steps(2);+ h.get_by_label("Double Column").click();+ h.run_steps(2);+ h.get_by_label(" OK ").click();+ h.run_steps(3);+ assert!(h.state().ui.dialog.is_none());+ assert_eq!(h.state().ui.brightness, Brightness::Dark);+ assert!(h.state().ui.tools_double_column);+ // The same command the Window menu toggles, with an explicit state for Preferences.+ assert_eq!(h.state_mut().run("window.toolsDoubleColumn", json!({"on": false})).unwrap(), json!(false));+ assert_eq!(h.state_mut().run("window.toolsDoubleColumn", json!({"on": false})).unwrap(), json!(false), "set, not toggled");+ assert_eq!(h.state_mut().run("window.toolsDoubleColumn", json!({})).unwrap(), json!(true), "toggled without `on`");+ // UI Size has a section of its own.+ open(h.state_mut());+ h.state_mut().ui.dialog.as_mut().unwrap().fields.insert("section".into(), json!("uiScaling"));+ h.run_steps(3);+ assert!(h.query_by_label("UI Size:").is_some());+}++/// With no document open, Preferences has Units & Increments, as InDesign's: OK keeps them+/// for new documents, and New Document opens in them (Lollo's inches, set once).+#[test]+fn preferences_with_no_document_set_the_units_of_new_documents() {+ let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());+ crate::menus::activate(&mut app, "app.preferences", &Value::Null);+ let mut d = app.ui.dialog.take().expect("Preferences");+ assert!(d.b("defaults"), "for new documents");+ let ctx = dialog_context("en");+ let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1178.0, 814.0));+ app.ui.dialog = Some(d.clone());+ let mut labels = vec![];+ for _ in 0..3 {+ labels = dialog_frame(&mut app, &ctx, screen, vec![]);+ }+ assert!(labels.iter().any(|(t, _, _)| t == "Units & Increments"), "listed with no document: {labels:?}");+ d.fields.insert("horizontalUnits".into(), json!("inches"));+ d.fields.insert("verticalUnits".into(), json!("inches"));+ d.fields.insert("keyboardIncrement".into(), json!("0.5 pt"));+ app.ui.dialog = Some(d);+ confirm(&mut app).unwrap();+ let du = app.session.prefs.default_units;+ assert_eq!((du.horizontal_units, du.vertical_units, du.keyboard_increment), (Unit::Inches, Unit::Inches, 0.5));+ assert!(app.session.active().is_none(), "no document made");+ // A Cursor Key of 0 or text that isn't a measure is refused, keeping the dialog open and+ // the saved values, the other preferences' too; a Kerning/Tracking of 0.5 is kept as it is.+ let scale = app.session.prefs.scale_strokes;+ for bad in [json!({"keyboardIncrement": "0 pt"}), json!({"keyboardIncrement": "wide"}), json!({"kerningIncrement": "lots"})] {+ let mut d = Dialog::new("preferences", json!({"defaults": true, "horizontalUnits": "inches", "scaleStrokes": !scale}));+ for (k, v) in bad.as_object().unwrap() {+ d.fields.insert(k.clone(), v.clone());+ }+ app.ui.dialog = Some(d);+ assert!(confirm(&mut app).is_err(), "{bad}");+ assert!(app.ui.dialog.as_ref().is_some_and(|d| d.id == "preferences"), "still open: {bad}");+ assert_eq!(app.session.prefs.default_units.keyboard_increment, 0.5, "{bad}");+ assert_eq!(app.session.prefs.scale_strokes, scale, "no other preference saved: {bad}");+ }+ app.ui.dialog = Some(Dialog::new("preferences", json!({"defaults": true, "horizontalUnits": "inches", "kerningIncrement": "0.5"})));+ confirm(&mut app).unwrap();+ assert_eq!(app.session.prefs.default_units.kerning_increment, 0.5, "not rounded up to 1");+ // New Document opens in inches, and the document it makes has inch rulers.+ crate::menus::activate(&mut app, "app.newDocumentDialog", &Value::Null);+ let nd = app.ui.dialog.clone().expect("New Document");+ assert_eq!(nd.fields["units"], json!("inches"));+ assert_eq!(nd.s("width"), designcraft_geom::format_measure(612.0, Unit::Inches));+ confirm(&mut app).unwrap();+ let st = &app.session.doc().unwrap().doc.settings;+ assert_eq!((st.horizontal_units, st.vertical_units, st.keyboard_increment), (Unit::Inches, Unit::Inches, 0.5));+ // With the document open, Preferences edits that document's units, not the defaults.+ crate::menus::activate(&mut app, "app.preferences", &Value::Null);+ assert!(!app.ui.dialog.as_ref().unwrap().b("defaults"));+}++/// Preferences › File Handling shows the number of recent items as a whole number, as+/// InDesign's does ("20"; it read "20.0").+#[test]+fn file_handling_shows_the_recent_items_count_as_a_whole_number() {+ let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());+ app.run("file.new", json!({})).unwrap();+ app.run("app.preferences", json!({})).unwrap();+ app.ui.dialog.as_mut().unwrap().fields.insert("section".into(), json!("files"));+ let ctx = dialog_context("en");+ let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1000.0, 700.0));+ dialog_frame(&mut app, &ctx, screen, vec![]);+ let labels = dialog_frame(&mut app, &ctx, screen, vec![]);+ visible_label(&labels, screen, "Number of Recent Items to Display:");+ let count = app.ui.dialog.as_ref().unwrap().n("recentFilesMax").unwrap();+ assert_eq!(count, 20.0, "InDesign's default");+ visible_label(&labels, screen, &format!("{count}"));+ assert!(!labels.iter().any(|(t, _, _)| t.trim() == format!("{count:.1}")), "no decimal shown");+}++/// Collapsing advanced TOC controls changes visibility without discarding their values.+#[test]+fn toc_more_options_preserves_hidden_settings() {+ let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());+ app.run("file.newSample", json!({})).unwrap();+ open_toc(&mut app);+ app.ui.dialog.as_mut().unwrap().fields.insert(+ "included".into(),+ json!([{+ "style": "Headline", "level": 3, "separator": " ^t", "pageNumber": "before",+ "pageNumberStyle": "Accent", "separatorStyle": "Emphasis", "sort": true+ }]),+ );+ let before = toc_params(&app, app.ui.dialog.as_ref().unwrap());+ let revision = app.session.doc().unwrap().revision;+ let ctx = dialog_context("en");+ let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1440.0, 900.0));+ for _ in 0..3 {+ dialog_frame(&mut app, &ctx, screen, vec![]);+ }+ let labels = dialog_frame(&mut app, &ctx, screen, vec![]);+ visible_label(&labels, screen, "Between Entry and Number:");+ click_dialog(&mut app, &ctx, screen, visible_label(&labels, screen, "Fewer Options").center());+ let labels = dialog_frame(&mut app, &ctx, screen, vec![]);+ assert!(!labels.iter().any(|(text, _, _)| text == "Between Entry and Number:"));+ visible_label(&labels, screen, "Entry Style:");+ assert_eq!(toc_params(&app, app.ui.dialog.as_ref().unwrap()), before);+ click_dialog(&mut app, &ctx, screen, visible_label(&labels, screen, "More Options").center());+ for _ in 0..3 {+ dialog_frame(&mut app, &ctx, screen, vec![]);+ }+ let labels = dialog_frame(&mut app, &ctx, screen, vec![]);+ visible_label(&labels, screen, "Between Entry and Number:");+ assert_eq!(toc_params(&app, app.ui.dialog.as_ref().unwrap()), before);+ assert_eq!(app.session.doc().unwrap().revision, revision);+}++/// Enter on the focused Fewer Options / More Options button toggles the options; it doesn't+/// also make the table of contents.+#[test]+fn enter_on_the_toc_options_toggle_only_toggles() {+ use egui_kittest::{Harness, kittest::Queryable};+ let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());+ app.run("file.newSample", json!({})).unwrap();+ open_toc(&mut app);+ let revision = app.session.doc().unwrap().revision;+ let mut h = Harness::builder().with_size(egui::vec2(1440.0, 900.0)).build_ui_state(+ |ui, app: &mut DesignApp| {+ let key = egui::Id::unique("toc_toggle_test_fonts");+ if ui.data(|d| d.get_temp::<bool>(key)).is_none() {+ crate::theme::install_fonts(ui.ctx(), "");+ ui.data_mut(|d| d.insert_temp(key, true));+ return;+ }+ show(app, ui.ctx());+ },+ app,+ );+ h.run_steps(3);+ h.get_by_label("Fewer Options").focus();+ h.run_steps(2);+ h.key_press(egui::Key::Enter);+ h.run_steps(3);+ let d = h.state().ui.dialog.as_ref().expect("the dialog stays open");+ assert_eq!((d.id.as_str(), d.b("moreOptions")), (TOC, false), "the options are fewer");+ assert_eq!(h.state().session.doc().unwrap().revision, revision, "no table of contents made");+ assert!(h.query_by_label("More Options").is_some());+}++/// The title stays readable beside the style selector after the grid settles.+#[test]+fn toc_title_field_shows_the_whole_default_title() {+ let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());+ app.run("file.newSample", json!({})).unwrap();+ open_toc(&mut app);+ let ctx = dialog_context("en");+ let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1440.0, 900.0));+ for _ in 0..3 {+ dialog_frame(&mut app, &ctx, screen, vec![]);+ }+ let labels = dialog_frame(&mut app, &ctx, screen, vec![]);+ let title_row = |labels: &[(String, egui::Rect, egui::Rect)]| {+ let y = visible_label(labels, screen, "Title:").center().y;+ labels.iter().filter(|(_, rect, _)| (rect.center().y - y).abs() < 2.0).cloned().collect::<Vec<_>>()+ };+ visible_label(&title_row(&labels), screen, "Contents");+ app.ui.dialog.as_mut().unwrap().fields.insert("title".into(), json!("Table of Contents"));+ let labels = dialog_frame(&mut app, &ctx, screen, vec![]);+ visible_label(&title_row(&labels), screen, "Table of Contents");+ // A small window: the title narrows and the style selector beside it stays in view.+ let small = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(450.0, 280.0));+ for _ in 0..3 {+ dialog_frame(&mut app, &ctx, small, vec![]);+ }+ let labels = dialog_frame(&mut app, &ctx, small, vec![]);+ let y = visible_label(&labels, small, "Title:").center().y;+ let row: Vec<_> = labels.iter().filter(|(_, rect, _)| (rect.center().y - y).abs() < 2.0).cloned().collect();+ let style = visible_label(&row, small, "TOC Title");+ // The selector is 200 pt wide from just before its text: all of it is in the dialog body.+ let (_, _, body) = row.iter().find(|(text, _, _)| text == "Style:").unwrap();+ assert!(style.min.x - 4.0 + 200.0 <= body.max.x, "the style selector fits the dialog: {style:?} in {body:?}");+}++/// The bookmarks checkbox persists through generation and reopening the dialog.+#[test]+fn toc_bookmarks_checkbox_sets_and_reopens_the_persisted_option() {+ let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());+ app.run("file.newSample", json!({})).unwrap();+ open_toc(&mut app);+ assert!(app.ui.dialog.as_ref().unwrap().b("createBookmarks"));+ app.ui.dialog.as_mut().unwrap().fields.insert("included".into(), json!([{"style": "Headline", "level": 1}]));+ let ctx = dialog_context("en");+ let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1200.0, 800.0));+ for _ in 0..3 {+ dialog_frame(&mut app, &ctx, screen, vec![]);+ }+ let labels = dialog_frame(&mut app, &ctx, screen, vec![]);+ visible_label(&labels, screen, "Create PDF Bookmarks");+ confirm(&mut app).unwrap();+ assert!(app.session.doc().unwrap().doc.toc.as_ref().unwrap().create_bookmarks);+ assert!(!app.session.doc().unwrap().doc.bookmarks.is_empty());+ open_toc(&mut app);+ for _ in 0..3 {+ dialog_frame(&mut app, &ctx, screen, vec![]);+ }+ let labels = dialog_frame(&mut app, &ctx, screen, vec![]);+ click_dialog(&mut app, &ctx, screen, visible_label(&labels, screen, "Create PDF Bookmarks").center());+ confirm(&mut app).unwrap();+ assert!(app.session.doc().unwrap().doc.bookmarks.is_empty());+ open_toc(&mut app);+ assert!(!app.ui.dialog.as_ref().unwrap().b("createBookmarks"));+}++#[test]+fn corner_options_dialog_sets_each_corner_with_preview_and_one_undo_step() {+ use designcraft_geom::corners::CornerShape;+ let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());+ app.run("file.new", json!({})).unwrap();+ let id = app.run("frame.create", json!({"rect": [72, 72, 360, 360]})).unwrap()["id"].as_u64().unwrap();+ app.run("selection.set", json!({"ids": [id]})).unwrap();+ let corners = |app: &DesignApp| app.session.doc().unwrap().doc.item(designcraft_doc::ItemId(id)).unwrap().corners.corners;+ let undo = |app: &DesignApp| app.session.doc().unwrap().history.undo.len();+ let set = |app: &mut DesignApp, k: &str, v: Value| {+ app.ui.dialog.as_mut().unwrap().fields.insert(k.into(), v);+ };+ let u0 = undo(&app);+ let ctx = dialog_context("en");+ let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1200.0, 800.0));+ // Object › Corner Options… opens InDesign's dialog, not a form of the command's params.+ crate::menus::activate(&mut app, "object.cornerOptions", &Value::Null);+ assert_eq!(app.ui.dialog.as_ref().map(|d| d.id.as_str()), Some(CORNER_OPTIONS));+ dialog_frame(&mut app, &ctx, screen, vec![]);+ let labels = dialog_frame(&mut app, &ctx, screen, vec![]);+ for expected in ["Corner Options", "Corner Size and Shape:", "Preview", "OK", "Cancel"] {+ visible_label(&labels, screen, expected);+ }+ assert!(!labels.iter().any(|(t, _, _)| t.trim() == "Ids"), "no raw command fields");+ let d = app.ui.dialog.as_ref().unwrap();+ assert_eq!((d.s("size1"), d.s("shape1"), d.b("link")), ("0p0".into(), "none".into(), true), "seeded from the frame, linked");+ // Linked: a corner changed is all four.+ set(&mut app, "size0", json!("1p0"));+ dialog_frame(&mut app, &ctx, screen, vec![]);+ assert_eq!(app.ui.dialog.as_ref().unwrap().s("size2"), "1p0");+ // Unlinked, only the top-right corner rounds, as in the tutorial.+ set(&mut app, "link", json!(false));+ for k in 0..4 {+ set(&mut app, &format!("size{k}"), json!("0"));+ }+ set(&mut app, "size1", json!("3 cm"));+ set(&mut app, "shape1", json!("rounded"));+ set(&mut app, "preview", json!(true));+ dialog_frame(&mut app, &ctx, screen, vec![]);+ assert_eq!(corners(&app)[1].shape, CornerShape::Rounded, "Preview shows it");+ assert_eq!(undo(&app), u0, "without an undo step");+ set(&mut app, "preview", json!(false));+ dialog_frame(&mut app, &ctx, screen, vec![]);+ assert_eq!(corners(&app)[1].shape, CornerShape::None, "Preview off puts it back");+ set(&mut app, "preview", json!(true));+ dialog_frame(&mut app, &ctx, screen, vec![]);+ confirm(&mut app).unwrap();+ let c = corners(&app);+ assert_eq!(c.map(|c| c.shape), [CornerShape::None, CornerShape::Rounded, CornerShape::None, CornerShape::None]);+ assert!((c[1].size - 3.0 / 2.54 * 72.0).abs() < 1e-6, "{}", c[1].size);+ assert_eq!(undo(&app), u0 + 1, "one undo step");+ // Reopened, it shows the frame's corners, no longer linked.+ crate::menus::activate(&mut app, "object.cornerOptions", &Value::Null);+ dialog_frame(&mut app, &ctx, screen, vec![]);+ let d = app.ui.dialog.as_ref().unwrap();+ assert_eq!((d.s("shape1"), d.s("shape0"), d.b("link")), ("rounded".into(), "none".into(), false));+ // A size that does not parse keeps the dialog open with the error; so does a shape the+ // dialog doesn't offer (rather than another shape taking its place).+ set(&mut app, "size0", json!("abc"));+ assert!(confirm(&mut app).is_err());+ assert!(app.ui.dialog.is_some());+ set(&mut app, "size0", json!("0"));+ set(&mut app, "shape0", json!("spiky"));+ assert!(confirm(&mut app).is_err());+ assert!(app.ui.dialog.is_some());+ cancel(&mut app);+ assert_eq!(corners(&app), c);+}++/// Several objects: the dialog shows the first one's corners, and OK sets only the corners+/// edited; the others keep each object's own. A linked edit sets all four.+#[test]+fn corner_options_keep_each_objects_untouched_corners() {+ use designcraft_geom::corners::CornerShape;+ let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());+ app.run("file.new", json!({})).unwrap();+ let a = app.run("frame.create", json!({"rect": [72, 72, 200, 200]})).unwrap()["id"].as_u64().unwrap();+ let b = app.run("frame.create", json!({"rect": [272, 72, 400, 200]})).unwrap()["id"].as_u64().unwrap();+ app.run("object.cornerOptions", json!({"ids": [b], "shape": "bevel", "size": 12})).unwrap();+ app.run("selection.set", json!({"ids": [a, b]})).unwrap();+ let corners = |app: &DesignApp, id: u64| app.session.doc().unwrap().doc.item(designcraft_doc::ItemId(id)).unwrap().corners.corners;+ let set = |app: &mut DesignApp, k: &str, v: Value| {+ app.ui.dialog.as_mut().unwrap().fields.insert(k.into(), v);+ };+ let ctx = dialog_context("en");+ let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1200.0, 800.0));+ let b0 = corners(&app, b);+ // Unlinked: only the top-right corner rounds, on both.+ crate::menus::activate(&mut app, "object.cornerOptions", &Value::Null);+ dialog_frame(&mut app, &ctx, screen, vec![]);+ set(&mut app, "link", json!(false));+ set(&mut app, "size1", json!("1p0"));+ set(&mut app, "shape1", json!("rounded"));+ dialog_frame(&mut app, &ctx, screen, vec![]);+ confirm(&mut app).unwrap();+ let (ca, cb) = (corners(&app, a), corners(&app, b));+ assert_eq!(ca.map(|c| c.shape), [CornerShape::None, CornerShape::Rounded, CornerShape::None, CornerShape::None]);+ assert_eq!(cb.map(|c| c.shape), [CornerShape::Bevel, CornerShape::Rounded, CornerShape::Bevel, CornerShape::Bevel], "b keeps its others");+ assert_eq!((cb[0], cb[2], cb[3]), (b0[0], b0[2], b0[3]));+ assert_eq!(ca[1], cb[1]);+ // Linked: a corner set to the first object's own value still sets all four, on both.+ crate::menus::activate(&mut app, "object.cornerOptions", &Value::Null);+ dialog_frame(&mut app, &ctx, screen, vec![]);+ set(&mut app, "link", json!(true));+ dialog_frame(&mut app, &ctx, screen, vec![]);+ set(&mut app, "size0", json!("0p6"));+ dialog_frame(&mut app, &ctx, screen, vec![]);+ confirm(&mut app).unwrap();+ let (ca, cb) = (corners(&app, a), corners(&app, b));+ assert_eq!(ca, cb, "all four, on both");+ assert!(ca.iter().all(|c| c.shape == CornerShape::None && (c.size - 6.0).abs() < 1e-6), "{ca:?}");+}++#[test]+fn on_a_page_without_a_section_the_window_is_new_section() {+ // Chris Nielsen's "Numbering Page Sections" (4:43): page 3 selected, the Pages panel menu's+ // Numbering & Section Options opens New Section with Start Section on and 1 offered.+ let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());+ app.run("file.new", json!({"pages": 6, "facingPages": true})).unwrap();+ app.canvas_rect = Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1000.0, 800.0)));+ crate::canvas::go_to_page(&mut app, 2);+ crate::menus::activate(&mut app, "layout.section", &Value::Null);+ let d = app.ui.dialog.as_ref().unwrap();+ assert_eq!(+ (d.n("page"), d.b("newSection"), d.b("startSection"), d.b("automatic"), d.s("startNumber")),+ (Some(3.0), true, true, true, "1".into())+ );+ let ctx = dialog_context("en");+ let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1178.0, 814.0));+ for _ in 0..3 {+ dialog_frame(&mut app, &ctx, screen, vec![]);+ }+ let labels = dialog_frame(&mut app, &ctx, screen, vec![]);+ visible_label(&labels, screen, "New Section");+ // Typing a number in the field chooses Start Page Numbering at; OK: page 3 is page 5 (odd,+ // so a facing page stays on the right).+ let field = visible_label(&labels, screen, "1");+ click_dialog(&mut app, &ctx, screen, field.center());+ dialog_frame(+ &mut app,+ &ctx,+ screen,+ vec![+ egui::Event::Key { key: egui::Key::End, physical_key: None, pressed: true, repeat: false, modifiers: egui::Modifiers::NONE },+ egui::Event::Key { key: egui::Key::Backspace, physical_key: None, pressed: true, repeat: false, modifiers: egui::Modifiers::NONE },+ egui::Event::Text("5".into()),+ ],+ );+ assert!(!app.ui.dialog.as_ref().unwrap().b("automatic"), "typing chose Start Page Numbering at");+ let labels = dialog_frame(&mut app, &ctx, screen, vec![]);+ click_dialog(&mut app, &ctx, screen, visible_label(&labels, screen, "OK").center());+ assert!(app.ui.dialog.is_none());+ assert_eq!(app.session.active().unwrap().doc.page_name(2), "5");+ // Opened again on that page, it is Numbering & Section Options, showing the section.+ crate::menus::activate(&mut app, "layout.section", &Value::Null);+ let d = app.ui.dialog.as_ref().unwrap();+ assert_eq!((d.b("newSection"), d.b("startSection"), d.b("automatic"), d.s("startNumber")), (false, true, false, "5".into()));+ let labels = (0..4).map(|_| dialog_frame(&mut app, &ctx, screen, vec![])).last().unwrap();+ visible_label(&labels, screen, "Numbering & Section Options");+ assert!(!labels.iter().any(|(t, _, _)| t == "New Section"));+}++/// Find/Change's Change and Change/Find, as InDesign's: Find Next selects a match, Change/Find+/// changes it and selects the next, Change changes that one and keeps it selected. With no+/// text selected they're off.+#[test]+fn change_and_change_find_change_the_found_text() {+ use egui_kittest::Harness;+ use egui_kittest::kittest::{NodeT, Queryable};+ let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());+ app.run("file.new", json!({})).unwrap();+ let f = app.run("frame.create", json!({"rect": [36, 36, 400, 300], "content": "text", "text": "red red | red"})).unwrap();+ let sid = designcraft_doc::StoryId(f["story"].as_u64().unwrap());+ app.run("text.select", json!({"story": sid.0, "anchor": 0, "focus": 0})).unwrap();+ app.run("app.findChange", json!({})).unwrap();+ if let Some(d) = app.ui.dialog.as_mut() {+ d.fields.insert("find".into(), json!("red"));+ d.fields.insert("change".into(), json!("blue"));+ }+ let mut h = Harness::builder().with_size(egui::vec2(1200.0, 900.0)).build_ui_state(+ |ui, app: &mut DesignApp| {+ let key = egui::Id::unique("change_find_test_fonts");+ if ui.data(|d| d.get_temp::<bool>(key)).is_none() {+ crate::theme::install_fonts(ui.ctx(), "");+ ui.data_mut(|d| d.insert_temp(key, true));+ return;+ }+ show(app, ui.ctx());+ },+ app,+ );+ h.run_steps(4);+ assert!(h.query_by_value("Document").is_some(), "the Search choices are InDesign's");+ assert!(h.get_by_label("Change").accesskit_node().is_disabled(), "nothing found yet");+ let text = |h: &Harness<'_, DesignApp>| h.state().session.doc().unwrap().doc.story(sid).unwrap().text.clone();+ let selected = |h: &Harness<'_, DesignApp>| h.state().session.doc().unwrap().selection.text.unwrap().range();+ h.get_by_label("Find Next").click();+ h.run_steps(3);+ assert_eq!(selected(&h), 0..3);+ h.get_by_label("Change/Find").click();+ h.run_steps(3);+ assert_eq!((text(&h), selected(&h)), ("blue red | red".to_string(), 5..8));+ h.get_by_label("Change").click();+ h.run_steps(3);+ assert_eq!((text(&h), selected(&h)), ("blue blue | red".to_string(), 5..9));+ assert_eq!(h.state().ui.dialog.as_ref().unwrap().fields["status"], json!("1 replacement(s) made"));+}diff --cc crates/ui-egui/src/i18n/ar.rsindex fff828274,5a1265900..38ce0ed60--- a/crates/ui-egui/src/i18n/ar.rs+++ b/crates/ui-egui/src/i18n/ar.rs@@@ -32,50 -31,13 +32,55 @@@ pub(super) const TABLE: &[(&str, &str)("Cut", "قص"),("Copy", "نسخ"),("Paste", "لصق"),+ ("Keep In Frame", "الإبقاء داخل الإطار"),+ ("New Paragraph Style", "نمط فقرة جديد"),+ ("New Character Style", "نمط حرف جديد"),+ ("Next Style:", "النمط التالي:"),+ ("[Same style]", "[النمط نفسه]"),+ ("Reset To Base", "إعادة التعيين إلى الأساس"),+ ("Apply Style to Selection", "تطبيق النمط على التحديد"),+ ("Change/Find", "تغيير/بحث"),+ ("Find Format:", "البحث عن تنسيق:"),+ ("Find Format Settings", "إعدادات البحث عن تنسيق"),+ ("Specify attributes to find", "تحديد السمات المراد البحث عنها"),+ (+ "With a Find Format, only text that has it is found; with nothing in Find what, all text that has it",+ "مع تنسيق للبحث، يُعثر فقط على النص الذي يحمله؛ وإذا كان حقل «البحث عن» فارغًا، فعلى كل نص يحمله",+ ),+ ("Change Format:", "تغيير التنسيق:"),+ ("Change Format Settings", "إعدادات تغيير التنسيق"),+ ("Style Options", "خيارات النمط"),+ ("[Any Style]", "[أي نمط]"),+ ("Specify attributes to change", "تحديد السمات المراد تغييرها"),+ ("Clear specified attributes", "مسح السمات المحددة"),+ (+ "With a Change Format and nothing in Change to, the found text stays and is only formatted",+ "مع تنسيق للتغيير وحقل «تغيير إلى» فارغ، يبقى النص الذي تم العثور عليه ويتغير تنسيقه فقط",+ ),+ ("Double Column", "عمود مزدوج"),+ ("Tools Panel:", "لوحة الأدوات:"),+ ("Color Theme:", "سمة الألوان:"),+ ("At End of Document", "في نهاية المستند"),+ ("At Start of Document", "في بداية المستند"),+ ("Before Page", "قبل الصفحة"),+ ("After Page", "بعد الصفحة"),+ ("Parent:", "الصفحة الأصلية:"),+ ("Insert:", "إدراج:"),+ ("Stroke Type", "نوع الحد"),+ ("Corner Shape", "شكل الزاوية"),+ ("Corner Size and Shape:", "حجم الزوايا وشكلها:"),+ ("Join", "وصل"),+ ("Convert Point", "تحويل النقطة"),+ ("New Section", "قسم جديد"),+ ("Clear Frame Fitting Options", "مسح خيارات ملاءمة الإطار"),+ ("Cannot be edited", "غير قابل للتحرير"),+ ("Maximum:", "الحد الأقصى:"),+ ("Paragraph Spacing Limit:", "حد تباعد الفقرات:"),+ ("Overprint", "طباعة فوقية"),+ ("Top Left Corner", "الزاوية العلوية اليسرى"),+ ("Top Right Corner", "الزاوية العلوية اليمنى"),+ ("Bottom Left Corner", "الزاوية السفلية اليسرى"),+ ("Bottom Right Corner", "الزاوية السفلية اليمنى"),- ("Stroke Type", "نوع الحد"),- ("Corner Shape", "شكل الزاوية"),("Restart Numbering", "إعادة الترقيم"),("Continue Numbering", "متابعة الترقيم"),("Keep Options…", "خيارات الإبقاء…"),diff --cc crates/ui-egui/src/i18n/cs.rsindex fea049b3f,bc28e17b2..4aa6a5bbe--- a/crates/ui-egui/src/i18n/cs.rs+++ b/crates/ui-egui/src/i18n/cs.rs@@@ -33,54 -32,13 +33,59 @@@ pub(super) const TABLE: &[(&str, &str)("Cut", "Vyjmout"),("Copy", "Kopírovat"),("Paste", "Vložit"),+ ("Keep In Frame", "Zachovat v rámečku"),+ ("Gap Tint:", "Odstín mezery:"),+ ("New Paragraph Style", "Nový styl odstavce"),+ ("New Character Style", "Nový styl znaku"),+ ("Next Style:", "Další styl:"),+ ("[Same style]", "[Stejný styl]"),+ ("Reset To Base", "Obnovit podle základu"),+ ("Apply Style to Selection", "Použít styl na výběr"),+ ("Change/Find", "Změnit/Najít"),+ ("Find Format:", "Hledat formát:"),+ ("Find Format Settings", "Nastavení hledání formátu"),+ ("Specify attributes to find", "Určit atributy k hledání"),+ (+ "With a Find Format, only text that has it is found; with nothing in Find what, all text that has it",+ "S formátem hledání se najde jen text, který ho má; s prázdným polem „Najít“ veškerý text, který ho má",+ ),+ ("Change Format:", "Změnit formát:"),+ ("Change Format Settings", "Nastavení změny formátu"),+ ("Style Options", "Volby stylu"),+ ("[Any Style]", "[Libovolný styl]"),+ ("Specify attributes to change", "Určit atributy ke změně"),+ ("Clear specified attributes", "Vymazat určené atributy"),+ (+ "With a Change Format and nothing in Change to, the found text stays and is only formatted",+ "Se změnou formátu a prázdným polem „Změnit na“ nalezený text zůstane a změní se jen jeho formát",+ ),+ ("Double Column", "Dvojitý sloupec"),+ ("Single Column", "Jednoduchý sloupec"),+ ("Tools Panel:", "Panel nástrojů:"),+ ("Color Theme:", "Barevný motiv:"),+ ("At End of Document", "Na konec dokumentu"),+ ("At Start of Document", "Na začátek dokumentu"),+ ("Before Page", "Před stránku"),+ ("After Page", "Za stránku"),+ ("Parent:", "Vzor:"),+ ("Insert:", "Vložit:"),+ ("Stroke Type", "Typ tahu"),+ ("Corner Shape", "Tvar rohu"),+ ("Corner Size and Shape:", "Velikost a tvar rohů:"),+ ("Join", "Spojit"),+ ("Convert Point", "Převést bod"),+ ("Plain", "Obyčejný"),+ ("Symmetrical", "Symetrický"),+ ("New Section", "Nový oddíl"),+ ("Clear Frame Fitting Options", "Vymazat volby přizpůsobení rámečku"),+ ("Cannot be edited", "Nelze upravit"),+ ("Maximum:", "Maximum:"),+ ("Paragraph Spacing Limit:", "Limit mezer mezi odstavci:"),+ ("Overprint", "Přetisk"),+ ("Top Left Corner", "Levý horní roh"),+ ("Top Right Corner", "Pravý horní roh"),+ ("Bottom Left Corner", "Levý dolní roh"),+ ("Bottom Right Corner", "Pravý dolní roh"),- ("Stroke Type", "Typ tahu"),- ("Corner Shape", "Tvar rohu"),("Restart Numbering", "Začít číslování znovu"),("Continue Numbering", "Pokračovat v číslování"),("Keep Options…", "Volby zachování…"),diff --cc crates/ui-egui/src/i18n/de.rsindex 07a026f55,0ffe06440..dce19904b--- a/crates/ui-egui/src/i18n/de.rs+++ b/crates/ui-egui/src/i18n/de.rs@@@ -32,16 -31,13 +32,21 @@@ pub(super) const TABLE: &[(&str, &str)("Cut", "Ausschneiden"),("Copy", "Kopieren"),("Paste", "Einfügen"),+ ("Stroke Type", "Konturtyp"),+ ("Corner Shape", "Eckenform"),+ ("Corner Size and Shape:", "Eckengröße und -form:"),+ ("Join", "Verbinden"),+ ("Convert Point", "Punkt konvertieren"),+ ("Plain", "Einfach"),+ ("Symmetrical", "Symmetrisch"),+ ("New Section", "Neuer Abschnitt"),+ ("Clear Frame Fitting Options", "Rahmeneinpassungsoptionen löschen"),+ ("Cannot be edited", "Nicht bearbeitbar"),+ ("Overprint", "Überdrucken"),+ ("Top Left Corner", "Ecke oben links"),+ ("Top Right Corner", "Ecke oben rechts"),+ ("Bottom Left Corner", "Ecke unten links"),+ ("Bottom Right Corner", "Ecke unten rechts"),- ("Stroke Type", "Konturtyp"),- ("Corner Shape", "Eckenform"),("Restart Numbering", "Nummerierung neu beginnen"),("Continue Numbering", "Nummerierung fortführen"),("Keep Options…", "Umbruchoptionen …"),diff --cc crates/ui-egui/src/i18n/it.rsindex 513592c62,75fb53ace..4b9e1aae9--- a/crates/ui-egui/src/i18n/it.rs+++ b/crates/ui-egui/src/i18n/it.rs@@@ -30,51 -29,13 +30,56 @@@ pub(super) const TABLE: &[(&str, &str)("Cut", "Taglia"),("Copy", "Copia"),("Paste", "Incolla"),+ ("Keep In Frame", "Mantieni nella cornice"),+ ("New Paragraph Style", "Nuovo stile di paragrafo"),+ ("New Character Style", "Nuovo stile di carattere"),+ ("Next Style:", "Stile successivo:"),+ ("[Same style]", "[Stesso stile]"),+ ("Reset To Base", "Ripristina base"),+ ("Apply Style to Selection", "Applica stile alla selezione"),+ ("Change/Find", "Sostituisci/Trova"),+ ("Find Format:", "Trova formato:"),+ ("Find Format Settings", "Impostazioni di ricerca formato"),+ ("Specify attributes to find", "Specifica gli attributi da trovare"),+ (+ "With a Find Format, only text that has it is found; with nothing in Find what, all text that has it",+ "Con un formato di ricerca si trova solo il testo che lo ha; con «Trova» vuoto, tutto il testo che lo ha",+ ),+ ("Change Format:", "Modifica formato:"),+ ("Change Format Settings", "Impostazioni di modifica formato"),+ ("Style Options", "Opzioni stile"),+ ("[Any Style]", "[Qualsiasi stile]"),+ ("Specify attributes to change", "Specifica gli attributi da modificare"),+ ("Clear specified attributes", "Cancella gli attributi specificati"),+ (+ "With a Change Format and nothing in Change to, the found text stays and is only formatted",+ "Con un formato di modifica e «Sostituisci con» vuoto, il testo trovato resta e cambia solo la formattazione",+ ),+ ("Double Column", "Colonna doppia"),+ ("Tools Panel:", "Pannello Strumenti:"),+ ("Color Theme:", "Tema colore:"),+ ("At End of Document", "Alla fine del documento"),+ ("At Start of Document", "All'inizio del documento"),+ ("Before Page", "Prima della pagina"),+ ("After Page", "Dopo la pagina"),+ ("Parent:", "Pagina mastro:"),+ ("Insert:", "Inserisci:"),+ ("Insert Pages", "Inserisci pagine"),+ ("Stroke Type", "Tipo traccia"),+ ("Corner Shape", "Forma angolo"),+ ("Corner Size and Shape:", "Dimensione e forma angoli:"),+ ("Join", "Unisci"),+ ("Convert Point", "Converti punto"),+ ("New Section", "Nuova sezione"),+ ("Clear Frame Fitting Options", "Cancella opzioni di adattamento cornice"),+ ("Cannot be edited", "Non modificabile"),+ ("Maximum:", "Massimo:"),+ ("Paragraph Spacing Limit:", "Limite spaziatura paragrafo:"),+ ("Overprint", "Sovrastampa"),+ ("Top Left Corner", "Angolo superiore sinistro"),+ ("Top Right Corner", "Angolo superiore destro"),+ ("Bottom Left Corner", "Angolo inferiore sinistro"),+ ("Bottom Right Corner", "Angolo inferiore destro"),- ("Stroke Type", "Tipo traccia"),- ("Corner Shape", "Forma angolo"),("Restart Numbering", "Riavvia numerazione"),("Continue Numbering", "Continua numerazione"),("Keep Options…", "Opzioni di separazione…"),diff --cc crates/ui-egui/src/i18n/ja.rsindex 761512b83,3d2433799..ff11e1da6--- a/crates/ui-egui/src/i18n/ja.rs+++ b/crates/ui-egui/src/i18n/ja.rs@@@ -31,14 -30,13 +31,19 @@@ pub(super) const TABLE: &[(&str, &str)("Cut", "カット"),("Copy", "コピー"),("Paste", "ペースト"),+ ("Stroke Type", "線の種類"),+ ("Corner Shape", "角のシェイプ"),+ ("Corner Size and Shape:", "角のサイズとシェイプ:"),+ ("Join", "連結"),+ ("Convert Point", "ポイントを切り換え"),+ ("New Section", "新規セクション"),+ ("Clear Frame Fitting Options", "フレーム調整オプションを消去"),+ ("Cannot be edited", "編集不可"),+ ("Overprint", "オーバープリント"),+ ("Top Left Corner", "左上角"),+ ("Top Right Corner", "右上角"),+ ("Bottom Left Corner", "左下角"),+ ("Bottom Right Corner", "右下角"),- ("Stroke Type", "線の種類"),- ("Corner Shape", "角のシェイプ"),("Restart Numbering", "番号の振り直し"),("Continue Numbering", "番号の継続"),("Keep Options…", "段落分離禁止オプション…"),diff --cc crates/ui-egui/src/i18n/ka.rsindex 92b78cebc,80e286dc5..cc1ac3fe2--- a/crates/ui-egui/src/i18n/ka.rs+++ b/crates/ui-egui/src/i18n/ka.rs@@@ -33,48 -32,13 +33,53 @@@ pub(super) const TABLE: &[(&str, &str)("Cut", "ამოჭრა"),("Copy", "კოპირება"),("Paste", "ჩასმა"),+ ("Keep In Frame", "ჩარჩოში შენარჩუნება"),+ ("New Paragraph Style", "აბზაცის ახალი სტილი"),+ ("New Character Style", "სიმბოლოს ახალი სტილი"),+ ("Next Style:", "შემდეგი სტილი:"),+ ("[Same style]", "[იგივე სტილი]"),+ ("Reset To Base", "საბაზოზე დაბრუნება"),+ ("Apply Style to Selection", "სტილის გამოყენება მონიშნულზე"),+ ("Change/Find", "ჩანაცვლება/ძიება"),+ ("Find Format:", "ფორმატის ძიება:"),+ ("Find Format Settings", "ფორმატის ძიების პარამეტრები"),+ ("Specify attributes to find", "საძიებო ატრიბუტების მითითება"),+ (+ "With a Find Format, only text that has it is found; with nothing in Find what, all text that has it",+ "ძიების ფორმატით მხოლოდ ის ტექსტი მოიძებნება, რომელსაც ის აქვს; ცარიელი „ძიება“ ველით — ყველა ასეთი ტექსტი",+ ),+ ("Change Format:", "ფორმატის შეცვლა:"),+ ("Change Format Settings", "ფორმატის შეცვლის პარამეტრები"),+ ("Style Options", "სტილის პარამეტრები"),+ ("[Any Style]", "[ნებისმიერი სტილი]"),+ ("Specify attributes to change", "შესაცვლელი ატრიბუტების მითითება"),+ ("Clear specified attributes", "მითითებული ატრიბუტების გასუფთავება"),+ (+ "With a Change Format and nothing in Change to, the found text stays and is only formatted",+ "ფორმატის შეცვლით და ცარიელი „ჩანაცვლება“ ველით ნაპოვნი ტექსტი რჩება და მხოლოდ ფორმატი იცვლება",+ ),+ ("Double Column", "ორმაგი სვეტი"),+ ("Tools Panel:", "ხელსაწყოების პანელი:"),+ ("Color Theme:", "ფერთა თემა:"),+ ("At End of Document", "დოკუმენტის ბოლოს"),+ ("At Start of Document", "დოკუმენტის დასაწყისში"),+ ("Before Page", "გვერდის წინ"),+ ("After Page", "გვერდის შემდეგ"),+ ("Parent:", "საბაზო გვერდი:"),+ ("Insert:", "ჩასმა:"),+ ("Stroke Type", "კონტურის ტიპი"),+ ("Corner Shape", "კუთხის ფორმა"),+ ("Corner Size and Shape:", "კუთხეების ზომა და ფორმა:"),+ ("New Section", "ახალი სექცია"),+ ("Clear Frame Fitting Options", "ჩარჩოს მორგების პარამეტრების გასუფთავება"),+ ("Cannot be edited", "რედაქტირება შეუძლებელია"),+ ("Maximum:", "მაქსიმუმი:"),+ ("Paragraph Spacing Limit:", "აბზაცებს შორის ინტერვალის ზღვარი:"),+ ("Overprint", "ზედაბეჭდვა"),+ ("Top Left Corner", "ზედა მარცხენა კუთხე"),+ ("Top Right Corner", "ზედა მარჯვენა კუთხე"),+ ("Bottom Left Corner", "ქვედა მარცხენა კუთხე"),+ ("Bottom Right Corner", "ქვედა მარჯვენა კუთხე"),- ("Stroke Type", "კონტურის ტიპი"),- ("Corner Shape", "კუთხის ფორმა"),("Restart Numbering", "ნუმერაციის თავიდან დაწყება"),("Continue Numbering", "ნუმერაციის გაგრძელება"),("Keep Options…", "შენარჩუნების პარამეტრები…"),diff --cc crates/ui-egui/src/i18n/pl.rsindex f419146ef,489510841..2c3a7109f--- a/crates/ui-egui/src/i18n/pl.rs+++ b/crates/ui-egui/src/i18n/pl.rs@@@ -31,54 -30,13 +31,59 @@@ pub(super) const TABLE: &[(&str, &str)("Cut", "Wytnij"),("Copy", "Kopiuj"),("Paste", "Wklej"),+ ("Keep In Frame", "Zachowaj w ramce"),+ ("Gap Tint:", "Odcień odstępu:"),+ ("New Paragraph Style", "Nowy styl akapitowy"),+ ("New Character Style", "Nowy styl znakowy"),+ ("Next Style:", "Następny styl:"),+ ("[Same style]", "[Ten sam styl]"),+ ("Reset To Base", "Przywróć bazowy"),+ ("Apply Style to Selection", "Zastosuj styl do zaznaczenia"),+ ("Change/Find", "Zmień/Znajdź"),+ ("Find Format:", "Znajdź format:"),+ ("Find Format Settings", "Ustawienia wyszukiwania formatu"),+ ("Specify attributes to find", "Określ atrybuty do znalezienia"),+ (+ "With a Find Format, only text that has it is found; with nothing in Find what, all text that has it",+ "Przy formacie wyszukiwania znajdowany jest tylko tekst, który go ma; przy pustym polu „Znajdź” — cały taki tekst",+ ),+ ("Change Format:", "Zmień format:"),+ ("Change Format Settings", "Ustawienia zmiany formatu"),+ ("Style Options", "Opcje stylu"),+ ("[Any Style]", "[Dowolny styl]"),+ ("Specify attributes to change", "Określ atrybuty do zmiany"),+ ("Clear specified attributes", "Wyczyść określone atrybuty"),+ (+ "With a Change Format and nothing in Change to, the found text stays and is only formatted",+ "Przy zmianie formatu i pustym polu „Zmień na” znaleziony tekst zostaje, a zmienia się tylko jego format",+ ),+ ("Double Column", "Podwójna kolumna"),+ ("Single Column", "Pojedyncza kolumna"),+ ("Tools Panel:", "Panel narzędzi:"),+ ("Color Theme:", "Motyw kolorów:"),+ ("At End of Document", "Na końcu dokumentu"),+ ("At Start of Document", "Na początku dokumentu"),+ ("Before Page", "Przed stroną"),+ ("After Page", "Po stronie"),+ ("Parent:", "Strona wzorcowa:"),+ ("Insert:", "Wstaw:"),+ ("Stroke Type", "Rodzaj obrysu"),+ ("Corner Shape", "Kształt narożnika"),+ ("Corner Size and Shape:", "Rozmiar i kształt narożników:"),+ ("Join", "Połącz"),+ ("Convert Point", "Konwertuj punkt"),+ ("Plain", "Zwykły"),+ ("Symmetrical", "Symetryczny"),+ ("New Section", "Nowa sekcja"),+ ("Clear Frame Fitting Options", "Wyczyść opcje dopasowania ramki"),+ ("Cannot be edited", "Nie można edytować"),+ ("Maximum:", "Maksimum:"),+ ("Paragraph Spacing Limit:", "Limit odstępu akapitów:"),+ ("Overprint", "Nadruk"),+ ("Top Left Corner", "Lewy górny narożnik"),+ ("Top Right Corner", "Prawy górny narożnik"),+ ("Bottom Left Corner", "Lewy dolny narożnik"),+ ("Bottom Right Corner", "Prawy dolny narożnik"),- ("Stroke Type", "Rodzaj obrysu"),- ("Corner Shape", "Kształt narożnika"),("Restart Numbering", "Zacznij numerowanie od nowa"),("Continue Numbering", "Kontynuuj numerowanie"),("Keep Options…", "Opcje utrzymywania…"),diff --cc crates/ui-egui/src/i18n/pt_br.rsindex 6abb2519f,eb247c9c1..b9aa37e27--- a/crates/ui-egui/src/i18n/pt_br.rs+++ b/crates/ui-egui/src/i18n/pt_br.rs@@@ -33,51 -32,13 +33,56 @@@ pub(super) const TABLE: &[(&str, &str)("Cut", "Recortar"),("Copy", "Copiar"),("Paste", "Colar"),+ ("Keep In Frame", "Manter no quadro"),+ ("New Paragraph Style", "Novo estilo de parágrafo"),+ ("New Character Style", "Novo estilo de caractere"),+ ("Next Style:", "Próximo estilo:"),+ ("[Same style]", "[Mesmo estilo]"),+ ("Reset To Base", "Redefinir para base"),+ ("Apply Style to Selection", "Aplicar estilo à seleção"),+ ("Change/Find", "Alterar/Localizar"),+ ("Find Format:", "Localizar formato:"),+ ("Find Format Settings", "Configurações de localização de formato"),+ ("Specify attributes to find", "Especificar atributos a localizar"),+ (+ "With a Find Format, only text that has it is found; with nothing in Find what, all text that has it",+ "Com um formato de localização, só o texto que o tem é encontrado; com “Localizar” vazio, todo o texto que o tem",+ ),+ ("Change Format:", "Alterar formato:"),+ ("Change Format Settings", "Configurações de alteração de formato"),+ ("Style Options", "Opções de estilo"),+ ("[Any Style]", "[Qualquer estilo]"),+ ("Specify attributes to change", "Especificar atributos a alterar"),+ ("Clear specified attributes", "Limpar atributos especificados"),+ (+ "With a Change Format and nothing in Change to, the found text stays and is only formatted",+ "Com um formato de alteração e “Alterar para” vazio, o texto encontrado permanece e só a formatação muda",+ ),+ ("Double Column", "Coluna dupla"),+ ("Tools Panel:", "Painel Ferramentas:"),+ ("Color Theme:", "Tema de cores:"),+ ("At End of Document", "No final do documento"),+ ("At Start of Document", "No início do documento"),+ ("Before Page", "Antes da página"),+ ("After Page", "Após a página"),+ ("Parent:", "Página principal:"),+ ("Insert:", "Inserir:"),+ ("Insert Pages", "Inserir páginas"),+ ("Stroke Type", "Tipo de traçado"),+ ("Corner Shape", "Forma do canto"),+ ("Corner Size and Shape:", "Tamanho e forma dos cantos:"),+ ("Join", "Unir"),+ ("Convert Point", "Converter ponto"),+ ("New Section", "Nova seção"),+ ("Clear Frame Fitting Options", "Limpar opções de ajuste do quadro"),+ ("Cannot be edited", "Não editável"),+ ("Maximum:", "Máximo:"),+ ("Paragraph Spacing Limit:", "Limite de espaçamento de parágrafo:"),+ ("Overprint", "Superimprimir"),+ ("Top Left Corner", "Canto superior esquerdo"),+ ("Top Right Corner", "Canto superior direito"),+ ("Bottom Left Corner", "Canto inferior esquerdo"),+ ("Bottom Right Corner", "Canto inferior direito"),- ("Stroke Type", "Tipo de traçado"),- ("Corner Shape", "Forma do canto"),("Restart Numbering", "Reiniciar numeração"),("Continue Numbering", "Continuar numeração"),("Keep Options…", "Opções de manutenção…"),diff --cc crates/ui-egui/src/i18n/ru.rsindex 4f84ce9d4,d44f8782a..0d181cfeb--- a/crates/ui-egui/src/i18n/ru.rs+++ b/crates/ui-egui/src/i18n/ru.rs@@@ -35,54 -34,13 +35,59 @@@ pub(super) const TABLE: &[(&str, &str)("Cut", "Вырезать"),("Copy", "Копировать"),("Paste", "Вставить"),+ ("Keep In Frame", "Сохранить во фрейме"),+ ("Gap Tint:", "Оттенок пробелов:"),+ ("New Paragraph Style", "Новый стиль абзаца"),+ ("New Character Style", "Новый стиль символов"),+ ("Next Style:", "Следующий стиль:"),+ ("[Same style]", "[Тот же стиль]"),+ ("Reset To Base", "Сбросить до основы"),+ ("Apply Style to Selection", "Применить стиль к выделенному"),+ ("Change/Find", "Заменить/Найти"),+ ("Find Format:", "Найти формат:"),+ ("Find Format Settings", "Параметры поиска формата"),+ ("Specify attributes to find", "Задать атрибуты для поиска"),+ (+ "With a Find Format, only text that has it is found; with nothing in Find what, all text that has it",+ "С форматом поиска находится только текст с этим форматом; если поле «Найти» пусто — весь такой текст",+ ),+ ("Change Format:", "Заменить формат:"),+ ("Change Format Settings", "Параметры замены формата"),+ ("Style Options", "Параметры стиля"),+ ("[Any Style]", "[Любой стиль]"),+ ("Specify attributes to change", "Задать атрибуты для замены"),+ ("Clear specified attributes", "Очистить заданные атрибуты"),+ (+ "With a Change Format and nothing in Change to, the found text stays and is only formatted",+ "Если задан формат замены, а поле «Заменить на» пусто, найденный текст остаётся, меняется только его формат",+ ),+ ("Double Column", "Две колонки"),+ ("Single Column", "Одна колонка"),+ ("Tools Panel:", "Панель инструментов:"),+ ("Color Theme:", "Цветовая тема:"),+ ("At End of Document", "В конец документа"),+ ("At Start of Document", "В начало документа"),+ ("Before Page", "Перед страницей"),+ ("After Page", "После страницы"),+ ("Parent:", "Шаблон:"),+ ("Insert:", "Вставить:"),+ ("Stroke Type", "Тип обводки"),+ ("Corner Shape", "Форма угла"),+ ("Corner Size and Shape:", "Размер и форма углов:"),+ ("Join", "Соединить"),+ ("Convert Point", "Преобразовать точку"),+ ("Plain", "Простая"),+ ("Symmetrical", "Симметричная"),+ ("New Section", "Новый раздел"),+ ("Clear Frame Fitting Options", "Очистить параметры подгонки фрейма"),+ ("Cannot be edited", "Нельзя изменить"),+ ("Maximum:", "Максимум:"),+ ("Paragraph Spacing Limit:", "Предел интервала абзацев:"),+ ("Overprint", "Наложение"),+ ("Top Left Corner", "Левый верхний угол"),+ ("Top Right Corner", "Правый верхний угол"),+ ("Bottom Left Corner", "Левый нижний угол"),+ ("Bottom Right Corner", "Правый нижний угол"),- ("Stroke Type", "Тип обводки"),- ("Corner Shape", "Форма угла"),("Restart Numbering", "Начать нумерацию заново"),("Continue Numbering", "Продолжить нумерацию"),("Keep Options…", "Параметры удержания…"),diff --cc crates/ui-egui/src/i18n/table.rsindex 9890c0172,d24c0330c..b23d7105b--- a/crates/ui-egui/src/i18n/table.rs+++ b/crates/ui-egui/src/i18n/table.rs@@@ -1235,9 -1130,11 +1235,14 @@@ pub(super) const TABLE: &[(&str, [&str],),("Load Styles", ["Formate laden", "Charger les styles", "Cargar estilos", "スタイルを読み込み", "加载样式"]),+ ("New Section", ["Neuer Abschnitt", "Nouvelle section", "Nueva sección", "新規セクション", "新建章节"]),+ ("Cannot be edited", ["Nicht bearbeitbar", "Non modifiable", "No editable", "編集不可", "不可编辑"]),+ ("Selection", ["Auswahl", "Sélection", "Selección", "選択範囲", "选区"]),+ ("Overprint", ["Überdrucken", "Surimpression", "Sobreimprimir", "オーバープリント", "叠印"]),+ ("Top Left Corner", ["Ecke oben links", "Angle supérieur gauche", "Esquina superior izquierda", "左上角", "左上角"]),+ ("Top Right Corner", ["Ecke oben rechts", "Angle supérieur droit", "Esquina superior derecha", "右上角", "右上角"]),+ ("Bottom Left Corner", ["Ecke unten links", "Angle inférieur gauche", "Esquina inferior izquierda", "左下角", "左下角"]),+ ("Bottom Right Corner", ["Ecke unten rechts", "Angle inférieur droit", "Esquina inferior derecha", "右下角", "右下角"]),("Restart Numbering", ["Nummerierung neu beginnen", "Recommencer la numérotation", "Reiniciar numeración", "番号の振り直し", "重新开始编号"]),("Continue Numbering", ["Nummerierung fortführen", "Poursuivre la numérotation", "Continuar numeración", "番号の継続", "继续编号"]),("Keep Options…", ["Umbruchoptionen …", "Options d'enchaînement…", "Opciones de separación…", "段落分離禁止オプション…", "保持选项…"]),diff --cc crates/ui-egui/src/i18n/uk.rsindex edab01623,02c1eb69b..a1e02ecc1--- a/crates/ui-egui/src/i18n/uk.rs+++ b/crates/ui-egui/src/i18n/uk.rs@@@ -31,51 -30,13 +31,56 @@@ pub(super) const TABLE: &[(&str, &str)("Cut", "Вирізати"),("Copy", "Копіювати"),("Paste", "Вставити"),+ ("Keep In Frame", "Зберегти у фреймі"),+ ("New Paragraph Style", "Новий стиль абзацу"),+ ("New Character Style", "Новий стиль символів"),+ ("Next Style:", "Наступний стиль:"),+ ("[Same style]", "[Той самий стиль]"),+ ("Reset To Base", "Скинути до основи"),+ ("Apply Style to Selection", "Застосувати стиль до виділеного"),+ ("Change/Find", "Замінити/Знайти"),+ ("Find Format:", "Знайти формат:"),+ ("Find Format Settings", "Параметри пошуку формату"),+ ("Specify attributes to find", "Задати атрибути для пошуку"),+ (+ "With a Find Format, only text that has it is found; with nothing in Find what, all text that has it",+ "З форматом пошуку знаходиться лише текст із цим форматом; якщо поле «Знайти» порожнє — увесь такий текст",+ ),+ ("Change Format:", "Замінити формат:"),+ ("Change Format Settings", "Параметри заміни формату"),+ ("Style Options", "Параметри стилю"),+ ("[Any Style]", "[Будь-який стиль]"),+ ("Specify attributes to change", "Задати атрибути для заміни"),+ ("Clear specified attributes", "Очистити задані атрибути"),+ (+ "With a Change Format and nothing in Change to, the found text stays and is only formatted",+ "Якщо задано формат заміни, а поле «Замінити на» порожнє, знайдений текст лишається, змінюється лише його формат",+ ),+ ("Double Column", "Подвійна колонка"),+ ("Tools Panel:", "Панель інструментів:"),+ ("Color Theme:", "Колірна тема:"),+ ("At End of Document", "У кінець документа"),+ ("At Start of Document", "На початок документа"),+ ("Before Page", "Перед сторінкою"),+ ("After Page", "Після сторінки"),+ ("Parent:", "Шаблон:"),+ ("Insert:", "Вставити:"),+ ("Insert Pages", "Вставити сторінки"),+ ("Stroke Type", "Тип обведення"),+ ("Corner Shape", "Форма кута"),+ ("Corner Size and Shape:", "Розмір і форма кутів:"),+ ("Join", "Зʼєднати"),+ ("Convert Point", "Перетворити точку"),+ ("New Section", "Новий розділ"),+ ("Clear Frame Fitting Options", "Очистити параметри припасування фрейму"),+ ("Cannot be edited", "Не можна змінити"),+ ("Maximum:", "Максимум:"),+ ("Paragraph Spacing Limit:", "Межа інтервалу абзаців:"),+ ("Overprint", "Накладання"),+ ("Top Left Corner", "Лівий верхній кут"),+ ("Top Right Corner", "Правий верхній кут"),+ ("Bottom Left Corner", "Лівий нижній кут"),+ ("Bottom Right Corner", "Правий нижній кут"),- ("Stroke Type", "Тип обведення"),- ("Corner Shape", "Форма кута"),("Restart Numbering", "Почати нумерацію знову"),("Continue Numbering", "Продовжити нумерацію"),("Keep Options…", "Параметри утримання…"),diff --cc crates/ui-egui/src/panels/properties.rsindex 7243bad44,554014c0d..1f51fd30c--- a/crates/ui-egui/src/panels/properties.rs+++ b/crates/ui-egui/src/panels/properties.rs@@@ -31,9 -31,7 +31,9 @@@ use flex::flex_sectionpub(crate) use links::run_update_links;pub use links::{info_panel, links_panel, preflight_panel, update_links};use object::{align_row, appearance_section, guide_section, quick_actions_object, transform_section, wrap_section};-pub(crate) use object::{corner_type_dropdown, paint_corner_shape, preview_dropdown, preview_row, ref_point_proxy, stroke_type_dropdown};+#[cfg(test)]- use object::{align_to_icon, preview_row};- pub(crate) use object::{corner_shape_button, corner_type_dropdown, ref_point_proxy, stroke_type_dropdown};++use object::align_to_icon;++pub(crate) use object::{corner_shape_button, corner_type_dropdown, paint_corner_shape, preview_row, ref_point_proxy, stroke_type_dropdown};use object_panels::pathfinder_row;pub use object_panels::{align_panel, attributes_panel, effects_panel, pathfinder_panel, stroke_panel, wrap_panel};pub(crate) use text::{LANGUAGES, kerning_control, language_menu};