From ebe718808be566e9a2e08d6f4f4e3b8cf1603d21 Mon Sep 17 00:00:00 2001 From: Taha-Mahmoodi <85902429+Taha-Mahmoodi@users.noreply.github.com> Date: Wed, 4 Nov 2026 00:56:04 +0430 Subject: [PATCH 001/112] Fix #4462: SVG export can write width and height in mm, cm or in SVG Options gets a units choice (px, pt, mm, cm, in) for the width and height an export writes; px stays the default and writes bare numbers as before, the viewBox stays in points. An unknown unit is an error. --- crates/engine/src/cmd/fileio/commands.rs | 2 +- crates/engine/src/cmd/fileio/svg.rs | 6 ++++ crates/engine/src/cmd/fileio/tests_svg.rs | 26 ++++++++++++++ crates/svg/src/export.rs | 4 ++- crates/svg/src/lib.rs | 41 +++++++++++++++++++++++ crates/svg/tests/it/roundtrip.rs | 17 +++++++++- crates/ui-egui/src/dialogs/svg_options.rs | 6 ++-- docs/control-protocol.md | 2 +- docs/file-format-parity.md | 5 +-- docs/gaps.md | 6 +++- docs/mcp.md | 2 +- docs/target-app-parity.md | 7 ++-- docs/ui-parity.md | 3 +- 13 files changed, 113 insertions(+), 14 deletions(-) diff --git a/crates/engine/src/cmd/fileio/commands.rs b/crates/engine/src/cmd/fileio/commands.rs index f269f0fc0f..60c0f72ee1 100644 --- a/crates/engine/src/cmd/fileio/commands.rs +++ b/crates/engine/src/cmd/fileio/commands.rs @@ -36,7 +36,7 @@ pub fn specs() -> Vec { "Export Document", [], None, - "{path?, format?: svg|svgz|pdf|ai|png|jpg|webp|gif|png8|txt|dxf|eps|emf|wmf|tiff|bmp|tga|psd|vectorcraft|template (default: from the path's extension, else png; png8 writes an indexed .png; ait, a .ait template, is written by file.saveAsTemplate; an exporter plug-in's format is plugin., which an extension only it lists picks too), params?: {…} (an exporter plug-in's parameters; missing ones take their defaults, see plugin.info), selectedOnly?: false (the selected objects alone, in their layers), includeArtboardFill?: true (raster, PDF, SVG and EPS draw each exported artboard's background color behind its art, a transparent background too; false leaves it out), artboard?: 0, artboards?: [i…], rect?: [x, y, width, height] (raster formats: that area of the page in points, y down, instead of an artboard; not with artboard, artboards, range or useArtboards), range?: \"1-3, 5\" | \"all\" (1-based; PDF and .ai write one page per artboard, default all; SVG writes one file per artboard, {stem}-{artboard}.svg; raster formats write one artboard), useArtboards?: true (raster: one file per chosen artboard, default all, {stem}-{artboard}.{ext}; pdf/ai: every page) | false (pdf/ai/raster: the bounds of the visible art; SVG has it as an SVG option), ppi?: 72 (raster formats: pixels per inch, stored in the file; wins over scale), scale?: 1 (pixels per point), background?: transparent|white|black|\"#rrggbb\" (jpg: white when transparent), antiAlias?: none|art (default)|type (text snapped to pixels), interlaced?: false (png, Adam7), embedIcc?: true (png: an sRGB chunk marks the colours as sRGB), quality?: 90 (jpg: 0–100), colorModel?: rgb|cmyk|gray (jpg), method?: baseline|optimized|progressive, scans?: 3 (3–5, progressive), embedIcc?: true, imageMap?: none|client|server (an HTML or NCSA map of the objects with a URL, written as .html / .map), colors?: 256 (gif/png8: 2–256), reduction?: perceptual|selective (default)|adaptive|web|blackWhite|gray, dither?: none|diffusion (default)|pattern|noise, ditherAmount?: 100, transparency?: true, matte?: white|\"#rrggbb\"|none, interlaced?, lossless?: true (webp: lossy WebP isn't available yet: written lossless, with a warning), encoding?: utf8|utf16 (txt: the stories in stacking order, back to front, a thread once; utf16 with a byte order mark), lineEndings?: lf|crlf, selectionOnly?: false, svg?: {styling, outlineText, images, objectIds, decimals, minify, responsive, useArtboards, preserveEditing, metadata, fewerTspans, hiddenLayers, encoding, profile, embedFonts} (see document.formats), …the SVG options given flat instead, …the PDF options of document.exportPdf, …the DXF options of document.exportDxf (useArtboards: one drawing per artboard), …the EPS options of document.exportEps (useArtboards: one file per artboard, {stem}_{artboard}.eps, after a central {stem}.eps of the whole document when there are two or more and art shows; else the visible art), …emf and wmf write one picture of the artboard (useArtboards: true one file per chosen artboard, false the bounds of the visible art; EMF keeps curves, clipping, transparent images and gradients as images clipped to their shape; WMF flattens curves into polygons behind a placeable header; what a format leaves out comes back in warnings), colorModel?: rgb|cmyk|gray (tiff: rgb keeps transparency as an alpha channel), lzw?: true, byteOrder?: little|big, embedIcc?: true, colorModel?: rgb|gray (bmp), depth?: 24 (bmp: 1 black and white, 4|8 a palette by reduction and dither, 16, 24, 32 with alpha), fileFormat?: windows|os2 (1, 4, 8 or 24 bits), rle?: false (4 and 8 bits, windows), flipRows?: false (top-down rows), depth?: 24 (tga: 16 one-bit alpha, 24, 32 with alpha), colorModel?: rgb|cmyk|gray (psd), layers?: true (each top-level layer a pixel layer with its opacity and blend mode; a background colour is a Background layer; false: one flat image, on white), maxEditability?: false (layers and sublayers become groups, each object a layer named as in the Layers panel, text by its text; clipping, masked or knockout layers stay one layer), hiddenLayers?: false (hidden layers and objects written hidden instead of left out), embedIcc?: true (at most 30000 pixels a side; formats without alpha are flattened on white)} → {path, format, bytes, warnings, files?: [path…] (several), linked?: [path…] (linked images, image maps)}; no path → {dataBase64, format, bytes, warnings, files?: [{name, dataBase64}], linked?: [{name, dataBase64}]}. Never changes the document's path", + "{path?, format?: svg|svgz|pdf|ai|png|jpg|webp|gif|png8|txt|dxf|eps|emf|wmf|tiff|bmp|tga|psd|vectorcraft|template (default: from the path's extension, else png; png8 writes an indexed .png; ait, a .ait template, is written by file.saveAsTemplate; an exporter plug-in's format is plugin., which an extension only it lists picks too), params?: {…} (an exporter plug-in's parameters; missing ones take their defaults, see plugin.info), selectedOnly?: false (the selected objects alone, in their layers), includeArtboardFill?: true (raster, PDF, SVG and EPS draw each exported artboard's background color behind its art, a transparent background too; false leaves it out), artboard?: 0, artboards?: [i…], rect?: [x, y, width, height] (raster formats: that area of the page in points, y down, instead of an artboard; not with artboard, artboards, range or useArtboards), range?: \"1-3, 5\" | \"all\" (1-based; PDF and .ai write one page per artboard, default all; SVG writes one file per artboard, {stem}-{artboard}.svg; raster formats write one artboard), useArtboards?: true (raster: one file per chosen artboard, default all, {stem}-{artboard}.{ext}; pdf/ai: every page) | false (pdf/ai/raster: the bounds of the visible art; SVG has it as an SVG option), ppi?: 72 (raster formats: pixels per inch, stored in the file; wins over scale), scale?: 1 (pixels per point), background?: transparent|white|black|\"#rrggbb\" (jpg: white when transparent), antiAlias?: none|art (default)|type (text snapped to pixels), interlaced?: false (png, Adam7), embedIcc?: true (png: an sRGB chunk marks the colours as sRGB), quality?: 90 (jpg: 0–100), colorModel?: rgb|cmyk|gray (jpg), method?: baseline|optimized|progressive, scans?: 3 (3–5, progressive), embedIcc?: true, imageMap?: none|client|server (an HTML or NCSA map of the objects with a URL, written as .html / .map), colors?: 256 (gif/png8: 2–256), reduction?: perceptual|selective (default)|adaptive|web|blackWhite|gray, dither?: none|diffusion (default)|pattern|noise, ditherAmount?: 100, transparency?: true, matte?: white|\"#rrggbb\"|none, interlaced?, lossless?: true (webp: lossy WebP isn't available yet: written lossless, with a warning), encoding?: utf8|utf16 (txt: the stories in stacking order, back to front, a thread once; utf16 with a byte order mark), lineEndings?: lf|crlf, selectionOnly?: false, svg?: {styling, outlineText, images, objectIds, decimals, minify, responsive, units, useArtboards, preserveEditing, metadata, fewerTspans, hiddenLayers, encoding, profile, embedFonts} (see document.formats), …the SVG options given flat instead, …the PDF options of document.exportPdf, …the DXF options of document.exportDxf (useArtboards: one drawing per artboard), …the EPS options of document.exportEps (useArtboards: one file per artboard, {stem}_{artboard}.eps, after a central {stem}.eps of the whole document when there are two or more and art shows; else the visible art), …emf and wmf write one picture of the artboard (useArtboards: true one file per chosen artboard, false the bounds of the visible art; EMF keeps curves, clipping, transparent images and gradients as images clipped to their shape; WMF flattens curves into polygons behind a placeable header; what a format leaves out comes back in warnings), colorModel?: rgb|cmyk|gray (tiff: rgb keeps transparency as an alpha channel), lzw?: true, byteOrder?: little|big, embedIcc?: true, colorModel?: rgb|gray (bmp), depth?: 24 (bmp: 1 black and white, 4|8 a palette by reduction and dither, 16, 24, 32 with alpha), fileFormat?: windows|os2 (1, 4, 8 or 24 bits), rle?: false (4 and 8 bits, windows), flipRows?: false (top-down rows), depth?: 24 (tga: 16 one-bit alpha, 24, 32 with alpha), colorModel?: rgb|cmyk|gray (psd), layers?: true (each top-level layer a pixel layer with its opacity and blend mode; a background colour is a Background layer; false: one flat image, on white), maxEditability?: false (layers and sublayers become groups, each object a layer named as in the Layers panel, text by its text; clipping, masked or knockout layers stay one layer), hiddenLayers?: false (hidden layers and objects written hidden instead of left out), embedIcc?: true (at most 30000 pixels a side; formats without alpha are flattened on white)} → {path, format, bytes, warnings, files?: [path…] (several), linked?: [path…] (linked images, image maps)}; no path → {dataBase64, format, bytes, warnings, files?: [{name, dataBase64}], linked?: [{name, dataBase64}]}. Never changes the document's path", has_doc, export::export ), diff --git a/crates/engine/src/cmd/fileio/svg.rs b/crates/engine/src/cmd/fileio/svg.rs index a11e4a4e8f..ba843ab557 100644 --- a/crates/engine/src/cmd/fileio/svg.rs +++ b/crates/engine/src/cmd/fileio/svg.rs @@ -48,6 +48,12 @@ pub const OPTIONS: &[FormatOption] = &[ FormatOption { name: "decimals", ty: "integer", default: "3", description: "coordinate precision, 1–7 decimal places" }, FormatOption { name: "minify", ty: "boolean", default: "false", description: "no XML declaration, indentation or line breaks" }, FormatOption { name: "responsive", ty: "boolean", default: "false", description: "no width/height: the SVG scales to its container" }, + FormatOption { + name: "units", + ty: "string", + default: "\"px\"", + description: "the unit of width and height: px (bare numbers, one per point) | pt | mm | cm | in (the viewBox stays in points; not with responsive)", + }, FormatOption { name: "preserveEditing", ty: "boolean", diff --git a/crates/engine/src/cmd/fileio/tests_svg.rs b/crates/engine/src/cmd/fileio/tests_svg.rs index 73ee604a98..ed5cbc707b 100644 --- a/crates/engine/src/cmd/fileio/tests_svg.rs +++ b/crates/engine/src/cmd/fileio/tests_svg.rs @@ -83,6 +83,8 @@ fn junk_options_are_rejected() { json!({"svg": "css"}), json!({"images": "inline"}), json!({"useArtboards": "yes"}), + json!({"units": "furlong"}), + json!({"units": 7}), ] { let mut q = p.clone(); q["format"] = json!("svg"); @@ -92,6 +94,30 @@ fn junk_options_are_rejected() { assert!(s.execute("document.export", &json!({"format": "png", "styling": "fancy"})).is_ok()); } +/// #4462: width and height carry the chosen unit (the document is 200 × 100 pt, the viewBox stays +/// in points), px is today's bare numbers, and Responsive leaves the size out whatever the unit. +#[test] +fn svg_export_writes_width_height_with_the_requested_unit() { + let mut s = session(1); + let plain = svg(&mut s, json!({})); + assert!(plain.contains(" width=\"200\" height=\"100\" viewBox=\"0 0 200 100\""), "{plain}"); + assert_eq!(svg(&mut s, json!({"units": "px"})), plain, "px is the default, byte for byte"); + for (unit, size) in [ + ("mm", "width=\"70.556mm\" height=\"35.278mm\""), + ("cm", "width=\"7.056cm\" height=\"3.528cm\""), + ("in", "width=\"2.778in\" height=\"1.389in\""), + ("pt", "width=\"200pt\" height=\"100pt\""), + ] { + for p in [json!({"units": unit}), json!({"svg": {"units": unit}})] { + let out = svg(&mut s, p); + assert!(out.contains(&format!(" {size} viewBox=\"0 0 200 100\"")), "{unit}:\n{out}"); + } + } + let out = svg(&mut s, json!({"units": "mm", "responsive": true})); + assert!(!out.contains("mm\"") && !out.contains("height=\"100\" viewBox") && out.contains("viewBox=\"0 0 200 100\""), "{out}"); + assert!(svg(&mut s, json!({"units": "mm", "decimals": 1})).contains("width=\"70.6mm\" height=\"35.3mm\"")); +} + #[test] fn several_artboards_write_one_file_each() { let mut s = session(3); diff --git a/crates/svg/src/export.rs b/crates/svg/src/export.rs index 13c4268472..2b91bf7b8c 100644 --- a/crates/svg/src/export.rs +++ b/crates/svg/src/export.rs @@ -162,7 +162,9 @@ fn write(doc: &Document, opts: &ExportOptions, native: Option<&[u8]>, id_prefix: out.push_str(" version=\"1.2\" baseProfile=\"tiny\""); } if !opts.responsive { - out.push_str(&format!(" width=\"{ww}\" height=\"{hh}\"")); + // The viewBox stays in user units (points); the unit only scales the drawn size. + let (width, height) = (opts.units.length(rect.width(), opts.decimals), opts.units.length(rect.height(), opts.decimals)); + out.push_str(&format!(" width=\"{width}\" height=\"{height}\"")); } out.push_str(&format!(" viewBox=\"0 0 {ww} {hh}\">{nl}")); let css = opts.styling == Styling::InternalCss && !w.classes.is_empty(); diff --git a/crates/svg/src/lib.rs b/crates/svg/src/lib.rs index ccc154a383..2ab97856f8 100644 --- a/crates/svg/src/lib.rs +++ b/crates/svg/src/lib.rs @@ -177,6 +177,43 @@ impl Encoding { } } +/// The unit of the `width` and `height` an export writes (SVG Options → Units, off Responsive). +/// The `viewBox` stays in user units (points) whatever is chosen. +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum SizeUnit { + /// Bare numbers, CSS pixels at one per point (72 per inch). + #[default] + #[serde(rename = "px")] + Px, + #[serde(rename = "pt")] + Pt, + #[serde(rename = "mm")] + Mm, + #[serde(rename = "cm")] + Cm, + #[serde(rename = "in")] + In, +} + +impl SizeUnit { + /// This unit's size in points, and the suffix a length in it carries (`px` is written bare). + fn per_point(self) -> (f64, &'static str) { + match self { + Self::Px => (1.0, ""), + Self::Pt => (1.0, "pt"), + Self::Mm => (25.4 / 72.0, "mm"), + Self::Cm => (2.54 / 72.0, "cm"), + Self::In => (1.0 / 72.0, "in"), + } + } + + /// `points` as a length in this unit, rounded to `decimals` places, e.g. `70.556mm`. + pub fn length(self, points: f64, decimals: u8) -> String { + let (scale, suffix) = self.per_point(); + format!("{}{suffix}", fmt_num(points * scale, decimals)) + } +} + /// The SVG profile written (SVG Options → SVG Profile). #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] pub enum Profile { @@ -223,6 +260,9 @@ pub struct ExportOptions { pub minify: bool, /// Omit `width`/`height` so the SVG scales to its container. pub responsive: bool, + /// The unit `width` and `height` are written in (ignored when `responsive`). `px`, the + /// default, writes bare numbers. + pub units: SizeUnit, /// Fonts → Convert to Outlines: text becomes paths (portable, no font needed to view it). pub outline_text: bool, /// Embed the native document (passed to [`export_full`]) in `` so VectorCraft @@ -256,6 +296,7 @@ impl Default for ExportOptions { images: ImageMode::Embed, minify: false, responsive: false, + units: SizeUnit::Px, outline_text: false, preserve_editing: false, metadata: false, diff --git a/crates/svg/tests/it/roundtrip.rs b/crates/svg/tests/it/roundtrip.rs index fde9ff86f2..4ff2fd5bbe 100644 --- a/crates/svg/tests/it/roundtrip.rs +++ b/crates/svg/tests/it/roundtrip.rs @@ -6,7 +6,7 @@ use vectorcraft_doc::{ StrokeLayer, TextKind, TextObject, }; use vectorcraft_geom::{Affine, FillRule, PathData, Point, Rect, shapes}; -use vectorcraft_svg::{ExportOptions, ObjectIds, Styling, export, import, import_with_report}; +use vectorcraft_svg::{ExportOptions, ObjectIds, SizeUnit, Styling, export, import, import_with_report}; fn doc_with(nodes: Vec) -> Document { let mut d = Document::new(200.0, 200.0); @@ -547,6 +547,21 @@ fn options_decimals_minify_responsive_artboard() { assert!(!s.contains("id=\"Layer_1\"")); } +/// An SVG written with a physical width and height (#4462) reopens at the artboard it was written from. +#[test] +fn svg_in_physical_units_reopens_at_the_same_size() { + let mut d = Document::new(200.0, 100.0); + let n = rect_node(&mut d, Rect::new(10.0, 10.0, 60.0, 50.0), Appearance::default_art()); + let l = d.layers[0].id; + d.insert(Some(l), usize::MAX, n).unwrap(); + for units in [SizeUnit::Mm, SizeUnit::Cm, SizeUnit::In, SizeUnit::Pt] { + let s = export(&d, &ExportOptions { units, ..Default::default() }); + let back = import(&s).unwrap_or_else(|e| panic!("{units:?}: {e}\n{s}")); + let r = back.artboards[0].rect; + assert!((r.width() - 200.0).abs() < 0.1 && (r.height() - 100.0).abs() < 0.1, "{units:?}: {r:?}\n{s}"); + } +} + #[test] fn unique_sanitized_ids() { let mut d = Document::new(200.0, 200.0); diff --git a/crates/ui-egui/src/dialogs/svg_options.rs b/crates/ui-egui/src/dialogs/svg_options.rs index 14dc2d5a4f..5827da7d3c 100644 --- a/crates/ui-egui/src/dialogs/svg_options.rs +++ b/crates/ui-egui/src/dialogs/svg_options.rs @@ -1,5 +1,5 @@ //! SVG Options (Export As SVG, Save As / Save a Copy to .svg): profile, styling, fonts, images, -//! object ids, decimals, encoding, minify, responsive, embedded fonts, artboards (export) or +//! object ids, decimals, encoding, units, minify, responsive, embedded fonts, artboards (export) or //! editing data (save), and a read-only view of the code. OK remembers the choices for next time and runs the export or save command with //! them as `svg: {…}`. @@ -64,6 +64,7 @@ const IMAGES: [(&str, &str); 2] = [("embed", "Embed"), ("link", "Link")]; const OBJECT_IDS: [(&str, &str); 3] = [("layerNames", "Layer Names"), ("minimal", "Minimal"), ("unique", "Unique")]; const PROFILES: [(&str, &str); 2] = [("svg11", "SVG 1.1"), ("tiny12", "SVG Tiny 1.2")]; const ENCODINGS: [(&str, &str); 3] = [("utf8", "Unicode (UTF-8)"), ("utf16", "Unicode (UTF-16)"), ("latin1", "ISO 8859-1")]; +const UNITS: [(&str, &str); 5] = [("px", "Pixels"), ("pt", "Points"), ("mm", "Millimeters"), ("cm", "Centimeters"), ("in", "Inches")]; /// Dialog fields that are not SVG options. const UI_KEYS: [&str; 5] = ["mode", "path", "showCode", "allArtboards", "range"]; @@ -193,7 +194,7 @@ fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool { false } -/// The SVG options: styling, fonts, images, object ids, decimals, minify, responsive, ``s +/// The SVG options: styling, fonts, images, object ids, decimals, units, minify, responsive, ``s /// and metadata. `screens` (Export for Screens' Format Settings) leaves out Images: a linked /// image is another file. pub(super) fn option_fields(ui: &mut egui::Ui, d: &mut Dialog, screens: bool) { @@ -216,6 +217,7 @@ pub(super) fn option_fields(ui: &mut egui::Ui, d: &mut Dialog, screens: bool) { } ui.end_row(); choice(ui, d, "encoding", tl!("Encoding:"), &ENCODINGS, None); + choice(ui, d, "units", tl!("Units:"), &UNITS, None); }); ui.add_space(6.0); ui.horizontal(|ui| { diff --git a/docs/control-protocol.md b/docs/control-protocol.md index cdb7471df1..6b154fc1a0 100644 --- a/docs/control-protocol.md +++ b/docs/control-protocol.md @@ -112,7 +112,7 @@ the two can still win that race. | `ui.dialog.*` on `gradientStop` | `{field: "color" \| "opacity" \| "location", value}` | double-clicking a stop on the Gradient tool's annotator opens its popover (fields `index`, `x`, `y`, `tab`); set `color` (hex), `opacity` or `location` (percentages) and `ui.dialog.confirm` to apply them to the selected stop. `gradient.selectStop {index}` picks the stop the annotator, the panels and Delete/←/→ (`ui.key`) act on | | `engine.execute` `ui.savePdfDialog` | `{path?, preset?, range?, …document.exportPdf options}` | opens the Save PDF dialog (`file.export.pdf` with no params opens it too). Its fields are the `document.exportPdf` options: set `compatibility` with `ui.dialog.set {field: "compatibility", value: "1.5"}`, a whole section with `{field: "compression", value: {…}}`, the artboards with `__allArtboards: false` and `range`, the visible section with `__section` (General, Compression, Marks and Bleeds, Output, Advanced, Security, Summary). `ui.dialog.confirm` writes `path` (else asks for one), returns `{path, bytes, warnings}` and opens the file when `viewAfterSaving` is set | | `file.save` / `file.saveAs` / `file.saveCopy` / `file.saveAsTemplate` (via `engine.execute`) | `{path?, format?, options?, svg?}` | Save writes the document's own file in its own format (a document opened from or saved as SVG/PDF saves as that again; the result's `warnings` say what the format loses). With `path` the file is written at once (Save As or a Copy to an SVG path without SVG options first opens SVG Options, below). Without one (never saved, a converted older file, Save As, a Copy, a Template) the app shows a save panel with one file type per save format (`vectorcraft`, `template`, `pdf`, `svg`, `svgz`, `ai`; for a Template, `template` and `ait`), then the format's options: SVG opens the `svgOptions` dialog (below; returns `{"pending": "svgOptions", "path"}`), PDF the `savePdf` dialog (its `__save` field names the save command); `ui.dialog.confirm` finishes the save. A name typed in the panel without the file type's extension gets it, and a name the panel returns with the extension of a format the panel does not list has it replaced (in a native save, `card.png` and `card.ait` are saved as `card.vectorcraft`, and `notes.v2`, whose extension names no format, is saved as `notes.v2.vectorcraft`); when a file of that name exists, which the panel did not ask about, the save (and every export or other write through a save panel) answers `cancelled` and opens a `replaceFile` dialog (fields `message`, `detail`, `path`): `ui.dialog.confirm` writes that file, `ui.dialog.cancel` writes nothing. On the web a `saveOptions` dialog (fields `path`, `format`) first names the file and picks the format. `file.formatOptions {format?}` reads the options a save would use. `file.revert` opens a `confirm` dialog (`{"pending": "confirm"}`); `ui.dialog.confirm` reloads the saved file in the same tab | -| SVG Options (`engine.execute` of `file.export.svg`, `file.saveAs`, `file.saveCopy`) | `{}` / `{path?, svg?: {…}}` | `file.export.svg` without params, and Save As or Save a Copy to an `.svg`/`.svgz` path without SVG options, open the `svgOptions` dialog (`ui.dialog.set` its fields: `styling`, `outlineText`, `images`, `objectIds`, `decimals`, `minify`, `responsive`, `fewerTspans`, `metadata`, `preserveEditing`, `useArtboards`, `allArtboards`, `range`, `showCode`, `profile` (`svg11`/`tiny12`), `encoding` (`utf8`/`utf16`/`latin1`), `embedFonts`; `ui.dialog.confirm` exports or saves and remembers the choices). With `svg: {…}` (the `document.formats` SVG options) they run directly. `app.save {path?, svg?}` takes the same options; a document saved as SVG saves as SVG again with the same options | +| SVG Options (`engine.execute` of `file.export.svg`, `file.saveAs`, `file.saveCopy`) | `{}` / `{path?, svg?: {…}}` | `file.export.svg` without params, and Save As or Save a Copy to an `.svg`/`.svgz` path without SVG options, open the `svgOptions` dialog (`ui.dialog.set` its fields: `styling`, `outlineText`, `images`, `objectIds`, `decimals`, `minify`, `responsive`, `units`, `fewerTspans`, `metadata`, `preserveEditing`, `useArtboards`, `allArtboards`, `range`, `showCode`, `profile` (`svg11`/`tiny12`), `encoding` (`utf8`/`utf16`/`latin1`), `embedFonts`; `ui.dialog.confirm` exports or saves and remembers the choices). With `svg: {…}` (the `document.formats` SVG options) they run directly. `app.save {path?, svg?}` takes the same options; a document saved as SVG saves as SVG again with the same options | | `engine.execute` `file.place` | `{paths?}` / `{path \| name+dataBase64, …file.place params}` | with no file, picks files and opens the `place` dialog; with `paths`, opens it for them (fields `files`, `link`, `template`, `replace`; `__replace` says whether Replace applies, `__info` describes each file). `ui.dialog.confirm` places one file centered in the view (or in place of the selected object) and loads the place cursor with several (`file.place.queue`). In the desktop app the dialog reads its files off the UI thread: `__info` is empty until they are read, `ui.dialog.confirm` returns `{background: true, status}`, `ui.inspect` lists the files still being read in `placing`, and the file is placed (or the cursor loaded) once it is read. With a file, it runs `file.place` centered in the view, at once. Files dropped on the window with no document open open. On the web, files dropped on the canvas are placed at the drop point (linked; Shift embeds) and files dropped off it (the tab bar) open, as in Illustrator; desktop drops carry no pointer position, so documents (native, SVG, PDF, `.ai`, EPS, DXF, EMF/WMF) open as tabs of their own and pictures and text are placed in the middle of the view. Swatch libraries and color books (`.vcswatches`, `.gpl`, `.ase`, `.acb`), graphic style libraries (`.vcstyles`), Libraries panel files (`.vclibrary`), presets (`.vcflattener`, `.vcpdfpresets`, `.vcprintpresets`, `.vcperspective`, `.vcexportpresets`), plug-ins (`.wasm`) and shortcut sets (`.kys`, in Import Shortcut Set) open wherever they are dropped, as File › Open opens them. With the cursor loaded (`ui.inspect` → `tool: "place"`, `toolOptions: {count, current, name, names}`), `ui.pointer` clicks and drags place files (in the desktop app each file is read off the UI thread and placed once it is read, and `ui.inspect` lists it in `placing` until then) and `ui.key` ←/→/↑/↓ and Escape cycle and discard them | | `app.export` raster options | `{path?, format: png \| jpg \| webp, ppi?, width?, height?, background?, antiAlias?, interlaced?, quality?}` | `ppi` sets the pixel size (72 = one pixel per point) and is stored in PNG and JPEG files (WebP files store no resolution); `width` or `height` sets the size of each file in pixels instead (`width` wins), and PNG and JPEG files store the resolution that results; `background` is `transparent`, `white`, `black` or `"#rrggbb"`; `antiAlias` is `none`, `art` or `type` (text snapped to pixels); `interlaced` writes an Adam7 PNG. The PNG Options dialog (`pngOptions`; `jpgOptions` / `webpOptions` for the other raster formats) has the same fields: fill them with `ui.dialog.set` and press OK with `ui.dialog.confirm` | | `app.export` JPEG options | `{path?, format: jpg, quality?: 0–100, colorModel?: rgb \| cmyk \| gray, method?: baseline \| optimized \| progressive, scans?: 3–5, embedIcc?, imageMap?: none \| client \| server}` | `cmyk` writes ink amounts in the working CMYK space (CMYK colours keep their inks; RGB ones are separated with the colour settings); `embedIcc` (default true) embeds sRGB, the working CMYK profile or a grey profile, generated by the CMS; `imageMap` also writes `.html` (client-side ``) or `.map` (NCSA) beside the image for the objects with a URL and an Image Map shape (`attributes.set`), returned in `linked`. The `jpgOptions` dialog has these fields too (`quality` is shown 0–10; a CMYK document defaults to `cmyk`) | diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index 6f02703ca5..8d68f3bdc2 100644 --- a/docs/file-format-parity.md +++ b/docs/file-format-parity.md @@ -1,6 +1,6 @@ # File format parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-01 · **Change:** minor (native format: dynamic symbols, #4938) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-03 · **Change:** minor (SVG export writes width and height in mm, cm, in or pt, #4462; scores and estimates unchanged; previously: native format: dynamic symbols, #4938) · **Target:** Adobe Illustrator 2026 (30.x) Every format Illustrator opens, places, saves or exports, against VectorCraft's format table (`FORMATS`, `OPEN_EXTS`, `PLACE_EXTS` in `crates/engine/src/cmd/fileio/formats.rs`). Illustrator's list comes from its public @@ -125,7 +125,7 @@ the app's own editing copy of a file (an EPS after its `%%EOF`, a `.ai`'s `AIPri | PDF | open, place, save | yes (layers, masks, editable text, security, overprint, File Info from the XMP packet and the document information dictionary; Crop To › Trim takes the bleed box as the document's bleed) | yes (presets, PDF/X-1a/3/4, layers, marks and bleed, ICC, fast web view, 1.3+) | fuzzed import; shared guarded writer and windowed reader ([pdf-backend.md](pdf-backend.md)), metadata, incomplete-content and dependency-source regressions; PDF text opens where the file draws it, glyph by glyph (#722: kerning or none, spacing per character, text rise as baseline shift, vertical writing, justified text boxes); alpha soft masks drawn as images import with the mask (#1551); a clip only counts as covering the page when its shape does (#1542); a PDF another app copied pastes as editable vector art (#1499); letter-spaced type on a path keeps its length and its glyph-by-glyph stroke comes in as one text object (#1586, #1585); a crafted name tree with shared nodes no longer takes exponential time on open (#1781); fonts named with hyphens (`Noto-Sans-Bold`) or with a composite font's CMap (`Name-Identity-H`) find the installed family; invisible text (rendering mode 3: a scanned page's recognized text) opens as type with no fill or stroke and saves back as invisible, searchable text (#2675); PDF/X-1a and X-3 flattening in a CMYK document keeps CMYK inks where it rasterizes (#2160) | | EPS | open, place, save | yes (own PostScript L3 interpreter, Illustrator EPS editing data structure) | yes (L2/L3, TIFF previews) | CID-keyed CJK type not read; #505; images encoded with `CCITTFaxDecode` (ITU-T T.4 Group 3 and T.6 Group 4, with `K`, `Columns`, `Rows`, `EndOfBlock`, `EndOfLine`, `EncodedByteAlign` and `BlackIs1`) draw, and damaged data keeps the rows decoded before its first damaged row; Type 42 (TrueType) fonts set type at its size (#1553); a clip only counts as covering the page when its shape does (#1542); an EPS another app copied pastes as editable vector art (`clipboard.importEps`, #1499); a stitched shading keeps its hard colour changes on import (#1654); CMYK images, CMYK JPEGs included, keep their ink amounts on import, as from PDF, and the pixels a `MaskColor` or `ImageType 3` mask hides become a grayscale opacity mask; ruzstd 0.9.1 for compressed editing data (#1807, RUSTSEC-2026-0344) | | PostScript `.ps` | open, place | yes (the EPS reader reads its first page; `.epsf` files open and place as EPS) | via Print to PostScript | `tests_epsimport.rs` | -| SVG / SVGZ | open, place, save | yes | yes (SVG Options, Preserve Editing, symbols, filters, rich text) | strongest format; tests in `crates/svg/tests`; text on a path follows basic shapes as their SVG 2 equivalent paths (#1527); CSS transforms and the `font` shorthand (#1565), percentage lengths in symbols (#1596), Inkscape flowed text as area type (#1568) and Inkscape pages as artboards (#1601) import; an unsupported filter is named in its warning (#1598); an artboard exported on its own (Export As with Use Artboards, Export for Screens, Asset Export) has the artboard's name as ``, Save the document's (#3544); attributes in other applications' XML namespaces (`plotter:pen="2"`) kept on their objects from import to export, as `data-*` attributes are (`crates/svg/tests/it/foreign_attributes.rs`); simple shapes export as `<rect>`, `<circle>`, `<ellipse>`, `<line>`, `<polygon>` and `<polyline>` where they draw the same as the path (#4652, `crates/svg/tests/it/basic_shapes.rs`) | +| SVG / SVGZ | open, place, save | yes | yes (SVG Options, Preserve Editing, symbols, filters, rich text) | strongest format; tests in `crates/svg/tests`; text on a path follows basic shapes as their SVG 2 equivalent paths (#1527); CSS transforms and the `font` shorthand (#1565), percentage lengths in symbols (#1596), Inkscape flowed text as area type (#1568) and Inkscape pages as artboards (#1601) import; an unsupported filter is named in its warning (#1598); an artboard exported on its own (Export As with Use Artboards, Export for Screens, Asset Export) has the artboard's name as `<title>`, Save the document's (#3544); attributes in other applications' XML namespaces (`plotter:pen="2"`) kept on their objects from import to export, as `data-*` attributes are (`crates/svg/tests/it/foreign_attributes.rs`); simple shapes export as `<rect>`, `<circle>`, `<ellipse>`, `<line>`, `<polygon>` and `<polyline>` where they draw the same as the path (#4652, `crates/svg/tests/it/basic_shapes.rs`); SVG Options › Units writes `width` and `height` in px (bare numbers, the default), pt, mm, cm or in, the `viewBox` staying in points, for software that reads physical size such as LaserGRBL (#4462, `crates/svg/tests/it/roundtrip.rs`) | | DXF | open, export | yes | yes (R12–2018) | R13–2018 closed SPLINE flags and control-point closure on import verified (#1299); circular cubic paths export as native CIRCLE/ARC where stroke semantics permit; R12 weighted strokes remain POLYLINE while non-circular curves keep the existing fallback (`crates/cad/src/tests.rs`); [Autodesk group 70](https://help.autodesk.com/cloudhelp/2024/ENU/AutoCAD-DXF/files/GUID-E1F884F8-AA90-4864-A215-3182D47A9C74.htm). DXF 2000–2018 LAYOUT objects write the paper image origin as 148/149 (was a stray 158), the shade plot codes (2004+) and the model type flag, and the plot style placeholder carries no subclass marker (#3085; structure test `r2000_and_later_files_have_the_structure_cad_apps_require`, checked with ezdxf's audit; not yet confirmed in Autodesk Fusion). CNC preset and VCarve QA remain open | | DWG | open, export | no | no | no open spec; DXF instead | | EMF / WMF | open, export | yes | yes | an oversized embedded PNG or JPEG is refused from its header, before any pixels are decoded (#1776) | @@ -161,6 +161,7 @@ the app's own editing copy of a file (an EPS after its `%%EOF`, a `.ai`'s `AIPri | Date | Change | Summary | |---|---|---| +| 2026-11-03 | minor | SVG Options has a Units choice (Pixels, Points, Millimeters, Centimeters, Inches) for the `width` and `height` an export writes, so laser and plotter software read the physical size (#4462; the `units` option, Pixels still bare numbers as before); scores and estimates unchanged | | 2026-11-01 | minor | Native format: a symbol's Symbol Type (`dynamic`) and a dynamic symbol instance's appearance changes to objects of its art (`symbol_overrides`) round-trip; both are left out when unset, so other documents save unchanged (#4938). `.ai` reading and writing of dynamic symbols remains. | | 2026-11-01 | minor | Exports draw each artboard's background color behind its art (#4937): PNG, JPEG, GIF, TIFF, WebP, BMP, Targa and PSD (a layer of its own; on a transparent background too), PDF, SVG and EPS pages, a `.ai` file's PDF pages and PostScript and PDF print; `includeArtboardFill: false` leaves it out. Files with editing data (Preserve Editing, `.ai`, EPS, native) keep it as the artboard's color and reopen without extra art. Not read from the reference app's own `.ai` data, nor written to it. DXF, EMF and WMF leave it out | | 2026-10-31 | minor | PDF import finds an installed font whose PDF name holds hyphens (`Noto-Sans-Bold` is Noto Sans, Bold: the longest part before a hyphen that names an installed family) and a composite font by its CIDFont's name rather than its base name, which ends in the CMap's (`Name-Identity-H`, [ISO 32000-1 §9.7.6.1](https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/PDF32000_2008.pdf)); a missing font is split only before a style part (`Helvetica-BoldOblique`), so it is reported as `MS PGothic`, not `MS`; scores unchanged (estimated) | diff --git a/docs/gaps.md b/docs/gaps.md index 8b707fd9f6..0eb22f0cdd 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -1,6 +1,6 @@ # Gaps -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-03 · **Change:** minor (new gradients follow document color mode; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-03 · **Change:** minor (SVG export writes width and height in mm, cm, in or pt, #4462; scores and estimates unchanged; previously: new gradients follow document color mode; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) ## Feature submission evidence @@ -317,6 +317,9 @@ from G14 and the budget run of G15: **~170–270 h** one agent, ~50–80 h wall such stubs into one vertex (within 4× the sweep's tolerance up and down its frame and 1/16 of the 0.01 pt precision along it, bounded by each cluster's extent so a run of tiny level segments keeps its length); regression tests in `crates/pathops/src/planar.rs`. Estimate unchanged. +- **Done (2026-11-03):** SVG export writes `width` and `height` in the unit SVG Options › Units (`units`) names: `px` + (bare numbers, as before), `pt`, `mm`, `cm` or `in`, with the `viewBox` in points, so laser and plotter software reads + the physical size (#4462); an unknown unit is an error. Estimate unchanged. - **Missing:** SVG units reverting to points (#864). Shape Builder regions (#937, closed), PDF text placement (#722, above), the bezier drag preview (#834, #3065, #3729) and deleting an interior anchor of an open path (above) are done. @@ -732,6 +735,7 @@ trap, and the defaults (0.25 pt, 100%, 40%) are VectorCraft's own, the pages giv | Date | Change | Summary | |---|---|---| +| 2026-11-03 | minor | SVG Options has a Units choice (Pixels, Points, Millimeters, Centimeters, Inches) for the `width` and `height` an export writes, so laser and plotter software read the physical size (#4462; the `units` option, Pixels still bare numbers as before); scores and estimates unchanged | | 2026-11-02 | minor | G15: the renderer keeps a compound path's assembled path between frames and drops unused geometry entries after a few frames however few there are. Estimate unchanged. | | 2026-11-02 | minor | G15: hit testing culls paths and compound paths by their control points' box and tests a compound path's outline and fill against only its members near the click; the same objects are hit. Estimate unchanged. | | 2026-11-03 | minor | Symbol editing shows draggable 9-slice guides within the artwork (#5280). Guides outside the artwork remain unsupported. The G5 estimate remains 14–24 h. | diff --git a/docs/mcp.md b/docs/mcp.md index 0ca4e32353..77c265492f 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -581,7 +581,7 @@ colour group (one undo step). SVG Options: `export` to SVG takes them in `options`, flat or as `{"svg": {…}}`: `styling` (`presentation`, `style`, `entities`, `css`), `outlineText`, `images` (`embed`, or `link`: embedded images are written next to the SVG, or returned as `linked`), `objectIds` (`layerNames`, `minimal`, `unique`), `decimals` (1–7), `minify`, -`responsive`, `useArtboards`, `range: "all"` (one SVG per artboard, listed in `files`, each holding only the art over its artboard), `preserveEditing` (the SVG +`responsive`, `units` (`px`, `pt`, `mm`, `cm` or `in`: the unit `width` and `height` are written in, `px` meaning bare numbers as before; the `viewBox` stays in points; ignored with `responsive`), `useArtboards`, `range: "all"` (one SVG per artboard, listed in `files`, each holding only the art over its artboard), `preserveEditing` (the SVG reopens as the full document), `metadata` and `fewerTspans` (one `<tspan>` per line of type). Unknown keys inside `svg` are rejected; `run_command document.formats` lists every option with its default. `encoding` is `utf8`, `utf16` (big-endian after a byte order mark) or `latin1` (ISO 8859-1, other characters as `&#x…;` references); `document.serialize` still answers `text`, plus `dataBase64` diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index b4370a3a0c..9b50f8cb24 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1,6 +1,6 @@ # Parity with Adobe Illustrator -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-03 · **Change:** minor (new gradients follow document color mode; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026; Units › East Asian Type acts, with Q and Ha units; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-03 · **Change:** minor (SVG export writes width and height in mm, cm, in or pt, #4462; scores and estimates unchanged; previously: new gradients follow document color mode; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026; Units › East Asian Type acts, with Q and Ha units; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) ## Feature submission evidence @@ -1108,8 +1108,8 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Save as Template writes a PDF-compatible `.ait` as well as a `.vctemplate`, which stays the default: the save panel and the web build's Save as Template dialog list both, and New from Template opens the `.ait` as an untitled document with its layers and art (`file.saveAsTemplate {format: "ait"}`, or a path ending in `.ait`). Save as Template always writes a file named with its template type's extension: `file.saveAsTemplate` saves a path ending in another format's extension (`card.png`) as `card.vctemplate` (or `card.ait`), the desktop save panel does the same with a Save As format's extension typed in it (`card.pdf` is saved as `card.vctemplate`), and `file.saveAs` and `document.save` refuse `ait` with an error that names `file.saveAsTemplate`. A `.ait` is PDF-compatible only: `aiVersion: "7"` is an error for it, and the web build's dialog shows no Version row for it. Exports refuse a `.ait` with an error that names `file.saveAsTemplate`, and `vectorcraft-cli convert in.pdf out.ait` and `run --export out.ait` write the template as `file.saveAsTemplate` does. - - SVG/SVGZ in and out with SVG Options, Preserve Editing, symbols, filters, rich text and physical units (SVG type under a transform or `viewBox` scale opens at the size it draws at, the scale moved into its size, leading, baseline shift and strokes, a stretch, skew or rotation kept as its transform: #396; a top-level group with a clip path, such as a clipped Inkscape layer, opens as a layer with a clipping mask, its name kept: #420; hidden objects written hidden on Save and `convert`, and `data-*` attributes kept as the objects' own data: #522; top-level groups open as layers named from `data-name`, else the id, also when one more group (a transform on all the art, a `<switch>`) wraps them, hidden ones hidden, and a file whose art sits loose under a root `<svg>` with an id (or `data-name`), as one-layer exports write it, opens with its one layer named from it; nested groups stay groups, except the sublayers VectorCraft writes, marked `data-vc-layer`, and Inkscape sublayers, which open as sublayers in their layer's colour: #372); PDF and PDF-compatible `.ai` in and out (layers, with hidden ones kept hidden with their art and nested ones as sublayers, on pages of up to 64 million operators, art whose layer can't be told going to a hidden, non-printing layer rather than showing or printing: #419; strokes kept live, a fill and a stroke of one outline as one object; a type object's stroke written as each glyph's outline stroked back on the type, so it stays one editable object; lines wrapped in a frame (each wrapped line ending in a space, one left edge, leading and font) back as one area type object, left aligned or justified with its paragraph spacing, where laying it out breaks the lines where the file does; glyphs set apart by gaps wider than a space (a barcode's digit groups) keeping their places; layers stacked as the pages mark them even when one first paints on a later page, art ending a layer's marked content or a clip closing in a later layer kept in its own layer, and layers with no art kept empty: #508; art reaching past a plain PDF's page clipped to its crop box, as PDF viewers show it, each such object in a clip group of its own (a PDF-compatible `.ai` opens whole: #675); a `.ai` on its trim boxes with the bleed boxes round them as the document's bleed, as Crop To › Trim opens a PDF (#1266); masks, editable text with type set along a curve coming back as type on a path, each artboard's art on its own page only, an `.ai`'s white page under its layers left out rather than coming in as art, spot colours, presets, security, marks and bleed, ICC output intents, raster effects, subset fonts, PDF/X, PDF layers, overprint, page thumbnails, fast web view, PDF 1.3). CMYK images keep their ink amounts from PDF import (and from placed CMYK TIFFs) to PDF export: a CMYK JPEG passes through unchanged, others stay CMYK (DeviceCMYK, or ICC-based CMYK in PDF/X-3/X-4) unless the Output settings convert them; the canvas shows them through the working CMYK profile (#320). Overprint is kept from PDF import (opened, the PDF part of an `.ai`, placed) to PDF export: the graphics state's `/OP` and `/op` become the overprint of fills, strokes and type, so a spot colour over a process colour still overprints; a page whose overprint can't be read for certain knocks out with a note, as does `/OPM 0` being read as nonzero overprint (#1388; hand-written fixtures, `pdf/src/tests/import_overprint.rs`). A masked CMYK image (`/SMask`, `/Mask` or a colour key) keeps its inks too, its alpha coming in as a greyscale opacity mask. - - SVG/SVGZ in and out with SVG Options, Preserve Editing, symbols, filters, rich text and physical units (SVG type under a transform or `viewBox` scale opens at the size it draws at, the scale moved into its size, leading, baseline shift and strokes, a stretch, skew or rotation kept as its transform: #396; a top-level group with a clip path, such as a clipped Inkscape layer, opens as a layer with a clipping mask, its name kept: #420; hidden objects written hidden on Save and `convert`, and `data-*` attributes kept as the objects' own data: #522; top-level groups open as layers named from `data-name`, else the id, also when one more group (a transform on all the art, a `<switch>`) wraps them, hidden ones hidden, and a file whose art sits loose under a root `<svg>` with an id (or `data-name`), as one-layer exports write it, opens with its one layer named from it; nested groups stay groups, except the sublayers VectorCraft writes, marked `data-vc-layer`, and Inkscape sublayers, which open as sublayers in their layer's colour: #372); PDF and PDF-compatible `.ai` in and out (layers, with hidden ones kept hidden with their art and nested ones as sublayers, on pages of up to 64 million operators, art whose layer can't be told going to a hidden, non-printing layer rather than showing or printing: #419; strokes kept live, a fill and a stroke of one outline as one object; a type object's stroke written as each glyph's outline stroked back on the type, so it stays one editable object; lines wrapped in a frame (each wrapped line ending in a space, one left edge, leading and font) back as one area type object, left aligned or justified with its paragraph spacing, where laying it out breaks the lines where the file does; glyphs set apart by gaps wider than a space (a barcode's digit groups) keeping their places; layers stacked as the pages mark them even when one first paints on a later page, art ending a layer's marked content or a clip closing in a later layer kept in its own layer, and layers with no art kept empty: #508; art reaching past a plain PDF's page clipped to its crop box, as PDF viewers show it, each such object in a clip group of its own (a PDF-compatible `.ai` opens whole: #675); a `.ai` on its trim boxes with the bleed boxes round them as the document's bleed, as Crop To › Trim opens a PDF (#1266); masks, editable text with type set along a curve coming back as type on a path, each artboard's art on its own page only, an `.ai`'s white page under its layers left out rather than coming in as art, spot colours, presets, security, marks and bleed, ICC output intents, raster effects, subset fonts, PDF/X, PDF layers, overprint, page thumbnails, fast web view, PDF 1.3). CMYK images keep their ink amounts from PDF import (and from placed CMYK TIFFs and the images in an `.ai` or EPS file's editing data, an alpha channel coming in as a grayscale opacity mask) to PDF export: a CMYK JPEG passes through unchanged, others stay CMYK (DeviceCMYK, or ICC-based CMYK in PDF/X-3/X-4) unless the Output settings convert them; the canvas shows them through the working CMYK profile (#320). Overprint is kept from PDF import (opened, the PDF part of an `.ai`, placed) to PDF export: the graphics state's `/OP` and `/op` become the overprint of fills, strokes and type, so a spot colour over a process colour still overprints; a page whose overprint can't be read for certain knocks out with a note, as does `/OPM 0` being read as nonzero overprint (#1388; hand-written fixtures, `pdf/src/tests/import_overprint.rs`). A masked CMYK image (`/SMask`, `/Mask` or a colour key) keeps its inks too, its alpha coming in as a greyscale opacity mask. + - SVG/SVGZ in and out with SVG Options, Preserve Editing, symbols, filters, rich text and physical units (SVG type under a transform or `viewBox` scale opens at the size it draws at, the scale moved into its size, leading, baseline shift and strokes, a stretch, skew or rotation kept as its transform: #396; a top-level group with a clip path, such as a clipped Inkscape layer, opens as a layer with a clipping mask, its name kept: #420; hidden objects written hidden on Save and `convert`, and `data-*` attributes kept as the objects' own data: #522; top-level groups open as layers named from `data-name`, else the id, also when one more group (a transform on all the art, a `<switch>`) wraps them, hidden ones hidden, and a file whose art sits loose under a root `<svg>` with an id (or `data-name`), as one-layer exports write it, opens with its one layer named from it; nested groups stay groups, except the sublayers VectorCraft writes, marked `data-vc-layer`, and Inkscape sublayers, which open as sublayers in their layer's colour: #372); PDF and PDF-compatible `.ai` in and out (layers, with hidden ones kept hidden with their art and nested ones as sublayers, on pages of up to 64 million operators, art whose layer can't be told going to a hidden, non-printing layer rather than showing or printing: #419; strokes kept live, a fill and a stroke of one outline as one object; a type object's stroke written as each glyph's outline stroked back on the type, so it stays one editable object; lines wrapped in a frame (each wrapped line ending in a space, one left edge, leading and font) back as one area type object, left aligned or justified with its paragraph spacing, where laying it out breaks the lines where the file does; glyphs set apart by gaps wider than a space (a barcode's digit groups) keeping their places; layers stacked as the pages mark them even when one first paints on a later page, art ending a layer's marked content or a clip closing in a later layer kept in its own layer, and layers with no art kept empty: #508; art reaching past a plain PDF's page clipped to its crop box, as PDF viewers show it, each such object in a clip group of its own (a PDF-compatible `.ai` opens whole: #675); a `.ai` on its trim boxes with the bleed boxes round them as the document's bleed, as Crop To › Trim opens a PDF (#1266); masks, editable text with type set along a curve coming back as type on a path, each artboard's art on its own page only, an `.ai`'s white page under its layers left out rather than coming in as art, spot colours, presets, security, marks and bleed, ICC output intents, raster effects, subset fonts, PDF/X, PDF layers, overprint, page thumbnails, fast web view, PDF 1.3). CMYK images keep their ink amounts from PDF import (and from placed CMYK TIFFs) to PDF export: a CMYK JPEG passes through unchanged, others stay CMYK (DeviceCMYK, or ICC-based CMYK in PDF/X-3/X-4) unless the Output settings convert them; the canvas shows them through the working CMYK profile (#320). Overprint is kept from PDF import (opened, the PDF part of an `.ai`, placed) to PDF export: the graphics state's `/OP` and `/op` become the overprint of fills, strokes and type, so a spot colour over a process colour still overprints; a page whose overprint can't be read for certain knocks out with a note, as does `/OPM 0` being read as nonzero overprint (#1388; hand-written fixtures, `pdf/src/tests/import_overprint.rs`). A masked CMYK image (`/SMask`, `/Mask` or a colour key) keeps its inks too, its alpha coming in as a greyscale opacity mask. SVG Options › Units writes the export's `width` and `height` in px (bare numbers, the default), pt, mm, cm or in with the `viewBox` in points (#4462). + - SVG/SVGZ in and out with SVG Options, Preserve Editing, symbols, filters, rich text and physical units (SVG type under a transform or `viewBox` scale opens at the size it draws at, the scale moved into its size, leading, baseline shift and strokes, a stretch, skew or rotation kept as its transform: #396; a top-level group with a clip path, such as a clipped Inkscape layer, opens as a layer with a clipping mask, its name kept: #420; hidden objects written hidden on Save and `convert`, and `data-*` attributes kept as the objects' own data: #522; top-level groups open as layers named from `data-name`, else the id, also when one more group (a transform on all the art, a `<switch>`) wraps them, hidden ones hidden, and a file whose art sits loose under a root `<svg>` with an id (or `data-name`), as one-layer exports write it, opens with its one layer named from it; nested groups stay groups, except the sublayers VectorCraft writes, marked `data-vc-layer`, and Inkscape sublayers, which open as sublayers in their layer's colour: #372); PDF and PDF-compatible `.ai` in and out (layers, with hidden ones kept hidden with their art and nested ones as sublayers, on pages of up to 64 million operators, art whose layer can't be told going to a hidden, non-printing layer rather than showing or printing: #419; strokes kept live, a fill and a stroke of one outline as one object; a type object's stroke written as each glyph's outline stroked back on the type, so it stays one editable object; lines wrapped in a frame (each wrapped line ending in a space, one left edge, leading and font) back as one area type object, left aligned or justified with its paragraph spacing, where laying it out breaks the lines where the file does; glyphs set apart by gaps wider than a space (a barcode's digit groups) keeping their places; layers stacked as the pages mark them even when one first paints on a later page, art ending a layer's marked content or a clip closing in a later layer kept in its own layer, and layers with no art kept empty: #508; art reaching past a plain PDF's page clipped to its crop box, as PDF viewers show it, each such object in a clip group of its own (a PDF-compatible `.ai` opens whole: #675); a `.ai` on its trim boxes with the bleed boxes round them as the document's bleed, as Crop To › Trim opens a PDF (#1266); masks, editable text with type set along a curve coming back as type on a path, each artboard's art on its own page only, an `.ai`'s white page under its layers left out rather than coming in as art, spot colours, presets, security, marks and bleed, ICC output intents, raster effects, subset fonts, PDF/X, PDF layers, overprint, page thumbnails, fast web view, PDF 1.3). CMYK images keep their ink amounts from PDF import (and from placed CMYK TIFFs and the images in an `.ai` or EPS file's editing data, an alpha channel coming in as a grayscale opacity mask) to PDF export: a CMYK JPEG passes through unchanged, others stay CMYK (DeviceCMYK, or ICC-based CMYK in PDF/X-3/X-4) unless the Output settings convert them; the canvas shows them through the working CMYK profile (#320). Overprint is kept from PDF import (opened, the PDF part of an `.ai`, placed) to PDF export: the graphics state's `/OP` and `/op` become the overprint of fills, strokes and type, so a spot colour over a process colour still overprints; a page whose overprint can't be read for certain knocks out with a note, as does `/OPM 0` being read as nonzero overprint (#1388; hand-written fixtures, `pdf/src/tests/import_overprint.rs`). A masked CMYK image (`/SMask`, `/Mask` or a colour key) keeps its inks too, its alpha coming in as a greyscale opacity mask. SVG Options › Units writes the export's `width` and `height` in px (bare numbers, the default), pt, mm, cm or in with the `viewBox` in points (#4462). In imported PDF type, a space glyph the file draws between two words also keeps the next word where the file has it when the gap beside the space is wide, as VectorCraft's own export draws a tracked space: the space gets tracking of its own, and the wrapped lines of a justified paragraph still come back as one area type object when the word gaps on each line are alike (part of #2384). Letter-spaced PDF type, whether set with character spacing (`Tc`) or glyph by glyph, keeps its word spaces and gains none between its letters: the spacing a line's letters share is taken off each gap before a gap reads as a space. That holds on a line that also shows where its words break, with spaces the file draws or gaps wider than the rest; evenly spaced glyphs alone, which could be words of one letter, keep every gap as a space, as do glyphs set more than half an em apart, such as figures in columns. A function-based PDF shading (type 1) whose colour changes along one axis only, as a browser writes a repeating linear gradient, comes in as a linear gradient over its domain, each hard colour change two stops at one offset; one whose colour changes in two directions comes in as its average colour, with a warning. Either paints only over the shading's domain. Both came in as a flat grey that wasn't in the file (#3621). Each such shading is read once per import, and all of them within one budget of 200,000 function evaluations, so a file filling thousands of paths with long functions still opens in about a second (it took minutes); past the budget they come in as their average colour, then grey, with a warning. @@ -1565,6 +1565,7 @@ A double-click on a Repeat (Radial, Grid or Mirror) with the Selection tool ente | Date | Change | Summary | |---|---|---| +| 2026-11-03 | minor | SVG Options has a Units choice (Pixels, Points, Millimeters, Centimeters, Inches) for the `width` and `height` an export writes, so laser and plotter software read the physical size (#4462; the `units` option, Pixels still bare numbers as before); scores and estimates unchanged | | 2026-11-03 | minor | Enclosing Lasso is an add-on with no default shortcut or Basic toolbar slot. Scores and estimates remain unchanged. | | 2026-11-02 | minor | Wheel input over closed font-family fields changes selected text (#5253); public documentation and application choices distinguished; scores and estimates unchanged. | | 2026-11-03 | minor | Find Font's replacement-source chooser offers Document, Recent and System (#5217); scores and estimates unchanged. | diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 26d3dd6790..d27331d90d 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -1,6 +1,6 @@ # UI and interaction parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-03 · **Change:** minor (Type on a Path Options has a Preview checkbox, #5360; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; Units › East Asian Type acts, with Q and Ha units; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-03 · **Change:** minor (SVG export writes width and height in mm, cm, in or pt, #4462; scores and estimates unchanged; previously: Type on a Path Options has a Preview checkbox, #5360; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; Units › East Asian Type acts, with Q and Ha units; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x) ## Feature submission evidence @@ -418,6 +418,7 @@ separate. Scores and hours unchanged. [Behavior and command details](development | Date | Change | Summary | |---|---|---| +| 2026-11-03 | minor | SVG Options has a Units choice (Pixels, Points, Millimeters, Centimeters, Inches) for the `width` and `height` an export writes, so laser and plotter software read the physical size (#4462; the `units` option, Pixels still bare numbers as before); scores and estimates unchanged | | 2026-11-03 | minor | Enclosing Lasso selects fully enclosed objects with a freehand loop under Object › Plug-ins; scores and estimates unchanged. | | 2026-11-03 | minor | Type on a Path Options has a Preview checkbox (#5360, as public tutorials of the dialog show); scores and estimates unchanged | | 2026-11-02 | minor | Font-family fields in Character, Properties and Control accept the wheel without opening the menu (#5253); scores and estimates unchanged. | From 02169eb0abe8cb9e09d7d60e9b63fbd7d9c11c25 Mon Sep 17 00:00:00 2001 From: Taha-Mahmoodi <85902429+Taha-Mahmoodi@users.noreply.github.com> Date: Wed, 4 Nov 2026 03:16:46 +0430 Subject: [PATCH 002/112] Fix #4462: tiny physical sizes never format as zero; Units is dimmed while Responsive is on (review) --- crates/svg/src/lib.rs | 28 +++++++++++++++++++++-- crates/ui-egui/src/dialogs/svg_options.rs | 4 +++- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/crates/svg/src/lib.rs b/crates/svg/src/lib.rs index 2ab97856f8..407acef31d 100644 --- a/crates/svg/src/lib.rs +++ b/crates/svg/src/lib.rs @@ -207,10 +207,21 @@ impl SizeUnit { } } - /// `points` as a length in this unit, rounded to `decimals` places, e.g. `70.556mm`. + /// `points` as a length in this unit, rounded to `decimals` places, e.g. `70.556mm`. A + /// positive size never rounds to zero (a zero `width` disables rendering): in a unit with a + /// suffix it gets more places, up to 12, until a digit survives. `px` stays as [`fmt_num`] + /// writes it. pub fn length(self, points: f64, decimals: u8) -> String { + const MAX_PLACES: u8 = 12; let (scale, suffix) = self.per_point(); - format!("{}{suffix}", fmt_num(points * scale, decimals)) + let v = points * scale; + let mut places = decimals; + if !suffix.is_empty() && v.is_finite() && v > 0.0 { + while places < MAX_PLACES && fmt_num(v, places) == "0" { + places += 1; + } + } + format!("{}{suffix}", fmt_num(v, places)) } } @@ -711,6 +722,19 @@ mod tests { assert_eq!(fmt_num(100.0, 0), "100"); } + #[test] + fn tiny_physical_sizes_never_format_as_zero() { + // 3 pt is 0.0417 in: one place would write `0in`, and a zero width disables rendering. + assert_eq!(SizeUnit::In.length(3.0, 1), "0.04in"); + assert_eq!(SizeUnit::Mm.length(0.001, 1), "0.0004mm"); + // Nothing to widen when a digit survives, or when the size really is zero. + assert_eq!(SizeUnit::In.length(72.0, 1), "1in"); + assert_eq!(SizeUnit::In.length(0.0, 1), "0in"); + // `px` is written exactly as `fmt_num` does. + assert_eq!(SizeUnit::Px.length(3.0, 1), "3"); + assert_eq!(SizeUnit::Px.length(0.01, 1), "0"); + } + #[test] fn escaping() { assert_eq!(xml_escape("a<b>&\"'"), "a<b>&"'"); diff --git a/crates/ui-egui/src/dialogs/svg_options.rs b/crates/ui-egui/src/dialogs/svg_options.rs index 5827da7d3c..da5500dd1e 100644 --- a/crates/ui-egui/src/dialogs/svg_options.rs +++ b/crates/ui-egui/src/dialogs/svg_options.rs @@ -217,7 +217,9 @@ pub(super) fn option_fields(ui: &mut egui::Ui, d: &mut Dialog, screens: bool) { } ui.end_row(); choice(ui, d, "encoding", tl!("Encoding:"), &ENCODINGS, None); - choice(ui, d, "units", tl!("Units:"), &UNITS, None); + // Responsive omits width and height, so the unit has nothing to act on: show it dimmed. + let (units, responsive) = (d.str("units"), d.bool("responsive")); + choice(ui, d, "units", tl!("Units:"), &UNITS, responsive.then_some(units.as_str())); }); ui.add_space(6.0); ui.horizontal(|ui| { From d20787b36fee36bae5eeac3b1bcfc97d3ce3d062 Mon Sep 17 00:00:00 2001 From: Taha-Mahmoodi <85902429+Taha-Mahmoodi@users.noreply.github.com> Date: Sat, 7 Nov 2026 13:51:03 +0430 Subject: [PATCH 003/112] docs: restore the status lines damaged by merges (main's line plus this PR's note) --- docs/file-format-parity.md | 2 +- docs/gaps.md | 2 +- docs/target-app-parity.md | 2 +- docs/ui-parity.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index af005ed382..38a95b0821 100644 --- a/docs/file-format-parity.md +++ b/docs/file-format-parity.md @@ -1,6 +1,6 @@ # File format parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-03 · **Change:** minor (EPS and `.ai` editing data: a transparency set inside a clipping group stays after its `Q`; SVG import: filter and mask regions clip, #5876, #5875; SVG import: Gaussian blurs keep `color-interpolation-filters`, #5877; PDF and `.ai` export: objects' URLs as links, #5785; SVG import: `color-interpolation="linearRGB"` gradients, #5878; `.ai` import: paths with a Calligraphic brush open brushed, #372) · **Target:** Adobe Illustrator 2026 (30.x; SVG export writes width and height in mm, cm, in or pt, #4462; scores and estimates unchanged; previously: native format: dynamic symbols, #4938) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (SVG export can write width and height in mm, cm, in or pt (#4462); EPS and `.ai` editing data: a transparency set inside a clipping group stays after its `Q`; SVG import: filter and mask regions clip, #5876, #5875; SVG import: Gaussian blurs keep `color-interpolation-filters`, #5877; PDF and `.ai` export: objects' URLs as links, #5785; SVG import: `color-interpolation="linearRGB"` gradients, #5878; `.ai` import: paths with a Calligraphic brush open brushed, #372) · **Target:** Adobe Illustrator 2026 (30.x) Every format Illustrator opens, places, saves or exports, against VectorCraft's format table (`FORMATS`, `OPEN_EXTS`, `PLACE_EXTS` in `crates/engine/src/cmd/fileio/formats.rs`). Illustrator's list comes from its public diff --git a/docs/gaps.md b/docs/gaps.md index 8f31cba617..ad0b113cf9 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -1,6 +1,6 @@ # Gaps -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-03 · **Change:** minor (Indian-language hyphenation review and license allowlist, #4947; opening a slow file shows a progress window, part of #5930; Hindi catalog and contributor loanword preferences; agent wording pass complete; wider native proofreading welcome; an image zoomed in on is separated, colorized or proofed only where it shows (#4155); scores and estimates unchanged; a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window; scores and estimates unchanged; large images in CMYK documents are shrunk before they are separated into ink planes (#4155); scores and estimates unchanged; `.ai` paths with a Calligraphic brush open brushed, with the 6D Art Pen's channels, and Windows reads the pen's tilt and barrel rotation, #372; scores and estimates unchanged; Compound Shapes add-on, beyond Illustrator; scores and estimates unchanged; Contour add-on, beyond Illustrator; scores and estimates unchanged; a slow first frame is waited for instead of restarting without the graphics adapter, and the menu bar no longer waits for the installed fonts' scan; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; SVG export writes width and height in mm, cm, in or pt, #4462; scores and estimates unchanged; previously: new gradients follow document color mode; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-07 · **Change:** minor (SVG export can write width and height in mm, cm, in or pt (#4462); Indian-language hyphenation review and license allowlist, #4947; opening a slow file shows a progress window, part of #5930; Hindi catalog and contributor loanword preferences; agent wording pass complete; wider native proofreading welcome; an image zoomed in on is separated, colorized or proofed only where it shows (#4155); scores and estimates unchanged; a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window; scores and estimates unchanged; large images in CMYK documents are shrunk before they are separated into ink planes (#4155); scores and estimates unchanged; `.ai` paths with a Calligraphic brush open brushed, with the 6D Art Pen's channels, and Windows reads the pen's tilt and barrel rotation, #372; scores and estimates unchanged; Compound Shapes add-on, beyond Illustrator; scores and estimates unchanged; Contour add-on, beyond Illustrator; scores and estimates unchanged; a slow first frame is waited for instead of restarting without the graphics adapter, and the menu bar no longer waits for the installed fonts' scan; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) ## Feature submission evidence diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 8086a58a61..04fb6ce1bd 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1,6 +1,6 @@ # Parity with Adobe Illustrator -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-03 · **Change:** minor (the canvas keeps selection outlines and anchors between frames; Indian-language hyphenation review and license allowlist, #4947; Stroke gradients: an arrowhead aligned to the tip is painted to the corners of its base, #5964; Drop Shadow and glow dialogs: spinner arrows, #5367, #5368; Stroke Weight Up and Down shortcuts, #5797; Hindi catalog and contributor loanword preferences; full wording review in progress; Properties in Edit Artboards: a Transform section with the reference point above the Artboards section, #5219; the Control bar's Stroke: and Opacity: links scrub their fields, #4088; an image zoomed in on is separated, colorized or proofed only where it shows (#4155); a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window, #4155; Control bar Paragraph section with type selected, #5372; translating unchanged type reuses its glyph and character-stroke outlines; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026; Type core options status and Kashidas feature revision corrected; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026; SVG export writes width and height in mm, cm, in or pt, #4462; scores and estimates unchanged; previously: new gradients follow document color mode; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026; Units › East Asian Type acts, with Q and Ha units; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-07 · **Change:** minor (SVG export can write width and height in mm, cm, in or pt (#4462); the canvas keeps selection outlines and anchors between frames; Indian-language hyphenation review and license allowlist, #4947; Stroke gradients: an arrowhead aligned to the tip is painted to the corners of its base, #5964; Drop Shadow and glow dialogs: spinner arrows, #5367, #5368; Stroke Weight Up and Down shortcuts, #5797; Hindi catalog and contributor loanword preferences; full wording review in progress; Properties in Edit Artboards: a Transform section with the reference point above the Artboards section, #5219; the Control bar's Stroke: and Opacity: links scrub their fields, #4088; an image zoomed in on is separated, colorized or proofed only where it shows (#4155); a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window, #4155; Control bar Paragraph section with type selected, #5372; translating unchanged type reuses its glyph and character-stroke outlines; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) ## Feature submission evidence diff --git a/docs/ui-parity.md b/docs/ui-parity.md index f2102af7ec..849a34049d 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -1,6 +1,6 @@ # UI and interaction parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-03 · **Change:** minor (Drop Shadow and glow dialogs: spinner arrows, #5367, #5368; Stroke Weight Up and Down shortcuts, #5797; Layers: Rename (`ui.rename`) opens the name field of the selected layer, group or object, #5324; Properties in Edit Artboards: Transform section above the Artboards section, #5219; scrubby labels: the Control bar's Stroke: and Opacity: links and the Properties panel's Stroke link scrub their fields, #4088; Properties: Quick Actions has Repeat Options for one selected repeat, #5181; Direct Selection: Shift-click picks several blend spine points, which drag together, #5285; Direct Selection: Cmd/Ctrl held lends the Selection tool and shows its bounding box, #3901; Join tool trims two crossing open paths and joins them at the crossing, #5844; Control bar: Paragraph: link and Align left/center/right while type is selected, #5372; shape tools: a press on the selection's centre point moves it and one in the rotate zone outside a box corner turns it, #5477; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; Units › East Asian Type acts, with Q and Ha units; scores unchanged; Type on a Path Options has a Preview checkbox, #5360; the Action Options row cites the public Actions panel page; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; Units › East Asian Type acts, with Q and Ha units; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x; SVG export writes width and height in mm, cm, in or pt, #4462; scores and estimates unchanged; previously: Type on a Path Options has a Preview checkbox, #5360; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; Units › East Asian Type acts, with Q and Ha units; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (SVG export can write width and height in mm, cm, in or pt (#4462); Drop Shadow and glow dialogs: spinner arrows, #5367, #5368; Stroke Weight Up and Down shortcuts, #5797; Layers: Rename (`ui.rename`) opens the name field of the selected layer, group or object, #5324; Properties in Edit Artboards: Transform section above the Artboards section, #5219; scrubby labels: the Control bar's Stroke: and Opacity: links and the Properties panel's Stroke link scrub their fields, #4088; Properties: Quick Actions has Repeat Options for one selected repeat, #5181; Direct Selection: Shift-click picks several blend spine points, which drag together, #5285; Direct Selection: Cmd/Ctrl held lends the Selection tool and shows its bounding box, #3901; Join tool trims two crossing open paths and joins them at the crossing, #5844; Control bar: Paragraph: link and Align left/center/right while type is selected, #5372; shape tools: a press on the selection's centre point moves it and one in the rotate zone outside a box corner turns it, #5477; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; Units › East Asian Type acts, with Q and Ha units; scores unchanged) ## Feature submission evidence From b671c0bb8f8a59333833944ce7ffdbfb8cf36cab Mon Sep 17 00:00:00 2001 From: Taha-Mahmoodi <85902429+Taha-Mahmoodi@users.noreply.github.com> Date: Wed, 11 Nov 2026 19:37:00 +0430 Subject: [PATCH 004/112] Preserve physical SVG scale independently of coordinate precision --- crates/engine/src/cmd/fileio/tests_svg.rs | 20 ++++++------- crates/svg/src/lib.rs | 34 +++++++++++------------ crates/svg/tests/it/roundtrip.rs | 26 +++++++++++++++++ docs/target-app-parity.md | 6 ++-- 4 files changed, 56 insertions(+), 30 deletions(-) diff --git a/crates/engine/src/cmd/fileio/tests_svg.rs b/crates/engine/src/cmd/fileio/tests_svg.rs index 0af38d2821..3af795f847 100644 --- a/crates/engine/src/cmd/fileio/tests_svg.rs +++ b/crates/engine/src/cmd/fileio/tests_svg.rs @@ -102,20 +102,20 @@ fn svg_export_writes_width_height_with_the_requested_unit() { let plain = svg(&mut s, json!({})); assert!(plain.contains(" width=\"200\" height=\"100\" viewBox=\"0 0 200 100\""), "{plain}"); assert_eq!(svg(&mut s, json!({"units": "px"})), plain, "px is the default, byte for byte"); - for (unit, size) in [ - ("mm", "width=\"70.556mm\" height=\"35.278mm\""), - ("cm", "width=\"7.056cm\" height=\"3.528cm\""), - ("in", "width=\"2.778in\" height=\"1.389in\""), - ("pt", "width=\"200pt\" height=\"100pt\""), - ] { - for p in [json!({"units": unit}), json!({"svg": {"units": unit}})] { - let out = svg(&mut s, p); - assert!(out.contains(&format!(" {size} viewBox=\"0 0 200 100\"")), "{unit}:\n{out}"); + for unit in ["mm", "cm", "in", "pt"] { + for decimals in [1, 3] { + for p in [json!({"units": unit, "decimals": decimals}), json!({"svg": {"units": unit, "decimals": decimals}})] { + let out = svg(&mut s, p); + assert!(out.contains(&format!("{unit}\"")) && out.contains("viewBox=\"0 0 200 100\""), "{unit}:\n{out}"); + let back = vectorcraft_svg::import(&out).unwrap(); + let rect = back.artboards[0].rect; + assert!((rect.width() - 200.0).abs() < 0.001 && (rect.height() - 100.0).abs() < 0.001, "{unit}: {rect:?}\n{out}"); + } } } let out = svg(&mut s, json!({"units": "mm", "responsive": true})); assert!(!out.contains("mm\"") && !out.contains("height=\"100\" viewBox") && out.contains("viewBox=\"0 0 200 100\""), "{out}"); - assert!(svg(&mut s, json!({"units": "mm", "decimals": 1})).contains("width=\"70.6mm\" height=\"35.3mm\"")); + assert!(svg(&mut s, json!({"units": "mm", "decimals": 1})).contains("x=\"10.1\""), "coordinate precision is unchanged"); } #[test] diff --git a/crates/svg/src/lib.rs b/crates/svg/src/lib.rs index b4179d2bde..a8ba58d9ce 100644 --- a/crates/svg/src/lib.rs +++ b/crates/svg/src/lib.rs @@ -184,7 +184,8 @@ impl Encoding { /// The `viewBox` stays in user units (points) whatever is chosen. #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] pub enum SizeUnit { - /// Bare numbers, CSS pixels at one per point (72 per inch). + /// Legacy bare numbers, unchanged: one per document point. CSS pixels are 96 per inch; + /// choose an explicit physical unit to preserve the document's physical size. #[default] #[serde(rename = "px")] Px, @@ -210,20 +211,14 @@ impl SizeUnit { } } - /// `points` as a length in this unit, rounded to `decimals` places, e.g. `70.556mm`. A - /// positive size never rounds to zero (a zero `width` disables rendering): in a unit with a - /// suffix it gets more places, up to 12, until a digit survives. `px` stays as [`fmt_num`] - /// writes it. + /// `points` as a length in this unit. Physical sizes use at least six decimal places and + /// six significant digits, independent of coordinate precision, so rounding does not change + /// the viewBox's rendered scale. `px` keeps [`fmt_num`]'s selected `decimals`. pub fn length(self, points: f64, decimals: u8) -> String { - const MAX_PLACES: u8 = 12; let (scale, suffix) = self.per_point(); let v = points * scale; - let mut places = decimals; - if !suffix.is_empty() && v.is_finite() && v > 0.0 { - while places < MAX_PLACES && fmt_num(v, places) == "0" { - places += 1; - } - } + let places = + if !suffix.is_empty() && v.is_finite() && v != 0.0 { decimals.max(6).max((5.0 - v.abs().log10().floor()) as u8) } else { decimals }; format!("{}{suffix}", fmt_num(v, places)) } } @@ -783,12 +778,15 @@ mod tests { } #[test] - fn tiny_physical_sizes_never_format_as_zero() { - // 3 pt is 0.0417 in: one place would write `0in`, and a zero width disables rendering. - assert_eq!(SizeUnit::In.length(3.0, 1), "0.04in"); - assert_eq!(SizeUnit::Mm.length(0.001, 1), "0.0004mm"); - // Nothing to widen when a digit survives, or when the size really is zero. - assert_eq!(SizeUnit::In.length(72.0, 1), "1in"); + fn tiny_physical_sizes_keep_their_scale() { + for unit in [SizeUnit::Pt, SizeUnit::Mm, SizeUnit::Cm, SizeUnit::In] { + let (scale, suffix) = unit.per_point(); + for points in [200.0, 10.0, 3.0, 0.001, 1e-14, 1e-30] { + let written = unit.length(points, 1); + let value: f64 = written.strip_suffix(suffix).unwrap().parse().unwrap(); + assert!((value / scale / points - 1.0).abs() < 1e-5, "{points}pt: {written}"); + } + } assert_eq!(SizeUnit::In.length(0.0, 1), "0in"); // `px` is written exactly as `fmt_num` does. assert_eq!(SizeUnit::Px.length(3.0, 1), "3"); diff --git a/crates/svg/tests/it/roundtrip.rs b/crates/svg/tests/it/roundtrip.rs index b316b84359..2e2ad8d48b 100644 --- a/crates/svg/tests/it/roundtrip.rs +++ b/crates/svg/tests/it/roundtrip.rs @@ -682,6 +682,32 @@ fn svg_in_physical_units_reopens_at_the_same_size() { } } +/// A viewer's default `meet` scaling must preserve the artwork's physical extent, not just +/// reopen an artboard with roughly the right width and height. +#[test] +fn physical_units_preserve_rendered_extent_at_low_coordinate_precision() { + for (width, height, decimals) in [(200.0, 10.0, 1), (10.0, 200.0, 1), (0.2, 0.1, 1), (0.002, 0.001, 3)] { + let mut d = Document::new(width, height); + let n = rect_node(&mut d, Rect::new(0.0, 0.0, width, height), Appearance::basic(solid("#000000"), Paint::None, 0.0)); + let layer = d.layers[0].id; + d.insert(Some(layer), usize::MAX, n).unwrap(); + for units in [SizeUnit::Mm, SizeUnit::Cm, SizeUnit::In, SizeUnit::Pt] { + let svg = export(&d, &ExportOptions { units, decimals, ..Default::default() }); + let tree = usvg::Tree::from_str(&svg, &usvg::Options::default()).unwrap(); + let extent = tree.root().abs_bounding_box(); + // CSS consumers render physical lengths at 96 px/in, document geometry is 72 pt/in. + for (actual, expected) in [ + (tree.size().width(), width * 96.0 / 72.0), + (tree.size().height(), height * 96.0 / 72.0), + (extent.width(), width * 96.0 / 72.0), + (extent.height(), height * 96.0 / 72.0), + ] { + assert!((f64::from(actual) / expected - 1.0).abs() < 2e-5, "{units:?}: {actual} != {expected}\n{svg}"); + } + } + } +} + #[test] fn unique_sanitized_ids() { let mut d = Document::new(200.0, 200.0); diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 26db115ea8..d89fd2a1b4 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1,6 +1,6 @@ # Parity with Adobe Illustrator -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-11 · **Change:** minor (SVG export can write width and height in mm, cm, in or pt (#4462; ruler double-click adds a guide at the pointer, #5239; G5: Status Effects graphic style library; bundled content ~40% → ~42%; MCP symbol libraries list UI Frames and Map Markers; previously minor: G5: Inventory Icons built-in symbol library; bundled content ~38% → ~40%; previously minor: `.ai` and EPS import: stroked type in an envelope maps from its glyphs grown by half its stroke (#3179; scores and estimates unchanged); previously minor: `.ai` and EPS import: warps of type open as mesh envelopes on their saved grid where VectorCraft's warp doesn't draw as their drawn art (#3179; scores and estimates unchanged); G5: Game Trails brush library; bundled content ~36% → ~38%; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: `.ai` and EPS import: envelopes of type open live where they draw as their drawn art and the layers with them draw as the page (#3179; scores and estimates unchanged); G5: Game HUD graphic style library; bundled content ~34% → ~36%; previously minor: Line Arrow arrowhead (#5421; scores and estimates unchanged); G5: Map Markers built-in symbol library; bundled content ~32% → ~34%; previously minor: right-click on type: Spelling › Auto Spell Check, with its check mark, #4936; previously minor: right-click on a word Auto Spell Check underlined: its suggestions, Ignore All and Add to Dictionary, #4936; previously minor: Canvas: a 3D effect changed on type or a group redraws where its solid was; Fit to Artwork Bounds and per-artboard SVG export build each solid once for all artboards; previously minor: Effect Gallery: a thumbnail for each filter and a preview area inside the dialog, on an original drawing; Raster effects 52% → 55%, hours 1–2 → none; headline numbers unchanged; Auto Spell Check: `edit.autoSpellCheck` underlines the unknown words, #4936; previously minor: PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; G5: UI Frames built-in symbol library with default 9-slice; bundled content ~32%; previously minor: G5: dynamic symbol part on-canvas opacity/blend/gradient/pattern; strokes remaining no longer lists Overlap/auto corners; symbols ~88%; previously minor: interim macOS cursor delivery, #2292; native validation pending; scores and estimates unchanged; previously minor: harakat paint fallback clarified; previously minor: current Guides feature-area rows consolidated using existing ruler evidence; scores and estimates unchanged; previously minor: Control bar › Snapping includes the existing Snap to Glyph and Alignment Guides toggles (#6164); scores and estimates unchanged; previously minor: G5 docs: Art brush Overlap and Pattern brush auto corners removed from strokes remaining; symbols remaining lists dynamic on-canvas beyond solid and guides outside the art; previously minor: custom dictionary and Ignore All: `text.spelling.addWord`, `removeWord`, `changeWord`, `dictionary` and `ignoreAll`, #4936; previously minor: EPS import: embedded fonts (composite, Type 42, CID-keyed, Type 1, CFF FontSet) draw their glyphs; spell check engine: `text.spelling.check` and `text.spelling.suggest` on craft-proof, #4936; previously minor: floating tab groups collapse into the side icon rail and opened rail panels fold back into it, #5925 in part; `.ai`/EPS type keeps its tab stops, and right-aligned lines with tabs lay out as the file's page, #6147; `.ai`/EPS type from the text document lays its lines out closer to the file's page, within limits, #6137; `.ai` and EPS import: older Art brush objects read; numeric fields step on wheel hover without taking keyboard focus, and a panel wheel turn cannot seed a canvas zoom glide, #5949; Character Styles panel: a double-click on a style's row opens its Character Style Options; the dialog keeps a fixed width and scrolls its sections, so its buttons stay on screen; Tools stays beside the canvas with left-side panels; new gradients follow document color mode; Selection QoL: marquee modes and visible feedback, #5313; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; #3380 deletion-only review follow-up: independent survivors keep gradient placement, owned subpaths avoid discarded copies, and contracts/status/evidence are clarified; endpoint highlighting remains open; scores and estimates unchanged; the canvas keeps selection outlines and anchors between frames; Indian-language hyphenation review and license allowlist, #4947; Stroke gradients: an arrowhead aligned to the tip is painted to the corners of its base, #5964; Drop Shadow and glow dialogs: spinner arrows, #5367, #5368; Stroke Weight Up and Down shortcuts, #5797; Hindi catalog and contributor loanword preferences; full wording review in progress; Properties in Edit Artboards: a Transform section with the reference point above the Artboards section, #5219; the Control bar's Stroke: and Opacity: links scrub their fields, #4088; an image zoomed in on is separated, colorized or proofed only where it shows (#4155); a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window, #4155; Control bar Paragraph section with type selected, #5372; translating unchanged type reuses its glyph and character-stroke outlines; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026; Units › East Asian Type acts, with Q and Ha units; scores unchanged) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-11 · **Change:** minor (physical SVG dimensions retain scale independently of coordinate precision; disable Responsive and select physical units for physical output; previously: SVG export can write width and height in mm, cm, in or pt (#4462; ruler double-click adds a guide at the pointer, #5239; G5: Status Effects graphic style library; bundled content ~40% → ~42%; MCP symbol libraries list UI Frames and Map Markers; previously minor: G5: Inventory Icons built-in symbol library; bundled content ~38% → ~40%; previously minor: `.ai` and EPS import: stroked type in an envelope maps from its glyphs grown by half its stroke (#3179; scores and estimates unchanged); previously minor: `.ai` and EPS import: warps of type open as mesh envelopes on their saved grid where VectorCraft's warp doesn't draw as their drawn art (#3179; scores and estimates unchanged); G5: Game Trails brush library; bundled content ~36% → ~38%; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: `.ai` and EPS import: envelopes of type open live where they draw as their drawn art and the layers with them draw as the page (#3179; scores and estimates unchanged); G5: Game HUD graphic style library; bundled content ~34% → ~36%; previously minor: Line Arrow arrowhead (#5421; scores and estimates unchanged); G5: Map Markers built-in symbol library; bundled content ~32% → ~34%; previously minor: right-click on type: Spelling › Auto Spell Check, with its check mark, #4936; previously minor: right-click on a word Auto Spell Check underlined: its suggestions, Ignore All and Add to Dictionary, #4936; previously minor: Canvas: a 3D effect changed on type or a group redraws where its solid was; Fit to Artwork Bounds and per-artboard SVG export build each solid once for all artboards; previously minor: Effect Gallery: a thumbnail for each filter and a preview area inside the dialog, on an original drawing; Raster effects 52% → 55%, hours 1–2 → none; headline numbers unchanged; Auto Spell Check: `edit.autoSpellCheck` underlines the unknown words, #4936; previously minor: PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; G5: UI Frames built-in symbol library with default 9-slice; bundled content ~32%; previously minor: G5: dynamic symbol part on-canvas opacity/blend/gradient/pattern; strokes remaining no longer lists Overlap/auto corners; symbols ~88%; previously minor: interim macOS cursor delivery, #2292; native validation pending; scores and estimates unchanged; previously minor: harakat paint fallback clarified; previously minor: current Guides feature-area rows consolidated using existing ruler evidence; scores and estimates unchanged; previously minor: Control bar › Snapping includes the existing Snap to Glyph and Alignment Guides toggles (#6164); scores and estimates unchanged; previously minor: G5 docs: Art brush Overlap and Pattern brush auto corners removed from strokes remaining; symbols remaining lists dynamic on-canvas beyond solid and guides outside the art; previously minor: custom dictionary and Ignore All: `text.spelling.addWord`, `removeWord`, `changeWord`, `dictionary` and `ignoreAll`, #4936; previously minor: EPS import: embedded fonts (composite, Type 42, CID-keyed, Type 1, CFF FontSet) draw their glyphs; spell check engine: `text.spelling.check` and `text.spelling.suggest` on craft-proof, #4936; previously minor: floating tab groups collapse into the side icon rail and opened rail panels fold back into it, #5925 in part; `.ai`/EPS type keeps its tab stops, and right-aligned lines with tabs lay out as the file's page, #6147; `.ai`/EPS type from the text document lays its lines out closer to the file's page, within limits, #6137; `.ai` and EPS import: older Art brush objects read; numeric fields step on wheel hover without taking keyboard focus, and a panel wheel turn cannot seed a canvas zoom glide, #5949; Character Styles panel: a double-click on a style's row opens its Character Style Options; the dialog keeps a fixed width and scrolls its sections, so its buttons stay on screen; Tools stays beside the canvas with left-side panels; new gradients follow document color mode; Selection QoL: marquee modes and visible feedback, #5313; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; #3380 deletion-only review follow-up: independent survivors keep gradient placement, owned subpaths avoid discarded copies, and contracts/status/evidence are clarified; endpoint highlighting remains open; scores and estimates unchanged; the canvas keeps selection outlines and anchors between frames; Indian-language hyphenation review and license allowlist, #4947; Stroke gradients: an arrowhead aligned to the tip is painted to the corners of its base, #5964; Drop Shadow and glow dialogs: spinner arrows, #5367, #5368; Stroke Weight Up and Down shortcuts, #5797; Hindi catalog and contributor loanword preferences; full wording review in progress; Properties in Edit Artboards: a Transform section with the reference point above the Artboards section, #5219; the Control bar's Stroke: and Opacity: links scrub their fields, #4088; an image zoomed in on is separated, colorized or proofed only where it shows (#4155); a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window, #4155; Control bar Paragraph section with type selected, #5372; translating unchanged type reuses its glyph and character-stroke outlines; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026; Units › East Asian Type acts, with Q and Ha units; scores unchanged) > > Vector Halftone preview update (2026-11-10): temporary dot selection marks are hidden, and the bounding box stays available (#6369). > @@ -1391,6 +1391,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur A `.svgz` file copied in a file manager pastes as its art, as a copied `.svg` file does. SVG export (Save As, Export As, Export for Screens, Asset Export and the clipboard share the writer) writes simple shapes as SVG basic shapes, as the reference app does (an ellipse is an `ellipse` tag until an anchor is added, [forum](https://community.adobe.com/t5/illustrator-discussions/trouble-exporting-shape-with-points-to-svg/td-p/10720325); rectangles come out as `<rect>` and `<polygon>`, [forum](https://community.adobe.com/t5/illustrator-discussions/force-svg-export-using-all-lt-rect-gt/td-p/11282378)): an axis-aligned rectangle as `<rect>`, a circle or ellipse drawn with four standard arcs as `<circle>`/`<ellipse>`, a straight line as `<line>`, and other straight-segment paths as `<polygon>`/`<polyline>`, at the written precision (#4652). A rectangle or ellipse with a dashed stroke, whose dashes would start elsewhere, a turned ellipse, curves and compound paths stay `<path>`. `crates/svg/tests/it/basic_shapes.rs` checks each element, that the picture renders as the canvas does and that the geometry reimports. At a precision of 9 decimals or fewer, SVG export writes each number from an integer when the integer rounds it as the decimal formatter does; the formatter still writes values halfway between two written numbers and values too large for the integer. Exporting one path of 200,000 anchors takes a median of 43.4 ms instead of 167.0 ms on Windows 11, and 20,000 rectangles 81.4 ms instead of 141.4 ms, with the same SVG (`crates/svg/src/lib.rs`). + Physical SVG sizes require both disabling SVG Options › Responsive and selecting Points, Millimeters, Centimeters or Inches under Units; Responsive omits `width` and `height`, so selecting a unit alone does not set physical size. Physical dimensions retain at least six decimal places and six significant digits independently of coordinate precision. Legacy Pixels output remains bare numbers, one per document point, rather than a physical-size guarantee: CSS pixels are 96 per inch. Regression coverage: `physical_units_preserve_rendered_extent_at_low_coordinate_precision` checks a consumer's viewport and drawn extent under default aspect-ratio scaling, including narrow and tiny artboards; `tiny_physical_sizes_keep_their_scale` covers smaller converted lengths. SVG import reads each `<circle>` and `<ellipse>` as the ellipse VectorCraft draws: four smooth anchors on the axes, starting at the right, with handles of the standard length, so an ellipse exported as `<ellipse>` comes back with the anchors it was written from and draws the same (`circles_and_ellipses_import_as_the_ellipse_drawn` in `crates/svg/tests/it/basic_shapes.rs`, `filled_ellipse_on_the_artboard_edge_survives_visually` in `prop_svg.rs`). SVG import keeps attributes in other applications' XML namespaces (`plotter:pen="2"`) on the objects and layers they belong to, as it keeps their `data-*` attributes: copies, duplicates and `.vectorcraft` files keep them, and SVG export writes them back with each namespace declared once on the root (the rest of #522; `crates/svg/tests/it/foreign_attributes.rs`, `tests/attributes.rs`). A PDF-compatible `.ai` saved with Include Editing Data for Other Apps defines every symbol in its editing copy with its art, registration point and place in the Symbols panel's order, and writes its instances as symbol instances, which VectorCraft's `.ai` reader opens as symbols and instances again (`symbols_and_their_instances_are_read_back` in `crates/eps/src/ai_editing/tests.rs`; [file-format-parity.md](file-format-parity.md) lists the instances written as their art). @@ -1972,7 +1973,8 @@ Edit › Copy and Cut put the selected ruler guides on the clipboard, with the s | Date | Change | Summary | |---|---|---| -| 2026-11-03 | minor | SVG Options has a Units choice (Pixels, Points, Millimeters, Centimeters, Inches) for the `width` and `height` an export writes, so laser and plotter software read the physical size (#4462; the `units` option, Pixels still bare numbers as before); scores and estimates unchanged | +| 2026-11-11 | minor | SVG physical dimensions retain scale independently of coordinate precision, including tiny sizes (#5450 review); consumer-rendered extent regression added. Clarify that physical output requires Responsive off and a physical unit; legacy bare numeric output is unchanged and CSS pixels are 96/in. Scores and estimates unchanged. | +| 2026-11-03 | minor | SVG Options has a Units choice (Pixels, Points, Millimeters, Centimeters, Inches) for exported `width` and `height`. For physical size in laser and plotter software, disable Responsive and select a physical unit; Responsive omits both dimensions, so selecting a unit alone does not help (#4462; Pixels still bare numbers as before). Scores and estimates unchanged. | | 2026-11-11 | minor | Bundled content: built-in Status Effects graphic style library; style libraries evidence updated; ~40% → ~42%; MCP Symbol libraries list UI Frames and Map Markers; more built-in graphic-style libraries remain. | | 2026-11-11 | minor | Bundled content: built-in Inventory Icons symbol library (Sword, Shield, Potion, Key, Gem); symbol libraries evidence updated; ~38% → ~40%; more built-in symbol libraries remain. | | 2026-11-10 | minor | Type advanced: the Edit Custom Dictionary dialog, #4936; evidence added; the Check Spelling dialog remains; scores and hours unchanged. | From 8fe7b5dcb105a48274026106bc2862dc5175a848 Mon Sep 17 00:00:00 2001 From: Taha-Mahmoodi <85902429+Taha-Mahmoodi@users.noreply.github.com> Date: Tue, 17 Nov 2026 15:54:48 +0430 Subject: [PATCH 005/112] docs/gaps: SVG units entry says Responsive must be off and that bare px does not keep physical size --- docs/gaps.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/gaps.md b/docs/gaps.md index ee3bdbb0b4..0e9c8248e1 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -391,8 +391,10 @@ macOS cursor delivery (#2292) is narrowed to a native host adapter using the exi along it, bounded by each cluster's extent so a run of tiny level segments keeps its length); regression tests in `crates/pathops/src/planar.rs`. Estimate unchanged. - **Done (2026-11-03):** SVG export writes `width` and `height` in the unit SVG Options › Units (`units`) names: `px` - (bare numbers, as before), `pt`, `mm`, `cm` or `in`, with the `viewBox` in points, so laser and plotter software reads - the physical size (#4462); an unknown unit is an error. Estimate unchanged. + (bare numbers, as before; CSS pixels are 96 per inch, so they do not keep the physical size), `pt`, `mm`, `cm` or `in`, with + the `viewBox` in points, so laser and plotter software reads the physical size (#4462); to export physical dimensions turn + Responsive off and choose `pt`, `mm`, `cm` or `in` (Responsive omits `width` and `height`); an unknown unit is an error. + Estimate unchanged. - **Missing:** SVG units reverting to points (#864). Shape Builder regions (#937, closed), PDF text placement (#722, above), the bezier drag preview (#834, #3065, #3729) and deleting an interior anchor of an open path (above) are done. @@ -905,7 +907,7 @@ trap, and the defaults (0.25 pt, 100%, 40%) are VectorCraft's own, the pages giv | Date | Change | Summary | |---|---|---| -| 2026-11-03 | minor | SVG Options has a Units choice (Pixels, Points, Millimeters, Centimeters, Inches) for the `width` and `height` an export writes, so laser and plotter software read the physical size (#4462; the `units` option, Pixels still bare numbers as before); scores and estimates unchanged | +| 2026-11-03 | minor | SVG Options has a Units choice (Pixels, Points, Millimeters, Centimeters, Inches) for the `width` and `height` an export writes, so laser and plotter software read the physical size (#4462; the `units` option, Pixels still bare numbers as before; to export physical dimensions turn Responsive off and choose Points, Millimeters, Centimeters or Inches, since Responsive omits `width` and `height`); scores and estimates unchanged | | 2026-11-16 | minor | Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged. | | 2026-11-14 | minor | Type: Middle Eastern & South Asian and Standard composers per paragraph (#4935): Paragraph panel menu, paragraph styles, `text.setFormat {composer}` and the native file; the Standard composers set Indic, Arabic and Hebrew type glyph by glyph. `.ai`, EPS and PDF files carry no composer. Scores and estimates unchanged. | | 2026-11-14 | minor | Tech Circuit adds three original procedural brushes (Circuit Trace, Bus Lines, Terminal Nodes); ten built-in brush libraries. G5 remaining estimate 3–13 h (estimated); parity scores and headline totals unchanged. | From 48f5ec0c5decaf2ca02931efecd67e2031bfe754 Mon Sep 17 00:00:00 2001 From: Taha-Mahmoodi <85902429+Taha-Mahmoodi@users.noreply.github.com> Date: Thu, 19 Nov 2026 12:27:16 +0430 Subject: [PATCH 006/112] fix(svg): validate nested option keys from the format registry - Derive accepted SVG keys from the canonical format options, not serialized defaults that omit optional units. - Keep existing flat/nested precedence, document-unit inheritance and typed null rejection unchanged. --- crates/engine/src/cmd/params.rs | 9 ++++----- docs/target-app-parity.md | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/crates/engine/src/cmd/params.rs b/crates/engine/src/cmd/params.rs index 8e7d7f7b0f..f55bc77994 100644 --- a/crates/engine/src/cmd/params.rs +++ b/crates/engine/src/cmd/params.rs @@ -906,11 +906,10 @@ fn option_trees() -> Value { let mut trees = pdf_option_tree(); if let Some(tree) = trees.as_object_mut() { tree.insert("flattener".into(), serde_json::to_value(super::flatten::FlattenOptions::default()).unwrap_or_default()); - let mut svg = serde_json::to_value(vectorcraft_svg::ExportOptions::default()).unwrap_or_default(); - if let Some(svg) = svg.as_object_mut() { - svg.extend(super::fileio::ARTBOARD_PARAMS.iter().chain(&["useArtboards"]).map(|k| (k.to_string(), Value::Null))); - } - tree.insert("svg".into(), svg); + // Serialized defaults omit optional overrides such as units; the registry lists every key. + let svg = super::fileio::FORMATS.iter().find(|f| f.id == "svg").into_iter().flat_map(|f| f.options); + let svg = svg.filter(|o| o.name != "svg").map(|o| (o.name.to_string(), Value::Null)).collect(); + tree.insert("svg".into(), Value::Object(svg)); } trees } diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 12e4bbc5c0..9d3d10694a 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -8,7 +8,7 @@ > > Glyphs update (#5514): Alternates for Current Selection applies a variant's OpenType feature to that letter alone (`salt=2`) so an Arabic word stays joined; Entire Font lists unencoded glyphs. A positional variant no supported feature draws can be applied as a glyph choice (#6084). Entire Font uses the selection's font version and variable axes, and the default cell remains available after an unlisted choice even without GSUB alternates. Only Arabic presentation-form characters insert their joining base letter. Scores and estimates unchanged. > -> SVG physical dimensions update (#5450): explicit SVG Options write width and height in mm, cm, in or pt (#4462), retaining scale independently of coordinate precision, including tiny sizes. Without an override, export retains the document's units (#864). Responsive omits dimensions; explicit Pixels keeps bare numbers and CSS pixels are 96/in. Scores and estimates unchanged. +> SVG physical dimensions update (#5450): explicit SVG Options write width and height in mm, cm, in or pt (#4462), retaining scale independently of coordinate precision, including tiny sizes. Commands accept flat `units` or nested `svg.units`; nested values win and explicit null is rejected. Without an override, export retains the document's units (#864). Responsive omits dimensions; explicit Pixels keeps bare numbers and CSS pixels are 96/in. Scores and estimates unchanged. > > Live Paint Bucket update (2026-11-12): one drag fills the faces crossed in the same group (#6373). > From f06f957892acea426b798f80b529cf6fe9e2e4ba Mon Sep 17 00:00:00 2001 From: Taha-Mahmoodi <85902429+Taha-Mahmoodi@users.noreply.github.com> Date: Thu, 19 Nov 2026 13:11:15 +0430 Subject: [PATCH 007/112] Isolate PR notes from upstream update boundaries - Preserve PR wording and historical dates while moving only its own note away from actively edited summary/date-boundary lines. - No production source or Cargo changes; this is documentation placement, not a main-sync commit. --- docs/gaps.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/gaps.md b/docs/gaps.md index 0e3ca51235..fbfec79861 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -7,11 +7,12 @@ > Selection update (2026-11-11): path and compound-path interiors follow enabled non-None fill rows, including lower fills beneath a top None row (#6625). Hidden-only interiors miss; zero-opacity fills remain selectable. Cap/join follow-up (2026-11-12): hidden-fill and no-fill stroke hits must respect cap and join geometry; focused cap/join CPU regressions passed. Scores and estimates unchanged. > Blend redraw update (#5179): renderer bounds include spine-placed keys and steps; both focused CPU regressions pass. Scores and estimates unchanged. -> SVG Options can write physical dimensions with Responsive off and a physical unit selected (#4462); pixel output remains bare numbers. ## Feature submission evidence +> SVG Options can write physical dimensions with Responsive off and a physical unit selected (#4462); pixel output remains bare numbers. + Draft enhancement #5804: Preferences › File Handling can select a raster editor through the native picker, with a private draft outside engine preferences and generic dialog fields. OK saves it, Cancel discards it, and Reset restores PhotoCraft. With Use System Defaults off, a missing chosen editor falls back to PhotoCraft, then the system default; validation and launch failures are reported. Control/MCP and synthetic input cannot choose an application or run external Edit Original. Web behavior, parity scores and estimates are unchanged; macOS/Linux smoke tests remain pending. **2026-11-19 revision:** merged main while preserving the private raster-editor choice; no parity rescore. From 5183573f0460dde5c912f1a0a6c450d1c1157c14 Mon Sep 17 00:00:00 2001 From: Taha-Mahmoodi <85902429+Taha-Mahmoodi@users.noreply.github.com> Date: Thu, 19 Nov 2026 13:22:04 +0430 Subject: [PATCH 008/112] Keep historical revision notes off the live table front - Relocate existing PR records verbatim into their historical date groups in the parity and roadmap tables. - Preserve production source, Cargo and recorded proof status; no additional upstream source merge. --- docs/file-format-parity.md | 2 +- docs/ui-parity.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index e91313a8e2..9740c5139f 100644 --- a/docs/file-format-parity.md +++ b/docs/file-format-parity.md @@ -386,7 +386,6 @@ Stop opacity on translated artboards remains outside this regression coverage. | Date | Change | Summary | |---|---|---| -| 2026-11-03 | minor | SVG Options has a Units choice (Pixels, Points, Millimeters, Centimeters, Inches) for the `width` and `height` an export writes, so laser and plotter software read the physical size (#4462; the `units` option, Pixels still bare numbers as before); scores and estimates unchanged | | 2026-11-18 | minor | PDF import (#8543): type filled and stroked (text rendering modes 2 and 6) by a `TJ` whose kerning starts a new line part way through came in as four type objects, each part filled only and each part stroked only over it: the reader fills every glyph of the operator before it strokes them, and the line the first part was gathered on was finished before the stroke pass came back to it. Lines an operator's fill pass finishes while a stroke may still be drawn over them are now kept (up to 64 besides the open line, so a `TJ` over up to 65 lines: one over more stays a filled object and a stroked one for each part, as before) until the stroke pass goes past them, and the pass's strokes are held (up to 4096: a longer pass is matched a part at a time, each part to glyphs filled one right after another, never to one an operator before it filled) until it ends, then matched to the glyphs filled last, in the order they were filled, so each stroke finds the glyph it was filled as, also where the `TJ` draws a glyph again where it drew one (`[(A) -3500 (B) 4834 (A)] TJ`). Each part comes in as one type object filled and stroked, in the order drawn; also a `TJ` that jumps back and one whose kerning starts two new lines. In an `ActualText` span (whose stroke was lost) the replacement text stays one type object on the first glyph's line and in its style, now filled and stroked, also where the `TJ` draws a glyph again: the span's strokes are matched the same way. A stroke over no filled glyph (stroked type of its own) and the start and end of an `ActualText` span end a stroke pass: no stroke after them goes over a glyph filled before them, so none is drawn under type drawn after it, and a later span keeps its own replacement text. Stroke rendering stays stroke only, and translucent type stays a filled object and a stroked one. Tests: `a_tj_whose_kerning_starts_a_new_line_is_filled_and_stroked`, `a_tj_that_draws_a_glyph_again_where_it_drew_one_strokes_each_copy`, `a_stroked_tj_whose_kerning_starts_a_new_line_stays_stroke_only`, `a_translucent_tj_whose_kerning_starts_a_new_line_stays_fill_and_stroke_apart`, `a_long_stroke_pass_strokes_its_own_glyphs_not_one_filled_before`, `a_stroke_after_stroked_type_of_its_own_does_not_join_a_glyph_filled_before`, `a_stroke_in_an_actual_text_span_does_not_take_an_earlier_spans_glyph`, `a_tj_that_draws_a_glyph_again_in_an_actual_text_span_strokes_the_replacement`, `a_tj_over_more_lines_than_are_kept_comes_in_as_fill_and_stroke_apart`, `a_tj_over_more_lines_than_are_kept_that_ends_where_it_began_stays_fill_and_stroke_apart`, `type_after_a_tj_over_more_lines_than_are_kept_is_filled_and_stroked`; scores and estimates unchanged. | | 2026-11-18 | minor | PDF export (#3644): the document language chosen in Document Setup is written as the catalog's `/Lang` (BCP 47, `en-US` by default) and as XMP `dc:language`; a language without a tag writes none. Scores and estimates unchanged. | | 2026-11-17 | minor | PDF import (#8300): a glyph filled only (text rendering mode 0) right after one filled and stroked (mode 2) joined the stroked run and came in stroked too: `2 Tr (B) Tj 0 Tr (C) Tj` came in as `BC` stroked throughout. A glyph filled only now joins only a run drawn alike, so it starts a run of its own, filled only, in the same type object, and takes a stroke only when the file draws one over it (the #8015 matching); a word filled whole then stroked whole, and fill and stroke rendering glyph by glyph, still come in as one run filled and stroked. Tests: `a_glyph_filled_only_after_one_filled_and_stroked_is_not_stroked`, `glyphs_filled_and_stroked_one_by_one_stay_one_run`; scores and estimates unchanged. | @@ -408,6 +407,7 @@ Stop opacity on translated artboards remains outside this regression coverage. | 2026-11-11 | minor | Newly imported SVG/SVGZ titles use the imported-text rules: generated Untitled names and control-only titles give the filename fallback, other control characters are removed, and titles are limited to 65,536 characters. Native and Preserve Editing titles remain unchanged (#3626). | | 2026-11-11 | minor | Native and Preserve Editing restores keep an existing File Info title exactly, including repeated spaces; imported-text fallback titles alone are normalized (#3626). | | 2026-11-03 | minor | An imported document's own title goes into File Info only (#3626): an SVG's root `<title>`, a PDF's, `.ai`'s or `.ait`'s XMP `dc:title` else its Info `Title` is File Info's title (`metadata.title` in the native format, left out when unset so other documents save unchanged and older versions ignore it; written by exports); the document's name, which the tab, Save As and the default export names use, stays the file's name. | +| 2026-11-03 | minor | SVG Options has a Units choice (Pixels, Points, Millimeters, Centimeters, Inches) for the `width` and `height` an export writes, so laser and plotter software read the physical size (#4462; the `units` option, Pixels still bare numbers as before); scores and estimates unchanged | | 2026-11-11 | minor | `.ai` and EPS import, and what the canvas, every export and `.ai` save draw: type's strokes in an envelope (its characters' and those on its own appearance) paint along the bent glyph outlines at their own weight, Distort Appearance on or off, as the drawn art of users' `.ai` files strokes them (used locally, never committed: there the drawn art keeps those strokes as stroked paths at the type's own weights, and its ring is as wide wherever the grid squeezes or stretches the type). With Distort Appearance, VectorCraft bent them with the art, as their filled outlines, so an envelope of stroked type in a squeezed or stretched grid didn't draw as its drawn art and kept it. The same holds in an envelope inside an envelope. Paths' strokes, geometry effects, opacity masks, linear gradients and pattern fills bend as before. On 224 of our own files: envelopes of type that open live go from 135 in 37 files to 154 in 45, and no file loses one; no file changes whether it opens from its layers or its PDF part; renders at 40 ppi change in 31 files, by at most 2.3% of their pixels, 19 closer to the file's own page and 12 further, 11 of those where an envelope of type now opens live in place of its drawn art (the page's own art) and one by 4 pixels. Tests `envelope_distort::type_strokes_paint_at_their_own_weight_in_a_squeezed_envelope`, `a_stroke_on_types_appearance_paints_at_its_own_weight_in_a_squeezed_envelope`, `a_paths_stroke_still_bends_in_a_squeezed_envelope`, `tests_native::an_envelope_of_stroked_type_whose_drawn_art_strokes_the_bent_outlines_at_the_weight_opens_live` (#6644) | | 2026-11-11 | minor | Ordinary Save to a location refusing writes offers Save As (#6146); cancellation preserves the original path and modified state; automation receives READ_ONLY_LOCATION. Scores and estimates unchanged. Validation pending. | | 2026-11-11 | minor | `.ai` and EPS import, and what SVG export, PDF export and `.ai` save draw: centred and right-aligned lines of tracked type are aligned without the tracking after their last character, as a `.ai`'s own page aligns them (see type-parity.md, same date). In 224 users' files (used locally, never committed), 63 render differently: 54 closer to the page, 7 further, 1 alike and 1 that couldn't be compared; among them the median share of pixels that differ from the page went from 4.4% to 1.0%. Of the 7: one now opens from its layers instead of its PDF part (they differ from the page by less than the import's 5% limit now; type note 3.8%); one has a centred line whose spacing inside it differs from the page's, which now centres on the page's line while half of it no longer lies on the page's glyphs (type note 1.4% to 2.4%); five moved by less than 0.05 of a percentage point, in type the page draws in other glyphs. The type note shows a smaller share in 6 files; 2 more envelopes of type open live (129 to 131, none fewer in any file). SVG import: `text-anchor` aligns a line's advance, which ends after its last character's letter spacing, so a centred or right-aligned letter-spaced line moves back by half or all of it and stays where a reader draws it; SVG export, which anchors lines so, reads back unchanged (test `import_text::anchored_letter_spaced_lines_stay_where_a_reader_draws_them`). Affinity import: centred or right-aligned tracked artistic text moves by half or all of its last character's tracking, as layout now aligns it (unverified against Affinity, whose files we don't have), and differently aligned paragraphs line up by the widths layout aligns them by (`affinity_features::artistic_text_aligns_its_lines_within_the_longest`). Scores and estimates unchanged. (#6610) | diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 03e4afd774..0cae40e1b4 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -606,7 +606,6 @@ before release (#6373). [Paint faces and edges](https://helpx.adobe.com/illustra | Date | Change | Summary | |---|---|---| -| 2026-11-03 | minor | SVG Options has a Units choice (Pixels, Points, Millimeters, Centimeters, Inches) for the `width` and `height` an export writes, so laser and plotter software read the physical size (#4462; the `units` option, Pixels still bare numbers as before); scores and estimates unchanged | | 2026-11-18 | minor | Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) leaves out paths made into guides inside groups and compound paths too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; an enclosing marquee measures a group without its locked or hidden guides, and Direct Selection takes no anchor or segment of a guide that can't be picked; a guide in a group still moves with its group (#8538). Scores and estimates unchanged. | | 2026-11-18 | minor | Production Preflight: output-aware fonts, text overflow, linked files and effective image resolution, clickable findings and automatic rechecking; scores and estimates unchanged. See [production-preflight.md](production-preflight.md) for scope and limits. | | 2026-11-16 | minor | Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged. | @@ -657,6 +656,7 @@ before release (#6373). [Paint faces and edges](https://helpx.adobe.com/illustra | 2026-11-03 | minor | A double-click on a ruler adds a guide at the pointer (#5239): a vertical one on the top ruler, a horizontal one on the left ruler; scores and estimates unchanged. | | 2026-11-03 | minor | Enclosing Lasso selects fully enclosed objects with a freehand loop under Object › Plug-ins; scores and estimates unchanged. | | 2026-11-03 | minor | Type on a Path Options has a Preview checkbox (#5360, as public tutorials of the dialog show); scores and estimates unchanged | +| 2026-11-03 | minor | SVG Options has a Units choice (Pixels, Points, Millimeters, Centimeters, Inches) for the `width` and `height` an export writes, so laser and plotter software read the physical size (#4462; the `units` option, Pixels still bare numbers as before); scores and estimates unchanged | | 2026-11-03 | minor | Symbol editing draws and drags 9-slice guides on the canvas (#5280). Guides outside the artwork remain unsupported. Scores and hours remain unchanged. | | 2026-11-02 | minor | Font-family fields in Character, Properties and Control accept the wheel without opening the menu (#5253); scores and estimates unchanged. | | 2026-11-01 | minor | Object › Image Trace › Batch Trace Folder asks for a source and a destination folder and traces each image into it (#4921); scores and estimates unchanged | From 80d8acf7f96ae2238ee0c81e3ddfcac4b8f4a5e6 Mon Sep 17 00:00:00 2001 From: Taha-Mahmoodi <85902429+Taha-Mahmoodi@users.noreply.github.com> Date: Thu, 19 Nov 2026 13:25:25 +0430 Subject: [PATCH 009/112] fix(engine): remove needless borrow of profile parser closure - Pass the reusable parser closure directly to Option::map without changing profile-choice handling. Fixes #8679 --- crates/engine/src/cmd/colormgmt.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/engine/src/cmd/colormgmt.rs b/crates/engine/src/cmd/colormgmt.rs index 0ac4f8c3b0..bfaece3d77 100644 --- a/crates/engine/src/cmd/colormgmt.rs +++ b/crates/engine/src/cmd/colormgmt.rs @@ -1003,7 +1003,7 @@ impl PasteProfile { if o.keys().any(|k| k != "rgb" && k != "cmyk") { return Err(refuse()); } - let model = |m: &str| o.get(m).map(&one).transpose(); + let model = |m: &str| o.get(m).map(one).transpose(); Ok(Some(PasteChoice { rgb: model("rgb")?, cmyk: model("cmyk")? })) } Some(v) => { From 64211808de18357274a46d7f8517d2af6eeeaea7 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Thu, 19 Nov 2026 16:13:48 -0800 Subject: [PATCH 010/112] Quick Pen: Ctrl+wheel over the canvas changes the arc size With the Quick Pen tool active, Ctrl with a scroll on a touchpad over the canvas (the Control key on macOS too) changes the arc size as ] and [ do: up makes it 15 degrees larger and down 15 degrees smaller, for the last sharp-corner arc and the arcs after it, also while a press drags that arc. The touchpad makes one step for each wheel line of motion within one turn, and momentum after the fingers lift makes none; the keys held at any point of a gesture count until it ends. A mouse wheel turned with Ctrl does the same, one step for each wheel event. Sideways motion makes no step. The view does not zoom or scroll for the rest of that wheel turn. The arc size stays as it is for a wheel turned over the Quick Pen toolbar, under a modal dialog, in a turn begun under one, or with Shift, Alt or Cmd held as well. - New desktop commands tool.quickPen.arcLarger and tool.quickPen.arcSmaller step the size; each returns false when the Quick Pen tool is not active or the step would leave 1 to 359 degrees. - Labels in every catalog. - The command palette test that needs a short result list searches "pen tools": the new commands also match "pen tool", which then fills all twelve rows, so the popup can no longer grow. Docs: docs/mcp.md, ROADMAP, docs/ui-parity.md, docs/target-app-parity.md. Part of #2660. --- ROADMAP.md | 1 + crates/mcp/src/ui_catalog.rs | 12 + crates/ui-egui/src/canvas.rs | 1 + crates/ui-egui/src/canvas/input.rs | 7 +- crates/ui-egui/src/canvas/quick_pen_wheel.rs | 125 ++++++ crates/ui-egui/src/i18n/bg.tsv | 2 + crates/ui-egui/src/i18n/bs.tsv | 2 + crates/ui-egui/src/i18n/ca.tsv | 2 + crates/ui-egui/src/i18n/cs.tsv | 2 + crates/ui-egui/src/i18n/da.tsv | 2 + crates/ui-egui/src/i18n/de.tsv | 2 + crates/ui-egui/src/i18n/el.tsv | 2 + crates/ui-egui/src/i18n/es.tsv | 2 + crates/ui-egui/src/i18n/fi.tsv | 2 + crates/ui-egui/src/i18n/fr.tsv | 2 + crates/ui-egui/src/i18n/gu.tsv | 2 + crates/ui-egui/src/i18n/hi.tsv | 2 + crates/ui-egui/src/i18n/hu.tsv | 2 + crates/ui-egui/src/i18n/id.tsv | 2 + crates/ui-egui/src/i18n/it.tsv | 2 + crates/ui-egui/src/i18n/ja.tsv | 2 + crates/ui-egui/src/i18n/ka.tsv | 2 + crates/ui-egui/src/i18n/ko.tsv | 2 + crates/ui-egui/src/i18n/nl.tsv | 2 + crates/ui-egui/src/i18n/pl.tsv | 2 + crates/ui-egui/src/i18n/pt-br.tsv | 2 + crates/ui-egui/src/i18n/ru.tsv | 2 + crates/ui-egui/src/i18n/sv.tsv | 2 + crates/ui-egui/src/i18n/tr.tsv | 2 + crates/ui-egui/src/i18n/uk.tsv | 2 + crates/ui-egui/src/i18n/vi.tsv | 2 + crates/ui-egui/src/i18n/zh-hans.tsv | 2 + crates/ui-egui/src/i18n/zh-hant.tsv | 2 + crates/ui-egui/src/menus/run.rs | 33 ++ crates/ui-egui/src/menus/ui_commands.rs | 12 + crates/ui-egui/src/palette.rs | 2 +- crates/ui-egui/src/tests.rs | 1 + crates/ui-egui/src/tests/quickpenwheel.rs | 407 +++++++++++++++++++ docs/mcp.md | 21 +- docs/target-app-parity.md | 2 +- docs/ui-parity.md | 2 +- 41 files changed, 672 insertions(+), 10 deletions(-) create mode 100644 crates/ui-egui/src/canvas/quick_pen_wheel.rs create mode 100644 crates/ui-egui/src/tests/quickpenwheel.rs diff --git a/ROADMAP.md b/ROADMAP.md index 90a6100167..b7ecbca46f 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -149,6 +149,7 @@ Ranked; detail in [docs/roadmap.md](docs/roadmap.md) and [docs/gaps.md](docs/gap - 2026-11-17: Circle Tool Options (double-click the Circle tool): Show Center, Show Radii and Show Diameter switch what the tool shows while a circle is drawn, Color sets the color of the center cross and radius lines, Anchors at Standard Positions off puts the circle's anchors at the points it was drawn through (`shape.circleThroughPoints {anchors: "points"}`), and Third Point by Dragging off draws a three-point circle with three clicks and a two-point circle with a double-click on the second point. A VectorCraft addition: headline numbers unchanged. - 2026-11-19: Quick Pen tool, in the Pen tool's group (Alt+P, Option+P on macOS): clicks or drags add straight lines, continuous arcs or sharp-corner arcs; Alt tapped on its own switches the action, C flips the last arc, `[` and `]` size it, a click on the first point closes the path and a click on an open end continues it (`path.quickPen`, part of #2660). Headline numbers unchanged. - 2026-11-19: Quick Pen toolbar on the canvas while the tool is active: Straight Line, Continuous Arc and Sharp Corner Arc, Flip Arc, and More Options with Hide Toolbar, Pin Toolbar Position and Reset Toolbar Position; it follows the drawing beside the path's last point and its handle drags it (`tool.quickPen.flipArc`, `window.quickPenToolbar`, Window › Quick Pen Toolbar; part of #2660). Headline numbers unchanged. +- 2026-11-19: Quick Pen arc size with Ctrl+wheel: over the canvas, a touchpad scroll or a mouse wheel turned with Ctrl makes the arc size 15° larger or smaller per step, as `]` and `[` do, and the view stays put (`tool.quickPen.arcLarger`, `tool.quickPen.arcSmaller`; part of #2660). Headline numbers unchanged. - 2026-10-31: Pattern libraries: Window › Swatch Libraries › Patterns and the Swatches panel's library menu open Geometric Patterns, a built-in library of eleven pattern swatches (dots, stripes, checks, a grid and shapes); clicking one adds its pattern and swatch to the document, once, and applies it to the active fill or stroke (`swatch.library.add`). - 2026-11-11: Pattern libraries: Patterns › Grit Textures, a second built-in pattern library, holds eight seamless black textures (Fine Grain, Coarse Grit, Sand, Speckle, Stipple, Scratches, Sparse Flecks and Dense Flecks) on tiles of 18 to 36 pt, each drawn the same way every time; marks that reach past a tile edge continue on the next tile, so the tiles join without a seam (`swatch.library.add`). Scores and estimates unchanged. - 2026-11-11: Pattern libraries: Patterns › Optical Effects, a third built-in pattern library, of VectorCraft's own designs, holds eight black wave, moiré and op-art tiles (Sine Bands, Ripple Lines, Interference Rings, Offset Rings, Warped Checks, Pinched Stripes, Chevron Pulse and Radiating Lenses) of 32 to 48 pt, each drawn the same way every time; each tile is one period of its design, and art that reaches past a tile edge continues on the next tile, so the tiles join without a seam (`swatch.library.add`). Scores and estimates unchanged. diff --git a/crates/mcp/src/ui_catalog.rs b/crates/mcp/src/ui_catalog.rs index 64c57a6798..548f10b79f 100644 --- a/crates/mcp/src/ui_catalog.rs +++ b/crates/mcp/src/ui_catalog.rs @@ -718,6 +718,18 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "", "{} flip the last sharp-corner arc of the path the Quick Pen tool is drawing to the other side of its chord, as C and the toolbar's Flip Arc button do, as one undo step; first finishes any pending tool edit (which can change the document), then returns false, changing nothing more, when the Quick Pen tool is not active, no path is being drawn or the last piece is not a sharp-corner arc", ), + ( + "tool.quickPen.arcLarger", + "Increase Arc Size", + "", + "{} make the Quick Pen tool's arc size 15° larger, for the last sharp-corner arc of the path being drawn and the arcs after it, as ] and Ctrl+wheel up over the canvas do; first finishes any pending tool edit (which can change the document), then returns false, changing nothing more, when the Quick Pen tool is not active or a step would take the arc size above 359°", + ), + ( + "tool.quickPen.arcSmaller", + "Decrease Arc Size", + "", + "{} make the Quick Pen tool's arc size 15° smaller, for the last sharp-corner arc of the path being drawn and the arcs after it, as [ and Ctrl+wheel down over the canvas do; first finishes any pending tool edit (which can change the document), then returns false, changing nothing more, when the Quick Pen tool is not active or a step would take the arc size below 1°", + ), ( "window.dock", "Panels", diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs index 8b366665d4..09dbd5e07a 100644 --- a/crates/ui-egui/src/canvas.rs +++ b/crates/ui-egui/src/canvas.rs @@ -29,6 +29,7 @@ mod outline; mod overlays; mod panes; mod quick_pen_bar; +mod quick_pen_wheel; mod raster; mod selection_marks; mod task_bar; diff --git a/crates/ui-egui/src/canvas/input.rs b/crates/ui-egui/src/canvas/input.rs index a6a0509de5..f91a29d63f 100644 --- a/crates/ui-egui/src/canvas/input.rs +++ b/crates/ui-egui/src/canvas/input.rs @@ -248,7 +248,12 @@ fn wheel_view( if carried != was_carried { ui.data_mut(|d| d.insert_temp(carried_id, carried)); } - let muted = modal || carried; + // A Ctrl-wheel turn with the Quick Pen tool changes its arc size and leaves the view alone. + // Not over a floating panel, a menu or a toolbar drawn on top of the canvas ([`on_canvas`]), and not for a + // wheel turn that went on under a modal dialog. + let over = !modal && !carried && resp.hovered() && ui.input(|i| i.pointer.hover_pos()).is_some_and(|p| on_canvas(ui, resp, p)); + let arc_turn = super::quick_pen_wheel::arc_size(app, ui, over); + let muted = modal || carried || arc_turn; let navigates = resp.hovered() && !muted; // A docked field may be drawn later and has not consumed its wheel event yet. Only canvas // hover may start a zoom glide; existing glides still decay outside the canvas in `wheel`. diff --git a/crates/ui-egui/src/canvas/quick_pen_wheel.rs b/crates/ui-egui/src/canvas/quick_pen_wheel.rs new file mode 100644 index 0000000000..6ba86ca852 --- /dev/null +++ b/crates/ui-egui/src/canvas/quick_pen_wheel.rs @@ -0,0 +1,125 @@ +//! Ctrl+wheel over the canvas with the Quick Pen tool: the arc size, in place of the view. +//! +//! Public behavior: Ctrl + scroll on a trackpad makes the arc size larger or smaller, on Windows +//! and on macOS alike +//! ([Quick Pen tool keyboard shortcuts](https://helpx.adobe.com/illustrator/web/add-and-edit-artwork/draw-and-edit-paths/quick-pen-tool-keyboard-shortcuts.html)). +//! VectorCraft's own rules: a mouse wheel turned with Ctrl does the same; each wheel event from a +//! mouse wheel (one per notch) makes one step of 15°, as `[` and `]` do, and a touchpad makes one +//! step for each wheel line of its motion; up makes the arc larger and down smaller, and sideways +//! motion makes no step; momentum after +//! the fingers lift makes no step; and a turn ends as egui's scroll turns do (0.15 s without a wheel +//! event, 1 s while a touchpad gesture is under way). + +use super::view::fine_steps; +use super::{Ui, VectorcraftApp, json}; + +/// A wheel turn the Quick Pen tool may take: the motion, in wheel lines, not yet turned into a +/// step; whether the tool took the turn; whether a touchpad gesture is under way (between its Start +/// and End phases); when the turn's last wheel event came (egui's input time); whether a touchpad +/// sent it; and the modifiers the turn holds. +#[derive(Clone, Copy, Default, PartialEq)] +struct ArcWheel { + rest: f32, + taken: bool, + gesture: bool, + last: f64, + trackpad: bool, + held: egui::Modifiers, +} + +/// Seconds without a wheel event after which a wheel event starts a new turn, as egui's own scroll +/// timeouts: 1 s while a touchpad gesture is under way (fingers resting mid-gesture), else 0.15 s. +const TURN_GAP: f64 = 0.150; +const GESTURE_GAP: f64 = 1.0; + +/// Most steps one frame makes: from 1° to 359° is fewer than 24 steps of 15°. +const MOST_STEPS: i32 = 24; + +/// Ctrl alone (the Control key on macOS too). +fn ctrl_alone(m: egui::Modifiers) -> bool { + m.ctrl && !(m.alt || m.shift || m.mac_cmd) +} + +/// With the Quick Pen tool active and the pointer over the canvas (`over`), each wheel event from a +/// mouse wheel turned with Ctrl held makes the arc size one step larger (up) or smaller (down), and a +/// touchpad's motion makes one step per wheel line of it. Momentum after the fingers lift makes no +/// step. Returns true while such a turn goes on, so the view does not zoom or scroll for the rest of +/// it. +pub(super) fn arc_size(app: &mut VectorcraftApp, ui: &Ui, over: bool) -> bool { + let id = egui::Id::unique("quick-pen-arc-wheel"); + let before: ArcWheel = ui.data(|d| d.get_temp(id)).unwrap_or_default(); + let line = ui.ctx().options(|o| o.input_options.line_scroll_speed).max(1.0); + let takes = over && app.session.tool_id() == vectorcraft_tools::quickpen::ID; + let mut now = before; + let (any, scrolling) = ui.input(|i| { + let mut any = false; + for e in &i.events { + let egui::Event::MouseWheel { unit, delta, phase, modifiers, source } = e else { continue }; + any = true; + // A wheel event after egui's scroll timeout, or a touchpad gesture's start, begins a + // new turn: what the turn before it took and left over goes. + let gap = if now.gesture && now.trackpad { GESTURE_GAP } else { TURN_GAP }; + if i.time - now.last > gap || *phase == egui::TouchPhase::Start { + now = ArcWheel::default(); + } + now.last = i.time; + now.trackpad = *source == egui::MouseWheelSource::Trackpad; + // The modifiers held at any point of a touchpad gesture count until it ends, as egui + // keeps them (Ctrl let go still counts, and Shift added stays added); otherwise the + // modifiers of each event count. + match phase { + egui::TouchPhase::Start => { + now.gesture = true; + now.held = *modifiers; + } + egui::TouchPhase::Move if now.gesture => now.held |= *modifiers, + egui::TouchPhase::Move => now.held = *modifiers, + egui::TouchPhase::End | egui::TouchPhase::Cancel => now.gesture = false, + } + if !(takes && ctrl_alone(now.held)) { + continue; + } + now.taken = true; + // Only Move events move, as egui's scroll; momentum after the fingers lift makes no step. + if *phase != egui::TouchPhase::Move || *source == egui::MouseWheelSource::Momentum { + continue; + } + // A mouse wheel's event is one step, whatever it reports (a browser reports a notch in + // points, and a system may scale a fast turn's lines); a touchpad's fine motion steps + // once per wheel line of it. [`fine_steps`] tells them apart, as for the view. Only up + // and down motion counts. + let s = delta.y; + let d = if !fine_steps(*unit, *delta, *source) { + if s == 0.0 { 0.0 } else { s.signum() } + } else if *unit == egui::MouseWheelUnit::Point { + s / line + } else { + s + }; + if d.is_finite() { + now.rest += d; + } + } + (any, i.is_scrolling()) + }); + if !any && !scrolling { + now = ArcWheel::default(); + } + let steps = now.rest.trunc(); + now.rest -= steps; + let (cmd, n) = if steps > 0.0 { ("tool.quickPen.arcLarger", steps) } else { ("tool.quickPen.arcSmaller", -steps) }; + for _ in 0..(n as i32).min(MOST_STEPS) { + match app.run(cmd, json!({})) { + Ok(serde_json::Value::Bool(true)) => {} + Ok(_) => break, + Err(e) => { + app.ui.status = e; + break; + } + } + } + if now != before { + ui.data_mut(|d| d.insert_temp(id, now)); + } + now.taken +} diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index 1ffb352a36..fae08e2e60 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -2718,6 +2718,8 @@ font-technology Variable Променливи Continuous Arc Непрекъсната дъга Sharp Corner Arc Дъга с остър ъгъл Flip Arc Обръщане на дъгата + Increase Arc Size Увеличаване на размера на дъгата + Decrease Arc Size Намаляване на размера на дъгата Hide Toolbar Скриване на лентата с инструменти Pin Toolbar Position Закачане на позицията на лентата с инструменти Reset Toolbar Position Нулиране на позицията на лентата с инструменти diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index 712106379f..33c34cd2b8 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -4223,6 +4223,8 @@ theme Appearance Izgled Continuous Arc Neprekidni luk Sharp Corner Arc Luk s oštrim uglom Flip Arc Preokreni luk + Increase Arc Size Povećaj veličinu luka + Decrease Arc Size Smanji veličinu luka Hide Toolbar Sakrij traku s alatima Pin Toolbar Position Prikvači položaj trake s alatima Reset Toolbar Position Vrati položaj trake s alatima na početno diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index 70b7cbf8ee..ecf0120f0d 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -3474,6 +3474,8 @@ digits Malayalam Malaiàlam Continuous Arc Arc continu Sharp Corner Arc Arc de cantonada aguda Flip Arc Inverteix l’arc + Increase Arc Size Augmenta la mida de l’arc + Decrease Arc Size Redueix la mida de l’arc Hide Toolbar Amaga la barra d’eines Pin Toolbar Position Fixa la posició de la barra d’eines Reset Toolbar Position Restableix la posició de la barra d’eines diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 9ef6f066e6..384be3cbe3 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -4330,6 +4330,8 @@ theme Appearance Motiv Continuous Arc Plynulý oblouk Sharp Corner Arc Oblouk s ostrým rohem Flip Arc Překlopit oblouk + Increase Arc Size Zvětšit velikost oblouku + Decrease Arc Size Zmenšit velikost oblouku Hide Toolbar Skrýt panel nástrojů Pin Toolbar Position Připnout polohu panelu nástrojů Reset Toolbar Position Obnovit polohu panelu nástrojů diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 0d8b14dba4..ed499ef918 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -6787,6 +6787,8 @@ theme Appearance Udseende Continuous Arc Fortløbende bue Sharp Corner Arc Bue med skarpt hjørne Flip Arc Vend bue + Increase Arc Size Øg buestørrelse + Decrease Arc Size Formindsk buestørrelse Hide Toolbar Skjul værktøjslinjen Pin Toolbar Position Fastgør værktøjslinjens placering Reset Toolbar Position Nulstil værktøjslinjens placering diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index bd04b8cc19..f30781515c 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -2780,6 +2780,8 @@ file-filter Templates Vorlagen Continuous Arc Fortlaufender Bogen Sharp Corner Arc Bogen mit scharfer Ecke Flip Arc Bogen spiegeln + Increase Arc Size Bogengröße erhöhen + Decrease Arc Size Bogengröße verringern Hide Toolbar Werkzeugleiste ausblenden Pin Toolbar Position Position der Werkzeugleiste fixieren Reset Toolbar Position Position der Werkzeugleiste zurücksetzen diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 220e9dede3..229231f0ef 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -2184,6 +2184,8 @@ font-technology Variable Μεταβλητές Continuous Arc Συνεχές τόξο Sharp Corner Arc Τόξο με αιχμηρή γωνία Flip Arc Αναστροφή τόξου + Increase Arc Size Αύξηση μεγέθους τόξου + Decrease Arc Size Μείωση μεγέθους τόξου Hide Toolbar Απόκρυψη γραμμής εργαλείων Pin Toolbar Position Σταθεροποίηση θέσης γραμμής εργαλείων Reset Toolbar Position Επαναφορά θέσης γραμμής εργαλείων diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 016f297b3b..6da28fcf82 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -2821,6 +2821,8 @@ font-technology Variable Variables Continuous Arc Arco continuo Sharp Corner Arc Arco de esquina aguda Flip Arc Voltear arco + Increase Arc Size Aumentar tamaño del arco + Decrease Arc Size Reducir tamaño del arco Hide Toolbar Ocultar barra de herramientas Pin Toolbar Position Fijar posición de la barra de herramientas Reset Toolbar Position Restablecer posición de la barra de herramientas diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index 46b3fbf1d5..6582281378 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -4247,6 +4247,8 @@ theme Appearance Ulkoasu Continuous Arc Jatkuva kaari Sharp Corner Arc Terävän kulman kaari Flip Arc Käännä kaari + Increase Arc Size Suurenna kaaren kokoa + Decrease Arc Size Pienennä kaaren kokoa Hide Toolbar Piilota työkalurivi Pin Toolbar Position Kiinnitä työkalurivin sijainti Reset Toolbar Position Palauta työkalurivin sijainti diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 4ce31cfc06..887311455f 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -2809,6 +2809,8 @@ font-technology Variable Variables Continuous Arc Arc continu Sharp Corner Arc Arc à angle vif Flip Arc Retourner l’arc + Increase Arc Size Augmenter la taille de l’arc + Decrease Arc Size Réduire la taille de l’arc Hide Toolbar Masquer la barre d’outils Pin Toolbar Position Épingler la position de la barre d’outils Reset Toolbar Position Réinitialiser la position de la barre d’outils diff --git a/crates/ui-egui/src/i18n/gu.tsv b/crates/ui-egui/src/i18n/gu.tsv index f1ad753245..733f7f5e04 100644 --- a/crates/ui-egui/src/i18n/gu.tsv +++ b/crates/ui-egui/src/i18n/gu.tsv @@ -2827,6 +2827,8 @@ Continuous Arc સતત આર્ક Sharp Corner Arc તીક્ષ્ણ ખૂણાવાળો આર્ક Flip Arc આર્ક ફ્લિપ કરો + Increase Arc Size આર્કનું કદ વધારો + Decrease Arc Size આર્કનું કદ ઘટાડો Hide Toolbar ટૂલબાર છુપાવો Pin Toolbar Position ટૂલબાર સ્થિતિ પિન કરો Reset Toolbar Position ટૂલબાર સ્થિતિ રીસેટ કરો diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index c8852f1ddd..d8b632fefd 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -4021,6 +4021,8 @@ arrowhead Feather पंख Continuous Arc सतत आर्क Sharp Corner Arc तीखे कोने वाला आर्क Flip Arc आर्क पलटें + Increase Arc Size आर्क का आकार बढ़ाएँ + Decrease Arc Size आर्क का आकार घटाएँ Hide Toolbar टूलबार छिपाएँ Pin Toolbar Position टूलबार स्थिति पिन करें Reset Toolbar Position टूलबार स्थिति रीसेट करें diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 54ff192eed..08a100ae60 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -3350,6 +3350,8 @@ file-filter Templates Sablonok Continuous Arc Folytonos ív Sharp Corner Arc Éles sarkú ív Flip Arc Ív tükrözése + Increase Arc Size Ívméret növelése + Decrease Arc Size Ívméret csökkentése Hide Toolbar Eszköztár elrejtése Pin Toolbar Position Eszköztár helyének rögzítése Reset Toolbar Position Eszköztár helyének visszaállítása diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index 9a0f622d21..2c4d277610 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -4655,6 +4655,8 @@ theme Appearance Tampilan Continuous Arc Busur bersambung Sharp Corner Arc Busur sudut tajam Flip Arc Balik busur + Increase Arc Size Perbesar ukuran busur + Decrease Arc Size Perkecil ukuran busur Hide Toolbar Sembunyikan bilah alat Pin Toolbar Position Sematkan posisi bilah alat Reset Toolbar Position Atur ulang posisi bilah alat diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 190b136a06..50db260c8a 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -2865,6 +2865,8 @@ file-filter Templates Modelli Continuous Arc Arco continuo Sharp Corner Arc Arco ad angolo vivo Flip Arc Capovolgi arco + Increase Arc Size Aumenta dimensione arco + Decrease Arc Size Riduci dimensione arco Hide Toolbar Nascondi barra degli strumenti Pin Toolbar Position Fissa posizione barra degli strumenti Reset Toolbar Position Ripristina posizione barra degli strumenti diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 665e74c319..847716df08 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -2955,6 +2955,8 @@ antiAlias Sharp シャープ Continuous Arc 連続円弧 Sharp Corner Arc 鋭角円弧 Flip Arc 円弧を反転 + Increase Arc Size 円弧のサイズを大きく + Decrease Arc Size 円弧のサイズを小さく Hide Toolbar ツールバーを隠す Pin Toolbar Position ツールバーの位置を固定 Reset Toolbar Position ツールバーの位置をリセット diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index d3ea2160c1..6472689e0f 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -6068,6 +6068,8 @@ theme Appearance იერსახე Continuous Arc უწყვეტი რკალი Sharp Corner Arc მახვილკუთხიანი რკალი Flip Arc რკალის არეკვლა + Increase Arc Size რკალის ზომის გაზრდა + Decrease Arc Size რკალის ზომის შემცირება Hide Toolbar ხელსაწყოთა ზოლის დამალვა Pin Toolbar Position ხელსაწყოთა ზოლის პოზიციის ჩამაგრება Reset Toolbar Position ხელსაწყოთა ზოლის პოზიციის ჩამოყრა diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 0c2642f758..26fc1eeacd 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -2945,6 +2945,8 @@ antiAlias Sharp 날카롭게 Continuous Arc 연속 호 Sharp Corner Arc 뾰족한 모서리 호 Flip Arc 호 뒤집기 + Increase Arc Size 호 크기 늘리기 + Decrease Arc Size 호 크기 줄이기 Hide Toolbar 도구 모음 숨기기 Pin Toolbar Position 도구 모음 위치 고정 Reset Toolbar Position 도구 모음 위치 재설정 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index c1f7e36426..670b00a5aa 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -4655,6 +4655,8 @@ theme Appearance Vormgeving Continuous Arc Doorlopende boog Sharp Corner Arc Boog met scherpe hoek Flip Arc Boog spiegelen + Increase Arc Size Boog groter maken + Decrease Arc Size Boog kleiner maken Hide Toolbar Werkbalk verbergen Pin Toolbar Position Werkbalkpositie vastzetten Reset Toolbar Position Werkbalkpositie herstellen diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 5808ddb8c2..5478f6dd28 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -4195,6 +4195,8 @@ theme Appearance Wygląd Continuous Arc Łuk ciągły Sharp Corner Arc Łuk z ostrym narożnikiem Flip Arc Odwróć łuk + Increase Arc Size Zwiększ rozmiar łuku + Decrease Arc Size Zmniejsz rozmiar łuku Hide Toolbar Ukryj pasek narzędzi Pin Toolbar Position Przypnij położenie paska narzędzi Reset Toolbar Position Resetuj położenie paska narzędzi diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 2204a2bdc1..12749b8c83 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -2323,6 +2323,8 @@ antiAlias Sharp Nítido Continuous Arc Arco Contínuo Sharp Corner Arc Arco de Canto Agudo Flip Arc Virar Arco + Increase Arc Size Aumentar Tamanho do Arco + Decrease Arc Size Diminuir Tamanho do Arco Hide Toolbar Ocultar Barra de Ferramentas Pin Toolbar Position Fixar Posição da Barra de Ferramentas Reset Toolbar Position Redefinir Posição da Barra de Ferramentas diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index b3ca5d5d93..2b40f73140 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -2847,6 +2847,8 @@ file-filter Templates Шаблоны Continuous Arc Непрерывная дуга Sharp Corner Arc Дуга с острым углом Flip Arc Отразить дугу + Increase Arc Size Увеличить размер дуги + Decrease Arc Size Уменьшить размер дуги Hide Toolbar Скрыть панель инструментов Pin Toolbar Position Закрепить положение панели инструментов Reset Toolbar Position Сбросить положение панели инструментов diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 94a83ef975..f2b71da213 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -2742,6 +2742,8 @@ font-technology Variable Variabla Continuous Arc Kontinuerlig båge Sharp Corner Arc Båge med skarpt hörn Flip Arc Vänd båge + Increase Arc Size Öka bågstorlek + Decrease Arc Size Minska bågstorlek Hide Toolbar Dölj verktygsfältet Pin Toolbar Position Fäst verktygsfältets position Reset Toolbar Position Återställ verktygsfältets position diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 2fcd6d3b54..4ed628133b 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -2591,6 +2591,8 @@ shape Open Açık Continuous Arc Sürekli Yay Sharp Corner Arc Keskin Köşeli Yay Flip Arc Yayı Çevir + Increase Arc Size Yay Boyutunu Artır + Decrease Arc Size Yay Boyutunu Azalt Hide Toolbar Araç Çubuğunu Gizle Pin Toolbar Position Araç Çubuğu Konumunu Sabitle Reset Toolbar Position Araç Çubuğu Konumunu Sıfırla diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 49f8383268..31fdb3c4dc 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -2857,6 +2857,8 @@ file-filter Templates Шаблони Continuous Arc Неперервна дуга Sharp Corner Arc Дуга з гострим кутом Flip Arc Відобразити дугу + Increase Arc Size Збільшити розмір дуги + Decrease Arc Size Зменшити розмір дуги Hide Toolbar Сховати панель інструментів Pin Toolbar Position Закріпити положення панелі інструментів Reset Toolbar Position Скинути положення панелі інструментів diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 13d02e5184..d900872d1a 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -3170,6 +3170,8 @@ digits Hindi Hindi Continuous Arc Cung liên tục Sharp Corner Arc Cung góc nhọn Flip Arc Lật cung + Increase Arc Size Tăng kích thước cung + Decrease Arc Size Giảm kích thước cung Hide Toolbar Ẩn thanh công cụ Pin Toolbar Position Ghim vị trí thanh công cụ Reset Toolbar Position Đặt lại vị trí thanh công cụ diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index f51baaa7e7..43eae51e7c 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -2708,6 +2708,8 @@ file-filter Templates 模板 Continuous Arc 连续弧线 Sharp Corner Arc 尖角弧线 Flip Arc 翻转弧线 + Increase Arc Size 增大弧线尺寸 + Decrease Arc Size 减小弧线尺寸 Hide Toolbar 隐藏工具栏 Pin Toolbar Position 固定工具栏位置 Reset Toolbar Position 重置工具栏位置 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index d794ea15d9..5f585aa79e 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -4151,6 +4151,8 @@ liquify-list-end {0}, {1} {0}和{1} Continuous Arc 連續弧線 Sharp Corner Arc 尖角弧線 Flip Arc 翻轉弧線 + Increase Arc Size 增大弧線尺寸 + Decrease Arc Size 減小弧線尺寸 Hide Toolbar 隱藏工具列 Pin Toolbar Position 釘選工具列位置 Reset Toolbar Position 重設工具列位置 diff --git a/crates/ui-egui/src/menus/run.rs b/crates/ui-egui/src/menus/run.rs index 8c2767e20b..1aabf9faf4 100644 --- a/crates/ui-egui/src/menus/run.rs +++ b/crates/ui-egui/src/menus/run.rs @@ -725,6 +725,39 @@ fn run_ui_part6(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option<Result< Err(e) => Err(e.to_string()), } } + "tool.quickPen.arcLarger" | "tool.quickPen.arcSmaller" => { + // `]` or `[`, for Ctrl+wheel over the canvas: the arc size 15° larger or smaller. Input + // held for an edit is finished first, as for Flip Arc. False, with nothing changed beyond + // that, while the Quick Pen tool is not active or the step would leave 1° to 359°. + match app.session.finish_tool_edit() { + Ok(reqs) => crate::canvas::apply_requests(app, Ok(reqs)), + Err(e) => return Some(Err(e.to_string())), + } + if app.session.tool_id() != vectorcraft_tools::quickpen::ID { + return Some(Ok(json!(false))); + } + let key = + if id == "tool.quickPen.arcLarger" { vectorcraft_tools::ToolKey::BracketRight } else { vectorcraft_tools::ToolKey::BracketLeft }; + // A step changes the tool's size, or draws the arc again: as an edit between presses, or + // as the preview of a drag (applied, or kept for the release with Real-time Drawing off). + let state = |app: &VectorcraftApp| { + let d = app.session.active(); + ( + app.session.tool_options()["turn"].clone(), + d.map(|d| d.revision), + d.and_then(|d| d.interaction.as_ref()).and_then(|it| it.preview.clone()), + ) + }; + let before = state(app); + let view = app.view_info(); + match app.session.tool_key(key, vectorcraft_tools::Mods::default(), view) { + Ok(reqs) => { + crate::canvas::apply_requests(app, Ok(reqs)); + Ok(json!(state(app) != before)) + } + Err(e) => Err(e.to_string()), + } + } "window.dock" => { let ui = &mut app.ui; // The bars the last Tab hid show again, unless the toolbar or the Control bar was shown diff --git a/crates/ui-egui/src/menus/ui_commands.rs b/crates/ui-egui/src/menus/ui_commands.rs index ad562ecd6c..ccb4281794 100644 --- a/crates/ui-egui/src/menus/ui_commands.rs +++ b/crates/ui-egui/src/menus/ui_commands.rs @@ -719,6 +719,18 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "", "{} flip the last sharp-corner arc of the path the Quick Pen tool is drawing to the other side of its chord, as C and the toolbar's Flip Arc button do, as one undo step; first finishes any pending tool edit (which can change the document), then returns false, changing nothing more, when the Quick Pen tool is not active, no path is being drawn or the last piece is not a sharp-corner arc", ), + ( + "tool.quickPen.arcLarger", + "Increase Arc Size", + "", + "{} make the Quick Pen tool's arc size 15° larger, for the last sharp-corner arc of the path being drawn and the arcs after it, as ] and Ctrl+wheel up over the canvas do; first finishes any pending tool edit (which can change the document), then returns false, changing nothing more, when the Quick Pen tool is not active or a step would take the arc size above 359°", + ), + ( + "tool.quickPen.arcSmaller", + "Decrease Arc Size", + "", + "{} make the Quick Pen tool's arc size 15° smaller, for the last sharp-corner arc of the path being drawn and the arcs after it, as [ and Ctrl+wheel down over the canvas do; first finishes any pending tool edit (which can change the document), then returns false, changing nothing more, when the Quick Pen tool is not active or a step would take the arc size below 1°", + ), ( "window.dock", "Panels", diff --git a/crates/ui-egui/src/palette.rs b/crates/ui-egui/src/palette.rs index a3c5fed207..3f6883781c 100644 --- a/crates/ui-egui/src/palette.rs +++ b/crates/ui-egui/src/palette.rs @@ -5474,7 +5474,7 @@ mod tests { let mut window = Window::new(); window.app.ui.toolbar = false; window.app.ui.custom_toolbars.push(drawing_toolbar([100.0, 120.0])); - window.search("pen tool"); + window.search("pen tools"); let small = window.popup(); window.app.ui.custom_toolbars[0].pos = [small.center().x, small.bottom() + 2.0]; window.frame(vec![]); diff --git a/crates/ui-egui/src/tests.rs b/crates/ui-egui/src/tests.rs index e0619ddaf7..705ff99794 100644 --- a/crates/ui-egui/src/tests.rs +++ b/crates/ui-egui/src/tests.rs @@ -31,6 +31,7 @@ mod printps; mod printtiling; mod puppetwarp; mod quickpenbar; +mod quickpenwheel; mod recolor; mod recovery; pub(super) mod removeanchors; diff --git a/crates/ui-egui/src/tests/quickpenwheel.rs b/crates/ui-egui/src/tests/quickpenwheel.rs new file mode 100644 index 0000000000..597035bc47 --- /dev/null +++ b/crates/ui-egui/src/tests/quickpenwheel.rs @@ -0,0 +1,407 @@ +//! Ctrl+wheel over the canvas with the Quick Pen tool changes the arc size and leaves the view as it +//! is; the arc size commands step it as `[` and `]` do. + +use egui::{Event, Modifiers, MouseWheelSource, MouseWheelUnit, Pos2, Rect, vec2}; +use serde_json::json; +use vectorcraft_doc::NodeKind; +use vectorcraft_geom::SubPath; +use vectorcraft_tools::{PointerEvent, PointerKind}; + +use crate::{VectorcraftApp, canvas}; + +fn app() -> VectorcraftApp { + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + app.run("file.new", json!({"width": 400, "height": 300})).unwrap(); + app.select_tool("quickPen"); + app.run("tool.setOption", json!({"key": "action", "value": "sharpArc"})).unwrap(); + app +} + +fn frame(app: &mut VectorcraftApp, ctx: &egui::Context, events: Vec<Event>) { + frame_at(app, ctx, events, None); +} + +/// [`frame`] at input `time` (seconds), when given. +fn frame_at(app: &mut VectorcraftApp, ctx: &egui::Context, events: Vec<Event>, time: Option<f64>) { + let screen = Rect::from_min_size(Pos2::ZERO, vec2(1000.0, 700.0)); + let mut out = ctx.run_ui(egui::RawInput { screen_rect: Some(screen), events, time, ..Default::default() }, |ui| canvas::show(app, ui)); + out.textures_delta.clear(); +} + +/// A wheel turn over the middle of the canvas, then frames enough for egui to let out all of it. +fn turn(app: &mut VectorcraftApp, ctx: &egui::Context, unit: MouseWheelUnit, dy: f32, modifiers: Modifiers, source: MouseWheelSource) { + let at = app.canvas_rect.unwrap().center(); + let wheel = Event::MouseWheel { unit, delta: vec2(0.0, dy), phase: egui::TouchPhase::Move, modifiers, source }; + frame(app, ctx, vec![Event::PointerMoved(at), wheel]); + for _ in 0..40 { + frame(app, ctx, vec![]); + } +} + +fn click_doc(app: &mut VectorcraftApp, x: f64, y: f64) { + let v = app.view_info(); + for kind in [PointerKind::Down, PointerKind::Up] { + app.session.pointer(&PointerEvent::new(kind, x, y), v).unwrap(); + } +} + +fn paths(app: &VectorcraftApp) -> Vec<SubPath> { + let mut v = vec![]; + app.session.active().unwrap().doc.walk(|n| { + if let NodeKind::Path { path, .. } = &n.kind { + v.extend(path.subpaths.iter().cloned()); + } + }); + v +} + +fn arc_size(app: &VectorcraftApp) -> f64 { + app.session.tool_options()["turn"].as_f64().unwrap() +} + +/// (zoom, center x, center y) of the view. +fn view(app: &VectorcraftApp) -> (f64, f64, f64) { + let v = app.view().unwrap(); + (v.zoom, v.center.x, v.center.y) +} + +/// Ctrl+wheel with the Quick Pen tool: a notch up makes the last sharp-corner arc 15° larger and a +/// notch down 15° smaller, each as one undo step, with Ctrl as Windows and Linux report it (with +/// Command) and as macOS reports the Control key (alone). A touchpad steps once per wheel line of +/// motion. The view neither zooms nor scrolls. +#[test] +fn ctrl_wheel_changes_the_arc_size_and_not_the_view() { + let mut app = app(); + let ctx = egui::Context::default(); + frame(&mut app, &ctx, vec![]); + frame(&mut app, &ctx, vec![]); + click_doc(&mut app, 100.0, 150.0); + click_doc(&mut app, 200.0, 150.0); + let drawn = paths(&app)[0].clone(); + let undo = app.session.active().unwrap().history.undo.len(); + let still = view(&app); + let ctrl = Modifiers { ctrl: true, command: true, ..Modifiers::NONE }; + let line = ctx.options(|o| o.input_options.line_scroll_speed); + + turn(&mut app, &ctx, MouseWheelUnit::Line, 1.0, ctrl, MouseWheelSource::Wheel); + assert_eq!(arc_size(&app), 195.0); + assert_ne!(paths(&app)[0], drawn, "the last arc changed"); + assert_eq!(paths(&app).len(), 1); + assert_eq!(app.session.active().unwrap().history.undo.len(), undo + 1); + assert_eq!(view(&app), still, "Ctrl+wheel did not zoom or scroll"); + + let at = app.canvas_rect.unwrap().center(); + let notch = |dy: f32, modifiers| Event::MouseWheel { + unit: MouseWheelUnit::Line, + delta: vec2(0.0, dy), + phase: egui::TouchPhase::Move, + modifiers, + source: MouseWheelSource::Wheel, + }; + frame(&mut app, &ctx, vec![Event::PointerMoved(at), notch(-1.0, Modifiers::CTRL), notch(-1.0, Modifiers::CTRL)]); + for _ in 0..40 { + frame(&mut app, &ctx, vec![]); + } + assert_eq!(arc_size(&app), 165.0, "two notches down with the macOS Control key"); + assert_eq!(app.session.active().unwrap().history.undo.len(), undo + 3); + assert_eq!(view(&app), still); + + // A mouse wheel's event is one step, whether the system scaled a fast turn's lines or reports a + // fraction of a line. + turn(&mut app, &ctx, MouseWheelUnit::Line, 4.5, ctrl, MouseWheelSource::Wheel); + assert_eq!(arc_size(&app), 180.0, "a fast notch of four and a half lines"); + turn(&mut app, &ctx, MouseWheelUnit::Line, -0.3, ctrl, MouseWheelSource::Wheel); + assert_eq!(arc_size(&app), 165.0, "a notch of three tenths of a line"); + // With Shift, Alt or Command added (Cmd on macOS), the wheel leaves the arc size. + for modifiers in [ + Modifiers { shift: true, ..ctrl }, + Modifiers { alt: true, ..ctrl }, + Modifiers { mac_cmd: true, command: true, ..Modifiers::NONE }, + Modifiers { mac_cmd: true, ..Modifiers::CTRL }, + ] { + turn(&mut app, &ctx, MouseWheelUnit::Line, 1.0, modifiers, MouseWheelSource::Wheel); + assert_eq!(arc_size(&app), 165.0, "{modifiers:?}"); + } + turn(&mut app, &ctx, MouseWheelUnit::Line, 1.0, ctrl, MouseWheelSource::Wheel); + assert_eq!(arc_size(&app), 180.0); + // Sideways motion leaves the arc size. + let sideways = Event::MouseWheel { + unit: MouseWheelUnit::Line, + delta: vec2(1.0, 0.0), + phase: egui::TouchPhase::Move, + modifiers: ctrl, + source: MouseWheelSource::Wheel, + }; + frame(&mut app, &ctx, vec![Event::PointerMoved(at), sideways]); + for _ in 0..40 { + frame(&mut app, &ctx, vec![]); + } + assert_eq!(arc_size(&app), 180.0, "sideways"); + let still = view(&app); + + // Half a wheel line from a touchpad makes no step; the second half of the same turn makes one, + // and momentum after it makes none. + let steps = app.session.active().unwrap().history.undo.len(); + let at = app.canvas_rect.unwrap().center(); + let fine = |dy: f32, source| Event::MouseWheel { + unit: MouseWheelUnit::Point, + delta: vec2(0.0, dy), + phase: egui::TouchPhase::Move, + modifiers: ctrl, + source, + }; + frame(&mut app, &ctx, vec![Event::PointerMoved(at), fine(line / 2.0, MouseWheelSource::Trackpad)]); + assert_eq!(arc_size(&app), 180.0); + frame(&mut app, &ctx, vec![fine(line / 2.0, MouseWheelSource::Trackpad)]); + assert_eq!(arc_size(&app), 195.0); + frame(&mut app, &ctx, vec![fine(3.0 * line, MouseWheelSource::Momentum)]); + assert_eq!(arc_size(&app), 195.0, "momentum makes no step"); + for _ in 0..40 { + frame(&mut app, &ctx, vec![]); + } + assert_eq!(view(&app), still); + assert_eq!(app.session.active().unwrap().history.undo.len(), steps + 1, "one step and no piece"); + + // Without Ctrl the wheel scrolls the view and leaves the arc size. + turn(&mut app, &ctx, MouseWheelUnit::Line, 1.0, Modifiers::NONE, MouseWheelSource::Wheel); + assert_eq!(arc_size(&app), 195.0); + assert_ne!(view(&app), still, "the wheel scrolled"); +} + +/// Ctrl+wheel while a press drags a sharp-corner arc: the arc being dragged takes the new size, the +/// drag goes on, and once the press is let go the piece and its size change are one undo step. +#[test] +fn ctrl_wheel_sizes_the_arc_being_dragged() { + let mut app = app(); + let ctx = egui::Context::default(); + frame(&mut app, &ctx, vec![]); + frame(&mut app, &ctx, vec![]); + click_doc(&mut app, 100.0, 150.0); + let undo = app.session.active().unwrap().history.undo.len(); + let c = app.canvas_rect.unwrap().center(); + let from = c + vec2(150.0, 80.0); + let button = |pos, pressed| Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed, modifiers: Modifiers::NONE }; + frame(&mut app, &ctx, vec![Event::PointerMoved(from), button(from, true)]); + let mut to = from; + for _ in 0..5 { + to += vec2(14.0, 0.0); + frame(&mut app, &ctx, vec![Event::PointerMoved(to)]); + } + assert!(app.session.tool_busy(), "the press drags"); + let dragged = paths(&app)[0].clone(); + let ctrl = Modifiers { ctrl: true, command: true, ..Modifiers::NONE }; + let notch = Event::MouseWheel { + unit: MouseWheelUnit::Line, + delta: vec2(0.0, 1.0), + phase: egui::TouchPhase::Move, + modifiers: ctrl, + source: MouseWheelSource::Wheel, + }; + frame(&mut app, &ctx, vec![notch]); + assert_eq!(arc_size(&app), 195.0); + assert!(app.session.tool_busy(), "the drag goes on"); + assert_eq!(paths(&app).len(), 1); + assert_ne!(paths(&app)[0], dragged, "the arc being dragged is drawn again with the new size"); + // The tool's size set ahead of the dragged arc's: a step that brings the arc to it still reports + // the change. + app.run("tool.setOption", json!({"key": "turn", "value": 210})).unwrap(); + let sized = paths(&app)[0].clone(); + assert_eq!(app.run("tool.quickPen.arcLarger", json!({})).unwrap(), json!(true)); + assert_eq!(arc_size(&app), 210.0); + assert_ne!(paths(&app)[0], sized); + assert!(app.session.tool_busy()); + frame(&mut app, &ctx, vec![button(to, false)]); + for _ in 0..3 { + frame(&mut app, &ctx, vec![]); + } + assert!(!app.session.tool_busy()); + assert_eq!(app.session.active().unwrap().history.undo.len(), undo + 1, "the piece and its size change are one undo step"); +} + +/// Ctrl+wheel over the Quick Pen toolbar, which floats over the canvas, leaves the arc size; half a +/// wheel line from a touchpad does not add to half a line from a later turn. +#[test] +fn ctrl_wheel_over_the_toolbar_or_in_two_turns_makes_no_step() { + let mut app = app(); + let ctx = egui::Context::default(); + for _ in 0..3 { + frame(&mut app, &ctx, vec![]); + } + let ctrl = Modifiers { ctrl: true, command: true, ..Modifiers::NONE }; + let bar = canvas::quick_pen_bar_rect(&ctx).expect("the toolbar shows"); + let notch = |modifiers| Event::MouseWheel { + unit: MouseWheelUnit::Line, + delta: vec2(0.0, 1.0), + phase: egui::TouchPhase::Move, + modifiers, + source: MouseWheelSource::Wheel, + }; + frame(&mut app, &ctx, vec![Event::PointerMoved(bar.center()), notch(ctrl)]); + for _ in 0..40 { + frame(&mut app, &ctx, vec![]); + } + assert_eq!(arc_size(&app), 180.0, "over the toolbar"); + + let line = ctx.options(|o| o.input_options.line_scroll_speed); + let at = app.canvas_rect.unwrap().center(); + let half = Event::MouseWheel { + unit: MouseWheelUnit::Point, + delta: vec2(0.0, line / 2.0), + phase: egui::TouchPhase::Move, + modifiers: ctrl, + source: MouseWheelSource::Trackpad, + }; + // Two halves a second apart, with no frame in between. + frame_at(&mut app, &ctx, vec![Event::PointerMoved(at), half.clone()], Some(100.0)); + frame_at(&mut app, &ctx, vec![half.clone()], Some(101.0)); + assert_eq!(arc_size(&app), 180.0, "two turns of half a line each"); + + // Within one touchpad gesture, a pause of half a second keeps the half line from before it. + let phased = |phase| match half.clone() { + Event::MouseWheel { unit, delta, modifiers, source, .. } => Event::MouseWheel { unit, delta, phase, modifiers, source }, + e => e, + }; + // The Start event's motion does not count, as for egui's scroll. + frame_at(&mut app, &ctx, vec![phased(egui::TouchPhase::Start), phased(egui::TouchPhase::Move)], Some(200.0)); + assert_eq!(arc_size(&app), 180.0, "a half line and the motion of a Start"); + // Ctrl let go during the gesture still counts until it ends. + let let_go = match phased(egui::TouchPhase::Move) { + Event::MouseWheel { unit, delta, phase, source, .. } => Event::MouseWheel { unit, delta, phase, modifiers: Modifiers::NONE, source }, + e => e, + }; + frame_at(&mut app, &ctx, vec![let_go], Some(200.5)); + assert_eq!(arc_size(&app), 195.0, "one gesture of two half lines"); + // Shift joining the gesture ends what Ctrl held. + let shifted = match phased(egui::TouchPhase::Move) { + Event::MouseWheel { unit, delta, phase, source, .. } => Event::MouseWheel { unit, delta, phase, modifiers: Modifiers::SHIFT, source }, + e => e, + }; + frame_at(&mut app, &ctx, vec![shifted.clone(), shifted], Some(200.6)); + assert_eq!(arc_size(&app), 195.0, "Shift joined the gesture"); + frame_at(&mut app, &ctx, vec![phased(egui::TouchPhase::Move), phased(egui::TouchPhase::Move)], Some(200.7)); + assert_eq!(arc_size(&app), 195.0, "Shift let go stays in the gesture"); + + // A plain wheel turn half a second after the Ctrl one, with no frame in between, scrolls. + let still = view(&app); + let plain = Event::MouseWheel { + unit: MouseWheelUnit::Line, + delta: vec2(0.0, 1.0), + phase: egui::TouchPhase::Move, + modifiers: Modifiers::NONE, + source: MouseWheelSource::Wheel, + }; + frame_at(&mut app, &ctx, vec![phased(egui::TouchPhase::End)], Some(201.0)); + frame_at(&mut app, &ctx, vec![plain], Some(201.5)); + for k in 1..=40 { + frame_at(&mut app, &ctx, vec![], Some(201.5 + f64::from(k) / 60.0)); + } + assert_eq!(arc_size(&app), 195.0); + assert_ne!(view(&app), still, "the plain turn scrolled"); + + // From a source that is not named a touchpad, the same pause within a gesture ends the turn, + // as egui's scroll timeout does. + let unknown = |phase| match phased(phase) { + Event::MouseWheel { unit, delta, phase, modifiers, .. } => { + Event::MouseWheel { unit, delta, phase, modifiers, source: MouseWheelSource::Unknown } + } + e => e, + }; + frame_at(&mut app, &ctx, vec![Event::PointerMoved(at), unknown(egui::TouchPhase::Start), unknown(egui::TouchPhase::Move)], Some(300.0)); + frame_at(&mut app, &ctx, vec![unknown(egui::TouchPhase::Move)], Some(300.5)); + assert_eq!(arc_size(&app), 195.0, "two turns of half a line each from an unnamed source"); +} + +/// A mouse wheel that reports its notches in points (as a browser does) steps once per notch, +/// however many points a notch is. Under a modal dialog, and for the rest of a turn begun under it, +/// Ctrl+wheel leaves the arc size. +#[test] +fn ctrl_wheel_steps_per_notch_and_not_under_a_dialog() { + let mut app = app(); + let ctx = egui::Context::default(); + frame(&mut app, &ctx, vec![]); + frame(&mut app, &ctx, vec![]); + let ctrl = Modifiers { ctrl: true, command: true, ..Modifiers::NONE }; + turn(&mut app, &ctx, MouseWheelUnit::Point, 100.0, ctrl, MouseWheelSource::Wheel); + assert_eq!(arc_size(&app), 195.0, "one notch of 100 points"); + turn(&mut app, &ctx, MouseWheelUnit::Point, -3.0, ctrl, MouseWheelSource::Wheel); + assert_eq!(arc_size(&app), 180.0, "one notch of 3 points"); + // On the desktop, point motion from an unknown source is a touchpad's: it steps once per wheel + // line, and smaller motion adds up within the turn. + let line = ctx.options(|o| o.input_options.line_scroll_speed); + turn(&mut app, &ctx, MouseWheelUnit::Point, 2.5 * line, ctrl, MouseWheelSource::Unknown); + assert_eq!(arc_size(&app), 210.0, "two and a half lines"); + turn(&mut app, &ctx, MouseWheelUnit::Point, -line, ctrl, MouseWheelSource::Unknown); + assert_eq!(arc_size(&app), 195.0, "the half line left over did not count in a later turn"); + let small = Event::MouseWheel { + unit: MouseWheelUnit::Point, + delta: vec2(0.0, -line / 4.0), + phase: egui::TouchPhase::Move, + modifiers: ctrl, + source: MouseWheelSource::Unknown, + }; + let at = app.canvas_rect.unwrap().center(); + frame(&mut app, &ctx, vec![Event::PointerMoved(at), small.clone(), small.clone(), small.clone()]); + assert_eq!(arc_size(&app), 195.0, "three quarters of a line"); + frame(&mut app, &ctx, vec![small]); + assert_eq!(arc_size(&app), 180.0, "a whole line"); + for _ in 0..40 { + frame(&mut app, &ctx, vec![]); + } + + let notch = Event::MouseWheel { + unit: MouseWheelUnit::Line, + delta: vec2(0.0, 1.0), + phase: egui::TouchPhase::Move, + modifiers: ctrl, + source: MouseWheelSource::Wheel, + }; + app.ui.dialog = Some(crate::state::Dialog::new("preferences", json!({}))); + frame_at(&mut app, &ctx, vec![Event::PointerMoved(at), notch.clone()], Some(300.0)); + assert_eq!(arc_size(&app), 180.0, "under the dialog"); + app.ui.dialog = None; + frame_at(&mut app, &ctx, vec![notch], Some(300.05)); + assert_eq!(arc_size(&app), 180.0, "the rest of a turn begun under the dialog"); +} + +/// With another tool, Ctrl+wheel leaves the Quick Pen's arc size and moves the view as before. +#[test] +fn ctrl_wheel_with_another_tool_moves_the_view() { + let mut app = app(); + app.select_tool("pen"); + let ctx = egui::Context::default(); + frame(&mut app, &ctx, vec![]); + frame(&mut app, &ctx, vec![]); + let still = view(&app); + turn(&mut app, &ctx, MouseWheelUnit::Line, 1.0, Modifiers { ctrl: true, command: true, ..Modifiers::NONE }, MouseWheelSource::Wheel); + assert_eq!(app.session.tool_options_of("quickPen")["turn"], json!(180.0)); + assert_ne!(view(&app), still); +} + +/// The arc size commands step the size by 15° within 1° to 359°, return false at the ends and with +/// another tool, and change the last sharp-corner arc of the path being drawn. +#[test] +fn the_arc_size_commands_step_within_the_range() { + let mut app = app(); + assert_eq!(app.run("tool.quickPen.arcLarger", json!({})).unwrap(), json!(true)); + assert_eq!(arc_size(&app), 195.0); + assert_eq!(app.run("tool.quickPen.arcSmaller", json!({})).unwrap(), json!(true)); + for _ in 0..10 { + assert_eq!(app.run("tool.quickPen.arcLarger", json!({})).unwrap(), json!(true)); + } + assert_eq!(arc_size(&app), 330.0); + assert_eq!(app.run("tool.quickPen.arcLarger", json!({})).unwrap(), json!(true)); + assert_eq!(app.run("tool.quickPen.arcLarger", json!({})).unwrap(), json!(false), "360° is past 359°"); + assert_eq!(arc_size(&app), 345.0); + + click_doc(&mut app, 100.0, 150.0); + click_doc(&mut app, 200.0, 150.0); + let drawn = paths(&app)[0].clone(); + let undo = app.session.active().unwrap().history.undo.len(); + assert_eq!(app.run("tool.quickPen.arcSmaller", json!({})).unwrap(), json!(true)); + assert_ne!(paths(&app)[0], drawn); + assert_eq!(app.session.active().unwrap().history.undo.len(), undo + 1); + + app.select_tool("pen"); + assert_eq!(app.run("tool.quickPen.arcSmaller", json!({})).unwrap(), json!(false)); + assert_eq!(app.session.tool_options_of("quickPen")["turn"], json!(330.0)); +} diff --git a/docs/mcp.md b/docs/mcp.md index ae119cc4b1..850fc50cd1 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -7303,16 +7303,25 @@ path's last point, drawn with the tool's `action` option: Alt (Option on macOS) pressed and let go with no other key, click or wheel turn in between switches to the next action: Line, Continuous Arc, Sharp Corner Arc, and back to Line. C flips the last piece, while it is a sharp-corner arc, to the other side of its chord. `[` and `]` make the arc size 15° smaller or larger, for the last sharp-corner arc and the -arcs after it. During a drag, C and `[` `]` change the sharp-corner arc being dragged, and Alt switches its action. A -dragged piece ends where the press is let go. A click on the first point closes the path, and a click on an end of an -open path goes on drawing from that end. Escape or Enter ends the path, and so does an edit made to it by another -command. An edit made by another command during a drag, to the path or to other art, also ends the path: the edit +arcs after it, as `tool.quickPen.arcSmaller {}` and `tool.quickPen.arcLarger {}` do (each first finishes any pending +tool edit, then returns false, changing nothing more, when the Quick Pen tool is not active or the step would leave 1° to +359°). `tool.quickPen.arcSmaller` and `tool.quickPen.arcLarger` run in the desktop app (`--connect`). Ctrl with a +scroll on a touchpad over the canvas (the Control key on macOS too) changes the arc size as well, as +[Quick Pen tool keyboard shortcuts](https://helpx.adobe.com/illustrator/web/add-and-edit-artwork/draw-and-edit-paths/quick-pen-tool-keyboard-shortcuts.html) +lists: the touchpad makes one step for each wheel line of its motion, and motion that goes on after the fingers lift +makes none. A mouse wheel turned with Ctrl over the canvas does the same, one step for each wheel event (one per +notch). Up makes the arc size larger and down smaller, sideways motion makes no step, and the view does not zoom or +scroll for the rest of that wheel turn. During a drag, C, `[` `]` and the wheel change the sharp-corner arc being +dragged, and Alt switches its action. A dragged piece ends where the press is let go. A click on the first point +closes the path, and a click on an end of an open path goes on drawing from that end. Escape or Enter ends the path, +and so does an edit made to it by another command. An edit made by another command during a drag, to the path or to other art, also ends the path: the edit stays, and the piece stays as last shown. With the `realTimeDrawing` preference off, a press during which another command edits the document adds no piece, and the edit stays. The path's points show as circles without handles, and a preview shows the piece the next click adds. Points snap to Smart Guides. Each piece is one undo step, together with the flips and size changes made during its drag, and each flip or size change made between presses is one undo step. The -arc size of 180°, its 15° steps, the side an arc bulges to, what C and `[` `]` do during a drag and Enter ending the -path are VectorCraft's own rules. The tool keeps `action` and `turn` with the preferences +arc size of 180°, its 15° steps, the side an arc bulges to, what C, `[` `]` and the wheel do during a drag, Enter +ending the path, the mouse wheel changing the arc size, and the wheel's step per event or wheel line and its direction are +VectorCraft's own rules. The tool keeps `action` and `turn` with the preferences (`tool.setOption {tool: "quickPen", key, value}`). Selecting the tool shows its toolbar on the canvas: Straight Line, Continuous Arc and Sharp Corner Arc set `action`, diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 0616b700f0..9734e21c74 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -633,7 +633,7 @@ since 2026-10-01. - **Trim View hides guides and the grid (#8363):** while View › Trim View is on, the canvas and tiled panes draw no ruler guides, no guide paths and no grid, the guides are neither snapped to nor picked, and Show/Hide Guides and Show/Hide Grid are greyed out (menu bar, canvas context menu, Properties) and refuse to run; the stored choices come back when it is turned off, and the rulers stay ([trim view hides guides](https://community.adobe.com/t5/illustrator-discussions/trim-view-hides-guides/td-p/14066140), [guides greyed out](https://community.adobe.com/t5/illustrator-discussions/guides-greyed-out/m-p/11132728)). A drag or double-click on a ruler makes no guide while it is on (no preview, no undo step, a status message). `trim_view_hides_the_guides_and_the_grid`, `trim_view_deselects_selected_guide_paths`, `trim_view_makes_no_guide_from_the_rulers` in `crates/ui-egui/src/canvas/tests.rs`; `trim_view_greys_out_show_guides_and_show_grid` in `crates/ui-egui/src/menus/tests.rs`. - **Recolor picker follow-up (#8031/#4028):** native Lab numeric entry, document/loaded-library swatches in the Color Picker, and Assign-row Pick from Swatches / Limit to Library menus. #4090 provided the double-click picker and #5113 the Assign sliders. Regression tests `native_lab_entry_in_color_picker` and `row_context_menu_pick_from_swatches_and_limit_to_library` exercise the fields and menu callbacks rather than writing their result state. Area score and hours unchanged. -- **Quick Pen tool (#2660, in part):** a tool in the Pen tool's group (Alt+P, Option+P on macOS) draws straight lines, continuous arcs and sharp-corner arcs, one undo step per piece; Alt pressed and let go on its own switches the action, C flips the last sharp-corner arc, `[` and `]` change the arc size by 15°, a click on the first point closes the path, a click on an open end continues it, and Escape or Enter ends it (`path.quickPen`), as [Draw with the Quick Pen tool](https://helpx.adobe.com/illustrator/web/add-and-edit-artwork/draw-and-edit-paths/draw-with-quick-pen-tool.html) and [Quick Pen tool keyboard shortcuts](https://helpx.adobe.com/illustrator/web/add-and-edit-artwork/draw-and-edit-paths/quick-pen-tool-keyboard-shortcuts.html) describe. The 180° default arc, its 15° steps, the side an arc bulges to, a dragged piece ending where the press is let go, and C, `[` and `]` changing the arc being dragged are VectorCraft's own rules. Tests: tools `quickpen::tests`, engine `tests::quickpen`, ui-egui `shortcuts::alt_tap::tests`, `alt_p_chooses_the_quick_pen_and_an_alt_tap_switches_its_action` and `brackets_size_the_quick_pen_arc_being_dragged`. Score and hours unchanged. +- **Quick Pen tool (#2660, in part):** a tool in the Pen tool's group (Alt+P, Option+P on macOS) draws straight lines, continuous arcs and sharp-corner arcs, one undo step per piece; Alt pressed and let go on its own switches the action, C flips the last sharp-corner arc, `[` and `]` and Ctrl with a touchpad scroll or a mouse wheel over the canvas change the arc size by 15° (`tool.quickPen.arcLarger`, `tool.quickPen.arcSmaller`), a click on the first point closes the path, a click on an open end continues it, and Escape or Enter ends it (`path.quickPen`), as [Draw with the Quick Pen tool](https://helpx.adobe.com/illustrator/web/add-and-edit-artwork/draw-and-edit-paths/draw-with-quick-pen-tool.html) and [Quick Pen tool keyboard shortcuts](https://helpx.adobe.com/illustrator/web/add-and-edit-artwork/draw-and-edit-paths/quick-pen-tool-keyboard-shortcuts.html) describe. The 180° default arc, its 15° steps, the side an arc bulges to, a dragged piece ending where the press is let go, C, `[` and `]` changing the arc being dragged, the mouse wheel changing the arc size, and one step per wheel event of a mouse wheel are VectorCraft's own rules. Tests: tools `quickpen::tests`, engine `tests::quickpen`, ui-egui `shortcuts::alt_tap::tests`, `tests::quickpenwheel`, `alt_p_chooses_the_quick_pen_and_an_alt_tap_switches_its_action` and `brackets_size_the_quick_pen_arc_being_dragged`. Score and hours unchanged. - **Optional compact Tools (#7234):** Window > Toolbars > Compact Tools reduces row and column spacing and the main panel's allocated width in one or two columns, docked or floating. The setting is saved with the UI state and applies to Basic, Advanced and edited main Tools layouts; the selected tool, icon size, footer controls and tool-flyout behavior are retained. Turning it off restores the existing layout, which remains the default. Named custom toolbars and flyout spacing are unchanged. Public regressions in `crates/ui-egui/tests/toolbar_compact.rs` cover the actual toolbar layout against the default control, the command and saved-state roundtrip, tool selection, flyouts, footer controls and short-window reachability. This is an optional layout choice, without a styling-parity or score claim; hours are unchanged. diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 7d1d61416e..3acd3960a2 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -205,7 +205,7 @@ tools, never checked side by side) isn't captured row by row. | Busy cursor during long operations | done | Background open, save and export show the system progress cursor (gap G1) | | Each anchor snaps to Smart Guides and construction angles | done | `DrawSnap` | | Curvature tool: click/drag points, double-click or Alt-click for a corner, temporary Direct Selection, point conversion | partial | circular point markers without direction handles or duplicate markers, Anchor Size and Hide Edges regression-tested (#1236, in part); curve geometry: each stretch of three points follows the circle through them (handles along its tangent, chord/(3·cos²(α/2)) long, shorter in a turn tighter than 30°), open ends curving in, the same rule for the rubber band, dragged, inserted and converted points (#1236, in part); neighbours of a point dragged on an existing path keep their tangents, and modifiers requested in #975 remain | -| Quick Pen tool: straight lines, continuous arcs and sharp-corner arcs, Alt/Option to switch action, C to flip an arc, `[` / `]` for its size, Alt+P / Option+P, close on the first point, continue from an end, Escape to end ([help page](https://helpx.adobe.com/illustrator/web/add-and-edit-artwork/draw-and-edit-paths/draw-with-quick-pen-tool.html), [shortcuts](https://helpx.adobe.com/illustrator/web/add-and-edit-artwork/draw-and-edit-paths/quick-pen-tool-keyboard-shortcuts.html)) | partial | `path.quickPen` and the tool in `crates/tools/src/quickpen.rs`, in the Pen tool's group (#2660); the on-canvas toolbar with its actions, Flip Arc and its More menu (Hide Toolbar and Reset Toolbar Position, and VectorCraft's own Pin Toolbar Position) in `crates/ui-egui/src/canvas/quick_pen_bar.rs`. Not yet: dragging a path's ends to change a line's or arc's length, Ctrl+scroll for the arc size, and editing and deleting with the tool | +| Quick Pen tool: straight lines, continuous arcs and sharp-corner arcs, Alt/Option to switch action, C to flip an arc, `[` / `]` and Ctrl+scroll for its size, Alt+P / Option+P, close on the first point, continue from an end, Escape to end ([help page](https://helpx.adobe.com/illustrator/web/add-and-edit-artwork/draw-and-edit-paths/draw-with-quick-pen-tool.html), [shortcuts](https://helpx.adobe.com/illustrator/web/add-and-edit-artwork/draw-and-edit-paths/quick-pen-tool-keyboard-shortcuts.html)) | partial | `path.quickPen` and the tool in `crates/tools/src/quickpen.rs`, in the Pen tool's group (#2660); the on-canvas toolbar with its actions, Flip Arc and its More menu (Hide Toolbar and Reset Toolbar Position, and VectorCraft's own Pin Toolbar Position) in `crates/ui-egui/src/canvas/quick_pen_bar.rs`; Ctrl+scroll on a touchpad, and VectorCraft's own Ctrl+mouse wheel, over the canvas for the arc size in `crates/ui-egui/src/canvas/quick_pen_wheel.rs` (`tool.quickPen.arcLarger`, `tool.quickPen.arcSmaller`). Not yet: dragging a path's ends to change a line's or arc's length, and editing and deleting with the tool | | Icon-strip flyout resizing (#5713) | done | Canvas-side edge and bottom; user size persists after reopening and workspace restore; Glyphs and Artboards pointer/cursor regression | | Icon-strip flyout resizing from the top (storytold/craft-libs#1094) | done | Top edge (a 4 pt band over the tab strip) and the canvas-side top corner; the bottom and the icon-column edge stay; the moved top persists after reopening and workspace restore; `an_icon_flyout_grows_upward_from_its_top_edge_and_free_corner` | | Graphic Styles list fills a taller panel (#2992) | done | Docked, floating or in a resized flyout, the list takes the height above the panel's footer, as the Artboards list does; outside a sized panel it stays 220 pt; `the_list_fills_a_tall_panel_above_its_footer` | From e799a697703c3c1883c82a0094f56812cd6d7ba5 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Thu, 19 Nov 2026 20:12:18 -0800 Subject: [PATCH 011/112] Quick Pen: Ctrl+wheel steps the arc size in event order Each wheel event's whole steps now run before the next event's, and only the fraction of a wheel line carries over. A notch up refused at 345 degrees no longer cancels a notch down in the same frame, so the size goes to 330, and a touchpad gesture that starts later in a frame keeps the steps of the motion before it. A frame whose Ctrl+wheel event stepped the arc size no longer moves the view when a later event in the same frame starts a new turn. --- crates/ui-egui/src/canvas/quick_pen_wheel.rs | 43 +++++++++----- crates/ui-egui/src/tests/quickpenwheel.rs | 59 ++++++++++++++++++++ 2 files changed, 88 insertions(+), 14 deletions(-) diff --git a/crates/ui-egui/src/canvas/quick_pen_wheel.rs b/crates/ui-egui/src/canvas/quick_pen_wheel.rs index 6ba86ca852..129e234ee4 100644 --- a/crates/ui-egui/src/canvas/quick_pen_wheel.rs +++ b/crates/ui-egui/src/canvas/quick_pen_wheel.rs @@ -32,7 +32,7 @@ struct ArcWheel { const TURN_GAP: f64 = 0.150; const GESTURE_GAP: f64 = 1.0; -/// Most steps one frame makes: from 1° to 359° is fewer than 24 steps of 15°. +/// Most steps one wheel event makes: from 1° to 359° is fewer than 24 steps of 15°. const MOST_STEPS: i32 = 24; /// Ctrl alone (the Control key on macOS too). @@ -51,6 +51,11 @@ pub(super) fn arc_size(app: &mut VectorcraftApp, ui: &Ui, over: bool) -> bool { let line = ui.ctx().options(|o| o.input_options.line_scroll_speed).max(1.0); let takes = over && app.session.tool_id() == vectorcraft_tools::quickpen::ID; let mut now = before; + // The steps to make, in event order: the command and how many times to run it. + let mut runs: Vec<(&str, i32)> = Vec::new(); + // Whether the tool took any of this frame's wheel events, even one of a turn that a later event + // of the frame ended: the view does not move for this frame's events then. + let mut took = false; let (any, scrolling) = ui.input(|i| { let mut any = false; for e in &i.events { @@ -80,6 +85,7 @@ pub(super) fn arc_size(app: &mut VectorcraftApp, ui: &Ui, over: bool) -> bool { continue; } now.taken = true; + took = true; // Only Move events move, as egui's scroll; momentum after the fingers lift makes no step. if *phase != egui::TouchPhase::Move || *source == egui::MouseWheelSource::Momentum { continue; @@ -96,8 +102,18 @@ pub(super) fn arc_size(app: &mut VectorcraftApp, ui: &Ui, over: bool) -> bool { } else { s }; - if d.is_finite() { - now.rest += d; + if !d.is_finite() { + continue; + } + // Each event's whole steps are made before the next event's, in the order the events + // came, so a step refused at an end of the range does not cancel a later step back; only + // the fraction of a wheel line is left for later motion. + now.rest += d; + let whole = now.rest.trunc(); + now.rest -= whole; + if whole != 0.0 { + let cmd = if whole > 0.0 { "tool.quickPen.arcLarger" } else { "tool.quickPen.arcSmaller" }; + runs.push((cmd, (whole.abs().min(MOST_STEPS as f32)) as i32)); } } (any, i.is_scrolling()) @@ -105,21 +121,20 @@ pub(super) fn arc_size(app: &mut VectorcraftApp, ui: &Ui, over: bool) -> bool { if !any && !scrolling { now = ArcWheel::default(); } - let steps = now.rest.trunc(); - now.rest -= steps; - let (cmd, n) = if steps > 0.0 { ("tool.quickPen.arcLarger", steps) } else { ("tool.quickPen.arcSmaller", -steps) }; - for _ in 0..(n as i32).min(MOST_STEPS) { - match app.run(cmd, json!({})) { - Ok(serde_json::Value::Bool(true)) => {} - Ok(_) => break, - Err(e) => { - app.ui.status = e; - break; + 'runs: for (cmd, n) in runs { + for _ in 0..n { + match app.run(cmd, json!({})) { + Ok(serde_json::Value::Bool(true)) => {} + Ok(_) => break, + Err(e) => { + app.ui.status = e; + break 'runs; + } } } } if now != before { ui.data_mut(|d| d.insert_temp(id, now)); } - now.taken + now.taken || took } diff --git a/crates/ui-egui/src/tests/quickpenwheel.rs b/crates/ui-egui/src/tests/quickpenwheel.rs index 597035bc47..edf6940edb 100644 --- a/crates/ui-egui/src/tests/quickpenwheel.rs +++ b/crates/ui-egui/src/tests/quickpenwheel.rs @@ -363,6 +363,65 @@ fn ctrl_wheel_steps_per_notch_and_not_under_a_dialog() { assert_eq!(arc_size(&app), 180.0, "the rest of a turn begun under the dialog"); } +/// Wheel events in one frame step in the order they came: a notch up refused at the top of the +/// range does not cancel the notch down after it, and a touchpad gesture that starts later in the +/// frame keeps the steps of the motion before it and does not let that motion move the view. +#[test] +fn ctrl_wheel_steps_in_event_order() { + let mut app = app(); + let ctx = egui::Context::default(); + frame(&mut app, &ctx, vec![]); + frame(&mut app, &ctx, vec![]); + app.run("tool.setOption", json!({"key": "turn", "value": 345})).unwrap(); + let ctrl = Modifiers { ctrl: true, command: true, ..Modifiers::NONE }; + let at = app.canvas_rect.unwrap().center(); + let notch = |dy: f32| Event::MouseWheel { + unit: MouseWheelUnit::Line, + delta: vec2(0.0, dy), + phase: egui::TouchPhase::Move, + modifiers: ctrl, + source: MouseWheelSource::Wheel, + }; + frame(&mut app, &ctx, vec![Event::PointerMoved(at), notch(1.0), notch(-1.0)]); + assert_eq!(arc_size(&app), 330.0, "up refused at 345°, then down"); + for _ in 0..40 { + frame(&mut app, &ctx, vec![]); + } + + let line = ctx.options(|o| o.input_options.line_scroll_speed); + let pad = |phase, dy: f32| Event::MouseWheel { + unit: MouseWheelUnit::Point, + delta: vec2(0.0, dy), + phase, + modifiers: ctrl, + source: MouseWheelSource::Trackpad, + }; + frame_at( + &mut app, + &ctx, + vec![pad(egui::TouchPhase::Start, 0.0), pad(egui::TouchPhase::Move, -line), pad(egui::TouchPhase::Start, 0.0)], + Some(500.0), + ); + assert_eq!(arc_size(&app), 315.0, "a line down before a later Start"); + for k in 1..=40 { + frame_at(&mut app, &ctx, vec![], Some(500.0 + f64::from(k) / 60.0)); + } + + // A Ctrl notch followed in the same frame by the Start of a touchpad gesture without Ctrl: the + // notch steps the arc size and does not move the view. + let still = view(&app); + let plain_start = Event::MouseWheel { + unit: MouseWheelUnit::Point, + delta: vec2(0.0, 0.0), + phase: egui::TouchPhase::Start, + modifiers: Modifiers::NONE, + source: MouseWheelSource::Trackpad, + }; + frame_at(&mut app, &ctx, vec![Event::PointerMoved(at), notch(1.0), plain_start], Some(600.0)); + assert_eq!(arc_size(&app), 330.0); + assert_eq!(view(&app), still, "the notch did not move the view"); +} + /// With another tool, Ctrl+wheel leaves the Quick Pen's arc size and moves the view as before. #[test] fn ctrl_wheel_with_another_tool_moves_the_view() { From c4df0b626fb7520e64b39cb82473c86a214517e2 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Sun, 22 Nov 2026 13:34:17 -0800 Subject: [PATCH 012/112] Quick Pen: keys tapped between touchpad wheel events count for the gesture During a touchpad gesture the held modifiers were taken only from wheel events, so Shift pressed and let go between two of them did not count and the next Ctrl-only event still stepped the arc size. While a gesture is under way, the modifiers of key events and modifier changes now join the gesture's held set in the order they come. The mouse-wheel path is unchanged. --- crates/ui-egui/src/canvas/quick_pen_wheel.rs | 8 +++ crates/ui-egui/src/tests/quickpenwheel.rs | 51 ++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/crates/ui-egui/src/canvas/quick_pen_wheel.rs b/crates/ui-egui/src/canvas/quick_pen_wheel.rs index 129e234ee4..8b036ada5d 100644 --- a/crates/ui-egui/src/canvas/quick_pen_wheel.rs +++ b/crates/ui-egui/src/canvas/quick_pen_wheel.rs @@ -59,6 +59,14 @@ pub(super) fn arc_size(app: &mut VectorcraftApp, ui: &Ui, over: bool) -> bool { let (any, scrolling) = ui.input(|i| { let mut any = false; for e in &i.events { + // Keys pressed or let go between a touchpad gesture's wheel events count for the rest of + // the gesture too, in the order they came. + if let egui::Event::ModifiersChanged(m) | egui::Event::Key { modifiers: m, .. } = e { + if now.gesture { + now.held |= *m; + } + continue; + } let egui::Event::MouseWheel { unit, delta, phase, modifiers, source } = e else { continue }; any = true; // A wheel event after egui's scroll timeout, or a touchpad gesture's start, begins a diff --git a/crates/ui-egui/src/tests/quickpenwheel.rs b/crates/ui-egui/src/tests/quickpenwheel.rs index edf6940edb..4e5800c269 100644 --- a/crates/ui-egui/src/tests/quickpenwheel.rs +++ b/crates/ui-egui/src/tests/quickpenwheel.rs @@ -422,6 +422,57 @@ fn ctrl_wheel_steps_in_event_order() { assert_eq!(view(&app), still, "the notch did not move the view"); } +/// Shift pressed and let go between two wheel events of a touchpad gesture held with Ctrl counts for +/// the rest of the gesture, whether it comes as a key event or as a change of the held modifiers. +/// Between a mouse wheel's notches it does not. +#[test] +fn shift_tapped_between_touchpad_wheel_events_counts_for_the_gesture() { + let mut app = app(); + let ctx = egui::Context::default(); + frame(&mut app, &ctx, vec![]); + frame(&mut app, &ctx, vec![]); + let ctrl = Modifiers { ctrl: true, command: true, ..Modifiers::NONE }; + let both = Modifiers { shift: true, ..ctrl }; + let at = app.canvas_rect.unwrap().center(); + let line = ctx.options(|o| o.input_options.line_scroll_speed); + let pad = |phase, dy: f32| Event::MouseWheel { + unit: MouseWheelUnit::Point, + delta: vec2(0.0, dy), + phase, + modifiers: ctrl, + source: MouseWheelSource::Trackpad, + }; + let shift_key = |pressed, modifiers| Event::Key { key: egui::Key::ShiftLeft, physical_key: None, pressed, repeat: false, modifiers }; + let taps = [vec![shift_key(true, both), shift_key(false, ctrl)], vec![Event::ModifiersChanged(both), Event::ModifiersChanged(ctrl)]]; + let mut t = 700.0; + for tap in taps { + let size = arc_size(&app); + frame_at(&mut app, &ctx, vec![Event::PointerMoved(at), pad(egui::TouchPhase::Start, 0.0), pad(egui::TouchPhase::Move, line)], Some(t)); + assert_eq!(arc_size(&app), size + 15.0, "a line up with Ctrl"); + frame_at(&mut app, &ctx, tap.clone(), Some(t + 0.1)); + frame_at(&mut app, &ctx, vec![pad(egui::TouchPhase::Move, line)], Some(t + 0.2)); + assert_eq!(arc_size(&app), size + 15.0, "Shift tapped mid-gesture: {tap:?}"); + frame_at(&mut app, &ctx, vec![pad(egui::TouchPhase::End, 0.0)], Some(t + 0.3)); + for k in 1..=40 { + frame_at(&mut app, &ctx, vec![], Some(t + 0.3 + f64::from(k) / 60.0)); + } + t += 100.0; + } + + let size = arc_size(&app); + let notch = Event::MouseWheel { + unit: MouseWheelUnit::Line, + delta: vec2(0.0, 1.0), + phase: egui::TouchPhase::Move, + modifiers: ctrl, + source: MouseWheelSource::Wheel, + }; + frame_at(&mut app, &ctx, vec![Event::PointerMoved(at), notch.clone()], Some(t)); + frame_at(&mut app, &ctx, vec![shift_key(true, both), shift_key(false, ctrl)], Some(t + 0.05)); + frame_at(&mut app, &ctx, vec![notch], Some(t + 0.1)); + assert_eq!(arc_size(&app), size + 30.0, "two Ctrl notches around a Shift tap"); +} + /// With another tool, Ctrl+wheel leaves the Quick Pen's arc size and moves the view as before. #[test] fn ctrl_wheel_with_another_tool_moves_the_view() { From 1807f9ef3773eb6c8c11b34dfbac149f490a1315 Mon Sep 17 00:00:00 2001 From: tareq <tareq.halaby@gmail.com> Date: Tue, 24 Nov 2026 09:38:51 +0100 Subject: [PATCH 013/112] feat(i18n): add Arabic language support, catalog and 6-form plural rules --- crates/ui-egui/src/i18n.rs | 1 + crates/ui-egui/src/i18n/ar.tsv | 888 +++++++++++++++++++++++++++++++ crates/ui-egui/src/i18n/tests.rs | 34 +- docs/localization-parity.md | 5 +- 4 files changed, 924 insertions(+), 4 deletions(-) create mode 100644 crates/ui-egui/src/i18n/ar.tsv diff --git a/crates/ui-egui/src/i18n.rs b/crates/ui-egui/src/i18n.rs index ec1296192f..1900d249aa 100644 --- a/crates/ui-egui/src/i18n.rs +++ b/crates/ui-egui/src/i18n.rs @@ -69,6 +69,7 @@ static EMBEDDED: &Embedded = &[ ("fi", "", include_str!("i18n/fi.tsv")), ("tr", "", include_str!("i18n/tr.tsv")), ("ca", "", include_str!("i18n/ca.tsv")), + ("ar", "", include_str!("i18n/ar.tsv")), ]; /// The codes of [`EMBEDDED`] the interface offers. Browsers cannot use the native installed-font diff --git a/crates/ui-egui/src/i18n/ar.tsv b/crates/ui-egui/src/i18n/ar.tsv new file mode 100644 index 0000000000..353f6dd5b9 --- /dev/null +++ b/crates/ui-egui/src/i18n/ar.tsv @@ -0,0 +1,888 @@ +# Arabic (ar) catalog. Same format as zh-hant.tsv: context <TAB> source <TAB> translation +# (empty context = a plain UI string; `@id` = a command id; `@plural` = 6 CLDR forms; +# `@msg` = a status or error message). +# +# Clean-room: written from the meaning of VectorCraft's English labels in Modern Standard Arabic, +# using ordinary vector-illustration vocabulary (لوحة عمل، مسار، نقطة إرساء، حد، +# تعبئة، عينة لون، تدرج، قناع، طبقة). No other application's Arabic localisation +# resource, string table or product UI was consulted or copied; add entries the same way. +# +# Conventions: labels use standard Arabic creative suite terminology. Plural rule (CLDR): +# zero|one|two|few|many|other. Status and error messages (`@msg`) keep the case of their English +# first word. Left in English on purpose (`MENU_KEEP_AS_IS` in the tests): the product name +# (VectorCraft), OpenType, the built-in workspace names and perspective grid presets. +# Every `ar-*` locale (ar-SA, ar-EG, ar-AE, ar-MA, ar-KW, etc.) resolves here. Keep the +# placeholders ({name}), trailing "…" and leading/trailing spaces of fragments exactly as they are. +@id language.name العربية + % of all commits % من كل الإيداعات + 16 bit 16 بت + 24 bits/pixel 24 بت/بكسل + 32 bits/pixel 32 بت/بكسل + 8 bit 8 بت + About حول + Absolute مطلق + Absolute Colorimetric قياس لوني مطلق + Actions الإجراءات + Activate Panel تنشيط اللوحة + Actual Size الحجم الفعلي + Adaptive تكيفي + Add إضافة + Add Anchor Point إضافة نقطة إرساء + Add Anchor Point Tool أداة إضافة نقطة ارتكاز + Add Anchor Points إضافة نقاط إرساء + Add to Swatches إضافة إلى عينات الألوان + Advanced متقدم + Align محاذاة + All الكل + All Caps جميع الأحرف كبيرة + All Layers كل الطبقات + All Slices كل الشرائح + Alt Alt + Amount المقدار + Amount: المقدار: + Anchor Point نقطة إرساء + Angle الزاوية + Angle: الزاوية: + Anti-alias إزالة التسنن + Anti-Alias إزالة التسنن + Appearance المظهر + Appearance of Black مظهر اللون الأسود + Apply تطبيق + Arc قوس + Arrange ترتيب + Art & Illustration الفن والرسم التوضيحي + Artboard لوح التصميم + Artboard Tool أداة لوحة العمل + Artboards لوحات العمل + ArtCraft Website موقع ArtCraft + ArtCraft website موقع ArtCraft + Aspect Ratio نسبة العرض إلى الارتفاع + Assign Profile… تعيين ملف تعريف… + Attributes السمات + Author: المؤلف: + Auto تلقائي + Auto Color لون تلقائي + Auto-Collapse Iconic Panels طي الألواح الرمزية تلقائيًا + Automate أتمتة + Automatic تلقائي + Average متوسط + Average… توسيط… + Background Contents محتويات الخلفية + Balance التوازن + Baseline خط الأساس + Baseline Optimized أساسي محسّن + Basic أساسي + Batch… دفعة… + Bend: الانحناء: + Best الأفضل + Bevel مشطوفة + Bicubic ثنائي التكعيب + Binary assets added الأصول الثنائية المضافة + Binary assets removed الأصول الثنائية المحذوفة + Bitmap صورة نقطية + Black أسود + Black & White أبيض وأسود + Blend دمج / مزج + Bloat انتفاخ + Blob Brush فرشاة التلطيخ + Blocks كتل + Blue أزرق + Blur ضبابية + Bold غامق + Bottom أسفل + Bottom Left أسفل اليسار + Bottom Right أسفل اليمين + Bottom: أسفل: + Brightness السطوع + Brightness/Contrast… السطوع/التباين… + Brightness: السطوع: + Bring Forward إحضار للأمام + Bring to Front إحضار إلى المقدمة + Brushes الفرش + Cancel إلغاء + Canvas مساحة الرسم + Cascade تتالي + Cell Size حجم الخلية + Center مركز + Centimeters سنتيمترات + Chalk & Charcoal طباشير وفحم + Change تغيير + Change All تغيير الكل + Change Panel Layout تغيير تخطيط اللوحات + Channel قناة + Character حرف + Character Styles أنماط الأحرف + Charcoal فحم + Check Spelling… تدقيق إملائي… + Chrome كروم + Circle دائرة + Classic كلاسيكي + Clear مسح + Clear All مسح الكل + Clear Guides مسح خطوط الإرشاد + Clear History مسح السجل + Clear Recent Files مسح الملفات الأخيرة + Clipboard Handling معالجة الحافظة + Close إغلاق + Close All إغلاق الكل + Close Panel إغلاق اللوحة + Cmd Cmd + CMYK Color ألوان CMYK + Coarse Dots نقاط خشنة + Collapse Panel Group طي مجموعة اللوحات + Color اللون + Color Burn حرق اللون + Color Dodge تفادي اللون + Color Guide دليل الألوان + Color Halftone… أنصاف ألوان… + Color Management إدارة الألوان + Color Mode وضع الألوان + Color Settings… إعدادات الألوان… + Color Table جدول الألوان + Color: اللون: + Colorize تلوين + Colors الألوان + Command الأمر + Commits الإيداعات + Community المجتمع + Company الشركة + Compound Path مسار مركب + Compression الضغط + Contextual Alternates بدائل سياقية + Contrast التباين + Contributors المساهمون + Conté Crayon قلم Conté + Convert to Shape تحويل إلى شكل + Convert to sRGB تحويل إلى sRGB + Cool بارد + Copy نسخ + Copyright حقوق النشر + Copyright and Contact Info حقوق النشر ومعلومات الاتصال + Copyrighted محمي بحقوق النشر + Corner زاوية + Corners الزوايا + Create إنشاء + Create Clipping Mask إنشاء قناع اقتطاع + Create Gradient Mesh… إنشاء شبكة تدرج… + Create Object Mosaic… إنشاء فسيفساء كائن… + Crop اقتصاص + Cross صليب + Crystallize تبلور + Crystallize… تبلور… + Ctrl Ctrl + Current Colors الألوان الحالية + Curvature الانحناء + Curves… المنحنيات… + Custom مخصص + Cut قص + Cyan سماوي + Dark داكن + Darken تغميق + Dash شرطة + Dashed متقطع + Data Sets مجموعات البيانات + De-Interlace… إزالة التشابك… + Decorative زخرفي + Default افتراضي + Delete حذف + Delete Anchor Point حذف نقطة إرساء + Delete Anchor Point Tool أداة حذف نقطة ارتكاز + Delete Brush حذف الفرشاة + Delete Group حذف المجموعة + Delete Layer حذف الطبقة + Delete Workspace حذف مساحة العمل + Depth العمق + Description الوصف + Deselect إلغاء التحديد + Detail التفاصيل + Devices الأجهزة + Diameter: القطر: + Diamond ماسي + Difference فرق + Diffusion الانتشار + Direct Selection تحديد مباشر + Direct Selection Tool أداة التحديد المباشر + Discord Discord + Discretionary Ligatures حروف مركبة اختيارية + Display name الاسم المعروض + Distance المسافة + Distort تشويه + Distortion التشويه + Distribute توزيع + Dither ترقيش + Divide تقسيم + Dock Panel إرساء اللوحة + Document المستند + Document Color Mode نمط ألوان المستند + Document Info معلومات المستند + Document Setup… إعداد المستند… + Don't Save عدم الحفظ + Done تم + Dots نقاط + Draft مسودة + Drop Shadow ظل مسقط + Drop Shadow… ظل مسقط… + Duplicate تكرار + Duplicate Layer تكرار الطبقة + Duplication تكرار + Edge الحافة + Edge Only الحافة فقط + Edit تحرير + Edit Colors تحرير الألوان + Edit Contents تحرير المحتويات + Effect تأثير + Effects التأثيرات + Eliminate إزالة + Ellipse شكل بيضاوي + Ellipse Tool أداة الشكل البيضاوي + Entire Font الخط بالكامل + Eraser ممحاة + Eraser Tool أداة الممحاة + Error خطأ + Even Fields حقول زوجية + Exact دقيق + Exclude استبعاد + Exclusion استبعاد + Exit خروج + Expand توسيع + Expand Appearance توسيع المظهر + Expand… توسيع… + Export تصدير + Export As… تصدير باسم… + Export for Screens… تصدير للشاشات… + Export Presets تصدير الإعدادات المسبقة + Export… تصدير… + Eyedropper قطارة + Eyedropper Tool أداة القطارة + Feather تلاشي الحواف + Feather… تلاشي الحواف… + File ملف + File Handling معالجة الملفات + File Info… معلومات الملف… + Files الملفات + Fill تعبئة + Fill: التعبئة: + Film & Video الأفلام والفيديو + Filter فلتر + Find بحث + Find and Replace… بحث واستبدال… + Find Next بحث عن التالي + Fine Dots نقاط دقيقة + First الأول + First commit أول إيداع + Fit ملاءمة + Fit All in Window ملاءمة الكل في النافذة + Fit Artboard in Window ملاءمة لوحة العمل مع النافذة + Fit in View ملاءمة في العرض + Fit on Screen ملاءمة للشاشة + Fixed ثابت + Flare توهج + Flatten Transparency… تسطيح الشفافية… + Flip قلب + Flip Horizontal قلب أفقي + Flip Vertical قلب عمودي + Float in Window تعويم في نافذة + Float Panel تعويم اللوحة + Folder المجلد + Font الخط + Font Preview Size حجم معاينة الخط + Format التنسيق + Format Options خيارات التنسيق + Fractions كسور + Free حر + Free Transform تحويل حر + Frequency التردد + Full Document المستند الكامل + Full Screen Mode وضع ملء الشاشة + Fuzziness: التضبيب: + Gamma غاما + Gamut Warning تحذير النطاق اللوني + Gaussian Blur… ضبابية غاوسية… + General عام + Global شامل + Glyphs المحارف + Good جيد + Grab bag مزيج عشوائي + Gradient تدرج + Gradient Tool أداة التدرج + Gradients التدرجات + Grain حبيبات + Grainy Dots نقاط حبيبية + Graphic Pen قلم رسومي + Graphic Styles الأنماط الرسومية + Graphics الرسومات + Gray رمادي + Gray Gamma 2.2 رمادي غاما 2.2 + Grayscale تدرج الرمادي + Green أخضر + Grid الشبكة + Grid Size: حجم الشبكة: + Gridline every خط الشبكة كل + Group تجميع + Group Selection تحديد مجموعة + Group with تجميع مع + Guides خطوط التوجيه + Guides & Grid خطوط الإرشاد والشبكة + Gutter الفاصل بين الأعمدة + Halftone Pattern نقشة أنصاف الألوان + Hand اليد + Hand Tool أداة اليد + Hard صلب + Hard Light ضوء ساطع + Hard Mix مزج صلب + Height الارتفاع + Height: الارتفاع: + Help تعليمات + Hexagon سداسي + Hide إخفاء + Hide Bounding Box إخفاء مربع الإحاطة + Hide Rulers إخفاء المساطر + Hide Transparency Grid إخفاء شبكة الشفافية + High عالٍ + History السجل + History Options… خيارات السجل… + Home الرئيسية + Horizontal أفقي + Hue درجة اللون + Hue/Saturation… درجة اللون/التشبع… + Hyphenate وصل الكلمات + Hyphenation الوصل بالمكspace + Ignore تجاهل + Image صورة + Image Size حجم الصورة + Image Trace تتبع الصورة + Inches بوصات + Info معلومات + Inner Glow… توهج داخلي… + Inside داخل + Install Plug-in… تثبيت مكون إضافي… + Intensity الشدة + Interlaced متشابك + Interpolation الاستيفاء + Intersect تقاطع + Inverse عكس التحديد + Invert عكس + Italic مائل + Join ربط + Join our Discord انضم إلى ديسكورد + Justification الضبط + Keyboard Shortcuts اختصارات لوحة المفاتيح + Keyboard Shortcuts… اختصارات لوحة المفاتيح… + Kind النوع + Knife سكين + Lab Lab + Landscape أفقي + Language اللغة + Language Options خيارات اللغة + Language: اللغة: + Large كبير + Large Tabs علامات تبويب كبيرة + Lasso حبل التحديد + Lasso Tool أداة الحبل + Last الأخير + Last commit آخر إيداع + Layer طبقة + Layers الطبقات + Layers Panel Options خيارات لوحة الطبقات + Leading تباعد الأسطر + Left يسار + Left-to-Right Paragraph Direction اتجاه الفقرة من اليسار إلى اليمين + Left: يسار: + Legal Legal + Length الطول + Length: الطول: + Letter Letter + Levels المستويات + Levels… المستويات… + Libraries المكتبات + Light فاتح + Light Blue أزرق فاتح + Light Direction اتجاه الضوء + Light Gray رمادي فاتح + Lighten تفتيح + Lighting الإضاءة + Lightness الإضاءة + Lights المناطق الفاتحة + Line خط + Line delta صافي الأسطر + Line Segment قطعة مستقيمة + Linear خطي + Linear Gradient تدرج خطي + Lines خطوط + Lines +/− الأسطر +/− + Lines added الأسطر المضافة + Lines deleted الأسطر المحذوفة + Links الارتباطات + Live Paint Bucket دلو التلوين الحي + Location الموقع + Location: الموقع: + Lock قفل + Lock Guides قفل خطوط الإرشاد + Lock Slices قفل الشرائح + Long Lines خطوط طويلة + Long Strokes ضربات طويلة + Low منخفض + Luminosity السطوع + Magenta أرجواني + Magic Wand العصا السحرية + Magic Wand Tool أداة العصا السحرية + Make الشركة المصنعة + Make Clipping Mask إنشاء قناع قطع + Make Compound Path إنشاء مسار مركب + Make Guides إنشاء خطوط إرشاد + Mask قناع + Matte لون الحافة + Maximize تكبير + Maximum الحد الأقصى + Measure قياس + Medium متوسط + Medium Dots نقاط متوسطة + Medium Lines خطوط متوسطة + Medium Strokes ضربات متوسطة + Merge دمج + Merge Layers دمج الطبقات + Merged PRs طلبات السحب المدمجة + Mesh شبكة + Message: الرسالة: + Method الطريقة + Mezzotint… ميزوتينت… + Millimeters مليمترات + Minimize تصغير + Minimum الحد الأدنى + Minus Back طرح الخلفية + Minus Front طرح المقدمة + Mirror مرآة + Miter حادة + Mobile الجوال + Mode الوضع + Mode: الوضع: + Model الطراز + Models النماذج + Modern حديث + Modify تعديل + Monitor RGB RGB الشاشة + Monochromatic أحادي اللون + Monochrome أحادي اللون + Move تحريك + Move Down تحريك لأسفل + Move Panel تحريك اللوحة + Move Up تحريك لأعلى + Multiply مضاعفة + Name الاسم + Name (A–Z) الاسم (أ–ي) + Name: الاسم: + Navigator الملاح + New جديد + New Group مجموعة جديدة + New Group… مجموعة جديدة… + New Layer… طبقة جديدة… + New Set… مجموعة جديدة… + New Swatch… عينة لون جديدة… + New Workspace مساحة عمل جديدة + New Workspace… مساحة عمل جديدة… + New… جديد… + No contributor data was built into this copy. لم يتم تضمين بيانات المساهمين في هذه النسخة. + No Dither بلا ترقيش + No document لا يوجد مستند + No document open لا يوجد مستند مفتوح + No model credits were built into this copy. لم يتم تضمين بيانات الإشادة بالنماذج في هذه النسخة. + Noise تشويش + None بلا + Normal عادي + Note Paper ورق ملاحظات + NTSC Colors ألوان NTSC + Object كائن + Odd Fields حقول فردية + Off إيقاف + Offset إزاحة + OK موافق + Only Web Colors ألوان الويب فقط + Opacity العتامة + Opacity: العتامة: + Open فتح + Open Documents As Tabs فتح المستندات كعلامات تبويب + Open… فتح… + Optimized محسّن + Options الخيارات + Options… خيارات… + Orange برتقالي + Ordinals أرقام ترتيبية + Orientation الاتجاه + Original الأصلي + Other أخرى + Outer Glow… توهج خارجي… + Outline مخطط تفصيلي + Outline Stroke تحديد مسار الحد + Output الإخراج + Output: الإخراج: + Outside خارج + Overlay تراكب + Overlay Edge تراكب الحافة + Overprint طباعة فوقية + Overprint Preview معاينة الطباعة الفوقية + Package… تجميع الحزمة… + Paintbrush فرشاة الطلاء + Panel menu قائمة اللوحة + Panel Options… خيارات اللوحة… + Panels اللوحات + Paragraph فقرة + Paragraph Styles أنماط الفقرات + Paste لصق + Paste in Back لصق في الخلف + Paste in Front لصق في المقدمة + Paste in Place لصق في المكان + Paste on All Artboards لصق على كافة لوحات العمل + Path مسار + Path Eraser ممحاة المسار + Pathfinder مستكشف المسارات + Paths المسارات + Pattern النقشة + Pen القلم + Pen Tool أداة القلم + Pencil قلم رصاص + Pencil Tool أداة القلم الرصاص + Perceptual إدراكي + Performance الأداء + Perspective منظور + Perspective Grid شبكة المنظور + Photocopy نسخ ضوئي + Picas بيكا + Pixel بكسل + Pixel Preview معاينة البكسل + Pixelate بكسلة + Pixels بكسل + Place… إدراج… + Plaster جبس + Plug-ins المكونات الإضافية + Plug-ins & Scratch Disks المكونات الإضافية وأقراص العمل المؤقتة + Point Sample عينة نقطية + Pointillize… تنقيط… + Points نقاط + Polar Grid شبكة قطبية + Polygon مضلع + Polygon Tool أداة المضلع + Portrait عمودي + Position الموضع + Postcard بطاقة بريدية + Preferences التفضيلات + Preserve الاحتفاظ + PRESET DETAILS تفاصيل الإعداد المسبق + Preset Name اسم الإعداد المسبق + Preset: الإعداد المسبق: + Presets إعدادات مسبقة + Presets: الإعدادات المسبقة: + Press keys… اضغط المفاتيح… + Pressure الضغط + Preview معاينة + Print طباعة + Print Tiling تجانب الطباعة + Printer الطابعة + Print… طباعة… + Progressive تدريجي + Proof Colors ألوان المعاينة الطباعية + Proof Setup إعداد المعاينة الطباعية + Properties الخصائص + Public Domain ملكية عامة + Pucker انكماش + Punctuation علامات الترقيم + Puppet Warp التواء الدمية + Purple بنفسجي + Quality الجودة + Quick Actions إجراءات سريعة + Quickly start a new file بدء ملف جديد بسرعة + Radial شعاعي + Radial Blur… ضبابية شعاعية… + Radial Gradient تدرج شعاعي + Radius نصف القطر + Radius: نصف القطر: + Random عشوائي + Range: النطاق: + Rasterize تنقيط + Rasterize… تنقيط… + Ratio النسبة + Real name الاسم الحقيقي + Rearrange All Artboards… إعادة ترتيب كافة لوحات العمل… + Recent الأخيرة + Recent Files الملفات الأخيرة + Recolor Artwork… إعادة تلوين العمل الفني… + Rectangle مستطيل + Rectangle Tool أداة المستطيل + Rectangular Grid شبكة مستطيلة + Red أحمر + Redo إعادة + Reflect انعكاس + Regular عادي + Relative نسبي + Relative Colorimetric قياس لوني نسبي + Release Clipping Mask تحرير قناع القطع + Release Compound Path تحرير المسار المركب + Release Guides تحرير خطوط الإرشاد + Remove إزالة + Remove Anchor Points إزالة نقاط الإرساء + Rename إعادة تسمية + Rename Group… إعادة تسمية المجموعة… + Rename… إعادة تسمية… + Repeat تكرار + Replace استبدال + Reselect إعادة التحديد + Reset إعادة تعيين + Reset Preferences إعادة تعيين التفضيلات + Reset to Default إعادة تعيين إلى الافتراضي + Reshape إعادة تشكيل + Resize panel window تغيير حجم نافذة اللوحة + Resize panels تغيير حجم اللوحات + Resolution: الدقة: + Restore استعادة + Reticulation تشبيك + Reverse Path Direction عكس اتجاه المسار + Reverse the order عكس الترتيب + Revert استعادة + RGB Color ألوان RGB + Right يمين + Right-to-Left Paragraph Direction اتجاه الفقرة من اليمين إلى اليسار + Right: يمين: + Roman روماني + Rotate تدوير + Rotate View تدوير العرض + Rotate View Tool أداة تدوير العرض + Rotation تدوير + Round مستديرة + Rounded Rectangle مستطيل مستدير الزوايا + Roundness: الاستدارة: + Rulers المساطر + Rulers & Grids المساطر والشبكات + Saturate زيادة التشبع + Saturation التشبع + Save حفظ + Save a Copy… حفظ نسخة… + Save As… حفظ باسم… + Save for Web (Legacy)… حفظ للويب (قديم)… + Save Preset… حفظ الإعداد المسبق… + Save Selection حفظ التحديد + Save Selection… حفظ التحديد… + Saved تم الحفظ + Save… حفظ… + Scale تحجيم + Scale Cursor Proportional to UI تحجيم المؤشر بالتناسب مع واجهة المستخدم + Scale: المقياس: + Scallop تسنن + Scatter تبعثر + Scissors مقص + Scratch Disks أقراص التخزين المؤقت + Screen شاشة + Screen Mode وضع الشاشة + Scripts البرامج النصية + Search بحث + Select تحديد + Select All تحديد الكل + Select: التحديد: + Selection تحديد + Selection & Anchor Display التحديد وعرض نقاط الإرساء + Selective انتقائي + Send Backward إرسال للخلف + Send to Back إرسال إلى المؤخرة + Set: المجموعة: + Settings… إعدادات… + Shape شكل + Shape Builder منشئ الأشكال + Shape: الشكل: + Shapes الأشكال + Sharpen زيادة الحدة + Shear إمالة + Shear… قص مائل… + Shift Shift + Short Lines خطوط قصيرة + Short Strokes ضربات قصيرة + Show إظهار + Show All إظهار الكل + Show Bounding Box إظهار مربع الإحاطة + Show Grid إظهار الشبكة + Show Guides إظهار خطوط الإرشاد + Show in Folder إظهار في المجلد + Show Mesh إظهار الشبكة + Show Rulers إظهار المساطر + Show Tool Group Labels إظهار تسميات مجموعات الأدوات + Show Transparency Grid إظهار شبكة الشفافية + Show: إظهار: + Sides: الأضلاع: + Simplify… تبسيط… + Simulate Paper محاكاة الورق + Size الحجم + Size: الحجم: + Skew إمالة + Slice Options… خيارات الشريحة… + Slice Tool أداة الشريحة + Slices الشرائح + Small صغير + Small Caps أحرف استهلالية صغيرة + Smaller ↔ Larger أصغر ↔ أكبر + Smart Blur… ضبابية ذكية… + Smart Guides خطوط الإرشاد الذكية + Smooth تنعيم + Snap to Grid محاذاة إلى الشبكة + Soft ناعم + Soft Light ضوء خافت + Softness النعومة + Solid مصمت + Sort فرز + Spacing التباعد + Spin دوران + Spiral حلزون + Sponge إسفنجة + Spot Color لون موضعي + Square مربع + Stamp ختم + Standard قياسي + Standard Ligatures حروف مركبة قياسية + Star نجمة + Step Backward خطوة للخلف + Step Forward خطوة للأمام + Stop إيقاف + Strength القوة + Strikethrough يتوسطه خط + Stroke الحد + Patterns النقشات + Stroke Options خيارات الحدود + Stroke: حدود: + Style النمط + Stylize تنميط + Subdivisions التقسيمات الفرعية + Subtract طرح + Swash حروف مزخرفة + Swatches عينات الألوان + Symbol Sprayer بخاخ الرموز + Symbols الرموز + System Title Bar شريط عنوان النظام + Table جدول + Tabloid Tabloid + Taper التناقص التدريجي + Target الهدف + Target: الهدف: + Temperature درجة الحرارة + Texture الملمس + Thickness السماكة + Threshold العتبة + Tile تجانب + Tint صبغة + Tolerance التفاوت + Tolerance: التفاوت: + Tool أداة + Tools الأدوات + Top أعلى + Top Left أعلى اليسار + Top Right أعلى اليمين + Top: أعلى: + Torn Edges حواف ممزقة + Total: الإجمالي: + Tracking تباعد الأحرف + Transform تحويل + Transparency الشفافية + Transparent شفاف + Trap… حصر الألوان… + Triangle مثلث + Trim قص الحواف + Twirl دوامة + Twist لف + Type نوع + Type: النوع: + Type… النص… + UI Scaling تحجيم واجهة المستخدم + Underline تسطير + Undo تراجع + Ungroup فك التجميع + Uniform منتظم + Unite توحيد + Units الوحدات + Unknown غير معروف + Unlock All إلغاء قفل الكل + Unsharp Mask… قناع الحدة… + Untitled بدون عنوان + Use Default استخدام الافتراضي + User Interface واجهة المستخدم + Username اسم المستخدم + Variables المتغيرات + Version الإصدار + Vertical عمودي + Vertical Type Tool أداة النص العمودي + Very High عالٍ جدًا + Video فيديو + View عرض + Violet بنفسجي + Visibility الرؤية + W: العرض: + Warp التواء + Water Paper ورق مائي + Wave… موجة… + Weight الوزن + Weight: السمك: + White أبيض + Width العرض + Width: العرض: + Window نافذة + Windows Windows + Working CMYK مساحة عمل CMYK + Workspace مساحة العمل + Wrinkle تجعد + Yellow أصفر + Zoom تكبير/تصغير + Zoom In تكبير + Zoom Out تصغير + Zoom Tool أداة التكبير/التصغير + “{name}” already exists. Replace it? “{name}” موجود بالفعل. هل تريد استبداله؟ +@plural agrees with {n} default shortcut|agrees with {n} default shortcuts يتطابق مع {n} اختصار افتراضي|يتطابق مع {n} اختصار افتراضي|يتطابق مع {n} اختصارين افتراضيين|يتطابق مع {n} اختصارات افتراضية|يتطابق مع {n} اختصارًا افتراضيًا|يتطابق مع {n} اختصار افتراضي +@plural Color Table ({n} color)|Color Table ({n} colors) جدول الألوان ({n} لون)|جدول الألوان ({n} لون)|جدول الألوان ({n} لونين)|جدول الألوان ({n} ألوان)|جدول الألوان ({n} لونًا)|جدول الألوان ({n} لون) +@plural Delete this {n} graphic style?|Delete these {n} graphic styles? هل تريد حذف هذا النمط الرسومي ({n})؟|هل تريد حذف هذا النمط الرسومي ({n})؟|هل تريد حذف هذين النمطين الرسوميين ({n})؟|هل تريد حذف هذه الأنماط الرسومية ({n})؟|هل تريد حذف هذه الأنماط الرسومية ({n})؟|هل تريد حذف هذه الأنماط الرسومية ({n})؟ +@plural {n} area highlighted|{n} areas highlighted {n} منطقة مميزة|{n} منطقة مميزة|{n} منطقتان مميزتان|{n} مناطق مميزة|{n} منطقةً مميزة|{n} منطقة مميزة +@plural {n} color|{n} colors {n} لون|{n} لون|{n} لونين|{n} ألوان|{n} لونًا|{n} لون +@plural {n} commit|{n} commits {n} إيداع|{n} إيداع|{n} إيداعين|{n} إيداعات|{n} إيداعًا|{n} إيداع +@plural {n} fill|{n} fills {n} تعبئة|{n} تعبئة|{n} تعبئتان|{n} تعبئات|{n} تعبئةً|{n} تعبئة +@plural {n} glyph|{n} glyphs {n} محرف|{n} محرف|{n} محرفين|{n} محارف|{n} محرفًا|{n} محرف +@plural {n} item|{n} items {n} عنصر|{n} عنصر|{n} عنصران|{n} عناصر|{n} عنصرًا|{n} عنصر +@plural {n} Layer|{n} Layers {n} طبقة|{n} طبقة|{n} طبقتان|{n} طبقات|{n} طبقةً|{n} طبقة +@plural {n} more export waiting|{n} more exports waiting {n} عملية تصدير أخرى في الانتظار|{n} عملية تصدير أخرى في الانتظار|{n} عمليتا تصدير أخريان في الانتظار|{n} عمليات تصدير أخرى في الانتظار|{n} عملية تصدير أخرى في الانتظار|{n} عملية تصدير أخرى في الانتظار +@plural {n} object highlighted|{n} objects highlighted {n} كائن مميز|{n} كائن مميز|{n} كائنان مميزان|{n} كائنات مميزة|{n} كائنًا مميزًا|{n} كائن مميز +@plural {n} Object|{n} Objects {n} كائن|{n} كائن|{n} كائنان|{n} كائنات|{n} كائنًا|{n} كائن +@plural {n} part of the file wasn't read|{n} parts of the file weren't read لم يتم قراءة {n} جزء من الملف|لم يتم قراءة {n} جزء من الملف|لم يتم قراءة {n} جزءين من الملف|لم يتم قراءة {n} أجزاء من الملف|لم يتم قراءة {n} جزءًا من الملف|لم يتم قراءة {n} جزء من الملف +@plural {n} PR|{n} PRs {n} طلب سحب|{n} طلب سحب|{n} طلبا سحب|{n} طلبات سحب|{n} طلب سحب|{n} طلب سحب +@plural {n} shortcut is assigned more than once|{n} shortcuts are assigned more than once {n} اختصار تم تعيينه أكثر من مرة|{n} اختصار تم تعيينه أكثر من مرة|{n} اختصاران تم تعيينهما أكثر من مرة|{n} اختصارات تم تعيينها أكثر من مرة|{n} اختصارًا تم تعيينه أكثر من مرة|{n} اختصار تم تعيينه أكثر من مرة +@plural {n} star|{n} stars {n} نجمة|{n} نجمة|{n} نجمتان|{n} نجوم|{n} نجمةً|{n} نجمة +@plural {n} step|{n} steps {n} خطوة|{n} خطوة|{n} خطوتان|{n} خطوات|{n} خطوةً|{n} خطوة +@plural {n} stroke|{n} strokes {n} حد|{n} حد|{n} حدان|{n} حدود|{n} حدًا|{n} حد +3d Bevel مشطوفة +3d Light فاتح +3d Solid مصمت +3d Space Space +@msg Opened {url} تم فتح {url} +axis Both كلاهما +axis Horizontal أفقي +axis Vertical عمودي +effect Horizontal أفقي +effect Points نقاط +effect Regular عادي +effect Soft ناعم +effect Vertical عمودي +gradient-kind Radial شعاعي +imageTrace Outline مخطط تفصيلي +lighting Light فاتح +swatch Aqua أزرق مائي +swatch Black أسود +swatch Blue أزرق +swatch Copper نحاسي +swatch Cyan سماوي +swatch Green أخضر +swatch Indigo نيلي +swatch Magenta أرجواني +swatch Orange برتقالي +swatch Purple بنفسجي +swatch Red أحمر +swatch Violet بنفسجي +swatch White أبيض +swatch Yellow أصفر +theme Appearance المظهر + Gap فجوة + Exposure التعريض + Exposure… التعريض… + Desaturate إزالة التشبع + Adjustment تعديل + Brightness/Contrast السطوع/التباين + Hue/Saturation درجة اللون/التشبع diff --git a/crates/ui-egui/src/i18n/tests.rs b/crates/ui-egui/src/i18n/tests.rs index 24c452f944..7cb278ade3 100644 --- a/crates/ui-egui/src/i18n/tests.rs +++ b/crates/ui-egui/src/i18n/tests.rs @@ -160,6 +160,36 @@ fn numbered_labels_translate_the_name_before_the_number() { assert_eq!(numbered_label(Lang::EN, "Grays 12"), "Grays 12"); } +#[test] +fn arabic_resolves_locales_and_preferences() { + let ar = Lang::from_code("ar").expect("ar registered"); + assert_eq!(ar.name(), "العربية"); + assert!(ar.complete_menus()); + assert_eq!(Lang::from_pref("ar"), ar); + for tag in ["ar", "AR", "ar-SA", "ar_EG", "ar_EG.UTF-8", "ar-AE", "ar-MA"] { + assert_eq!(i18n().match_tag(tag), Some(ar), "{tag}"); + } + for (en, want) in [ + ("Artboards", "لوحات العمل"), + ("Swatches", "عينات الألوان"), + ("Stroke", "الحد"), + ("Direct Selection", "تحديد مباشر"), + ("Save As…", "حفظ باسم…"), + ("Undo", "تراجع"), + ] { + assert_eq!(tr(ar, en), want, "{en}"); + } +} + +#[test] +fn arabic_plural_rule_has_six_forms() { + let ar = Lang::from_code("ar").expect("ar registered"); + for (n, want) in [(0, "0 إيداع"), (1, "1 إيداع"), (2, "2 إيداعين"), (3, "3 إيداعات"), (11, "11 إيداعًا"), (100, "100 إيداع")] + { + assert_eq!(trn(ar, n, "{n} commit", "{n} commits"), want, "for n={n}"); + } +} + #[test] fn current_language_is_a_frame_setting() { set_current(ZH()); @@ -711,8 +741,8 @@ fn message_dump_lists_the_reported_messages() { } /// Languages whose catalogs leave [`MENU_KEEP_AS_IS`] in English. -const KEEPS_MENU_NAMES: [&str; 20] = - ["cs", "de", "el", "es", "fr", "hi", "hu", "it", "ja", "ka", "ko", "pl", "pt-br", "ru", "sv", "uk", "vi", "fi", "tr", "ca"]; +const KEEPS_MENU_NAMES: [&str; 21] = + ["cs", "de", "el", "es", "fr", "hi", "hu", "it", "ja", "ka", "ko", "pl", "pt-br", "ru", "sv", "uk", "vi", "fi", "tr", "ca", "ar"]; /// Menu labels the menu-complete catalogs (Czech, German, Spanish, Italian, Japanese, Brazilian Portuguese) show as they are: the product name, a format name, the built-in workspace /// names and the perspective grid presets (names, shown untranslated wherever else they appear). diff --git a/docs/localization-parity.md b/docs/localization-parity.md index 95ed33bf76..697f3ecf06 100644 --- a/docs/localization-parity.md +++ b/docs/localization-parity.md @@ -1,6 +1,6 @@ # Localization parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (Hindi catalog draft complete under the translation tests; contributor loanword terminology reviewed; wider proofreading welcome; Brazilian Portuguese: 154 rows for the strings the sibling catalogs translate — smart-filter and print presets, dimension lines, swatches, canvas messages; previously minor: Bosnian (`bs`): complete catalog; previously minor: Vietnamese text: stacked diacritics tested and attach in every form, #4491; previously: Catalan (`ca`) catalog added, complete under the tests) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-24 · **Change:** minor (Arabic (`ar`): catalog added with Modern Standard Arabic menus, preferences, tools, dialogs, commands and 6-form CLDR plurals; native name العربية; Hindi catalog draft complete under the translation tests; contributor loanword terminology reviewed; wider proofreading welcome; Brazilian Portuguese: 154 rows for the strings the sibling catalogs translate — smart-filter and print presets, dimension lines, swatches, canvas messages; previously minor: Bosnian (`bs`): complete catalog; previously minor: Vietnamese text: stacked diacritics tested and attach in every form, #4491; previously: Catalan (`ca`) catalog added, complete under the tests) Per-language status of VectorCraft's interface. How the catalogs work and how to add a language: [`development.md` › Localisation](development.md#localisation). Part of @@ -35,7 +35,7 @@ Chinese by `imachus`). Georgian and the original Gujarati catalog are recorded a | Spanish | `es` | 4,009 / 4,020 (99.7%) | all (3,770 `@msg` and 55 `@msgplural` rows, counted 2026-11-18: the untranslated report lists 269 messages without a Spanish row, 236 in its own section and 33 that all 24 checked languages lack) | Latin | no | full | — (review) | | Hindi | `hi` | 8,782 rows (2026-11-13): 3,014 `@msg`, 47 `@msgplural`, 41 `@plural`; the untranslated report on main `f793044f83` (2026-11-14) lists 676 missing rows for it: 608 in its own section and 68 that every checked language lacks | menus, dialogs, tooltips and scanned messages; contributor-approved loanword terminology; agent wording pass | UI and document text shape with HarfRust; installed desktop Devanagari fallback, or a `Deva` craft-fonts face; the web fetches Noto Sans Devanagari when the interface needs it | contributor terminology review; 2026-11-13 wording pass on messages and longer labels, and a word-sense pass on short labels, with a glossary-term test; wider proofread welcome | complete catalog, machine-assisted draft | reported missing rows, native review and layout | | Gujarati | `gu` | 4,673 rows (2026-11-14): original 4,286 unchanged; all 387 additions contributor-reviewed and approved | menus and dialogs; status/error messages partial | installed Gujarati fonts on desktop; optional `Gujr` craft-fonts fallback; no Gujarati face in the pinned CI/release fonts or web startup list | original catalog reviewed by a native speaker; all 387 later additions approved by the contributor, with 11 wording corrections | contributor-reviewed catalog | remaining messages and a bundled Gujarati web font | -| Arabic | `ar` | 0 | none | document text: bidi layout and Paragraph Direction; interface: no right-to-left layout, no Arabic shaping in egui | no | none | 25–40 | +| Arabic | `ar` | 873 catalog entries: menus, preferences, tools, dialogs, commands and 6-form CLDR plurals; native Arabic name العربية | menus, dialogs, preferences | Arabic: document text has bidi layout and paragraph direction; interface strings render in Modern Standard Arabic via system fallback fonts; full shell mirroring pending STD-I18N-001 | no (AI-drafted, clean-room) | partial | 15–20 | | French | `fr` | 9,166 rows, 3,436 of them `@msg` and 48 `@msgplural` (counted 2026-11-13): the untranslated report lists 178 missing messages for it | all | Latin | no | full | — (review) | | Portuguese | `pt-br` | 9,378 rows, 3,563 of them `@msg` and 48 `@msgplural` (counted 2026-11-13): the untranslated report lists 55 missing messages for it, which open #7116, #7211, #7330, #7378 and #7405 translate; one/other plurals | all | Latin | contributor is a Brazilian Portuguese speaker; further native review welcome | full | — (review) | | Indonesian | `id` | 7,553 rows, 1,682 of them `@msg` and 49 `@msgplural` (counted 2026-11-15 on `main` at `df984b2a02`): in `COMPLETE_MESSAGES`, and the untranslated report lists 50 missing menu strings, 35 `tl!` literals, 11 undo labels and 1,929 messages for it, the same sets as for Danish; one plural form | most dialogs and tooltips; status and error messages partial | Latin | no | full | — (review) | @@ -101,6 +101,7 @@ font for the web build. | Date | Change | Summary | |---|---|---| +| 2026-11-24 | minor | Arabic (`ar`): catalog added with Modern Standard Arabic menus, preferences, tools, dialogs, commands and 6-form CLDR plurals; registered as twenty-sixth non-English language; native name العربية | | 2026-11-14 | minor | Gujarati (#6613): contributor proofreading completed for all 387 additions, with 11 wording corrections; 4,673 reviewed catalog rows. Status/error messages remain partial; web selection requires a bundled Gujarati face. Scores and estimates unchanged. | | 2026-11-12 | minor | Gujarati (`gu`): reviewed by a native speaker; zero/one singular plurals (CLDR); Gujarati craft-fonts faces join the UI fonts; strings added on main since branching translated (4,286 rows) | | 2026-11-11 | minor | Gujarati (`gu`): 4,235-row machine-assisted interface catalog, one/other plurals, desktop Gujarati font fallback and a glyph-coverage filter; status and error messages not yet translated; native review pending | From bce66603c9ffd56985de4974038db61dc26be619 Mon Sep 17 00:00:00 2001 From: tareq <tareq.halaby@gmail.com> Date: Tue, 24 Nov 2026 17:21:31 +0100 Subject: [PATCH 014/112] refactor(i18n): move Arabic catalog to craft-i18n and keep language wiring in app Move the 873 Arabic translated entries to storytold/craft-i18n#486 under AGENTS.md rule 16, keeping the language registration, 6-form CLDR plural routing, and locale preference tests in VectorCraft. --- crates/ui-egui/src/i18n.rs | 2 +- crates/ui-egui/src/i18n/ar.tsv | 884 +------------------------------ crates/ui-egui/src/i18n/tests.rs | 20 +- docs/localization-parity.md | 2 +- 4 files changed, 9 insertions(+), 899 deletions(-) diff --git a/crates/ui-egui/src/i18n.rs b/crates/ui-egui/src/i18n.rs index 1900d249aa..bd6fb2f56c 100644 --- a/crates/ui-egui/src/i18n.rs +++ b/crates/ui-egui/src/i18n.rs @@ -142,7 +142,7 @@ impl LangExt for Lang { } fn complete_menus(self) -> bool { - self != Lang::EN + self != Lang::EN && self.code() != "ar" } fn from_code(code: &str) -> Option<Lang> { diff --git a/crates/ui-egui/src/i18n/ar.tsv b/crates/ui-egui/src/i18n/ar.tsv index 353f6dd5b9..0920934df4 100644 --- a/crates/ui-egui/src/i18n/ar.tsv +++ b/crates/ui-egui/src/i18n/ar.tsv @@ -2,887 +2,7 @@ # (empty context = a plain UI string; `@id` = a command id; `@plural` = 6 CLDR forms; # `@msg` = a status or error message). # -# Clean-room: written from the meaning of VectorCraft's English labels in Modern Standard Arabic, -# using ordinary vector-illustration vocabulary (لوحة عمل، مسار، نقطة إرساء، حد، -# تعبئة، عينة لون، تدرج، قناع، طبقة). No other application's Arabic localisation -# resource, string table or product UI was consulted or copied; add entries the same way. -# -# Conventions: labels use standard Arabic creative suite terminology. Plural rule (CLDR): -# zero|one|two|few|many|other. Status and error messages (`@msg`) keep the case of their English -# first word. Left in English on purpose (`MENU_KEEP_AS_IS` in the tests): the product name -# (VectorCraft), OpenType, the built-in workspace names and perspective grid presets. -# Every `ar-*` locale (ar-SA, ar-EG, ar-AE, ar-MA, ar-KW, etc.) resolves here. Keep the -# placeholders ({name}), trailing "…" and leading/trailing spaces of fragments exactly as they are. +# Translations are maintained upstream in storytold/craft-i18n (locales/ar/vectorcraft.tsv) +# under AGENTS.md rule 16. @id language.name العربية - % of all commits % من كل الإيداعات - 16 bit 16 بت - 24 bits/pixel 24 بت/بكسل - 32 bits/pixel 32 بت/بكسل - 8 bit 8 بت - About حول - Absolute مطلق - Absolute Colorimetric قياس لوني مطلق - Actions الإجراءات - Activate Panel تنشيط اللوحة - Actual Size الحجم الفعلي - Adaptive تكيفي - Add إضافة - Add Anchor Point إضافة نقطة إرساء - Add Anchor Point Tool أداة إضافة نقطة ارتكاز - Add Anchor Points إضافة نقاط إرساء - Add to Swatches إضافة إلى عينات الألوان - Advanced متقدم - Align محاذاة - All الكل - All Caps جميع الأحرف كبيرة - All Layers كل الطبقات - All Slices كل الشرائح - Alt Alt - Amount المقدار - Amount: المقدار: - Anchor Point نقطة إرساء - Angle الزاوية - Angle: الزاوية: - Anti-alias إزالة التسنن - Anti-Alias إزالة التسنن - Appearance المظهر - Appearance of Black مظهر اللون الأسود - Apply تطبيق - Arc قوس - Arrange ترتيب - Art & Illustration الفن والرسم التوضيحي - Artboard لوح التصميم - Artboard Tool أداة لوحة العمل - Artboards لوحات العمل - ArtCraft Website موقع ArtCraft - ArtCraft website موقع ArtCraft - Aspect Ratio نسبة العرض إلى الارتفاع - Assign Profile… تعيين ملف تعريف… - Attributes السمات - Author: المؤلف: - Auto تلقائي - Auto Color لون تلقائي - Auto-Collapse Iconic Panels طي الألواح الرمزية تلقائيًا - Automate أتمتة - Automatic تلقائي - Average متوسط - Average… توسيط… - Background Contents محتويات الخلفية - Balance التوازن - Baseline خط الأساس - Baseline Optimized أساسي محسّن - Basic أساسي - Batch… دفعة… - Bend: الانحناء: - Best الأفضل - Bevel مشطوفة - Bicubic ثنائي التكعيب - Binary assets added الأصول الثنائية المضافة - Binary assets removed الأصول الثنائية المحذوفة - Bitmap صورة نقطية - Black أسود - Black & White أبيض وأسود - Blend دمج / مزج - Bloat انتفاخ - Blob Brush فرشاة التلطيخ - Blocks كتل - Blue أزرق - Blur ضبابية - Bold غامق - Bottom أسفل - Bottom Left أسفل اليسار - Bottom Right أسفل اليمين - Bottom: أسفل: - Brightness السطوع - Brightness/Contrast… السطوع/التباين… - Brightness: السطوع: - Bring Forward إحضار للأمام - Bring to Front إحضار إلى المقدمة - Brushes الفرش - Cancel إلغاء - Canvas مساحة الرسم - Cascade تتالي - Cell Size حجم الخلية - Center مركز - Centimeters سنتيمترات - Chalk & Charcoal طباشير وفحم - Change تغيير - Change All تغيير الكل - Change Panel Layout تغيير تخطيط اللوحات - Channel قناة - Character حرف - Character Styles أنماط الأحرف - Charcoal فحم - Check Spelling… تدقيق إملائي… - Chrome كروم - Circle دائرة - Classic كلاسيكي - Clear مسح - Clear All مسح الكل - Clear Guides مسح خطوط الإرشاد - Clear History مسح السجل - Clear Recent Files مسح الملفات الأخيرة - Clipboard Handling معالجة الحافظة - Close إغلاق - Close All إغلاق الكل - Close Panel إغلاق اللوحة - Cmd Cmd - CMYK Color ألوان CMYK - Coarse Dots نقاط خشنة - Collapse Panel Group طي مجموعة اللوحات - Color اللون - Color Burn حرق اللون - Color Dodge تفادي اللون - Color Guide دليل الألوان - Color Halftone… أنصاف ألوان… - Color Management إدارة الألوان - Color Mode وضع الألوان - Color Settings… إعدادات الألوان… - Color Table جدول الألوان - Color: اللون: - Colorize تلوين - Colors الألوان - Command الأمر - Commits الإيداعات - Community المجتمع - Company الشركة - Compound Path مسار مركب - Compression الضغط - Contextual Alternates بدائل سياقية - Contrast التباين - Contributors المساهمون - Conté Crayon قلم Conté - Convert to Shape تحويل إلى شكل - Convert to sRGB تحويل إلى sRGB - Cool بارد - Copy نسخ - Copyright حقوق النشر - Copyright and Contact Info حقوق النشر ومعلومات الاتصال - Copyrighted محمي بحقوق النشر - Corner زاوية - Corners الزوايا - Create إنشاء - Create Clipping Mask إنشاء قناع اقتطاع - Create Gradient Mesh… إنشاء شبكة تدرج… - Create Object Mosaic… إنشاء فسيفساء كائن… - Crop اقتصاص - Cross صليب - Crystallize تبلور - Crystallize… تبلور… - Ctrl Ctrl - Current Colors الألوان الحالية - Curvature الانحناء - Curves… المنحنيات… - Custom مخصص - Cut قص - Cyan سماوي - Dark داكن - Darken تغميق - Dash شرطة - Dashed متقطع - Data Sets مجموعات البيانات - De-Interlace… إزالة التشابك… - Decorative زخرفي - Default افتراضي - Delete حذف - Delete Anchor Point حذف نقطة إرساء - Delete Anchor Point Tool أداة حذف نقطة ارتكاز - Delete Brush حذف الفرشاة - Delete Group حذف المجموعة - Delete Layer حذف الطبقة - Delete Workspace حذف مساحة العمل - Depth العمق - Description الوصف - Deselect إلغاء التحديد - Detail التفاصيل - Devices الأجهزة - Diameter: القطر: - Diamond ماسي - Difference فرق - Diffusion الانتشار - Direct Selection تحديد مباشر - Direct Selection Tool أداة التحديد المباشر - Discord Discord - Discretionary Ligatures حروف مركبة اختيارية - Display name الاسم المعروض - Distance المسافة - Distort تشويه - Distortion التشويه - Distribute توزيع - Dither ترقيش - Divide تقسيم - Dock Panel إرساء اللوحة - Document المستند - Document Color Mode نمط ألوان المستند - Document Info معلومات المستند - Document Setup… إعداد المستند… - Don't Save عدم الحفظ - Done تم - Dots نقاط - Draft مسودة - Drop Shadow ظل مسقط - Drop Shadow… ظل مسقط… - Duplicate تكرار - Duplicate Layer تكرار الطبقة - Duplication تكرار - Edge الحافة - Edge Only الحافة فقط - Edit تحرير - Edit Colors تحرير الألوان - Edit Contents تحرير المحتويات - Effect تأثير - Effects التأثيرات - Eliminate إزالة - Ellipse شكل بيضاوي - Ellipse Tool أداة الشكل البيضاوي - Entire Font الخط بالكامل - Eraser ممحاة - Eraser Tool أداة الممحاة - Error خطأ - Even Fields حقول زوجية - Exact دقيق - Exclude استبعاد - Exclusion استبعاد - Exit خروج - Expand توسيع - Expand Appearance توسيع المظهر - Expand… توسيع… - Export تصدير - Export As… تصدير باسم… - Export for Screens… تصدير للشاشات… - Export Presets تصدير الإعدادات المسبقة - Export… تصدير… - Eyedropper قطارة - Eyedropper Tool أداة القطارة - Feather تلاشي الحواف - Feather… تلاشي الحواف… - File ملف - File Handling معالجة الملفات - File Info… معلومات الملف… - Files الملفات - Fill تعبئة - Fill: التعبئة: - Film & Video الأفلام والفيديو - Filter فلتر - Find بحث - Find and Replace… بحث واستبدال… - Find Next بحث عن التالي - Fine Dots نقاط دقيقة - First الأول - First commit أول إيداع - Fit ملاءمة - Fit All in Window ملاءمة الكل في النافذة - Fit Artboard in Window ملاءمة لوحة العمل مع النافذة - Fit in View ملاءمة في العرض - Fit on Screen ملاءمة للشاشة - Fixed ثابت - Flare توهج - Flatten Transparency… تسطيح الشفافية… - Flip قلب - Flip Horizontal قلب أفقي - Flip Vertical قلب عمودي - Float in Window تعويم في نافذة - Float Panel تعويم اللوحة - Folder المجلد - Font الخط - Font Preview Size حجم معاينة الخط - Format التنسيق - Format Options خيارات التنسيق - Fractions كسور - Free حر - Free Transform تحويل حر - Frequency التردد - Full Document المستند الكامل - Full Screen Mode وضع ملء الشاشة - Fuzziness: التضبيب: - Gamma غاما - Gamut Warning تحذير النطاق اللوني - Gaussian Blur… ضبابية غاوسية… - General عام - Global شامل - Glyphs المحارف - Good جيد - Grab bag مزيج عشوائي - Gradient تدرج - Gradient Tool أداة التدرج - Gradients التدرجات - Grain حبيبات - Grainy Dots نقاط حبيبية - Graphic Pen قلم رسومي - Graphic Styles الأنماط الرسومية - Graphics الرسومات - Gray رمادي - Gray Gamma 2.2 رمادي غاما 2.2 - Grayscale تدرج الرمادي - Green أخضر - Grid الشبكة - Grid Size: حجم الشبكة: - Gridline every خط الشبكة كل - Group تجميع - Group Selection تحديد مجموعة - Group with تجميع مع - Guides خطوط التوجيه - Guides & Grid خطوط الإرشاد والشبكة - Gutter الفاصل بين الأعمدة - Halftone Pattern نقشة أنصاف الألوان - Hand اليد - Hand Tool أداة اليد - Hard صلب - Hard Light ضوء ساطع - Hard Mix مزج صلب - Height الارتفاع - Height: الارتفاع: - Help تعليمات - Hexagon سداسي - Hide إخفاء - Hide Bounding Box إخفاء مربع الإحاطة - Hide Rulers إخفاء المساطر - Hide Transparency Grid إخفاء شبكة الشفافية - High عالٍ - History السجل - History Options… خيارات السجل… - Home الرئيسية - Horizontal أفقي - Hue درجة اللون - Hue/Saturation… درجة اللون/التشبع… - Hyphenate وصل الكلمات - Hyphenation الوصل بالمكspace - Ignore تجاهل - Image صورة - Image Size حجم الصورة - Image Trace تتبع الصورة - Inches بوصات - Info معلومات - Inner Glow… توهج داخلي… - Inside داخل - Install Plug-in… تثبيت مكون إضافي… - Intensity الشدة - Interlaced متشابك - Interpolation الاستيفاء - Intersect تقاطع - Inverse عكس التحديد - Invert عكس - Italic مائل - Join ربط - Join our Discord انضم إلى ديسكورد - Justification الضبط - Keyboard Shortcuts اختصارات لوحة المفاتيح - Keyboard Shortcuts… اختصارات لوحة المفاتيح… - Kind النوع - Knife سكين - Lab Lab - Landscape أفقي - Language اللغة - Language Options خيارات اللغة - Language: اللغة: - Large كبير - Large Tabs علامات تبويب كبيرة - Lasso حبل التحديد - Lasso Tool أداة الحبل - Last الأخير - Last commit آخر إيداع - Layer طبقة - Layers الطبقات - Layers Panel Options خيارات لوحة الطبقات - Leading تباعد الأسطر - Left يسار - Left-to-Right Paragraph Direction اتجاه الفقرة من اليسار إلى اليمين - Left: يسار: - Legal Legal - Length الطول - Length: الطول: - Letter Letter - Levels المستويات - Levels… المستويات… - Libraries المكتبات - Light فاتح - Light Blue أزرق فاتح - Light Direction اتجاه الضوء - Light Gray رمادي فاتح - Lighten تفتيح - Lighting الإضاءة - Lightness الإضاءة - Lights المناطق الفاتحة - Line خط - Line delta صافي الأسطر - Line Segment قطعة مستقيمة - Linear خطي - Linear Gradient تدرج خطي - Lines خطوط - Lines +/− الأسطر +/− - Lines added الأسطر المضافة - Lines deleted الأسطر المحذوفة - Links الارتباطات - Live Paint Bucket دلو التلوين الحي - Location الموقع - Location: الموقع: - Lock قفل - Lock Guides قفل خطوط الإرشاد - Lock Slices قفل الشرائح - Long Lines خطوط طويلة - Long Strokes ضربات طويلة - Low منخفض - Luminosity السطوع - Magenta أرجواني - Magic Wand العصا السحرية - Magic Wand Tool أداة العصا السحرية - Make الشركة المصنعة - Make Clipping Mask إنشاء قناع قطع - Make Compound Path إنشاء مسار مركب - Make Guides إنشاء خطوط إرشاد - Mask قناع - Matte لون الحافة - Maximize تكبير - Maximum الحد الأقصى - Measure قياس - Medium متوسط - Medium Dots نقاط متوسطة - Medium Lines خطوط متوسطة - Medium Strokes ضربات متوسطة - Merge دمج - Merge Layers دمج الطبقات - Merged PRs طلبات السحب المدمجة - Mesh شبكة - Message: الرسالة: - Method الطريقة - Mezzotint… ميزوتينت… - Millimeters مليمترات - Minimize تصغير - Minimum الحد الأدنى - Minus Back طرح الخلفية - Minus Front طرح المقدمة - Mirror مرآة - Miter حادة - Mobile الجوال - Mode الوضع - Mode: الوضع: - Model الطراز - Models النماذج - Modern حديث - Modify تعديل - Monitor RGB RGB الشاشة - Monochromatic أحادي اللون - Monochrome أحادي اللون - Move تحريك - Move Down تحريك لأسفل - Move Panel تحريك اللوحة - Move Up تحريك لأعلى - Multiply مضاعفة - Name الاسم - Name (A–Z) الاسم (أ–ي) - Name: الاسم: - Navigator الملاح - New جديد - New Group مجموعة جديدة - New Group… مجموعة جديدة… - New Layer… طبقة جديدة… - New Set… مجموعة جديدة… - New Swatch… عينة لون جديدة… - New Workspace مساحة عمل جديدة - New Workspace… مساحة عمل جديدة… - New… جديد… - No contributor data was built into this copy. لم يتم تضمين بيانات المساهمين في هذه النسخة. - No Dither بلا ترقيش - No document لا يوجد مستند - No document open لا يوجد مستند مفتوح - No model credits were built into this copy. لم يتم تضمين بيانات الإشادة بالنماذج في هذه النسخة. - Noise تشويش - None بلا - Normal عادي - Note Paper ورق ملاحظات - NTSC Colors ألوان NTSC - Object كائن - Odd Fields حقول فردية - Off إيقاف - Offset إزاحة - OK موافق - Only Web Colors ألوان الويب فقط - Opacity العتامة - Opacity: العتامة: - Open فتح - Open Documents As Tabs فتح المستندات كعلامات تبويب - Open… فتح… - Optimized محسّن - Options الخيارات - Options… خيارات… - Orange برتقالي - Ordinals أرقام ترتيبية - Orientation الاتجاه - Original الأصلي - Other أخرى - Outer Glow… توهج خارجي… - Outline مخطط تفصيلي - Outline Stroke تحديد مسار الحد - Output الإخراج - Output: الإخراج: - Outside خارج - Overlay تراكب - Overlay Edge تراكب الحافة - Overprint طباعة فوقية - Overprint Preview معاينة الطباعة الفوقية - Package… تجميع الحزمة… - Paintbrush فرشاة الطلاء - Panel menu قائمة اللوحة - Panel Options… خيارات اللوحة… - Panels اللوحات - Paragraph فقرة - Paragraph Styles أنماط الفقرات - Paste لصق - Paste in Back لصق في الخلف - Paste in Front لصق في المقدمة - Paste in Place لصق في المكان - Paste on All Artboards لصق على كافة لوحات العمل - Path مسار - Path Eraser ممحاة المسار - Pathfinder مستكشف المسارات - Paths المسارات - Pattern النقشة - Pen القلم - Pen Tool أداة القلم - Pencil قلم رصاص - Pencil Tool أداة القلم الرصاص - Perceptual إدراكي - Performance الأداء - Perspective منظور - Perspective Grid شبكة المنظور - Photocopy نسخ ضوئي - Picas بيكا - Pixel بكسل - Pixel Preview معاينة البكسل - Pixelate بكسلة - Pixels بكسل - Place… إدراج… - Plaster جبس - Plug-ins المكونات الإضافية - Plug-ins & Scratch Disks المكونات الإضافية وأقراص العمل المؤقتة - Point Sample عينة نقطية - Pointillize… تنقيط… - Points نقاط - Polar Grid شبكة قطبية - Polygon مضلع - Polygon Tool أداة المضلع - Portrait عمودي - Position الموضع - Postcard بطاقة بريدية - Preferences التفضيلات - Preserve الاحتفاظ - PRESET DETAILS تفاصيل الإعداد المسبق - Preset Name اسم الإعداد المسبق - Preset: الإعداد المسبق: - Presets إعدادات مسبقة - Presets: الإعدادات المسبقة: - Press keys… اضغط المفاتيح… - Pressure الضغط - Preview معاينة - Print طباعة - Print Tiling تجانب الطباعة - Printer الطابعة - Print… طباعة… - Progressive تدريجي - Proof Colors ألوان المعاينة الطباعية - Proof Setup إعداد المعاينة الطباعية - Properties الخصائص - Public Domain ملكية عامة - Pucker انكماش - Punctuation علامات الترقيم - Puppet Warp التواء الدمية - Purple بنفسجي - Quality الجودة - Quick Actions إجراءات سريعة - Quickly start a new file بدء ملف جديد بسرعة - Radial شعاعي - Radial Blur… ضبابية شعاعية… - Radial Gradient تدرج شعاعي - Radius نصف القطر - Radius: نصف القطر: - Random عشوائي - Range: النطاق: - Rasterize تنقيط - Rasterize… تنقيط… - Ratio النسبة - Real name الاسم الحقيقي - Rearrange All Artboards… إعادة ترتيب كافة لوحات العمل… - Recent الأخيرة - Recent Files الملفات الأخيرة - Recolor Artwork… إعادة تلوين العمل الفني… - Rectangle مستطيل - Rectangle Tool أداة المستطيل - Rectangular Grid شبكة مستطيلة - Red أحمر - Redo إعادة - Reflect انعكاس - Regular عادي - Relative نسبي - Relative Colorimetric قياس لوني نسبي - Release Clipping Mask تحرير قناع القطع - Release Compound Path تحرير المسار المركب - Release Guides تحرير خطوط الإرشاد - Remove إزالة - Remove Anchor Points إزالة نقاط الإرساء - Rename إعادة تسمية - Rename Group… إعادة تسمية المجموعة… - Rename… إعادة تسمية… - Repeat تكرار - Replace استبدال - Reselect إعادة التحديد - Reset إعادة تعيين - Reset Preferences إعادة تعيين التفضيلات - Reset to Default إعادة تعيين إلى الافتراضي - Reshape إعادة تشكيل - Resize panel window تغيير حجم نافذة اللوحة - Resize panels تغيير حجم اللوحات - Resolution: الدقة: - Restore استعادة - Reticulation تشبيك - Reverse Path Direction عكس اتجاه المسار - Reverse the order عكس الترتيب - Revert استعادة - RGB Color ألوان RGB - Right يمين - Right-to-Left Paragraph Direction اتجاه الفقرة من اليمين إلى اليسار - Right: يمين: - Roman روماني - Rotate تدوير - Rotate View تدوير العرض - Rotate View Tool أداة تدوير العرض - Rotation تدوير - Round مستديرة - Rounded Rectangle مستطيل مستدير الزوايا - Roundness: الاستدارة: - Rulers المساطر - Rulers & Grids المساطر والشبكات - Saturate زيادة التشبع - Saturation التشبع - Save حفظ - Save a Copy… حفظ نسخة… - Save As… حفظ باسم… - Save for Web (Legacy)… حفظ للويب (قديم)… - Save Preset… حفظ الإعداد المسبق… - Save Selection حفظ التحديد - Save Selection… حفظ التحديد… - Saved تم الحفظ - Save… حفظ… - Scale تحجيم - Scale Cursor Proportional to UI تحجيم المؤشر بالتناسب مع واجهة المستخدم - Scale: المقياس: - Scallop تسنن - Scatter تبعثر - Scissors مقص - Scratch Disks أقراص التخزين المؤقت - Screen شاشة - Screen Mode وضع الشاشة - Scripts البرامج النصية - Search بحث - Select تحديد - Select All تحديد الكل - Select: التحديد: - Selection تحديد - Selection & Anchor Display التحديد وعرض نقاط الإرساء - Selective انتقائي - Send Backward إرسال للخلف - Send to Back إرسال إلى المؤخرة - Set: المجموعة: - Settings… إعدادات… - Shape شكل - Shape Builder منشئ الأشكال - Shape: الشكل: - Shapes الأشكال - Sharpen زيادة الحدة - Shear إمالة - Shear… قص مائل… - Shift Shift - Short Lines خطوط قصيرة - Short Strokes ضربات قصيرة - Show إظهار - Show All إظهار الكل - Show Bounding Box إظهار مربع الإحاطة - Show Grid إظهار الشبكة - Show Guides إظهار خطوط الإرشاد - Show in Folder إظهار في المجلد - Show Mesh إظهار الشبكة - Show Rulers إظهار المساطر - Show Tool Group Labels إظهار تسميات مجموعات الأدوات - Show Transparency Grid إظهار شبكة الشفافية - Show: إظهار: - Sides: الأضلاع: - Simplify… تبسيط… - Simulate Paper محاكاة الورق - Size الحجم - Size: الحجم: - Skew إمالة - Slice Options… خيارات الشريحة… - Slice Tool أداة الشريحة - Slices الشرائح - Small صغير - Small Caps أحرف استهلالية صغيرة - Smaller ↔ Larger أصغر ↔ أكبر - Smart Blur… ضبابية ذكية… - Smart Guides خطوط الإرشاد الذكية - Smooth تنعيم - Snap to Grid محاذاة إلى الشبكة - Soft ناعم - Soft Light ضوء خافت - Softness النعومة - Solid مصمت - Sort فرز - Spacing التباعد - Spin دوران - Spiral حلزون - Sponge إسفنجة - Spot Color لون موضعي - Square مربع - Stamp ختم - Standard قياسي - Standard Ligatures حروف مركبة قياسية - Star نجمة - Step Backward خطوة للخلف - Step Forward خطوة للأمام - Stop إيقاف - Strength القوة - Strikethrough يتوسطه خط - Stroke الحد - Patterns النقشات - Stroke Options خيارات الحدود - Stroke: حدود: - Style النمط - Stylize تنميط - Subdivisions التقسيمات الفرعية - Subtract طرح - Swash حروف مزخرفة - Swatches عينات الألوان - Symbol Sprayer بخاخ الرموز - Symbols الرموز - System Title Bar شريط عنوان النظام - Table جدول - Tabloid Tabloid - Taper التناقص التدريجي - Target الهدف - Target: الهدف: - Temperature درجة الحرارة - Texture الملمس - Thickness السماكة - Threshold العتبة - Tile تجانب - Tint صبغة - Tolerance التفاوت - Tolerance: التفاوت: - Tool أداة - Tools الأدوات - Top أعلى - Top Left أعلى اليسار - Top Right أعلى اليمين - Top: أعلى: - Torn Edges حواف ممزقة - Total: الإجمالي: - Tracking تباعد الأحرف - Transform تحويل - Transparency الشفافية - Transparent شفاف - Trap… حصر الألوان… - Triangle مثلث - Trim قص الحواف - Twirl دوامة - Twist لف - Type نوع - Type: النوع: - Type… النص… - UI Scaling تحجيم واجهة المستخدم - Underline تسطير - Undo تراجع - Ungroup فك التجميع - Uniform منتظم - Unite توحيد - Units الوحدات - Unknown غير معروف - Unlock All إلغاء قفل الكل - Unsharp Mask… قناع الحدة… - Untitled بدون عنوان - Use Default استخدام الافتراضي - User Interface واجهة المستخدم - Username اسم المستخدم - Variables المتغيرات - Version الإصدار - Vertical عمودي - Vertical Type Tool أداة النص العمودي - Very High عالٍ جدًا - Video فيديو - View عرض - Violet بنفسجي - Visibility الرؤية - W: العرض: - Warp التواء - Water Paper ورق مائي - Wave… موجة… - Weight الوزن - Weight: السمك: - White أبيض - Width العرض - Width: العرض: - Window نافذة - Windows Windows - Working CMYK مساحة عمل CMYK - Workspace مساحة العمل - Wrinkle تجعد - Yellow أصفر - Zoom تكبير/تصغير - Zoom In تكبير - Zoom Out تصغير - Zoom Tool أداة التكبير/التصغير - “{name}” already exists. Replace it? “{name}” موجود بالفعل. هل تريد استبداله؟ -@plural agrees with {n} default shortcut|agrees with {n} default shortcuts يتطابق مع {n} اختصار افتراضي|يتطابق مع {n} اختصار افتراضي|يتطابق مع {n} اختصارين افتراضيين|يتطابق مع {n} اختصارات افتراضية|يتطابق مع {n} اختصارًا افتراضيًا|يتطابق مع {n} اختصار افتراضي -@plural Color Table ({n} color)|Color Table ({n} colors) جدول الألوان ({n} لون)|جدول الألوان ({n} لون)|جدول الألوان ({n} لونين)|جدول الألوان ({n} ألوان)|جدول الألوان ({n} لونًا)|جدول الألوان ({n} لون) -@plural Delete this {n} graphic style?|Delete these {n} graphic styles? هل تريد حذف هذا النمط الرسومي ({n})؟|هل تريد حذف هذا النمط الرسومي ({n})؟|هل تريد حذف هذين النمطين الرسوميين ({n})؟|هل تريد حذف هذه الأنماط الرسومية ({n})؟|هل تريد حذف هذه الأنماط الرسومية ({n})؟|هل تريد حذف هذه الأنماط الرسومية ({n})؟ -@plural {n} area highlighted|{n} areas highlighted {n} منطقة مميزة|{n} منطقة مميزة|{n} منطقتان مميزتان|{n} مناطق مميزة|{n} منطقةً مميزة|{n} منطقة مميزة -@plural {n} color|{n} colors {n} لون|{n} لون|{n} لونين|{n} ألوان|{n} لونًا|{n} لون @plural {n} commit|{n} commits {n} إيداع|{n} إيداع|{n} إيداعين|{n} إيداعات|{n} إيداعًا|{n} إيداع -@plural {n} fill|{n} fills {n} تعبئة|{n} تعبئة|{n} تعبئتان|{n} تعبئات|{n} تعبئةً|{n} تعبئة -@plural {n} glyph|{n} glyphs {n} محرف|{n} محرف|{n} محرفين|{n} محارف|{n} محرفًا|{n} محرف -@plural {n} item|{n} items {n} عنصر|{n} عنصر|{n} عنصران|{n} عناصر|{n} عنصرًا|{n} عنصر -@plural {n} Layer|{n} Layers {n} طبقة|{n} طبقة|{n} طبقتان|{n} طبقات|{n} طبقةً|{n} طبقة -@plural {n} more export waiting|{n} more exports waiting {n} عملية تصدير أخرى في الانتظار|{n} عملية تصدير أخرى في الانتظار|{n} عمليتا تصدير أخريان في الانتظار|{n} عمليات تصدير أخرى في الانتظار|{n} عملية تصدير أخرى في الانتظار|{n} عملية تصدير أخرى في الانتظار -@plural {n} object highlighted|{n} objects highlighted {n} كائن مميز|{n} كائن مميز|{n} كائنان مميزان|{n} كائنات مميزة|{n} كائنًا مميزًا|{n} كائن مميز -@plural {n} Object|{n} Objects {n} كائن|{n} كائن|{n} كائنان|{n} كائنات|{n} كائنًا|{n} كائن -@plural {n} part of the file wasn't read|{n} parts of the file weren't read لم يتم قراءة {n} جزء من الملف|لم يتم قراءة {n} جزء من الملف|لم يتم قراءة {n} جزءين من الملف|لم يتم قراءة {n} أجزاء من الملف|لم يتم قراءة {n} جزءًا من الملف|لم يتم قراءة {n} جزء من الملف -@plural {n} PR|{n} PRs {n} طلب سحب|{n} طلب سحب|{n} طلبا سحب|{n} طلبات سحب|{n} طلب سحب|{n} طلب سحب -@plural {n} shortcut is assigned more than once|{n} shortcuts are assigned more than once {n} اختصار تم تعيينه أكثر من مرة|{n} اختصار تم تعيينه أكثر من مرة|{n} اختصاران تم تعيينهما أكثر من مرة|{n} اختصارات تم تعيينها أكثر من مرة|{n} اختصارًا تم تعيينه أكثر من مرة|{n} اختصار تم تعيينه أكثر من مرة -@plural {n} star|{n} stars {n} نجمة|{n} نجمة|{n} نجمتان|{n} نجوم|{n} نجمةً|{n} نجمة -@plural {n} step|{n} steps {n} خطوة|{n} خطوة|{n} خطوتان|{n} خطوات|{n} خطوةً|{n} خطوة -@plural {n} stroke|{n} strokes {n} حد|{n} حد|{n} حدان|{n} حدود|{n} حدًا|{n} حد -3d Bevel مشطوفة -3d Light فاتح -3d Solid مصمت -3d Space Space -@msg Opened {url} تم فتح {url} -axis Both كلاهما -axis Horizontal أفقي -axis Vertical عمودي -effect Horizontal أفقي -effect Points نقاط -effect Regular عادي -effect Soft ناعم -effect Vertical عمودي -gradient-kind Radial شعاعي -imageTrace Outline مخطط تفصيلي -lighting Light فاتح -swatch Aqua أزرق مائي -swatch Black أسود -swatch Blue أزرق -swatch Copper نحاسي -swatch Cyan سماوي -swatch Green أخضر -swatch Indigo نيلي -swatch Magenta أرجواني -swatch Orange برتقالي -swatch Purple بنفسجي -swatch Red أحمر -swatch Violet بنفسجي -swatch White أبيض -swatch Yellow أصفر -theme Appearance المظهر - Gap فجوة - Exposure التعريض - Exposure… التعريض… - Desaturate إزالة التشبع - Adjustment تعديل - Brightness/Contrast السطوع/التباين - Hue/Saturation درجة اللون/التشبع diff --git a/crates/ui-egui/src/i18n/tests.rs b/crates/ui-egui/src/i18n/tests.rs index 7cb278ade3..69daee29cd 100644 --- a/crates/ui-egui/src/i18n/tests.rs +++ b/crates/ui-egui/src/i18n/tests.rs @@ -7,9 +7,9 @@ fn lang(code: &str) -> Lang { Lang::from_code(code).unwrap_or_else(|| panic!("{code} registered")) } -/// The languages that are not English, the source language. +/// The languages that are not English, the source language, and have complete catalogs. fn translated() -> Vec<Lang> { - Lang::all().filter(|l| *l != Lang::EN).collect() + Lang::all().filter(|l| l.complete_menus()).collect() } /// (language, context, English source, the term the language's glossary gives it). One row per @@ -164,21 +164,11 @@ fn numbered_labels_translate_the_name_before_the_number() { fn arabic_resolves_locales_and_preferences() { let ar = Lang::from_code("ar").expect("ar registered"); assert_eq!(ar.name(), "العربية"); - assert!(ar.complete_menus()); + assert!(!ar.complete_menus()); assert_eq!(Lang::from_pref("ar"), ar); for tag in ["ar", "AR", "ar-SA", "ar_EG", "ar_EG.UTF-8", "ar-AE", "ar-MA"] { assert_eq!(i18n().match_tag(tag), Some(ar), "{tag}"); } - for (en, want) in [ - ("Artboards", "لوحات العمل"), - ("Swatches", "عينات الألوان"), - ("Stroke", "الحد"), - ("Direct Selection", "تحديد مباشر"), - ("Save As…", "حفظ باسم…"), - ("Undo", "تراجع"), - ] { - assert_eq!(tr(ar, en), want, "{en}"); - } } #[test] @@ -741,8 +731,8 @@ fn message_dump_lists_the_reported_messages() { } /// Languages whose catalogs leave [`MENU_KEEP_AS_IS`] in English. -const KEEPS_MENU_NAMES: [&str; 21] = - ["cs", "de", "el", "es", "fr", "hi", "hu", "it", "ja", "ka", "ko", "pl", "pt-br", "ru", "sv", "uk", "vi", "fi", "tr", "ca", "ar"]; +const KEEPS_MENU_NAMES: [&str; 20] = + ["cs", "de", "el", "es", "fr", "hi", "hu", "it", "ja", "ka", "ko", "pl", "pt-br", "ru", "sv", "uk", "vi", "fi", "tr", "ca"]; /// Menu labels the menu-complete catalogs (Czech, German, Spanish, Italian, Japanese, Brazilian Portuguese) show as they are: the product name, a format name, the built-in workspace /// names and the perspective grid presets (names, shown untranslated wherever else they appear). diff --git a/docs/localization-parity.md b/docs/localization-parity.md index 697f3ecf06..0e92bec3f1 100644 --- a/docs/localization-parity.md +++ b/docs/localization-parity.md @@ -35,7 +35,7 @@ Chinese by `imachus`). Georgian and the original Gujarati catalog are recorded a | Spanish | `es` | 4,009 / 4,020 (99.7%) | all (3,770 `@msg` and 55 `@msgplural` rows, counted 2026-11-18: the untranslated report lists 269 messages without a Spanish row, 236 in its own section and 33 that all 24 checked languages lack) | Latin | no | full | — (review) | | Hindi | `hi` | 8,782 rows (2026-11-13): 3,014 `@msg`, 47 `@msgplural`, 41 `@plural`; the untranslated report on main `f793044f83` (2026-11-14) lists 676 missing rows for it: 608 in its own section and 68 that every checked language lacks | menus, dialogs, tooltips and scanned messages; contributor-approved loanword terminology; agent wording pass | UI and document text shape with HarfRust; installed desktop Devanagari fallback, or a `Deva` craft-fonts face; the web fetches Noto Sans Devanagari when the interface needs it | contributor terminology review; 2026-11-13 wording pass on messages and longer labels, and a word-sense pass on short labels, with a glossary-term test; wider proofread welcome | complete catalog, machine-assisted draft | reported missing rows, native review and layout | | Gujarati | `gu` | 4,673 rows (2026-11-14): original 4,286 unchanged; all 387 additions contributor-reviewed and approved | menus and dialogs; status/error messages partial | installed Gujarati fonts on desktop; optional `Gujr` craft-fonts fallback; no Gujarati face in the pinned CI/release fonts or web startup list | original catalog reviewed by a native speaker; all 387 later additions approved by the contributor, with 11 wording corrections | contributor-reviewed catalog | remaining messages and a bundled Gujarati web font | -| Arabic | `ar` | 873 catalog entries: menus, preferences, tools, dialogs, commands and 6-form CLDR plurals; native Arabic name العربية | menus, dialogs, preferences | Arabic: document text has bidi layout and paragraph direction; interface strings render in Modern Standard Arabic via system fallback fonts; full shell mirroring pending STD-I18N-001 | no (AI-drafted, clean-room) | partial | 15–20 | +| Arabic | `ar` | registered with 6-form CLDR plurals and native name العربية; translations maintained upstream in `storytold/craft-i18n` (`locales/ar/vectorcraft.tsv`) under AGENTS.md rule 16 | menus, dialogs, preferences | Arabic: document text has bidi layout and paragraph direction; interface strings render in Modern Standard Arabic via system fallback fonts; full shell mirroring pending STD-I18N-001 | no (AI-drafted, clean-room) | partial | 15–20 | | French | `fr` | 9,166 rows, 3,436 of them `@msg` and 48 `@msgplural` (counted 2026-11-13): the untranslated report lists 178 missing messages for it | all | Latin | no | full | — (review) | | Portuguese | `pt-br` | 9,378 rows, 3,563 of them `@msg` and 48 `@msgplural` (counted 2026-11-13): the untranslated report lists 55 missing messages for it, which open #7116, #7211, #7330, #7378 and #7405 translate; one/other plurals | all | Latin | contributor is a Brazilian Portuguese speaker; further native review welcome | full | — (review) | | Indonesian | `id` | 7,553 rows, 1,682 of them `@msg` and 49 `@msgplural` (counted 2026-11-15 on `main` at `df984b2a02`): in `COMPLETE_MESSAGES`, and the untranslated report lists 50 missing menu strings, 35 `tl!` literals, 11 undo labels and 1,929 messages for it, the same sets as for Danish; one plural form | most dialogs and tooltips; status and error messages partial | Latin | no | full | — (review) | From 9838fc1f1cf4a83d710f2cea900cbdc46676294f Mon Sep 17 00:00:00 2001 From: tareq <tareq.halaby@gmail.com> Date: Wed, 25 Nov 2026 08:12:15 +0100 Subject: [PATCH 015/112] refactor(i18n): make Arabic PR preparatory and keep unavailable to users until catalog is consumed - Keep Arabic unavailable in offered_codes, Language picker, and preference resolution - Verify CLDR 6-form plural rule and catalog parsing on custom instance - Update parity docs and leave #7665 open for the catalog consumer PR --- crates/ui-egui/src/i18n.rs | 5 +++-- crates/ui-egui/src/i18n/tests.rs | 24 +++++++++++++----------- docs/localization-parity.md | 2 +- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/crates/ui-egui/src/i18n.rs b/crates/ui-egui/src/i18n.rs index bd6fb2f56c..70d087cfb2 100644 --- a/crates/ui-egui/src/i18n.rs +++ b/crates/ui-egui/src/i18n.rs @@ -74,9 +74,10 @@ static EMBEDDED: &Embedded = &[ /// The codes of [`EMBEDDED`] the interface offers. Browsers cannot use the native installed-font /// fallback, so on the web a language whose text would be missing-glyph boxes (Gujarati without a -/// bundled Gujarati face) is not offered, including when restoring a preference. +/// bundled Gujarati face) is not offered, including when restoring a preference. Arabic is kept +/// unavailable to users until the shared catalog in `storytold/craft-i18n` is consumed. fn offered_codes(web: bool, gujarati_font: bool) -> Vec<&'static str> { - EMBEDDED.iter().map(|(code, ..)| *code).filter(|code| *code != "gu" || !web || gujarati_font).collect() + EMBEDDED.iter().map(|(code, ..)| *code).filter(|code| *code != "ar" && (*code != "gu" || !web || gujarati_font)).collect() } /// The one catalog set of the process, built on first use. diff --git a/crates/ui-egui/src/i18n/tests.rs b/crates/ui-egui/src/i18n/tests.rs index 69daee29cd..ad0f07c5e9 100644 --- a/crates/ui-egui/src/i18n/tests.rs +++ b/crates/ui-egui/src/i18n/tests.rs @@ -161,22 +161,24 @@ fn numbered_labels_translate_the_name_before_the_number() { } #[test] -fn arabic_resolves_locales_and_preferences() { - let ar = Lang::from_code("ar").expect("ar registered"); - assert_eq!(ar.name(), "العربية"); - assert!(!ar.complete_menus()); - assert_eq!(Lang::from_pref("ar"), ar); - for tag in ["ar", "AR", "ar-SA", "ar_EG", "ar_EG.UTF-8", "ar-AE", "ar-MA"] { - assert_eq!(i18n().match_tag(tag), Some(ar), "{tag}"); - } +fn arabic_is_preparatory_and_unavailable_to_users() { + assert_eq!(Lang::from_code("ar"), None); + assert!(!Lang::for_picker().iter().any(|l| l.code() == "ar")); + assert_eq!(Lang::from_pref("ar"), Lang::from_pref("auto")); } #[test] -fn arabic_plural_rule_has_six_forms() { - let ar = Lang::from_code("ar").expect("ar registered"); +fn arabic_plural_rule_and_catalog_infrastructure() { + let (i18n, problems) = I18n::new(EMBEDDED, &["ar"]); + assert!(problems.is_empty(), "{problems:?}"); + let ar = i18n.from_code("ar").expect("ar offered in custom instance"); + assert_eq!(i18n.name(ar), "العربية"); + for tag in ["ar", "AR", "ar-SA", "ar_EG", "ar_EG.UTF-8", "ar-AE", "ar-MA"] { + assert_eq!(i18n.match_tag(tag), Some(ar), "{tag}"); + } for (n, want) in [(0, "0 إيداع"), (1, "1 إيداع"), (2, "2 إيداعين"), (3, "3 إيداعات"), (11, "11 إيداعًا"), (100, "100 إيداع")] { - assert_eq!(trn(ar, n, "{n} commit", "{n} commits"), want, "for n={n}"); + assert_eq!(i18n.trn_plain(ar, n, "{n} commit", "{n} commits"), want, "for n={n}"); } } diff --git a/docs/localization-parity.md b/docs/localization-parity.md index 0e92bec3f1..1a2e2047f0 100644 --- a/docs/localization-parity.md +++ b/docs/localization-parity.md @@ -35,7 +35,7 @@ Chinese by `imachus`). Georgian and the original Gujarati catalog are recorded a | Spanish | `es` | 4,009 / 4,020 (99.7%) | all (3,770 `@msg` and 55 `@msgplural` rows, counted 2026-11-18: the untranslated report lists 269 messages without a Spanish row, 236 in its own section and 33 that all 24 checked languages lack) | Latin | no | full | — (review) | | Hindi | `hi` | 8,782 rows (2026-11-13): 3,014 `@msg`, 47 `@msgplural`, 41 `@plural`; the untranslated report on main `f793044f83` (2026-11-14) lists 676 missing rows for it: 608 in its own section and 68 that every checked language lacks | menus, dialogs, tooltips and scanned messages; contributor-approved loanword terminology; agent wording pass | UI and document text shape with HarfRust; installed desktop Devanagari fallback, or a `Deva` craft-fonts face; the web fetches Noto Sans Devanagari when the interface needs it | contributor terminology review; 2026-11-13 wording pass on messages and longer labels, and a word-sense pass on short labels, with a glossary-term test; wider proofread welcome | complete catalog, machine-assisted draft | reported missing rows, native review and layout | | Gujarati | `gu` | 4,673 rows (2026-11-14): original 4,286 unchanged; all 387 additions contributor-reviewed and approved | menus and dialogs; status/error messages partial | installed Gujarati fonts on desktop; optional `Gujr` craft-fonts fallback; no Gujarati face in the pinned CI/release fonts or web startup list | original catalog reviewed by a native speaker; all 387 later additions approved by the contributor, with 11 wording corrections | contributor-reviewed catalog | remaining messages and a bundled Gujarati web font | -| Arabic | `ar` | registered with 6-form CLDR plurals and native name العربية; translations maintained upstream in `storytold/craft-i18n` (`locales/ar/vectorcraft.tsv`) under AGENTS.md rule 16 | menus, dialogs, preferences | Arabic: document text has bidi layout and paragraph direction; interface strings render in Modern Standard Arabic via system fallback fonts; full shell mirroring pending STD-I18N-001 | no (AI-drafted, clean-room) | partial | 15–20 | +| Arabic | `ar` | registered with 6-form CLDR plurals and native name العربية; translations maintained upstream in `storytold/craft-i18n` (`locales/ar/vectorcraft.tsv`) under AGENTS.md rule 16; preparatory registration kept unavailable in picker until upstream catalog is consumed | menus, dialogs, preferences | Arabic: document text has bidi layout and paragraph direction; interface strings render in Modern Standard Arabic via system fallback fonts; full shell mirroring pending STD-I18N-001 | no (AI-drafted, clean-room) | preparatory | 15–20 | | French | `fr` | 9,166 rows, 3,436 of them `@msg` and 48 `@msgplural` (counted 2026-11-13): the untranslated report lists 178 missing messages for it | all | Latin | no | full | — (review) | | Portuguese | `pt-br` | 9,378 rows, 3,563 of them `@msg` and 48 `@msgplural` (counted 2026-11-13): the untranslated report lists 55 missing messages for it, which open #7116, #7211, #7330, #7378 and #7405 translate; one/other plurals | all | Latin | contributor is a Brazilian Portuguese speaker; further native review welcome | full | — (review) | | Indonesian | `id` | 7,553 rows, 1,682 of them `@msg` and 49 `@msgplural` (counted 2026-11-15 on `main` at `df984b2a02`): in `COMPLETE_MESSAGES`, and the untranslated report lists 50 missing menu strings, 35 `tl!` literals, 11 undo labels and 1,929 messages for it, the same sets as for Danish; one plural form | most dialogs and tooltips; status and error messages partial | Latin | no | full | — (review) | From 2dcedf34fde2458c2ff2e7be6e1378088ef7345d Mon Sep 17 00:00:00 2001 From: tareq <tareq.halaby@gmail.com> Date: Wed, 25 Nov 2026 08:48:08 +0100 Subject: [PATCH 016/112] =?UTF-8?q?docs(i18n):=20align=20localization-pari?= =?UTF-8?q?ty=20Arabic=20row=20with=20preparatory=20PR=20scope=20(AGENTS.m?= =?UTF-8?q?d=20=C2=A715)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/localization-parity.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/localization-parity.md b/docs/localization-parity.md index 1a2e2047f0..60ad923f00 100644 --- a/docs/localization-parity.md +++ b/docs/localization-parity.md @@ -1,6 +1,6 @@ # Localization parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-24 · **Change:** minor (Arabic (`ar`): catalog added with Modern Standard Arabic menus, preferences, tools, dialogs, commands and 6-form CLDR plurals; native name العربية; Hindi catalog draft complete under the translation tests; contributor loanword terminology reviewed; wider proofreading welcome; Brazilian Portuguese: 154 rows for the strings the sibling catalogs translate — smart-filter and print presets, dimension lines, swatches, canvas messages; previously minor: Bosnian (`bs`): complete catalog; previously minor: Vietnamese text: stacked diacritics tested and attach in every form, #4491; previously: Catalan (`ca`) catalog added, complete under the tests) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-25 · **Change:** patch (Arabic (`ar`): preparatory registration and 6-form CLDR plural routing; UI not exposed pending upstream `storytold/craft-i18n` catalog; Hindi catalog draft complete under the translation tests; contributor loanword terminology reviewed; wider proofreading welcome; Brazilian Portuguese: 154 rows for the strings the sibling catalogs translate — smart-filter and print presets, dimension lines, swatches, canvas messages; previously minor: Bosnian (`bs`): complete catalog; previously minor: Vietnamese text: stacked diacritics tested and attach in every form, #4491; previously: Catalan (`ca`) catalog added, complete under the tests) Per-language status of VectorCraft's interface. How the catalogs work and how to add a language: [`development.md` › Localisation](development.md#localisation). Part of @@ -35,7 +35,7 @@ Chinese by `imachus`). Georgian and the original Gujarati catalog are recorded a | Spanish | `es` | 4,009 / 4,020 (99.7%) | all (3,770 `@msg` and 55 `@msgplural` rows, counted 2026-11-18: the untranslated report lists 269 messages without a Spanish row, 236 in its own section and 33 that all 24 checked languages lack) | Latin | no | full | — (review) | | Hindi | `hi` | 8,782 rows (2026-11-13): 3,014 `@msg`, 47 `@msgplural`, 41 `@plural`; the untranslated report on main `f793044f83` (2026-11-14) lists 676 missing rows for it: 608 in its own section and 68 that every checked language lacks | menus, dialogs, tooltips and scanned messages; contributor-approved loanword terminology; agent wording pass | UI and document text shape with HarfRust; installed desktop Devanagari fallback, or a `Deva` craft-fonts face; the web fetches Noto Sans Devanagari when the interface needs it | contributor terminology review; 2026-11-13 wording pass on messages and longer labels, and a word-sense pass on short labels, with a glossary-term test; wider proofread welcome | complete catalog, machine-assisted draft | reported missing rows, native review and layout | | Gujarati | `gu` | 4,673 rows (2026-11-14): original 4,286 unchanged; all 387 additions contributor-reviewed and approved | menus and dialogs; status/error messages partial | installed Gujarati fonts on desktop; optional `Gujr` craft-fonts fallback; no Gujarati face in the pinned CI/release fonts or web startup list | original catalog reviewed by a native speaker; all 387 later additions approved by the contributor, with 11 wording corrections | contributor-reviewed catalog | remaining messages and a bundled Gujarati web font | -| Arabic | `ar` | registered with 6-form CLDR plurals and native name العربية; translations maintained upstream in `storytold/craft-i18n` (`locales/ar/vectorcraft.tsv`) under AGENTS.md rule 16; preparatory registration kept unavailable in picker until upstream catalog is consumed | menus, dialogs, preferences | Arabic: document text has bidi layout and paragraph direction; interface strings render in Modern Standard Arabic via system fallback fonts; full shell mirroring pending STD-I18N-001 | no (AI-drafted, clean-room) | preparatory | 15–20 | +| Arabic | `ar` | preparatory registration (native name العربية) and 6-form CLDR plural probe only; translations maintained upstream in `storytold/craft-i18n` (`locales/ar/vectorcraft.tsv`) and not yet consumed | none (UI not exposed pending shared catalog) | document text: existing bidirectional layout and paragraph direction; interface UI: not exposed pending shared catalog, with full shell mirroring pending STD-I18N-001 | — (preparatory) | preparatory (not exposed) | 15–20 | | French | `fr` | 9,166 rows, 3,436 of them `@msg` and 48 `@msgplural` (counted 2026-11-13): the untranslated report lists 178 missing messages for it | all | Latin | no | full | — (review) | | Portuguese | `pt-br` | 9,378 rows, 3,563 of them `@msg` and 48 `@msgplural` (counted 2026-11-13): the untranslated report lists 55 missing messages for it, which open #7116, #7211, #7330, #7378 and #7405 translate; one/other plurals | all | Latin | contributor is a Brazilian Portuguese speaker; further native review welcome | full | — (review) | | Indonesian | `id` | 7,553 rows, 1,682 of them `@msg` and 49 `@msgplural` (counted 2026-11-15 on `main` at `df984b2a02`): in `COMPLETE_MESSAGES`, and the untranslated report lists 50 missing menu strings, 35 `tl!` literals, 11 undo labels and 1,929 messages for it, the same sets as for Danish; one plural form | most dialogs and tooltips; status and error messages partial | Latin | no | full | — (review) | @@ -101,7 +101,7 @@ font for the web build. | Date | Change | Summary | |---|---|---| -| 2026-11-24 | minor | Arabic (`ar`): catalog added with Modern Standard Arabic menus, preferences, tools, dialogs, commands and 6-form CLDR plurals; registered as twenty-sixth non-English language; native name العربية | +| 2026-11-25 | patch | Arabic (`ar`): preparatory registration and 6-form CLDR plural routing; kept unavailable to users pending upstream `storytold/craft-i18n` catalog | | 2026-11-14 | minor | Gujarati (#6613): contributor proofreading completed for all 387 additions, with 11 wording corrections; 4,673 reviewed catalog rows. Status/error messages remain partial; web selection requires a bundled Gujarati face. Scores and estimates unchanged. | | 2026-11-12 | minor | Gujarati (`gu`): reviewed by a native speaker; zero/one singular plurals (CLDR); Gujarati craft-fonts faces join the UI fonts; strings added on main since branching translated (4,286 rows) | | 2026-11-11 | minor | Gujarati (`gu`): 4,235-row machine-assisted interface catalog, one/other plurals, desktop Gujarati font fallback and a glyph-coverage filter; status and error messages not yet translated; native review pending | From 4f404feb3f604e7f93f0a570b58b8c367f017d65 Mon Sep 17 00:00:00 2001 From: Taha-Mahmoodi <85902429+Taha-Mahmoodi@users.noreply.github.com> Date: Sat, 28 Nov 2026 16:51:19 +0430 Subject: [PATCH 017/112] fix(svg): preserve document units in legacy save dialogs - Keep missing legacy Save and SaveCopy units as Document/None, without changing engine serialization. - Preserve explicit saved units and Export/Export for Screens pixel defaults. - Cover captured SVG output for legacy saves, explicit overrides and Export defaults. --- crates/ui-egui/src/dialogs/screen_formats.rs | 2 +- crates/ui-egui/src/dialogs/svg_options.rs | 75 ++++++++++++++++++-- docs/ui-parity.md | 2 +- 3 files changed, 70 insertions(+), 9 deletions(-) diff --git a/crates/ui-egui/src/dialogs/screen_formats.rs b/crates/ui-egui/src/dialogs/screen_formats.rs index f01bc521ee..5a9d1645b1 100644 --- a/crates/ui-egui/src/dialogs/screen_formats.rs +++ b/crates/ui-egui/src/dialogs/screen_formats.rs @@ -509,7 +509,7 @@ pub(crate) fn settings(ui: &mut Ui, fields: &mut Map<String, Value>, presets: &[ let mine = fields.get("settings").and_then(|all| all.get(id)).and_then(Value::as_object).cloned().unwrap_or_default(); let tiny = mine.get("profile").and_then(Value::as_str) == Some("tiny12"); let params = match id { - "svg" => svg_options::svg_params(true, tiny), + "svg" => svg_options::svg_params(svg_options::Mode::Export, true, tiny), "pdf" => Vec::new(), _ => png_options::raster_params(id, true, None), }; diff --git a/crates/ui-egui/src/dialogs/svg_options.rs b/crates/ui-egui/src/dialogs/svg_options.rs index a48941f5c9..e9fc5a9794 100644 --- a/crates/ui-egui/src/dialogs/svg_options.rs +++ b/crates/ui-egui/src/dialogs/svg_options.rs @@ -56,7 +56,8 @@ const IMAGES: [(&str, &str); 2] = [("embed", "Embed"), ("link", "Link")]; const OBJECT_IDS: [(&str, &str); 3] = [("layerNames", "Layer Names"), ("minimal", "Minimal"), ("unique", "Unique")]; const PROFILES: [(&str, &str); 2] = [("svg11", "SVG 1.1"), ("tiny12", "SVG Tiny 1.2")]; const ENCODINGS: [(&str, &str); 3] = [("utf8", "Unicode (UTF-8)"), ("utf16", "Unicode (UTF-16)"), ("latin1", "ISO 8859-1")]; -const UNITS: [(&str, &str); 5] = [("px", "Pixels"), ("pt", "Points"), ("mm", "Millimeters"), ("cm", "Centimeters"), ("in", "Inches")]; +const UNITS: [(&str, &str); 6] = + [("document", "Document"), ("px", "Pixels"), ("pt", "Points"), ("mm", "Millimeters"), ("cm", "Centimeters"), ("in", "Inches")]; /// Dialog fields that are not SVG options. const UI_KEYS: [&str; 5] = ["mode", "path", "showCode", "allArtboards", "range"]; @@ -73,9 +74,9 @@ pub(crate) struct SvgCodeKey { selected: Option<Vec<vectorcraft_doc::NodeId>>, } -/// The options a first SVG Options dialog starts from: the engine's defaults with Pixels, -/// Internal CSS and Responsive on (as the reference app's Export As starts). Hidden layers are -/// left to the command (Save keeps them, Export leaves them out). +/// The options a first SVG export starts from: the engine's defaults with Pixels, +/// Internal CSS and Responsive on. Saves choose Document unless a remembered unit overrides it. +/// Hidden layers are left to the command (Save keeps them, Export leaves them out). pub(super) fn first_use() -> Map<String, Value> { let opts = vectorcraft_svg::ExportOptions { units: Some(vectorcraft_svg::SizeUnit::Px), ..Default::default() }; let mut m = serde_json::to_value(opts).ok().and_then(|v| v.as_object().cloned()).unwrap_or_default(); @@ -111,6 +112,10 @@ pub(crate) fn open_with(app: &mut VectorcraftApp, mode: Mode, path: Option<&str> fields.extend(o.iter().map(|(k, v)| (k.clone(), v.clone()))); } } + if mode != Mode::Export && saved.as_ref().unwrap_or(&app.ui.svg_options).get("units").is_none() { + // A document's legacy SVG options must not inherit Pixels from the last export. + fields.insert("units".into(), json!("document")); + } fields.insert("allArtboards".into(), json!(true)); fields.insert("range".into(), json!("")); if let Some(p) = path { @@ -148,7 +153,7 @@ fn pairs(key: &str, label: &'static str, choices: &[(&str, &'static str)]) -> Pa /// responsive, `<tspan>`s and metadata. `screens` (Export for Screens' Format Settings) leaves out /// Images and Variable Data: a linked image is another file. `tiny`: SVG Tiny has presentation /// attributes alone and no web fonts. -pub(crate) fn svg_params(screens: bool, tiny: bool) -> Vec<Param> { +pub(crate) fn svg_params(mode: Mode, screens: bool, tiny: bool) -> Vec<Param> { let styling = pairs("styling", tl!("Styling:"), &STYLING); let fonts = ParamKind::radio(FONTS.iter().map(|(v, l)| ((*v).to_string(), tl!(*l).into())).collect(), Some("false".into())); let (lo, hi) = (*vectorcraft_svg::DECIMALS.start() as f64, *vectorcraft_svg::DECIMALS.end() as f64); @@ -164,7 +169,8 @@ pub(crate) fn svg_params(screens: bool, tiny: bool) -> Vec<Param> { rows.push(Param::number("decimals", tl!("Decimal:"), 3.0, 1.0, 0).bounds(Some(lo), Some(hi))); rows.push(pairs("encoding", tl!("Encoding:"), &ENCODINGS)); // Responsive omits width and height, so the unit has nothing to act on. - rows.push(pairs("units", tl!("Units:"), &UNITS).enabled_when("responsive", false)); + let units = if mode == Mode::Export { &UNITS[1..] } else { &UNITS[..] }; + rows.push(pairs("units", tl!("Units:"), units).enabled_when("responsive", false)); rows.push(check("minify", tl!("Minify"), false)); rows.push(check("responsive", tl!("Responsive"), true)); // Embedded fonts need SVG 1.1 and text that stays text. @@ -193,7 +199,7 @@ fn artboard_rows(count: usize) -> Vec<Param> { /// Every row of the dialog for `mode`. Export Selection writes the selection's crop, without /// artboards to choose. fn dialog_params(mode: Mode, selection: bool, count: usize, tiny: bool) -> Vec<Param> { - let mut rows = svg_params(false, tiny); + let mut rows = svg_params(mode, false, tiny); match mode { Mode::Export if !selection => rows.extend(artboard_rows(count)), Mode::Export => {} @@ -215,6 +221,9 @@ fn options(mode: Mode, f: &DialogFields) -> Value { let tiny = f.text("profile") == Some("tiny12"); let mut o = json_of(&dialog_params(mode, false, 1, tiny), f); o.retain(|k, _| !UI_KEYS.contains(&k.as_str()) && !k.starts_with("__")); + if o.get("units").and_then(Value::as_str) == Some("document") { + o.remove("units"); + } if mode == Mode::Export { o.remove("preserveEditing"); if f.bool("useArtboards").unwrap_or(false) { @@ -686,6 +695,58 @@ mod tests { assert!(!svg.contains("mm\"") && svg.contains("viewBox=\"0 0 120 80\""), "{svg}"); } + #[test] + fn legacy_svg_saves_keep_document_units() { + for mode in [Mode::Save, Mode::SaveCopy] { + for last in [json!({"responsive": false}), json!({"responsive": false, "units": "px"})] { + let (mut app, written) = app(); + let original = std::env::temp_dir().join("vc-original.svg").to_string_lossy().replace('\\', "/"); + let path = std::env::temp_dir().join("vc-saved.svg").to_string_lossy().replace('\\', "/"); + app.run("document.setUnits", json!({"units": "millimeters"})).unwrap(); + app.run("file.saveAs", json!({"path": original, "svg": {"responsive": false}})).unwrap(); + let before = vectorcraft_svg::import(&text(&written, 0)).unwrap(); + app.ui.svg_options = last; + start(&mut app, mode, &path, false); + confirm(&mut app); + let after = vectorcraft_svg::import(&text(&written, 1)).unwrap(); + assert_eq!(after.units, vectorcraft_doc::Unit::Millimeters, "{mode:?}: {}", text(&written, 1)); + let (a, b) = (before.artboards[0].rect, after.artboards[0].rect); + assert!((a.width() - b.width()).abs() < 1e-6 && (a.height() - b.height()).abs() < 1e-6, "{mode:?}: {a:?} -> {b:?}"); + let expected = if mode == Mode::SaveCopy { &original } else { &path }; + assert_eq!(app.session.active().unwrap().path.as_deref(), Some(expected.as_str())); + } + } + } + + #[test] + fn svg_saves_keep_explicit_units_and_allow_pixel_overrides() { + for mode in [Mode::Save, Mode::SaveCopy] { + let (mut app, written) = app(); + let path = std::env::temp_dir().join("vc-explicit.svg").to_string_lossy().replace('\\', "/"); + app.run("document.setUnits", json!({"units": "millimeters"})).unwrap(); + app.run("file.saveAs", json!({"path": path, "svg": {"responsive": false, "units": "in"}})).unwrap(); + app.ui.svg_options = json!({"responsive": false, "units": "px"}); + start(&mut app, mode, &path, false); + confirm(&mut app); + assert_eq!(vectorcraft_svg::import(&text(&written, 1)).unwrap().units, vectorcraft_doc::Unit::Inches); + start(&mut app, mode, &path, false); + set(&mut app, "units", json!("px")); + confirm(&mut app); + assert_eq!(vectorcraft_svg::import(&text(&written, 2)).unwrap().units, vectorcraft_doc::Unit::Pixels); + } + } + + #[test] + fn svg_export_keeps_pixels_when_legacy_options_omit_units() { + let (mut app, written) = app(); + let path = std::env::temp_dir().join("vc-export.svg").to_string_lossy().replace('\\', "/"); + app.run("document.setUnits", json!({"units": "millimeters"})).unwrap(); + app.ui.svg_options = json!({"responsive": false}); + start(&mut app, Mode::Export, &path, false); + confirm(&mut app); + assert_eq!(vectorcraft_svg::import(&text(&written, 0)).unwrap().units, vectorcraft_doc::Unit::Pixels); + } + /// OK with a range the document lacks keeps the dialog open with the reason, writes nothing and /// remembers nothing. #[test] diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 0b6caef602..df3ebfe937 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -2,7 +2,7 @@ > **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-20 · **Change:** minor (Pencil Edit Selected Paths follows lifted strokes, carves, loops, closes and redraws compound paths; Layers: a targeted item with an appearance of its own keeps its inner ring visible around a smaller appearance dot, so the target circle's four looks differ, #8711; scores and estimates unchanged; previously: G12: Asset Export tile context menus; scores and estimates unchanged; previously: Properties panel per context (G12): contextual text Quick Actions (Create Outlines, Retype, Find and Replace…); scores and estimates unchanged; previously: Layers: a targeted item with an appearance of its own keeps its inner ring visible around a smaller appearance dot, so the target circle's four looks differ, #8711; scores and estimates unchanged; previously: Trim View hides the ruler guides, guide paths and the grid while it is on and greys out Show/Hide Guides and Show/Hide Grid, #8363; scores and estimates unchanged; previously: Scissors shows the actual proposed cut point while hovering, using its existing snapping and cut target (#8655); scores and estimates unchanged; previously: Graphic Styles panel: right-click item context menu for tiles and rows with Options, Duplicate, Delete, Redefine, Break Link; scores and estimates unchanged; previously: Artboard tool: Shift held once a move or Alt-copy drag is under way keeps it to the level, upright or 45° line, #8580; scores and estimates unchanged; previously: Image Trace Ignore Color keeps the canvas View and stays armed on a missed pixel (#8068); Canvas context menu: a right-click on a path offers Simplify… next to Smooth…, opening the Simplify slider, or the Simplify dialog kept for next time, as Object › Path › Simplify… does, #8344; scores and estimates unchanged; previously: a tool drag held near an edge of the canvas scrolls the view, #8551; scores and estimates unchanged; previously: G12: Place: show progress window with Cancel for slow placed files exceeding 0.4 s, part of #5930; scores and estimates unchanged; previously: All Tools drawer: a tool the toolbar holds is dimmed in the readable dim text colour, not the disabled colour that was unreadable against the panel, and a hovered dimmed row takes the panel's darker fill so it stays readable, #8294; scores and estimates unchanged; previously: : selected guide rows stay highlighted after the pointer leaves (#7344); scores and estimates unchanged; previously: Layersselected Dimension extension-line color and weight in Properties (#7078; four focused UI regressions passed); scores and estimates unchanged; previously: Brush Options Key Color: restore canvas input for the existing one-shot pick, then resume the retained draft and previous tool (#8284; six full-app input regressions passed); scores and estimates unchanged; previously: Ellipse: Up/Down changes Anchors while drawing (#7840); scores and estimates unchanged; previously: Windows/Linux menu access keys and localized cues (#6596); previously: Backquote/~ arrow pattern nudges (#7717); scores and estimates unchanged; previously: Window > Toolbars > Compact Tools offers optional denser main Tools spacing (#7234); default layout, scores and estimates unchanged; previously: Direct Selection: Space during an ordinary path's handle drag repositions its anchor and handles, including a Pen loan (#7237, request 3 only; scores and estimates unchanged); previously: Floating panels keep their window level while focus moves between the app's windows, so a press on one panel's bar no longer hands the keyboard to another, #6986; scores and estimates unchanged; previously minor: Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) leaves out paths made into guides inside groups and compound paths too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; an enclosing marquee measures a group without its locked or hidden guides, and Direct Selection takes no anchor or segment of a guide that can't be picked; a guide in a group still moves with its group (#8538); scores and estimates unchanged; previously: Production Preflight: output-aware fonts, text overflow, linked files and effective image resolution, clickable findings and automatic rechecking; scores and estimates unchanged; previously: Layers panel: an Alt-drag copies a row above or below itself, so the top layer dragged up, the bottom layer dragged down and a lone layer are copied, #8237; scores and estimates unchanged; previously: Layers panel: Alt over the list shows the copy cursor while rows or the selected-art square are dragged, #8217; scores and estimates unchanged; previously: Gradient panel: the add-stop strip under the ramp shows the white arrow with a plus on Windows and X11, #8241; scores and estimates unchanged; previously: Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: Eraser review: hidden Rasterize and Along/Across stroke rows do not block preserving visible gradients; scores and estimates unchanged; previously: Eraser review: ordinary Group/Layer paints and reproducible evaluated gradient placements are preserved; other placements retain existing fitting; scores and estimates unchanged; previously: Eraser: shared fill-only area cutting for fixed and varied tips and the Alt-drag marquee, #6582; scores and estimates unchanged; previously: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: Pencil continuation, straight-line and closing cursors; scores and estimates unchanged; previously: Graphic Styles list fills a taller panel, #2992; scores and estimates unchanged; previously: library panels' lists fill a taller panel, #2992; scores and estimates unchanged; previously: Swatches list fills a taller panel, #1638; scores and estimates unchanged; previously: icon-strip flyouts also resize from the top edge and the canvas-side top corner, keeping the moved top in workspaces (storytold/craft-libs#1094); scores and estimates unchanged; previously: macOS: the canvas cursor stays after the pointer moves, #6362; scores and estimates unchanged; previously minor: Remove Background in the Contextual Task Bar, Properties › Quick Actions and the Control bar; previously minor: Ruler origin: the corner drag snaps as a drawn point does; previously minor: Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: Outline view: images and gradient meshes are picked on what Outline draws, so a click inside them reaches the path behind, #6437; previously minor: a middle-click on a document tab closes it, #6506; previously minor: Blob Brush: a round tip's preview is the outline of the area it adds, round at both ends, as the stroke it commits (#4343); scores and estimates unchanged; previously:; ruler double-click adds a guide at the pointer, #5239; G5: Inventory Icons built-in symbol library (four built-ins); previously minor: files that record no units open in Preferences › Units › General, #5820; previously minor: interim macOS cursor delivery, #2292; native validation pending; scores and estimates unchanged; Control bar › Snapping includes the existing Snap to Glyph and Alignment Guides toggles (#6164); scores and estimates unchanged; floating tab groups collapse into the side icon rail and opened rail panels fold back into it, #5925 in part; numeric fields step on wheel hover without taking keyboard focus, #5949; Character Styles panel: a double-click on a style's row opens its Character Style Options; the dialog keeps a fixed width and scrolls its sections, so its buttons stay on screen; Selection QoL: marquee modes and visible feedback, #5313; #3380 deletion-only review follow-up: independent survivors keep gradient placement, owned subpaths avoid discarded copies, and contracts/status/evidence are clarified; endpoint highlighting remains open; scores and estimates unchanged; Drop Shadow and glow dialogs: spinner arrows, #5367, #5368; Stroke Weight Up and Down shortcuts, #5797; Layers: Rename (`ui.rename`) opens the name field of the selected layer, group or object, #5324; Properties in Edit Artboards: Transform section above the Artboards section, #5219; scrubby labels: the Control bar's Stroke: and Opacity: links and the Properties panel's Stroke link scrub their fields, #4088; Properties: Quick Actions has Repeat Options for one selected repeat, #5181; Direct Selection: Shift-click picks several blend spine points, which drag together, #5285; Direct Selection: Cmd/Ctrl held lends the Selection tool and shows its bounding box, #3901; Join tool trims two crossing open paths and joins them at the crossing, #5844; Control bar: Paragraph: link and Align left/center/right while type is selected, #5372; shape tools: a press on the selection's centre point moves it and one in the rotate zone outside a box corner turns it, #5477; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; Units › East Asian Type acts, with Q and Ha units; scores unchanged) > -> SVG Options can write physical dimensions with Responsive off and a physical unit selected (#4462); pixel output remains bare numbers. +> SVG Options can write physical dimensions with Responsive off and a physical unit selected (#4462); pixel output remains bare numbers. Save As and Save a Copy offer Document units and preserve an existing SVG's physical units when legacy saved options omit a unit; Export keeps its Pixels default. > > Tech Circuit update (2026-11-14): three original procedural brushes; ten built-in brush libraries (G5). > From 60d16a5561581933565a5735c11dd7afbadb52c7 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Sat, 28 Nov 2026 22:20:43 -0800 Subject: [PATCH 018/112] Quick Pen: the arc-size wheel reads the framework's gesture, held keys and modal mark The Ctrl-wheel arc size now reads everything from the canvas's share of the craft wheel: its lines, its gesture's motion, the keys held during the gesture (held) and whether a modal layer held the turn (modal). The tool keeps no wheel timers or raw-event reads of its own. A turn the app's own modal window was up for stays muted until the framework starts a new gesture. Zoom-modifier motion adds both axes, as the zoom factor does. Pins craft-libs to the head of storytold/craft-libs#4220, which adds Wheel::held and Wheel::modal. --- Cargo.lock | 170 +++++++-------- Cargo.toml | 70 +++---- apps/vectorcraft-web/Cargo.toml | 2 +- crates/ui-egui/src/canvas.rs | 2 +- crates/ui-egui/src/canvas/quick_pen_wheel.rs | 209 +++++++------------ 5 files changed, 194 insertions(+), 259 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 520647b95d..74557685f6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1239,7 +1239,7 @@ dependencies = [ [[package]] name = "craft" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "craft-automation", "craft-behavior", @@ -1280,7 +1280,7 @@ dependencies = [ [[package]] name = "craft-affinity" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "crc32fast", "flate2", @@ -1291,7 +1291,7 @@ dependencies = [ [[package]] name = "craft-appkit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "block2 0.6.2", "objc2 0.6.5", @@ -1302,7 +1302,7 @@ dependencies = [ [[package]] name = "craft-atomic" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "rustix 1.1.6", ] @@ -1310,7 +1310,7 @@ dependencies = [ [[package]] name = "craft-automation" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -1335,7 +1335,7 @@ dependencies = [ [[package]] name = "craft-behavior" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "accesskit", "bitflags 2.13.2", @@ -1353,7 +1353,7 @@ dependencies = [ [[package]] name = "craft-browse" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "craft-behavior", "craft-docpath", @@ -1371,7 +1371,7 @@ dependencies = [ [[package]] name = "craft-cdr" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "crc32fast", "flate2", @@ -1380,7 +1380,7 @@ dependencies = [ [[package]] name = "craft-cloud-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "egui", ] @@ -1388,7 +1388,7 @@ dependencies = [ [[package]] name = "craft-cms" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "md-5", "rayon", @@ -1397,12 +1397,12 @@ dependencies = [ [[package]] name = "craft-codepage" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" [[package]] name = "craft-color-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "craft-behavior", "craft-cms", @@ -1422,7 +1422,7 @@ dependencies = [ [[package]] name = "craft-control" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "craft-control-protocol", "craft-platform", @@ -1433,7 +1433,7 @@ dependencies = [ [[package]] name = "craft-control-protocol" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "getrandom 0.3.4", "serde_json", @@ -1443,7 +1443,7 @@ dependencies = [ [[package]] name = "craft-dds" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "rayon", ] @@ -1451,7 +1451,7 @@ dependencies = [ [[package]] name = "craft-dialogs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "block2 0.6.2", "craft-appkit", @@ -1477,7 +1477,7 @@ dependencies = [ [[package]] name = "craft-doc" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "blake3", "craft-ecproj-format", @@ -1493,7 +1493,7 @@ dependencies = [ [[package]] name = "craft-docpath" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "serde", ] @@ -1501,7 +1501,7 @@ dependencies = [ [[package]] name = "craft-draw" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1520,7 +1520,7 @@ dependencies = [ [[package]] name = "craft-dxf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "craft-codepage", "encoding_rs", @@ -1532,7 +1532,7 @@ dependencies = [ [[package]] name = "craft-ecproj-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "serde", "serde_json", @@ -1542,12 +1542,12 @@ dependencies = [ [[package]] name = "craft-eps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "fontique", "harfrust 0.13.3", @@ -1562,7 +1562,7 @@ dependencies = [ [[package]] name = "craft-font-manager" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -1581,7 +1581,7 @@ dependencies = [ [[package]] name = "craft-font-os-windows" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "windows-registry", "windows-sys 0.61.2", @@ -1590,7 +1590,7 @@ dependencies = [ [[package]] name = "craft-font-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "cap-primitives", "craft-atomic", @@ -1613,12 +1613,12 @@ dependencies = [ [[package]] name = "craft-fonts-build" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" [[package]] name = "craft-gif" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "gif", ] @@ -1626,7 +1626,7 @@ dependencies = [ [[package]] name = "craft-gzip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "flate2", ] @@ -1634,7 +1634,7 @@ dependencies = [ [[package]] name = "craft-host" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "bitflags 2.13.2", "craft-i18n", @@ -1647,7 +1647,7 @@ dependencies = [ [[package]] name = "craft-i18n" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "chrono", "fixed_decimal", @@ -1675,7 +1675,7 @@ dependencies = [ [[package]] name = "craft-image-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "craft-dds", "craft-jpeg", @@ -1702,7 +1702,7 @@ dependencies = [ [[package]] name = "craft-imaging" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1720,7 +1720,7 @@ dependencies = [ [[package]] name = "craft-jpeg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "thiserror 2.0.21", ] @@ -1728,7 +1728,7 @@ dependencies = [ [[package]] name = "craft-jxl" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "brotli-decompressor 5.0.3", "jixel", @@ -1739,7 +1739,7 @@ dependencies = [ [[package]] name = "craft-keymap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "craft-host", "craft-i18n", @@ -1754,7 +1754,7 @@ dependencies = [ [[package]] name = "craft-layers" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "craft-behavior", "craft-i18n", @@ -1768,7 +1768,7 @@ dependencies = [ [[package]] name = "craft-menu" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "craft-behavior", "craft-host", @@ -1786,7 +1786,7 @@ dependencies = [ [[package]] name = "craft-metadata" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "brotli-decompressor 6.3.2", "chrono", @@ -1798,7 +1798,7 @@ dependencies = [ [[package]] name = "craft-metafile" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "encoding_rs", "image", @@ -1809,7 +1809,7 @@ dependencies = [ [[package]] name = "craft-mime" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "chrono", "craft-codepage", @@ -1819,7 +1819,7 @@ dependencies = [ [[package]] name = "craft-pages" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "craft-behavior", "craft-keymap", @@ -1835,7 +1835,7 @@ dependencies = [ [[package]] name = "craft-pcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "flate2", "serde", @@ -1846,7 +1846,7 @@ dependencies = [ [[package]] name = "craft-pdf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "hayro-interpret", "hayro-syntax", @@ -1858,7 +1858,7 @@ dependencies = [ [[package]] name = "craft-platform" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "async-channel", "async-io", @@ -1889,7 +1889,7 @@ dependencies = [ [[package]] name = "craft-plotter" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "kurbo 0.13.1", "thiserror 2.0.21", @@ -1898,7 +1898,7 @@ dependencies = [ [[package]] name = "craft-print" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "craft-behavior", "craft-host", @@ -1922,7 +1922,7 @@ dependencies = [ [[package]] name = "craft-proof" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "log", "miniz_oxide 0.9.1", @@ -1933,7 +1933,7 @@ dependencies = [ [[package]] name = "craft-ps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "craft-eps", "flate2", @@ -1947,7 +1947,7 @@ dependencies = [ [[package]] name = "craft-psd" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "encoding_rs", "flate2", @@ -1958,7 +1958,7 @@ dependencies = [ [[package]] name = "craft-quit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "dispatch2", "egui", @@ -1971,7 +1971,7 @@ dependencies = [ [[package]] name = "craft-review" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -1990,7 +1990,7 @@ dependencies = [ [[package]] name = "craft-settings" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "craft-atomic", "craft-host", @@ -2007,7 +2007,7 @@ dependencies = [ [[package]] name = "craft-stream-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "fax", "hayro-ccitt", @@ -2018,7 +2018,7 @@ dependencies = [ [[package]] name = "craft-svg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "craft-image-codecs", "craft-xml", @@ -2039,7 +2039,7 @@ dependencies = [ [[package]] name = "craft-table" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "craft-behavior", "craft-keymap", @@ -2051,7 +2051,7 @@ dependencies = [ [[package]] name = "craft-text" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "craft-behavior", "craft-font-manager", @@ -2076,7 +2076,7 @@ dependencies = [ [[package]] name = "craft-theme" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "bitflags 2.13.2", "craft-tracked", @@ -2091,7 +2091,7 @@ dependencies = [ [[package]] name = "craft-theme-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "craft-atomic", "craft-behavior", @@ -2106,7 +2106,7 @@ dependencies = [ [[package]] name = "craft-tiff" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "serde", "thiserror 2.0.21", @@ -2116,7 +2116,7 @@ dependencies = [ [[package]] name = "craft-time" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "serde", "thiserror 2.0.21", @@ -2125,7 +2125,7 @@ dependencies = [ [[package]] name = "craft-timeline" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "craft-behavior", "craft-keymap", @@ -2140,12 +2140,12 @@ dependencies = [ [[package]] name = "craft-tracked" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" [[package]] name = "craft-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "craft-cloud-ui", "craft-ui-canvas", @@ -2159,7 +2159,7 @@ dependencies = [ [[package]] name = "craft-ui-canvas" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "craft-behavior", "craft-i18n", @@ -2175,7 +2175,7 @@ dependencies = [ [[package]] name = "craft-ui-contract" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "accesskit", "craft-behavior", @@ -2213,7 +2213,7 @@ dependencies = [ [[package]] name = "craft-ui-macros" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2224,7 +2224,7 @@ dependencies = [ [[package]] name = "craft-ui-panels" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "craft-behavior", "craft-host", @@ -2242,7 +2242,7 @@ dependencies = [ [[package]] name = "craft-ui-patterns" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "craft-behavior", "craft-host", @@ -2263,7 +2263,7 @@ dependencies = [ [[package]] name = "craft-ui-shell" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "craft-behavior", "craft-host", @@ -2284,7 +2284,7 @@ dependencies = [ [[package]] name = "craft-ui-widgets" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "craft-behavior", "craft-host", @@ -2303,7 +2303,7 @@ dependencies = [ [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "base64 0.22.1", "chrono", @@ -2335,7 +2335,7 @@ dependencies = [ [[package]] name = "craft-vectorcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "flate2", "serde", @@ -2346,7 +2346,7 @@ dependencies = [ [[package]] name = "craft-wayland" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "raw-window-handle", "wayland-backend", @@ -2356,7 +2356,7 @@ dependencies = [ [[package]] name = "craft-web-api" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "js-sys", "serde_json", @@ -2367,7 +2367,7 @@ dependencies = [ [[package]] name = "craft-win32" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "winsafe", ] @@ -2375,7 +2375,7 @@ dependencies = [ [[package]] name = "craft-window" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "craft-appkit", "craft-atomic", @@ -2407,7 +2407,7 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "quick-xml 0.41.0", "serde", @@ -3762,7 +3762,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a" [[package]] name = "hayro-cmap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "brotli", "hayro-postscript", @@ -3771,7 +3771,7 @@ dependencies = [ [[package]] name = "hayro-interpret" version = "0.7.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "bitflags 2.13.2", "hayro-cmap", @@ -3789,7 +3789,7 @@ dependencies = [ [[package]] name = "hayro-jbig2" version = "0.3.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "fearless_simd", "hayro-ccitt", @@ -3807,12 +3807,12 @@ dependencies = [ [[package]] name = "hayro-postscript" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" [[package]] name = "hayro-syntax" version = "0.7.2" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "flate2", "hayro-ccitt", @@ -4795,7 +4795,7 @@ dependencies = [ [[package]] name = "krilla" version = "0.8.2" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "base64 0.22.1", "bumpalo", @@ -4952,7 +4952,7 @@ checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" [[package]] name = "linesweeper" version = "0.5.0" -source = "git+https://github.com/storytold/craft-libs?rev=610c86792a02aa3d416926ee44e3ec3788dea853#610c86792a02aa3d416926ee44e3ec3788dea853" +source = "git+https://github.com/storytold/craft-libs?rev=bb7cc548d286085f2d288445123ec3679248da86#bb7cc548d286085f2d288445123ec3679248da86" dependencies = [ "arrayvec", "kurbo 0.13.1", diff --git a/Cargo.toml b/Cargo.toml index a0fb986dcc..07d9278067 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,46 +11,46 @@ rust-version = "1.95" repository = "https://github.com/storytold/vectorcraft" [workspace.dependencies] -craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "610c86792a02aa3d416926ee44e3ec3788dea853" } -craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "610c86792a02aa3d416926ee44e3ec3788dea853", default-features = false, features = ["interpret", "write"] } -craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "610c86792a02aa3d416926ee44e3ec3788dea853" } -craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "610c86792a02aa3d416926ee44e3ec3788dea853" } +craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "bb7cc548d286085f2d288445123ec3679248da86" } +craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "bb7cc548d286085f2d288445123ec3679248da86", default-features = false, features = ["interpret", "write"] } +craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "bb7cc548d286085f2d288445123ec3679248da86" } +craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "bb7cc548d286085f2d288445123ec3679248da86" } # The `.vectorcraft` envelope: its members, version, embedded images and the data after the JSON. -craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "610c86792a02aa3d416926ee44e3ec3788dea853" } -craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "610c86792a02aa3d416926ee44e3ec3788dea853" } +craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "bb7cc548d286085f2d288445123ec3679248da86" } +craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "bb7cc548d286085f2d288445123ec3679248da86" } # `.pcraft` documents: their manifest, full-size composite, preview, layer pixels and ICC profile. -craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "610c86792a02aa3d416926ee44e3ec3788dea853", features = ["pcraft-pixels"] } +craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "bb7cc548d286085f2d288445123ec3679248da86", features = ["pcraft-pixels"] } # Native Affinity documents (craft-libs#914). -craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "610c86792a02aa3d416926ee44e3ec3788dea853" } +craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "bb7cc548d286085f2d288445123ec3679248da86" } # Bounded CDR (v1-v27) and CMX (32-bit) reader (craft-libs#778). -craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "610c86792a02aa3d416926ee44e3ec3788dea853" } +craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "bb7cc548d286085f2d288445123ec3679248da86" } # SVG parsing, limits, SVGZ and writer (craft-libs#778). -craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "610c86792a02aa3d416926ee44e3ec3788dea853", features = ["tree"] } -craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "610c86792a02aa3d416926ee44e3ec3788dea853" } +craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "bb7cc548d286085f2d288445123ec3679248da86", features = ["tree"] } +craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "bb7cc548d286085f2d288445123ec3679248da86" } # EPS container, previews, ASCII85 and DSC comments (craft-libs#778). -craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "610c86792a02aa3d416926ee44e3ec3788dea853" } +craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "bb7cc548d286085f2d288445123ec3679248da86" } # DXF tags, reader and writer (craft-libs#778, #926, #927). -craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "610c86792a02aa3d416926ee44e3ec3788dea853" } -craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "610c86792a02aa3d416926ee44e3ec3788dea853" } +craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "bb7cc548d286085f2d288445123ec3679248da86" } +craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "bb7cc548d286085f2d288445123ec3679248da86" } # WMF, EMF and EMF+ reader (craft-libs#778). -craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "610c86792a02aa3d416926ee44e3ec3788dea853" } -craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "610c86792a02aa3d416926ee44e3ec3788dea853" } -craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "610c86792a02aa3d416926ee44e3ec3788dea853" } -craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "610c86792a02aa3d416926ee44e3ec3788dea853" } -craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "610c86792a02aa3d416926ee44e3ec3788dea853" } -craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "610c86792a02aa3d416926ee44e3ec3788dea853", default-features = false, features = ["read", "write"] } -craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "610c86792a02aa3d416926ee44e3ec3788dea853" } -craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "610c86792a02aa3d416926ee44e3ec3788dea853" } -craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "610c86792a02aa3d416926ee44e3ec3788dea853" } -craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "610c86792a02aa3d416926ee44e3ec3788dea853" } +craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "bb7cc548d286085f2d288445123ec3679248da86" } +craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "bb7cc548d286085f2d288445123ec3679248da86" } +craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "bb7cc548d286085f2d288445123ec3679248da86" } +craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "bb7cc548d286085f2d288445123ec3679248da86" } +craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "bb7cc548d286085f2d288445123ec3679248da86" } +craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "bb7cc548d286085f2d288445123ec3679248da86", default-features = false, features = ["read", "write"] } +craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "bb7cc548d286085f2d288445123ec3679248da86" } +craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "bb7cc548d286085f2d288445123ec3679248da86" } +craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "bb7cc548d286085f2d288445123ec3679248da86" } +craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "bb7cc548d286085f2d288445123ec3679248da86" } # The framework facade (`craft::ui`, `craft::settings`, `craft::platform`, ...). No default features: each crate names # the members it imports. -craft = { git = "https://github.com/storytold/craft-libs", rev = "610c86792a02aa3d416926ee44e3ec3788dea853" } +craft = { git = "https://github.com/storytold/craft-libs", rev = "bb7cc548d286085f2d288445123ec3679248da86" } # Below the egui layer, so not through the facade: the colour harmony rules and their settings (craft-color-ui # without its `ui` feature), the colour type they work in, and the craft-fonts tables the text crate's build writes. -craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "610c86792a02aa3d416926ee44e3ec3788dea853" } -craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "610c86792a02aa3d416926ee44e3ec3788dea853" } -craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "610c86792a02aa3d416926ee44e3ec3788dea853" } +craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "bb7cc548d286085f2d288445123ec3679248da86" } +craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "bb7cc548d286085f2d288445123ec3679248da86" } +craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "bb7cc548d286085f2d288445123ec3679248da86" } # internal vectorcraft-geom = { path = "crates/geom" } vectorcraft-color = { path = "crates/color" } @@ -193,13 +193,13 @@ lto = "thin" codegen-units = 1 [patch.crates-io] -hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "610c86792a02aa3d416926ee44e3ec3788dea853" } -hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "610c86792a02aa3d416926ee44e3ec3788dea853" } -hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "610c86792a02aa3d416926ee44e3ec3788dea853" } -hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "610c86792a02aa3d416926ee44e3ec3788dea853" } -hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "610c86792a02aa3d416926ee44e3ec3788dea853" } -krilla = { git = "https://github.com/storytold/craft-libs", rev = "610c86792a02aa3d416926ee44e3ec3788dea853" } -linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "610c86792a02aa3d416926ee44e3ec3788dea853" } +hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "bb7cc548d286085f2d288445123ec3679248da86" } +hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "bb7cc548d286085f2d288445123ec3679248da86" } +hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "bb7cc548d286085f2d288445123ec3679248da86" } +hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "bb7cc548d286085f2d288445123ec3679248da86" } +hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "bb7cc548d286085f2d288445123ec3679248da86" } +krilla = { git = "https://github.com/storytold/craft-libs", rev = "bb7cc548d286085f2d288445123ec3679248da86" } +linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "bb7cc548d286085f2d288445123ec3679248da86" } ecolor = { git = "https://github.com/storytold/egui.git", rev = "932a73b28560acb1a695533307b2cd0d66a42081" } emath = { git = "https://github.com/storytold/egui.git", rev = "932a73b28560acb1a695533307b2cd0d66a42081" } epaint = { git = "https://github.com/storytold/egui.git", rev = "932a73b28560acb1a695533307b2cd0d66a42081" } diff --git a/apps/vectorcraft-web/Cargo.toml b/apps/vectorcraft-web/Cargo.toml index e8b56c29a9..687140ce2b 100644 --- a/apps/vectorcraft-web/Cargo.toml +++ b/apps/vectorcraft-web/Cargo.toml @@ -27,7 +27,7 @@ log = { workspace = true } # `wgpu` pulls egui-wgpu's defaults: WebGPU plus the WebGL2 fallback. eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit"] } # The page command API (storytold/craft-libs#413): the request plumbing behind window.vectorcraft. -craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "610c86792a02aa3d416926ee44e3ec3788dea853", version = "0.1.0" } +craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "bb7cc548d286085f2d288445123ec3679248da86", version = "0.1.0" } wasm-bindgen = "0.2" serde_json = { workspace = true } diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs index fe2cbb7504..965c06f3b1 100644 --- a/crates/ui-egui/src/canvas.rs +++ b/crates/ui-egui/src/canvas.rs @@ -328,7 +328,7 @@ fn show_body(app: &mut VectorcraftApp, ui: &mut Ui, space: &CanvasSpace, pass: O let task_bar = (app.ui.task_bar && !revolve_editing(app) && !strip && !dragging).then(|| task_bar::task_bar(app, ui, space)).flatten(); let bar = quick_pen_bar::quick_pen_bar(app, ui, space); // A Ctrl-wheel turn with the Quick Pen tool changes its arc size; the view stays as it was before the pass. - out.arc_turn = quick_pen_wheel::arc_size(app, ui, space.wheel(), bar); + out.arc_turn = quick_pen_wheel::arc_size(app, space.wheel(), bar); contour_bar::contour_bar(app, ui, space); // After the task bar, which the row of character alternates keeps clear of. alternates_bar::alternates_bar(app, ui, space, task_bar); diff --git a/crates/ui-egui/src/canvas/quick_pen_wheel.rs b/crates/ui-egui/src/canvas/quick_pen_wheel.rs index 6a5b43de78..06ee24dd50 100644 --- a/crates/ui-egui/src/canvas/quick_pen_wheel.rs +++ b/crates/ui-egui/src/canvas/quick_pen_wheel.rs @@ -4,53 +4,27 @@ //! and on macOS alike //! ([Quick Pen tool keyboard shortcuts](https://helpx.adobe.com/illustrator/web/add-and-edit-artwork/draw-and-edit-paths/quick-pen-tool-keyboard-shortcuts.html)). //! VectorCraft's own rules: a mouse wheel turned with Ctrl does the same; a mouse wheel makes one -//! step of 15°, as `[` and `]` do, for each notch (each whole wheel line, at least one for each pass +//! step of 15°, as `[` and `]` do, for each notch (each whole wheel line, at least one for each share //! of wheel motion the canvas reads), and a touchpad makes one step for each wheel line of its -//! motion; up makes the arc larger and down smaller, and sideways motion makes no step (with Ctrl on -//! Windows and Linux, where the wheel reaches the canvas as a zoom, sideways motion counts as up and -//! down); momentum after the fingers lift makes no step; and a turn ends after [`GESTURE_GAP`] -//! without a wheel event, as the framework's wheel gestures do, or after 1 s without one while a -//! touchpad gesture is under way. +//! gesture's motion; up makes the arc larger and down smaller, and sideways motion makes no step +//! (with Ctrl on Windows and Linux, where the wheel reaches the canvas as a zoom, sideways motion +//! counts as up and down); and momentum after the fingers lift makes no step. +//! +//! Everything here is read from the canvas's share of the framework's wheel (`space.wheel()`): its +//! modifiers, its device, its motion in lines (`lines`, or `zoom_lines` for a wheel that reaches the +//! canvas as a zoom), its gesture's motion so far (`gathered`, `zoom_gathered`), the keys held during +//! the gesture (`held`) and whether the gesture began under a modal window (`modal`). -use craft::behavior::{GESTURE_GAP, Wheel, WheelSource, WheelUnit}; +use craft::behavior::{Wheel, WheelSource, WheelUnit}; use craft::keymap::{Mods, Platform}; -use super::{Ui, VectorcraftApp, json}; - -/// A wheel turn the Quick Pen tool may take: the touchpad's motion, in wheel lines, not yet turned -/// into a step; whether the tool took the turn; whether the turn began under a modal window; -/// whether a touchpad gesture is under way (between its Start and End phases); when the turn's last -/// wheel event came (egui's input time); and the modifiers the gesture holds. -#[derive(Clone, Copy, Default, PartialEq)] -struct ArcWheel { - rest: f32, - taken: bool, - muted: bool, - gesture: bool, - last: f64, - held: Mods, -} - -/// What a pass's own wheel events say: whether any came, the modifiers of a touchpad gesture's -/// Start among them, and whether the gesture ended after it. -#[derive(Default)] -struct RawWheel { - any: bool, - start: Option<Mods>, - end: bool, -} - -/// Seconds without a wheel event after which a wheel event starts a new turn while a touchpad -/// gesture is under way (fingers resting mid-gesture); outside a gesture it is [`GESTURE_GAP`]. -const RESTING_GAP: f64 = 1.0; +use super::{VectorcraftApp, json}; /// Most steps one share of the wheel makes: from 1° to 359° is fewer than 24 steps of 15°. const MOST_STEPS: f32 = 24.0; -/// The modifiers held in `a` or in `b`. -fn either(a: Mods, b: Mods) -> Mods { - Mods { cmd: a.cmd || b.cmd, ctrl: a.ctrl || b.ctrl, alt: a.alt || b.alt, shift: a.shift || b.shift } -} +/// How far a line's worth of motion may fall short of a whole line and still count as one. +const LINE_SLACK: f32 = 1e-3; /// The Control key alone: Ctrl on Windows and Linux, which the keymap folds into `cmd`, and the /// Control key on macOS, where `cmd` is ⌘. @@ -59,27 +33,29 @@ fn ctrl_alone(m: Mods, os: Platform) -> bool { control && !(m.alt || m.shift) } -/// How far a line's worth of motion may fall short of a whole line and still count as one: a zoom -/// factor turned back into lines carries rounding. -const LINE_SLACK: f32 = 1e-3; - -/// The wheel's up and down motion in wheel lines, up positive. A wheel turned with egui's zoom -/// modifier (Ctrl on Windows and Linux) reaches the canvas as a zoom factor and no scroll, and so -/// does a touchpad's Ctrl+scroll there, which the framework reads as a pinch; the motion is read -/// back from the factor in lines of egui's `line_scroll_speed` points, at `scroll_zoom_speed` per -/// point, as egui and the framework made it. Points of a touchpad or a browser are lines of `line` -/// points. A wheel turned with the zoom modifier sideways counts as up and down: the factor does -/// not tell the two apart. -fn lines(wheel: &Wheel, ctx: &egui::Context, line: f32) -> f32 { - let lines = if wheel.scroll.y != 0.0 { +/// The share's up and down motion in wheel lines, up positive. A wheel turned with egui's zoom +/// modifier (Ctrl on Windows and Linux) reaches the canvas as a zoom, and the framework counts its +/// lines in `zoom_lines`; sideways motion there adds to up and down, as egui's zoom factor does. +/// Points of a touchpad or a browser are lines of `line` points. +fn lines(wheel: &Wheel, line: f32) -> f32 { + let d = if wheel.zoom_lines != egui::Vec2::ZERO { + wheel.zoom_lines.x + wheel.zoom_lines.y + } else if wheel.scroll.y != 0.0 { if wheel.unit == WheelUnit::Line { wheel.lines.y } else { wheel.scroll.y / line } - } else if wheel.scroll == egui::Vec2::ZERO && wheel.zoom.is_finite() && wheel.zoom > 0.0 && wheel.zoom != 1.0 { - let (speed, egui_line) = ctx.options(|o| (o.input_options.scroll_zoom_speed, o.input_options.line_scroll_speed)); - wheel.zoom.ln() / speed / egui_line } else { 0.0 }; - if lines.is_finite() { lines } else { 0.0 } + if d.is_finite() { d } else { 0.0 } +} + +/// A wheel turn the Quick Pen tool reads, from the framework's gesture: whether a modal window was up +/// during it, whether the tool took it, and the touchpad motion it took, in wheel lines, not yet +/// turned into a step. +#[derive(Clone, Copy, Default, PartialEq)] +struct ArcTurn { + muted: bool, + taken: bool, + rest: f32, } /// Whether `wheel`, of `lines` wheel lines, comes from a touchpad and not from a mouse wheel's @@ -96,99 +72,61 @@ fn fine(wheel: &Wheel, lines: f32) -> bool { } } +/// Whole lines in `v`, toward zero, with [`LINE_SLACK`] for rounding. +fn whole(v: f32) -> f32 { + (v + LINE_SLACK * v.signum()).trunc() +} + /// The steps `wheel` makes, up positive: a mouse wheel's whole lines, at least one; one for a share -/// of points or pages from a mouse; and a touchpad's motion in wheel lines of `line` points, with -/// the fraction kept in `rest` for later motion. Momentum after the fingers lift makes no step. -fn steps(wheel: &Wheel, ctx: &egui::Context, line: f32, rest: &mut f32) -> f32 { +/// of points or pages from a mouse; and for a touchpad the whole lines of the motion the tool took in +/// this turn, with the fraction kept in `rest`. Momentum after the fingers lift makes no step. +fn steps(wheel: &Wheel, line: f32, rest: &mut f32) -> f32 { if wheel.source == WheelSource::Momentum { return 0.0; } - let d = lines(wheel, ctx, line); + let d = lines(wheel, line); if d == 0.0 { return 0.0; } if fine(wheel, d) { *rest += d; - let whole = (*rest + LINE_SLACK * rest.signum()).trunc(); - *rest -= whole; - return whole.clamp(-MOST_STEPS, MOST_STEPS); + let steps = whole(*rest); + *rest -= steps; + return steps.clamp(-MOST_STEPS, MOST_STEPS); } - let whole = if wheel.unit == WheelUnit::Line { (d.abs() + LINE_SLACK).trunc() } else { 1.0 }; - d.signum() * whole.clamp(1.0, MOST_STEPS) + let notches = if wheel.unit == WheelUnit::Line { (d.abs() + LINE_SLACK).trunc() } else { 1.0 }; + d.signum() * notches.clamp(1.0, MOST_STEPS) } /// With the Quick Pen tool active, the wheel share the canvas read this pass (`wheel`), turned with /// the Control key alone and not over the Quick Pen toolbar (`bar`), makes the arc size larger (up) -/// or smaller (down). The modifiers held at any point of a touchpad gesture count until it ends, -/// keys tapped between its wheel events included. No step is made while a modal window is up, nor -/// for the rest of a turn begun under one. Returns true while the tool takes the turn, so the view -/// does not zoom or scroll for the rest of it. -pub(super) fn arc_size(app: &mut VectorcraftApp, ui: &Ui, wheel: Option<Wheel>, bar: Option<egui::Rect>) -> bool { - let id = egui::Id::unique("quick-pen-arc-wheel"); - let before: ArcWheel = ui.data(|d| d.get_temp(id)).unwrap_or_default(); - let os = crate::keymap::platform(); - let mut now = before; - // The pass's own events: the keys, and the wheel's events with the phases of a touchpad gesture, - // which the canvas's share does not carry when they move nothing (a gesture's Start). - let (time, raw, keys) = ui.input(|i| { - let mut keys = Mods::NONE; - let mut raw = RawWheel::default(); - for e in &i.events { - match e { - egui::Event::ModifiersChanged(m) | egui::Event::Key { modifiers: m, .. } => keys = either(keys, Mods::from_egui(m, os)), - // The framework's pinch from a Ctrl+wheel on Windows and Linux. - egui::Event::Zoom(_) => raw.any = true, - egui::Event::MouseWheel { phase, modifiers, .. } => { - raw.any = true; - match phase { - egui::TouchPhase::Start => { - raw.start = Some(either(raw.start.unwrap_or(Mods::NONE), Mods::from_egui(modifiers, os))); - raw.end = false; - } - egui::TouchPhase::End | egui::TouchPhase::Cancel => raw.end = true, - egui::TouchPhase::Move => {} - } - } - _ => {} - } - } - (i.time, raw, keys) - }); - let gap = if now.gesture { RESTING_GAP } else { GESTURE_GAP }; - if raw.any && (time - now.last > gap || raw.start.is_some()) { - // A wheel event after the gap, or a touchpad gesture's start, begins a new turn: what the - // turn before it took and left over goes. - now = ArcWheel::default(); - } - if let Some(m) = raw.start { - now.gesture = true; - now.held = m; - } - if now.gesture { - now.held = either(now.held, keys); - } - if raw.any { - now.last = time; - } - // The canvas reads no wheel under a modal window: a turn that goes on there makes no step after - // the window closes either. - let modal = crate::panel_docking::modal_window_up(app); - if modal && raw.any { - now.muted = true; - } - let mut runs = 0.0; +/// or smaller (down). A touchpad gesture counts the keys held at any point of it, keys tapped +/// between its events included. No step is made while a modal window is up, nor for the rest of a +/// turn begun under one. Returns true while the tool takes the turn, so the view does not zoom or +/// scroll for the rest of it. A turn is the framework's wheel gesture. +pub(super) fn arc_size(app: &mut VectorcraftApp, wheel: Option<Wheel>, bar: Option<egui::Rect>) -> bool { + let Some(w) = wheel else { return false }; + let id = egui::Id::unique("quick-pen-arc-turn"); + // The framework's first share of a gesture gathers only itself. + let first = w.gathered == w.scroll && w.zoom_gathered == w.zoom_lines; + let before = if first { ArcTurn::default() } else { app.ui_ctx.as_ref().and_then(|ctx| ctx.data(|d| d.get_temp(id))).unwrap_or_default() }; + let mut turn = before; + // The framework marks a turn a modal layer held (`modal`); a turn that reached the canvas while + // one of the app's own modal windows was up stays muted until the framework starts a new one. + turn.muted |= w.modal || crate::panel_docking::modal_window_up(app); + let line = crate::app::view::navigation(&app.session.prefs).wheel_line.max(1.0); + let mods = if fine(&w, lines(&w, line)) { w.held } else { w.mods }; + let over_bar = w.at.zip(bar).is_some_and(|(at, bar)| bar.contains(at)); let quick_pen = app.session.tool_id() == vectorcraft_tools::quickpen::ID; - if let Some(w) = wheel.filter(|_| !modal) { - now.held = if now.gesture { either(now.held, w.mods) } else { w.mods }; - let over_bar = w.at.zip(bar).is_some_and(|(at, bar)| bar.contains(at)); - if quick_pen && !now.muted && !over_bar && ctrl_alone(now.held, os) { - now.taken = true; - let line = crate::app::view::navigation(&app.session.prefs).wheel_line.max(1.0); - runs = steps(&w, ui.ctx(), line, &mut now.rest); - } + let mut runs = 0.0; + if quick_pen && !turn.muted && !over_bar && ctrl_alone(mods, crate::keymap::platform()) { + turn.taken = true; + runs = steps(&w, line, &mut turn.rest); } - if raw.end { - now.gesture = false; + if (first || turn != before) + && let Some(ctx) = &app.ui_ctx + { + ctx.data_mut(|d| d.insert_temp(id, turn)); } let cmd = if runs > 0.0 { "tool.quickPen.arcLarger" } else { "tool.quickPen.arcSmaller" }; for _ in 0..(runs.abs() as u32) { @@ -201,8 +139,5 @@ pub(super) fn arc_size(app: &mut VectorcraftApp, ui: &Ui, wheel: Option<Wheel>, } } } - if now != before { - ui.data_mut(|d| d.insert_temp(id, now)); - } - quick_pen && wheel.is_some() && now.taken + quick_pen && turn.taken } From c61c271b74a88a61b4d9225818c1e3081601654d Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Sun, 29 Nov 2026 19:14:13 -0800 Subject: [PATCH 019/112] CI: move the craft-fonts pin to craft-fonts main in every workflow The CI, FreeBSD, nightly, macOS nightly and release workflows pinned craft-fonts b076417, which has no fonts/latin-manifest.txt, so every build warned that it could not embed the tab-title face. They now pin craft-fonts main at 16bbfc3, which adds Noto Sans Condensed SemiBold (storytold/craft-fonts#72), so builds from these workflows draw document tab titles in it. The pin also brings Noto Sans Lao, Noto Sans for eight Indian scripts (Bengali, Gurmukhi, Gujarati, Oriya, Tamil, Telugu, Kannada and Malayalam) and the Latin catalog. With the new faces a build loads 135 faces instead of 54, and Retype compares the first 96 first. Two faults showed: - Retype: near matching fits a shape with at most the 256 glyphs closest to it in proportion over every face. The dots and periods of the new faces, drawn alike in each family and each named weight, took all 256 places, so a simplified Source Sans 3 period after "no" matched no glyph of Source Sans 3 and was left as an outline. A shape that near matches no glyph of the font of the line before it is now also compared with that font's own 256 closest glyphs, and joins the line when one fits. RetypeIndex::near_matches_in does that lookup. - Tests: six Retype tests added their test font to the global font database and expected Retype to compare it, which it did only while fewer than 96 faces were loaded before it. They now name the font (type.retype's fonts, or live type in the family as #6896 does for of_two_versions_only_the_one_the_name_gives_is_listed), and lines_in_family fails when the family has no match instead of reading another face. all_supplied_craft_font_families_are_registered_without_system_fonts looked up every embedded craft-fonts face in the document font database. The tab-title face is embedded for tab titles only and the database leaves it out (document_fonts), so the test now checks the faces document_fonts lists. docs/mcp.md describes the new near-match step, and docs/ui-parity.md and docs/localization-parity.md describe the new pin. The pin change and the version test fix follow #6896 by @newsbaba24x7. --- .github/workflows/ci.yml | 2 +- .github/workflows/freebsd.yml | 2 +- .github/workflows/nightly-macos.yml | 2 +- .github/workflows/nightly.yml | 2 +- .github/workflows/release.yml | 2 +- crates/engine/src/cmd/retype.rs | 48 +++++++++++++++--- crates/engine/src/cmd/retype_fonts_tests.rs | 4 ++ crates/engine/src/cmd/retype_tests.rs | 20 ++++++-- crates/text/src/retype.rs | 55 +++++++++++++++++++-- crates/text/src/tests.rs | 4 +- docs/localization-parity.md | 2 +- docs/mcp.md | 5 +- docs/ui-parity.md | 2 +- 13 files changed, 124 insertions(+), 26 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0954b5c35c..590e22ffda 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: uses: storytold/craft-common-actions/.github/workflows/gate.yml@main with: # Same craft-fonts commit as release.yml. - craft-fonts-ref: b076417b5880bd4154bd22f00695b1d28c6bea83 + craft-fonts-ref: 16bbfc3d451fad51971ca3f2a28c1e69e279b67c # A cold `cache warm` leg (the nightly run, or any run after a toolchain or lockfile change) # took 90 minutes to reach its last three steps on 2026-11-27 and was canceled there; with # those steps and the save it needs about two hours. diff --git a/.github/workflows/freebsd.yml b/.github/workflows/freebsd.yml index c74a3e83ab..4edc2fbfdc 100644 --- a/.github/workflows/freebsd.yml +++ b/.github/workflows/freebsd.yml @@ -29,7 +29,7 @@ jobs: uses: storytold/craft-common-actions/.github/workflows/freebsd.yml@main with: require-craft-fonts: true - craft-fonts-ref: b076417b5880bd4154bd22f00695b1d28c6bea83 + craft-fonts-ref: 16bbfc3d451fad51971ca3f2a28c1e69e279b67c run-package-check: true # The test builds of this workspace's largest crates (engine, ui-egui) need more than the # VM's 12 GB when two compile at once: the build was killed (exit 137) every night with diff --git a/.github/workflows/nightly-macos.yml b/.github/workflows/nightly-macos.yml index 59536dcf36..2ae797d92d 100644 --- a/.github/workflows/nightly-macos.yml +++ b/.github/workflows/nightly-macos.yml @@ -47,7 +47,7 @@ jobs: - name: Check out craft-fonts uses: storytold/craft-common-actions/actions/checkout-craft-fonts@main with: - ref: b076417b5880bd4154bd22f00695b1d28c6bea83 + ref: 16bbfc3d451fad51971ca3f2a28c1e69e279b67c - id: rust uses: storytold/craft-common-actions/actions/rust-channel@main with: diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 0e963e43e1..b56867306c 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -27,7 +27,7 @@ jobs: tooling-revision: main app-name: vectorcraft manual-actors: '["bflatastic","dylanmtaylor","echelon","FredApps","skylartaylor"]' - craft-fonts-ref: b076417b5880bd4154bd22f00695b1d28c6bea83 + craft-fonts-ref: 16bbfc3d451fad51971ca3f2a28c1e69e279b67c # One producer run builds every listed platform for one all-or-nothing release. The pin is the # craft-common-actions main commit that merged the exact-analysis admission (#371, after #370, # #369 and #364). diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 538d09cc31..254a8aa321 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -43,7 +43,7 @@ jobs: app-name: vectorcraft app-title: VectorCraft macos-runner: macos-15 - craft-fonts-ref: b076417b5880bd4154bd22f00695b1d28c6bea83 + craft-fonts-ref: 16bbfc3d451fad51971ca3f2a28c1e69e279b67c web-craft-fonts: true version: ${{ inputs.version }} contributors-artifact: ${{ needs.credits.outputs.artifact-name }} diff --git a/crates/engine/src/cmd/retype.rs b/crates/engine/src/cmd/retype.rs index cd2f804331..ed290b84fc 100644 --- a/crates/engine/src/cmd/retype.rs +++ b/crates/engine/src/cmd/retype.rs @@ -1753,6 +1753,29 @@ fn candidates(indexes: &[&RetypeIndex], path: &BezPath, part: bool, near: bool, if exact.is_empty() && near { indexes.iter().flat_map(|ix| painted(ix, ix.near_matches(path, tolerance), tolerance)).collect() } else { exact } } +/// Joins whole shape `pc`, whose matches `ms` are near ones in faces other than `l`'s alone, to line +/// `l` by its near matches among the glyphs of `l`'s face in `indexes`: the 256 glyphs closest to a +/// shape in proportion can all be glyphs of other faces drawn alike (a period, a dot). Those +/// matches when the shape joins, `None` when it does not (`l` unchanged). +fn join_in_line_face(l: &mut Line, pc: &Piece, ms: &[GlyphMatch], indexes: &[RetypeIndex], tolerance: f64) -> Option<Vec<GlyphMatch>> { + let face = l.face.id(); + if ms.iter().any(|m| m.exact || m.face.id() == face) { + return None; + } + let fill = pc.filled.then_some(pc.nonzero); + let own: Vec<GlyphMatch> = indexes + .iter() + .flat_map(|ix| { + let found = ix.near_matches_in(&pc.path, tolerance, face); + match fill { + Some(nonzero) => found.iter().filter_map(|m| ix.painted_agrees(m, &pc.path, nonzero, tolerance)).collect(), + None => found, + } + }) + .collect(); + join(l, pc, &own).then_some(own) +} + /// The parts of the shape `path` ([`parts`]: the whole shape, or the glyphs of its contour /// `groups`), each with its [`candidates`] in `indexes`; empty when it matches nothing. `fill` is /// as [`candidates`] takes it, and `once` is set when the shape paints its overlaps once, as @@ -1886,14 +1909,17 @@ fn retype(s: &mut Session, p: &Value) -> Result<Value> { extra.push(f); } } - if !extra.is_empty() { + let indexes: Vec<RetypeIndex> = if extra.is_empty() { + vec![index] + } else { // Near matching spends an index's comparison budget, so with a tolerance the // candidates are indexed again for this pass. let first = if tolerance > 0.0 { build(cands) } else { index }; - let others: Vec<RetypeIndex> = extra.chunks(vectorcraft_text::retype::MAX_FACES).map(|g| build(g.to_vec())).collect(); - let all: Vec<&RetypeIndex> = std::iter::once(&first).chain(&others).collect(); - found = match_pieces(&pieces, &groups, &all, tolerance); - } + let mut all = vec![first]; + all.extend(extra.chunks(vectorcraft_text::retype::MAX_FACES).map(|g| build(g.to_vec()))); + found = match_pieces(&pieces, &groups, &all.iter().collect::<Vec<_>>(), tolerance); + all + }; // The face most shapes match, so a glyph several fonts share is set in the same font as // the glyphs around it. Among faces that as many shapes match, the one whose glyphs fit // them closest in all (the least leftover distance summed over those shapes), so every @@ -1949,11 +1975,19 @@ fn retype(s: &mut Session, p: &Value) -> Result<Value> { for ms in parts { // The part's candidates in the face most shapes fit (see `ranked`). let face = ms.iter().enumerate().max_by(ranked).map(|(_, m)| m.face.id()); - let cands: Vec<GlyphMatch> = ms.iter().filter(|m| Some(m.face.id()) == face).cloned().collect(); - let joined = match lines.last_mut() { + let mut cands: Vec<GlyphMatch> = ms.iter().filter(|m| Some(m.face.id()) == face).cloned().collect(); + let mut joined = match lines.last_mut() { Some(l) if open => join(l, pc, &cands), _ => false, }; + if !joined + && open + && parts.len() == 1 + && let Some(own) = lines.last_mut().and_then(|l| join_in_line_face(l, pc, ms, &indexes, tolerance)) + { + joined = true; + cands = own; + } // A part that joined a line, perhaps as a mark, that is also another character, in // that face or else in the face most shapes fit of those it is a character in: the // character, should a split leave the part first on a line ([`verified`]). Kept by diff --git a/crates/engine/src/cmd/retype_fonts_tests.rs b/crates/engine/src/cmd/retype_fonts_tests.rs index 60218b8b4a..a239baafdd 100644 --- a/crates/engine/src/cmd/retype_fonts_tests.rs +++ b/crates/engine/src/cmd/retype_fonts_tests.rs @@ -149,6 +149,10 @@ fn of_two_versions_only_the_one_the_name_gives_is_listed() { db.add_font(named_copy(true, (FAMILY, "Regular", "Version 2.000", "VersiontestSans-Regular")).unwrap()); assert_eq!(db.face(FAMILY, "Regular").unwrap().version, "Version 1.000"); let mut s = session(); + // Live type in the family puts the font among those compared first. Added last, after the + // bundled fonts and however many faces craft-fonts supplies, it can fall past the fonts + // Retype compares (`MAX_FACES`). + s.execute("text.create", &json!({"x": 40, "y": 300, "text": "live", "size": 40, "font": FAMILY, "style": "Regular"})).unwrap(); let inter = outlined(&mut s, json!({"x": 40, "y": 100, "text": "Kg", "size": 40, "font": "Inter", "style": "Regular"})); s.execute("select.set", &json!({"ids": [inter]})).unwrap(); let r = query(&mut s, json!({"count": 96}), &db); diff --git a/crates/engine/src/cmd/retype_tests.rs b/crates/engine/src/cmd/retype_tests.rs index 5f89bc1284..47da2c46d5 100644 --- a/crates/engine/src/cmd/retype_tests.rs +++ b/crates/engine/src/cmd/retype_tests.rs @@ -102,10 +102,12 @@ fn a_mark_in_one_font_starts_its_line_as_another_fonts_character() { use vectorcraft_text::test_fonts::{SPACING_COMMA_FAMILY, spacing_comma_font}; // The comma below of Source Sans 3 is only marks there, and a modifier letter in this face. vectorcraft_text::FontDb::global().add_font(spacing_comma_font().unwrap()); + // Named, so it is among the fonts compared first, however many faces are loaded before it. + let fonts = json!([SPACING_COMMA_FAMILY]); let mut s = session(); let g = outlined(&mut s, json!({"x": 40, "y": 100, "text": "\u{326}", "size": 40, "font": "Source Sans 3", "style": "Regular"})); s.execute("select.set", &json!({"ids": [g]})).unwrap(); - let r = s.execute("type.retype", &json!({})).unwrap(); + let r = s.execute("type.retype", &json!({"fonts": fonts})).unwrap(); assert_eq!(r["texts"], json!(["\u{2bb}"]), "{r}"); assert_eq!(r["fonts"][0]["family"], json!(SPACING_COMMA_FAMILY), "{r}"); // After a base, it joins the line as the mark; moved off its base, the split leaves it first, @@ -115,7 +117,7 @@ fn a_mark_in_one_font_starts_its_line_as_another_fonts_character() { s.execute("select.set", &json!({"ids": [mark]})).unwrap(); s.execute("object.move", &json!({"dx": 3, "dy": 0})).unwrap(); s.execute("select.set", &json!({"ids": [g]})).unwrap(); - let r = s.execute("type.retype", &json!({})).unwrap(); + let r = s.execute("type.retype", &json!({"fonts": fonts})).unwrap(); assert_eq!((&r["texts"], &r["unmatched"]), (&json!(["x", "\u{2bb}", "yz"]), &json!([])), "{r}"); assert_eq!(r["fonts"][1]["family"], json!(SPACING_COMMA_FAMILY), "{r}"); } @@ -1918,16 +1920,24 @@ fn lines_in(s: &Session, g: u64) -> Vec<super::Line> { lines_in_family(s, g, None) } -/// [`lines_in`] with the face of the first glyph's match in `family` when given. +/// [`lines_in`] with the face of the first glyph's match in `family` when given. The family is +/// compared first, as `type.retype`'s `fonts` puts it, so the faces loaded before it cannot leave it +/// out of the fonts Retype compares. fn lines_in_family(s: &Session, g: u64, family: Option<&str>) -> Vec<super::Line> { let d = &s.doc().unwrap().doc; let (mut barrier, mut truncated, mut pieces) = (true, false, vec![]); super::collect(d.node(NodeId(g)).unwrap(), d.parent_of(NodeId(g)), 0, &mut barrier, &mut truncated, &mut pieces); let db = vectorcraft_text::FontDb::global(); let wanted = pieces.iter().filter_map(|pc| vectorcraft_text::retype::shape_key(&pc.path)).collect(); - let index = super::RetypeIndex::build(db, super::candidate_faces(db, d, &[]), &wanted); + let fonts: Vec<String> = family.into_iter().map(str::to_string).collect(); + let index = super::RetypeIndex::build(db, super::candidate_faces(db, d, &fonts), &wanted); let first = index.matches(&pieces[0].path); - let face = first.iter().find(|m| family.is_none_or(|f| m.face.family == f)).unwrap_or(&first[0]).face.id(); + let face = match family { + Some(f) => first.iter().find(|m| m.face.family == f).unwrap_or_else(|| panic!("the first glyph matches no glyph of {f}")), + None => &first[0], + } + .face + .id(); let mut lines: Vec<super::Line> = vec![]; for pc in &pieces { let cands: Vec<_> = index.matches(&pc.path).into_iter().filter(|m| m.face.id() == face).collect(); diff --git a/crates/text/src/retype.rs b/crates/text/src/retype.rs index deeebbd519..b61afe0d4e 100644 --- a/crates/text/src/retype.rs +++ b/crates/text/src/retype.rs @@ -502,6 +502,21 @@ impl RetypeIndex { /// all (ranking a glyph by proportion counts as one per contour and one more); once they are /// spent, the glyphs not yet ranked or compared are left out. pub fn near_matches(&self, shape: &BezPath, tolerance: f64) -> Vec<GlyphMatch> { + self.near_matches_among(shape, tolerance, None) + } + + /// [`Self::near_matches`] among the glyphs of the indexed face with id `face` alone: the 256 + /// of its glyphs closest to `shape` in proportion, which the glyphs of the other faces cannot + /// crowd out. Empty when the index does not hold that face. + pub fn near_matches_in(&self, shape: &BezPath, tolerance: f64, face: u32) -> Vec<GlyphMatch> { + match self.faces.iter().position(|f| f.id() == face) { + Some(i) => self.near_matches_among(shape, tolerance, Some(i)), + None => vec![], + } + } + + /// [`Self::near_matches`], among the glyphs of face `only` (an index into `faces`) when given. + fn near_matches_among(&self, shape: &BezPath, tolerance: f64, only: Option<usize>) -> Vec<GlyphMatch> { // NaN too. if tolerance.is_nan() || tolerance <= 0.0 { return vec![]; @@ -528,7 +543,7 @@ impl RetypeIndex { Err(now) => seen = now, } }; - let near = self.ranked_near(&s, &mut work); + let near = self.ranked_near(&s, only, &mut work); for (_, e) in near { if work == 0 { break; @@ -572,8 +587,8 @@ impl RetypeIndex { /// proportion, at most [`NEAR_FITS`], closest first: their spread-to-length ratio, and the /// share of the length each contour has, longest first. Ranking a glyph takes one comparison /// per contour, and one more, from `work`; once it is spent, the glyphs not yet ranked are - /// left out. - fn ranked_near(&self, s: &Signature, work: &mut u64) -> Vec<(f64, &Entry)> { + /// left out. With `only`, the glyphs of that face (an index into `faces`) alone. + fn ranked_near(&self, s: &Signature, only: Option<usize>, work: &mut u64) -> Vec<(f64, &Entry)> { let Some(list) = self.buckets.get(&s.contours) else { return vec![] }; let lo = s.invariant * (1.0 - NEAR_INVARIANT_SLACK); let hi = s.invariant * (1.0 + NEAR_INVARIANT_SLACK); @@ -597,6 +612,9 @@ impl RetypeIndex { let cost = s.contours as u64 + 1; let mut near: Vec<(f64, &Entry)> = vec![]; for e in list.iter().skip(start).filter_map(|i| self.entries.get(*i)).take_while(|e| e.sig.invariant <= hi) { + if only.is_some_and(|f| e.face != f) { + continue; + } let Some(left) = work.checked_sub(cost) else { break }; *work = left; near.push((apart(e), e)); @@ -2106,6 +2124,33 @@ mod tests { assert!(found.len() > MAX_CANDIDATES && has_every_period(&found), "near: {} matches", found.len()); } + #[test] + fn near_matches_in_one_face_find_its_glyphs_however_many_faces_are_drawn_alike() { + // Source Sans 3 Regular last, after 95 copies of it under other names: every face has + // several glyphs drawn as the period, far more than the 256 near matching fits in all. + let db = FontDb::with_font_dirs(vec![]); + for i in 0..MAX_FACES - 1 { + let family = format!("Crowd {i} Sans"); + let postscript = format!("Crowd{i}Sans-Regular"); + db.add_font(crate::test_fonts::named_copy(false, (&family, "Regular", "Version 1.000", &postscript)).unwrap()); + } + let mut faces: Vec<Arc<FontFace>> = (0..MAX_FACES - 1).map(|i| db.face(&format!("Crowd {i} Sans"), "Regular").unwrap()).collect(); + let source = db.face("Source Sans 3", "Regular").unwrap(); + faces.push(source.clone()); + let gid = source.mapped_chars().iter().find(|(c, _)| *c == '.').map(|(_, g)| *g).unwrap(); + let period = Affine::translate((100.0, 200.0)) * Affine::scale(0.04) * db.outline_uncached(&source, gid); + let simple = simplified(&period, 0.05); + let index = RetypeIndex::build_near(&db, faces.clone(), &BTreeSet::new(), &[near_key(&simple).unwrap()]); + for face in [&faces[0], &source] { + let found = index.near_matches_in(&simple, 0.02, face.id()); + assert!(found.iter().all(|m| m.face.id() == face.id()), "{}", face.family); + assert!(found.iter().any(|m| m.ch == '.') && found.len() <= MAX_CANDIDATES, "{}: {} matches", face.family, found.len()); + } + // A face the index does not hold has no matches. + let other = db.face("Inter", "Regular").unwrap(); + assert!(index.near_matches_in(&simple, 0.02, other.id()).is_empty()); + } + #[test] fn a_face_past_its_near_share_keeps_the_glyphs_closest_to_the_shapes() { // One glyph of the face is indexed for near matching: the one closest to a simplified o, @@ -2377,12 +2422,12 @@ mod tests { let index = RetypeIndex::build_near(db, [face], &BTreeSet::new(), &[near_key(&shape).unwrap()]); let s = near_signature(&shape).unwrap(); let mut all = u64::MAX; - let ranked = index.ranked_near(&s, &mut all).len(); + let ranked = index.ranked_near(&s, None, &mut all).len(); assert!(ranked >= 1, "the o is ranked"); assert_eq!(u64::MAX - all, ranked as u64 * 3, "each glyph of two contours takes three"); // Enough to rank one glyph of two contours and nothing more. let mut work = 4; - assert_eq!(index.ranked_near(&s, &mut work).len(), 1); + assert_eq!(index.ranked_near(&s, None, &mut work).len(), 1); assert_eq!(work, 1); } diff --git a/crates/text/src/tests.rs b/crates/text/src/tests.rs index 40b29331f9..c050539198 100644 --- a/crates/text/src/tests.rs +++ b/crates/text/src/tests.rs @@ -1935,7 +1935,9 @@ fn all_supplied_craft_font_families_are_registered_without_system_fonts() { return; } let db = FontDb::with_font_dirs(vec![]); - for font in CRAFT_FONTS { + // The faces the document font database loads: the tab-title face draws document tab titles + // alone and is left out. + for font in crate::craft_fonts::document_fonts() { let face = db.face(font.family, font.style).unwrap(); assert_eq!(face.family, font.family, "{} {}", font.family, font.style); } diff --git a/docs/localization-parity.md b/docs/localization-parity.md index 555cc17f7f..c8b5109d29 100644 --- a/docs/localization-parity.md +++ b/docs/localization-parity.md @@ -34,7 +34,7 @@ Chinese by `imachus`). Georgian and the original Gujarati catalog are recorded a | Simplified Chinese (Mandarin) | `zh-hans` | 9,625 rows, 3,735 of them `@msg` and 51 `@msgplural` (counted 2026-11-17 on `main` at `ee60c51fd9`) | all (the untranslated report lists 237 messages without a row for it) | CJK UI font from craft-fonts (BIZ UDPGothic) when embedded, else a system font; IME with marked text at the caret; vertical type partial ([type-parity.md](type-parity.md)) | no | full | — (review) | | Spanish | `es` | 4,009 / 4,020 (99.7%) | all (3,770 `@msg` and 55 `@msgplural` rows, counted 2026-11-18: the untranslated report lists 269 messages without a Spanish row, 236 in its own section and 33 that all 24 checked languages lack) | Latin | no | full | — (review) | | Hindi | `hi` | 8,782 rows (2026-11-13): 3,014 `@msg`, 47 `@msgplural`, 41 `@plural`; the untranslated report on main `f793044f83` (2026-11-14) lists 676 missing rows for it: 608 in its own section and 68 that every checked language lacks | menus, dialogs, tooltips and scanned messages; contributor-approved loanword terminology; agent wording pass | UI and document text shape with HarfRust; installed desktop Devanagari fallback, or a `Deva` craft-fonts face; the web fetches Noto Sans Devanagari when the interface needs it | contributor terminology review; 2026-11-13 wording pass on messages and longer labels, and a word-sense pass on short labels, with a glossary-term test; wider proofread welcome | complete catalog, machine-assisted draft | reported missing rows, native review and layout | -| Gujarati | `gu` | 4,673 rows (2026-11-14): original 4,286 unchanged; all 387 additions contributor-reviewed and approved | menus and dialogs; status/error messages partial | installed Gujarati fonts on desktop; optional `Gujr` craft-fonts fallback; no Gujarati face in the pinned CI/release fonts or web startup list | original catalog reviewed by a native speaker; all 387 later additions approved by the contributor, with 11 wording corrections | contributor-reviewed catalog | remaining messages and a bundled Gujarati web font | +| Gujarati | `gu` | 4,673 rows (2026-11-14): original 4,286 unchanged; all 387 additions contributor-reviewed and approved | menus and dialogs; status/error messages partial | installed Gujarati fonts on desktop; optional `Gujr` craft-fonts fallback (Noto Sans Gujarati, in the pinned CI/release fonts); not in the web startup list | original catalog reviewed by a native speaker; all 387 later additions approved by the contributor, with 11 wording corrections | contributor-reviewed catalog | remaining messages and a bundled Gujarati web font | | Arabic | `ar` | 0 | none | document text: bidi layout and Paragraph Direction; interface: no right-to-left layout, no Arabic shaping in egui | no | none | 25–40 | | French | `fr` | 9,166 rows, 3,436 of them `@msg` and 48 `@msgplural` (counted 2026-11-13): the untranslated report lists 178 missing messages for it | all | Latin | no | full | — (review) | | Portuguese | `pt-br` | 9,378 rows, 3,563 of them `@msg` and 48 `@msgplural` (counted 2026-11-13): the untranslated report lists 55 missing messages for it, which open #7116, #7211, #7330, #7378 and #7405 translate; one/other plurals | all | Latin | contributor is a Brazilian Portuguese speaker; further native review welcome | full | — (review) | diff --git a/docs/mcp.md b/docs/mcp.md index a9e9d9649a..1c550859e7 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -13422,7 +13422,10 @@ for near matches; when none passes, the shape stays an outline. Glyphs fused int or 65,536 path elements is matched whole only. One command groups at most 16,384 contours, in selection order; the shapes after them are matched whole only. Near matching compares a shape with at most the 256 glyphs closest to it in proportion, in at most 50 million point comparisons per shape and 2 billion per command, ranking a glyph by proportion counting as one -comparison per contour and one more; past them, the glyphs not yet ranked or compared are left out. It looks glyphs up for at most 1,024 distinct shapes and runs per command: every selected shape first, in +comparison per contour and one more; past them, the glyphs not yet ranked or compared are left out. Those 256 can +all be glyphs of other fonts drawn alike (a period or a dot): a shape that near matches no glyph of the font of the +line before it is also compared with the 256 glyphs of that font closest to it in proportion, and joins the line when +one of them fits. It looks glyphs up for at most 1,024 distinct shapes and runs per command: every selected shape first, in selection order, then the runs of groups of the compound paths. Glyphs close only to the shapes and runs past that limit are not looked up. At most 262,144 glyphs are drawn to check whether they could near match, and at most 32,768 are indexed for it, each face taking an equal share of both; of a face's glyphs, those closest to the selected shapes diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 51af6698d5..93a7d8809e 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -458,7 +458,7 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po | A middle-click on a document tab or its × closes it as the × does; closing a modified document's last view asks to save first (VectorCraft addition, as in PhotoCraft) | done | #6506; `chrome::tests::a_middle_click_on_a_tab_closes_it_as_the_close_box_does`; not scored | | When the document tabs don't all fit, the first tab that doesn't fit whole fills the room before the » button with its title shortened and ending in "…", once that room leaves at least 40 pt for the title; with the active tab among the last ones, the tab before the ones shown fills the room left at the start instead; an active tab wider than the strip is shortened to it, and a tab narrower than 25 pt shows no ×; the tooltip of a shortened tab shows the whole title, wrapped to the window (VectorCraft's own rule) | done | #8584; `tests::tab_overflow`; not scored | | An inactive document tab shows the document's name, the view number and the unsaved-changes mark, without the zoom and the mode in parentheses (the color mode and view, or the opacity mask being edited); the active tab keeps its whole title, and an inactive tab's tooltip shows the whole title (VectorCraft's own rule) | done | #8582; `tests::tab_overflow::inactive_tabs_show_the_name_alone_so_more_tabs_fit`; not scored | -| Document tab titles draw in a condensed face (craft-fonts' Noto Sans Condensed SemiBold) at the x-height of the interface's semibold face, so more tabs fit; builds without that face draw them in the semibold face (VectorCraft's own rule) | done; release builds pending | #8583; craft-ui's `TypeRole::TabTitle` and `craft_fonts_build::Embed::tab_face`; `craft_fonts::tests::document_fonts_leave_out_the_tab_title_face`; the release and FreeBSD workflows pin a craft-fonts commit without the face, so official builds draw tab titles in the semibold face until that pin moves past storytold/craft-fonts#72; not scored | +| Document tab titles draw in a condensed face (craft-fonts' Noto Sans Condensed SemiBold) at the x-height of the interface's semibold face, so more tabs fit; builds without that face draw them in the semibold face (VectorCraft's own rule) | done; release builds pending | #8583; craft-ui's `TypeRole::TabTitle` and `craft_fonts_build::Embed::tab_face`; `craft_fonts::tests::document_fonts_leave_out_the_tab_title_face`; the CI, nightly, release and FreeBSD workflows pin craft-fonts `16bbfc3`, which has the face (storytold/craft-fonts#72), so official builds made from them draw tab titles in it; not scored | | Panels hidden by Tab or Shift+Tab show for a while when the pointer rests on the left or right edge of the window, over the canvas, and hide again when it moves away; Tab shows them for good | done | Part of #5661; `window.panels.peek` ([Workspace basics](https://web.archive.org/web/2014/https://helpx.adobe.com/illustrator/using/workspace-basics.html), "Hide or show all panels"); VectorCraft's own choices: the 6 pt band and the 0.3 s delays, only the docked panels on that side show (floating panels, Tools and the Control bar stay hidden), and nothing shows in Presentation Mode; `panel_docking::tests::resting_on_the_right_edge_shows_the_hidden_panels_over_the_canvas_until_the_pointer_leaves` and the tests after it | | Behaviour | Status | Notes | From fb0d82ea3fd6bbbacaf12dec145d49a9d77b1aa9 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Sun, 29 Nov 2026 20:24:27 -0800 Subject: [PATCH 020/112] Docs: state the Retype same-font retry, Gujarati and tab-title font status exactly docs/mcp.md now names the shapes the same-font near match compares again: a shape matched whole whose matches are all near matches in other fonts, with an open line before it. Exact matches, split shapes, shapes with no match and shapes after an unmatched shape are not compared again (crates/engine/src/cmd/retype.rs, join_in_line_face and its caller). The Gujarati status callout in docs/localization-parity.md now says the pinned fonts include Noto Sans Gujarati, as its table row does; the web startup list still has no Gujarati face. docs/ui-parity.md limits the condensed tab-title face to desktop builds; web builds draw tab titles in the semibold face (docs/development.md). --- docs/localization-parity.md | 2 +- docs/mcp.md | 8 +++++--- docs/ui-parity.md | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/localization-parity.md b/docs/localization-parity.md index c8b5109d29..e9c1d49bd6 100644 --- a/docs/localization-parity.md +++ b/docs/localization-parity.md @@ -24,7 +24,7 @@ English) in-app help, and the docs are English. (`bflatastic`), with community contributors adding or correcting (German by `dwetscher`, Japanese and Traditional Chinese by `imachus`). Georgian and the original Gujarati catalog are recorded as reviewed by native speakers; the contributor approved all 387 later Gujarati additions on 2026-11-14. -> **Gujarati status (2026-11-14, #6613):** 4,673 catalog rows: the original 4,286 remain unchanged; all 387 additions are contributor-reviewed and approved, with 11 wording corrections. Status/error messages remain partial, and the pinned CI/release fonts and web startup list contain no Gujarati face; web selection stays unavailable until a Gujarati interface face is bundled. Scores and estimates unchanged. +> **Gujarati status (2026-11-14, #6613):** 4,673 catalog rows: the original 4,286 remain unchanged; all 387 additions are contributor-reviewed and approved, with 11 wording corrections. Status/error messages remain partial. The pinned CI/release fonts include Noto Sans Gujarati as an optional `Gujr` fallback, but the web startup list contains no Gujarati face; web selection stays unavailable until a Gujarati interface face is bundled. Scores and estimates unchanged. ## The thirteen key languages diff --git a/docs/mcp.md b/docs/mcp.md index 1c550859e7..575cc6e0d7 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -13423,9 +13423,11 @@ or 65,536 path elements is matched whole only. One command groups at most 16,384 matched whole only. Near matching compares a shape with at most the 256 glyphs closest to it in proportion, in at most 50 million point comparisons per shape and 2 billion per command, ranking a glyph by proportion counting as one comparison per contour and one more; past them, the glyphs not yet ranked or compared are left out. Those 256 can -all be glyphs of other fonts drawn alike (a period or a dot): a shape that near matches no glyph of the font of the -line before it is also compared with the 256 glyphs of that font closest to it in proportion, and joins the line when -one of them fits. It looks glyphs up for at most 1,024 distinct shapes and runs per command: every selected shape first, in +all be glyphs of other fonts drawn alike (a period or a dot): a shape matched whole, whose matches are all near +matches in other fonts than that of the line before it, is also compared with the 256 glyphs of that line's font +closest to it in proportion when it does not join the line, and joins the line when one of them fits. A shape with an +exact match, a shape split into several glyphs, a shape that matches no glyph at all and a shape after an unmatched +shape are not compared again. It looks glyphs up for at most 1,024 distinct shapes and runs per command: every selected shape first, in selection order, then the runs of groups of the compound paths. Glyphs close only to the shapes and runs past that limit are not looked up. At most 262,144 glyphs are drawn to check whether they could near match, and at most 32,768 are indexed for it, each face taking an equal share of both; of a face's glyphs, those closest to the selected shapes diff --git a/docs/ui-parity.md b/docs/ui-parity.md index da14a057f8..c0cb708a50 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -458,7 +458,7 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po | A middle-click on a document tab or its × closes it as the × does; closing a modified document's last view asks to save first (VectorCraft addition, as in PhotoCraft) | done | #6506; `chrome::tests::a_middle_click_on_a_tab_closes_it_as_the_close_box_does`; not scored | | When the document tabs don't all fit, the first tab that doesn't fit whole fills the room before the » button with its title shortened and ending in "…", once that room leaves at least 40 pt for the title; with the active tab among the last ones, the tab before the ones shown fills the room left at the start instead; an active tab wider than the strip is shortened to it, and a tab narrower than 25 pt shows no ×; the tooltip of a shortened tab shows the whole title, wrapped to the window (VectorCraft's own rule) | done | #8584; `tests::tab_overflow`; not scored | | An inactive document tab shows the document's name, the view number and the unsaved-changes mark, without the zoom and the mode in parentheses (the color mode and view, or the opacity mask being edited); the active tab keeps its whole title, and an inactive tab's tooltip shows the whole title (VectorCraft's own rule) | done | #8582; `tests::tab_overflow::inactive_tabs_show_the_name_alone_so_more_tabs_fit`; not scored | -| Document tab titles draw in a condensed face (craft-fonts' Noto Sans Condensed SemiBold) at the x-height of the interface's semibold face, so more tabs fit; builds without that face draw them in the semibold face (VectorCraft's own rule) | done; release builds pending | #8583; craft-ui's `TypeRole::TabTitle` and `craft_fonts_build::Embed::tab_face`; `craft_fonts::tests::document_fonts_leave_out_the_tab_title_face`; the CI, nightly, release and FreeBSD workflows pin craft-fonts `16bbfc3`, which has the face (storytold/craft-fonts#72), so official builds made from them draw tab titles in it; not scored | +| Document tab titles draw in a condensed face (craft-fonts' Noto Sans Condensed SemiBold) at the x-height of the interface's semibold face, so more tabs fit; builds without that face draw them in the semibold face (VectorCraft's own rule) | done; release builds pending | #8583; craft-ui's `TypeRole::TabTitle` and `craft_fonts_build::Embed::tab_face`; `craft_fonts::tests::document_fonts_leave_out_the_tab_title_face`; the CI, nightly, release and FreeBSD workflows pin craft-fonts `16bbfc3`, which has the face (storytold/craft-fonts#72), so official desktop builds made from them draw tab titles in it; web builds draw them in the semibold face; not scored | | Panels hidden by Tab or Shift+Tab show for a while when the pointer rests on the left or right edge of the window, over the canvas, and hide again when it moves away; Tab shows them for good | done | Part of #5661; `window.panels.peek` ([Workspace basics](https://web.archive.org/web/2014/https://helpx.adobe.com/illustrator/using/workspace-basics.html), "Hide or show all panels"); VectorCraft's own choices: the 6 pt band and the 0.3 s delays, only the docked panels on that side show (floating panels, Tools and the Control bar stay hidden), and nothing shows in Presentation Mode; `panel_docking::tests::resting_on_the_right_edge_shows_the_hidden_panels_over_the_canvas_until_the_pointer_leaves` and the tests after it | | Behaviour | Status | Notes | From 78ec5fe34902454130ee12d4b0c7cf123badc351 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Sun, 29 Nov 2026 21:52:46 -0800 Subject: [PATCH 021/112] Tests: the .mjs listing test lists the Scripts folder on a fixed clock script_module_is_listed_and_taken_by_path listed the Scripts folder on the session's default wall clock, so on a loaded machine the 250 ms listing limit (folder::MAX_SCAN) could pass before the scan reached tool.mjs and the test failed with an empty, truncated listing. The test now sets the session's listing clock to a fixed zero, as the other Scripts folder tests do, and also checks that the listing is not truncated. The time limit itself stays covered by list_installed_stops_when_the_sessions_clock_is_past_the_time_limit. --- crates/engine/src/tests/script_modules.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/engine/src/tests/script_modules.rs b/crates/engine/src/tests/script_modules.rs index 45d5a22417..c9cb73e774 100644 --- a/crates/engine/src/tests/script_modules.rs +++ b/crates/engine/src/tests/script_modules.rs @@ -2,9 +2,11 @@ //! specifiers and paths, the run's limits, and errors at the file they are in. use std::path::{Path, PathBuf}; +use std::time::Duration; use serde_json::{Value, json}; +use crate::script::folder::Clock; use crate::*; /// A fresh folder for test `name`, with a `main` folder inside it for the script. @@ -217,8 +219,11 @@ fn script_module_is_listed_and_taken_by_path() { write(&root.join("tool.mjs"), "export var a = 1;"); let mut s = Session::new(); s.attach_scripts_dir(root.clone()); + // The listing's time limit is checked against a clock that does not move. + s.set_script_listing_clock(Clock::Fixed(Duration::ZERO)); let listed = s.execute("script.listInstalled", &json!({})).unwrap(); assert_eq!(listed["scripts"], json!([{"path": root.join("tool.mjs").to_string_lossy(), "label": "tool", "folders": []}])); + assert_eq!(listed["truncated"], false); // A script given as text is not a module, whatever its name. let mut s = Session::new(); let r = s.execute("script.run", &json!({"source": "export var a = 1;", "name": "t.mjs"})); From 411abb2f86621db04d3c242ab53eee39bb70adc6 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Sun, 29 Nov 2026 21:54:37 -0800 Subject: [PATCH 022/112] Quick Pen: Ctrl+wheel arc size reads the framework's wheel claims The arc size keeps no per-gesture state of its own: each share the tool reads is claimed with CanvasSpace::claim_wheel, the touchpad motion not yet turned into a step rides in claimed_spent, and an app modal window marks the gesture with mark_wheel_modal. craft-libs moves to main at 5190e08ab, which has the wheel claim API (craft-libs #4373). --- Cargo.lock | 207 +++++++++---------- Cargo.toml | 74 +++---- crates/ui-egui/src/canvas.rs | 2 +- crates/ui-egui/src/canvas/quick_pen_wheel.rs | 55 +++-- 4 files changed, 165 insertions(+), 173 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4fce3ecad1..4f79f80d81 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -626,12 +626,6 @@ dependencies = [ "cpufeatures 0.3.1", ] -[[package]] -name = "block" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" - [[package]] name = "block-buffer" version = "0.10.4" @@ -725,6 +719,17 @@ dependencies = [ "brotli-decompressor 5.0.3", ] +[[package]] +name = "brotli" +version = "9.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9071f285ed78f04f37d675abaaef5de7689e2f30a216c8dc6795465d81910a13" +dependencies = [ + "alloc-no-stdlib 3.0.0", + "alloc-stdlib 0.3.0", + "brotli-decompressor 6.3.2", +] + [[package]] name = "brotli-decompressor" version = "5.0.3" @@ -1184,19 +1189,6 @@ dependencies = [ "libc", ] -[[package]] -name = "core-graphics2" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b65858d95344d2711161cd92196732f67d6c5fea238cf12f994584828731a5c" -dependencies = [ - "bitflags 2.13.2", - "block", - "cfg-if", - "core-foundation 0.10.1", - "libc", -] - [[package]] name = "core_detect" version = "1.0.0" @@ -1239,7 +1231,7 @@ dependencies = [ [[package]] name = "craft" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "craft-automation", "craft-behavior", @@ -1280,7 +1272,7 @@ dependencies = [ [[package]] name = "craft-affinity" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "crc32fast", "flate2", @@ -1291,18 +1283,19 @@ dependencies = [ [[package]] name = "craft-appkit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "block2 0.6.2", "objc2 0.6.5", "objc2-app-kit 0.3.2", + "objc2-core-graphics", "objc2-foundation 0.3.2", ] [[package]] name = "craft-atomic" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "rustix 1.1.6", ] @@ -1310,7 +1303,7 @@ dependencies = [ [[package]] name = "craft-automation" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -1335,7 +1328,7 @@ dependencies = [ [[package]] name = "craft-behavior" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "accesskit", "bitflags 2.13.2", @@ -1353,7 +1346,7 @@ dependencies = [ [[package]] name = "craft-browse" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "craft-behavior", "craft-docpath", @@ -1371,7 +1364,7 @@ dependencies = [ [[package]] name = "craft-cdr" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "crc32fast", "flate2", @@ -1380,7 +1373,7 @@ dependencies = [ [[package]] name = "craft-cloud-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "egui", ] @@ -1388,7 +1381,7 @@ dependencies = [ [[package]] name = "craft-cms" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "md-5", "rayon", @@ -1397,12 +1390,12 @@ dependencies = [ [[package]] name = "craft-codepage" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" [[package]] name = "craft-color-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "craft-behavior", "craft-cms", @@ -1422,7 +1415,7 @@ dependencies = [ [[package]] name = "craft-control" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "craft-control-protocol", "craft-platform", @@ -1433,7 +1426,7 @@ dependencies = [ [[package]] name = "craft-control-protocol" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "getrandom 0.3.4", "serde_json", @@ -1443,7 +1436,7 @@ dependencies = [ [[package]] name = "craft-dds" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "rayon", ] @@ -1451,7 +1444,7 @@ dependencies = [ [[package]] name = "craft-dialogs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "block2 0.6.2", "craft-appkit", @@ -1477,7 +1470,7 @@ dependencies = [ [[package]] name = "craft-doc" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "blake3", "craft-ecproj-format", @@ -1493,7 +1486,7 @@ dependencies = [ [[package]] name = "craft-docpath" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "serde", ] @@ -1501,7 +1494,7 @@ dependencies = [ [[package]] name = "craft-draw" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1520,7 +1513,7 @@ dependencies = [ [[package]] name = "craft-dxf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "craft-codepage", "encoding_rs", @@ -1532,7 +1525,7 @@ dependencies = [ [[package]] name = "craft-ecproj-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "serde", "serde_json", @@ -1542,12 +1535,12 @@ dependencies = [ [[package]] name = "craft-eps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "fontique", "harfrust 0.13.3", @@ -1562,7 +1555,7 @@ dependencies = [ [[package]] name = "craft-font-manager" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -1581,7 +1574,7 @@ dependencies = [ [[package]] name = "craft-font-os-windows" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "windows-registry", "windows-sys 0.61.2", @@ -1590,7 +1583,7 @@ dependencies = [ [[package]] name = "craft-font-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "cap-primitives", "craft-atomic", @@ -1613,12 +1606,12 @@ dependencies = [ [[package]] name = "craft-fonts-build" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" [[package]] name = "craft-gif" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "gif", ] @@ -1626,7 +1619,7 @@ dependencies = [ [[package]] name = "craft-gzip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "flate2", ] @@ -1634,7 +1627,7 @@ dependencies = [ [[package]] name = "craft-host" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "bitflags 2.13.2", "craft-i18n", @@ -1647,8 +1640,10 @@ dependencies = [ [[package]] name = "craft-i18n" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ + "brotli 9.1.3", + "brotli-decompressor 6.3.2", "chrono", "fixed_decimal", "icu_calendar", @@ -1675,7 +1670,7 @@ dependencies = [ [[package]] name = "craft-image-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "craft-dds", "craft-jpeg", @@ -1702,7 +1697,7 @@ dependencies = [ [[package]] name = "craft-imaging" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1720,7 +1715,7 @@ dependencies = [ [[package]] name = "craft-jpeg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "thiserror 2.0.21", ] @@ -1728,7 +1723,7 @@ dependencies = [ [[package]] name = "craft-jxl" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "brotli-decompressor 5.0.3", "jixel", @@ -1739,7 +1734,7 @@ dependencies = [ [[package]] name = "craft-keymap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "craft-host", "craft-i18n", @@ -1754,7 +1749,7 @@ dependencies = [ [[package]] name = "craft-layers" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "craft-behavior", "craft-i18n", @@ -1768,7 +1763,7 @@ dependencies = [ [[package]] name = "craft-menu" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "craft-behavior", "craft-host", @@ -1786,7 +1781,7 @@ dependencies = [ [[package]] name = "craft-metadata" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "brotli-decompressor 6.3.2", "chrono", @@ -1798,7 +1793,7 @@ dependencies = [ [[package]] name = "craft-metafile" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "encoding_rs", "image", @@ -1809,7 +1804,7 @@ dependencies = [ [[package]] name = "craft-mime" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "chrono", "craft-codepage", @@ -1827,7 +1822,7 @@ dependencies = [ [[package]] name = "craft-pages" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "craft-behavior", "craft-keymap", @@ -1843,7 +1838,7 @@ dependencies = [ [[package]] name = "craft-pcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "flate2", "serde", @@ -1854,7 +1849,7 @@ dependencies = [ [[package]] name = "craft-pdf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "hayro-interpret", "hayro-syntax", @@ -1866,12 +1861,12 @@ dependencies = [ [[package]] name = "craft-platform" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "async-channel", "async-io", "async-process", - "core-graphics2", + "craft-appkit", "craft-atomic", "craft-docpath", "craft-host", @@ -1881,6 +1876,8 @@ dependencies = [ "js-sys", "log", "objc2-app-kit 0.3.2", + "objc2-core-foundation", + "objc2-core-graphics", "rfd", "serde", "serde_json", @@ -1897,7 +1894,7 @@ dependencies = [ [[package]] name = "craft-plotter" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "kurbo 0.13.1", "thiserror 2.0.21", @@ -1906,7 +1903,7 @@ dependencies = [ [[package]] name = "craft-print" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "craft-behavior", "craft-host", @@ -1930,7 +1927,7 @@ dependencies = [ [[package]] name = "craft-proof" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "log", "miniz_oxide 0.9.1", @@ -1941,7 +1938,7 @@ dependencies = [ [[package]] name = "craft-ps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "craft-eps", "flate2", @@ -1955,7 +1952,7 @@ dependencies = [ [[package]] name = "craft-psd" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "encoding_rs", "flate2", @@ -1966,7 +1963,7 @@ dependencies = [ [[package]] name = "craft-quit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "dispatch2", "egui", @@ -1979,7 +1976,7 @@ dependencies = [ [[package]] name = "craft-review" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -1998,7 +1995,7 @@ dependencies = [ [[package]] name = "craft-settings" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "craft-atomic", "craft-host", @@ -2015,7 +2012,7 @@ dependencies = [ [[package]] name = "craft-stream-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "fax", "hayro-ccitt", @@ -2026,7 +2023,7 @@ dependencies = [ [[package]] name = "craft-svg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "craft-image-codecs", "craft-xml", @@ -2047,7 +2044,7 @@ dependencies = [ [[package]] name = "craft-table" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "craft-behavior", "craft-keymap", @@ -2059,7 +2056,7 @@ dependencies = [ [[package]] name = "craft-text" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "craft-behavior", "craft-font-manager", @@ -2084,7 +2081,7 @@ dependencies = [ [[package]] name = "craft-theme" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "bitflags 2.13.2", "craft-tracked", @@ -2099,7 +2096,7 @@ dependencies = [ [[package]] name = "craft-theme-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "craft-atomic", "craft-behavior", @@ -2114,7 +2111,7 @@ dependencies = [ [[package]] name = "craft-tiff" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "serde", "thiserror 2.0.21", @@ -2124,7 +2121,7 @@ dependencies = [ [[package]] name = "craft-time" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "serde", "thiserror 2.0.21", @@ -2133,7 +2130,7 @@ dependencies = [ [[package]] name = "craft-timeline" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "craft-behavior", "craft-keymap", @@ -2148,12 +2145,12 @@ dependencies = [ [[package]] name = "craft-tracked" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" [[package]] name = "craft-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "craft-cloud-ui", "craft-ui-canvas", @@ -2167,7 +2164,7 @@ dependencies = [ [[package]] name = "craft-ui-canvas" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "craft-behavior", "craft-i18n", @@ -2183,7 +2180,7 @@ dependencies = [ [[package]] name = "craft-ui-contract" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "accesskit", "craft-behavior", @@ -2221,7 +2218,7 @@ dependencies = [ [[package]] name = "craft-ui-macros" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2232,7 +2229,7 @@ dependencies = [ [[package]] name = "craft-ui-panels" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "craft-behavior", "craft-host", @@ -2250,7 +2247,7 @@ dependencies = [ [[package]] name = "craft-ui-patterns" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "craft-behavior", "craft-host", @@ -2271,7 +2268,7 @@ dependencies = [ [[package]] name = "craft-ui-shell" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "craft-behavior", "craft-host", @@ -2292,7 +2289,7 @@ dependencies = [ [[package]] name = "craft-ui-widgets" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "craft-behavior", "craft-host", @@ -2311,7 +2308,7 @@ dependencies = [ [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "base64 0.22.1", "chrono", @@ -2343,7 +2340,7 @@ dependencies = [ [[package]] name = "craft-vectorcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "flate2", "serde", @@ -2354,7 +2351,7 @@ dependencies = [ [[package]] name = "craft-wayland" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "raw-window-handle", "wayland-backend", @@ -2375,7 +2372,7 @@ dependencies = [ [[package]] name = "craft-win32" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "winsafe", ] @@ -2383,7 +2380,7 @@ dependencies = [ [[package]] name = "craft-window" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "craft-appkit", "craft-atomic", @@ -2415,7 +2412,7 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "quick-xml 0.41.0", "serde", @@ -3770,16 +3767,16 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a" [[package]] name = "hayro-cmap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ - "brotli", + "brotli 8.0.4", "hayro-postscript", ] [[package]] name = "hayro-interpret" version = "0.7.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "bitflags 2.13.2", "hayro-cmap", @@ -3797,7 +3794,7 @@ dependencies = [ [[package]] name = "hayro-jbig2" version = "0.3.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "fearless_simd", "hayro-ccitt", @@ -3815,12 +3812,12 @@ dependencies = [ [[package]] name = "hayro-postscript" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" [[package]] name = "hayro-syntax" version = "0.7.2" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "flate2", "hayro-ccitt", @@ -4803,7 +4800,7 @@ dependencies = [ [[package]] name = "krilla" version = "0.8.2" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "base64 0.22.1", "bumpalo", @@ -4960,7 +4957,7 @@ checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" [[package]] name = "linesweeper" version = "0.5.0" -source = "git+https://github.com/storytold/craft-libs?rev=186a229c8da8db5916f8a863dfd894f1879af735#186a229c8da8db5916f8a863dfd894f1879af735" +source = "git+https://github.com/storytold/craft-libs?rev=5190e08ab8ef93c0abdfce2790a34cc0c377b3b6#5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" dependencies = [ "arrayvec", "kurbo 0.13.1", diff --git a/Cargo.toml b/Cargo.toml index cc76d129c5..a3e05e0732 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,49 +10,49 @@ license = "MIT OR Apache-2.0" rust-version = "1.95" [workspace.dependencies] -craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "186a229c8da8db5916f8a863dfd894f1879af735" } -craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "186a229c8da8db5916f8a863dfd894f1879af735", default-features = false, features = ["interpret", "write"] } -craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "186a229c8da8db5916f8a863dfd894f1879af735" } -craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "186a229c8da8db5916f8a863dfd894f1879af735" } +craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" } +craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "5190e08ab8ef93c0abdfce2790a34cc0c377b3b6", default-features = false, features = ["interpret", "write"] } +craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" } +craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" } # Language packs: the Craft apps' shared font store installs them (#4936). -craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "186a229c8da8db5916f8a863dfd894f1879af735" } -craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "186a229c8da8db5916f8a863dfd894f1879af735" } +craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" } +craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" } # The `.vectorcraft` envelope: its members, version, embedded images and the data after the JSON. -craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "186a229c8da8db5916f8a863dfd894f1879af735" } -craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "186a229c8da8db5916f8a863dfd894f1879af735" } +craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" } +craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" } # `.pcraft` documents: their manifest, full-size composite, preview, layer pixels and ICC profile. -craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "186a229c8da8db5916f8a863dfd894f1879af735", features = ["pcraft-pixels"] } +craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "5190e08ab8ef93c0abdfce2790a34cc0c377b3b6", features = ["pcraft-pixels"] } # Native Affinity documents (craft-libs#914). -craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "186a229c8da8db5916f8a863dfd894f1879af735" } +craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" } # Bounded CDR (v1-v27) and CMX (32-bit) reader (craft-libs#778). -craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "186a229c8da8db5916f8a863dfd894f1879af735" } +craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" } # SVG parsing, limits, SVGZ and writer (craft-libs#778). -craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "186a229c8da8db5916f8a863dfd894f1879af735", features = ["tree"] } -craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "186a229c8da8db5916f8a863dfd894f1879af735" } +craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "5190e08ab8ef93c0abdfce2790a34cc0c377b3b6", features = ["tree"] } +craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" } # EPS container, previews, ASCII85 and DSC comments (craft-libs#778). -craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "186a229c8da8db5916f8a863dfd894f1879af735" } +craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" } # DXF tags, reader and writer (craft-libs#778, #926, #927). -craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "186a229c8da8db5916f8a863dfd894f1879af735" } -craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "186a229c8da8db5916f8a863dfd894f1879af735" } +craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" } +craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" } # WMF, EMF and EMF+ reader (craft-libs#778). -craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "186a229c8da8db5916f8a863dfd894f1879af735" } -craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "186a229c8da8db5916f8a863dfd894f1879af735" } -craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "186a229c8da8db5916f8a863dfd894f1879af735" } -craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "186a229c8da8db5916f8a863dfd894f1879af735" } -craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "186a229c8da8db5916f8a863dfd894f1879af735" } -craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "186a229c8da8db5916f8a863dfd894f1879af735", default-features = false, features = ["read", "write"] } -craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "186a229c8da8db5916f8a863dfd894f1879af735" } -craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "186a229c8da8db5916f8a863dfd894f1879af735" } -craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "186a229c8da8db5916f8a863dfd894f1879af735" } -craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "186a229c8da8db5916f8a863dfd894f1879af735" } +craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" } +craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" } +craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" } +craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" } +craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" } +craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "5190e08ab8ef93c0abdfce2790a34cc0c377b3b6", default-features = false, features = ["read", "write"] } +craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" } +craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" } +craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" } +craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" } # The framework facade (`craft::ui`, `craft::settings`, `craft::platform`, ...). No default features: each crate names # the members it imports. -craft = { git = "https://github.com/storytold/craft-libs", rev = "186a229c8da8db5916f8a863dfd894f1879af735" } +craft = { git = "https://github.com/storytold/craft-libs", rev = "5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" } # Below the egui layer, so not through the facade: the colour harmony rules and their settings (craft-color-ui # without its `ui` feature), the colour type they work in, and the craft-fonts tables the text crate's build writes. -craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "186a229c8da8db5916f8a863dfd894f1879af735" } -craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "186a229c8da8db5916f8a863dfd894f1879af735" } -craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "186a229c8da8db5916f8a863dfd894f1879af735" } +craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" } +craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" } +craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" } # Nightly profile isolation, launch protocol, and security fence. craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "1f6c3a21f85ed96f8fd4ddd5a959d4e1edbedb24" } # internal @@ -194,13 +194,13 @@ lto = "thin" codegen-units = 1 [patch.crates-io] -hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "186a229c8da8db5916f8a863dfd894f1879af735" } -hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "186a229c8da8db5916f8a863dfd894f1879af735" } -hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "186a229c8da8db5916f8a863dfd894f1879af735" } -hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "186a229c8da8db5916f8a863dfd894f1879af735" } -hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "186a229c8da8db5916f8a863dfd894f1879af735" } -krilla = { git = "https://github.com/storytold/craft-libs", rev = "186a229c8da8db5916f8a863dfd894f1879af735" } -linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "186a229c8da8db5916f8a863dfd894f1879af735" } +hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" } +hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" } +hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" } +hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" } +hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" } +krilla = { git = "https://github.com/storytold/craft-libs", rev = "5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" } +linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "5190e08ab8ef93c0abdfce2790a34cc0c377b3b6" } ecolor = { git = "https://github.com/storytold/egui.git", rev = "14c39fed181756be6f357c284354e0ab55b64443" } emath = { git = "https://github.com/storytold/egui.git", rev = "14c39fed181756be6f357c284354e0ab55b64443" } epaint = { git = "https://github.com/storytold/egui.git", rev = "14c39fed181756be6f357c284354e0ab55b64443" } diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs index 84bb417676..34b6d7e5df 100644 --- a/crates/ui-egui/src/canvas.rs +++ b/crates/ui-egui/src/canvas.rs @@ -329,7 +329,7 @@ fn show_body(app: &mut VectorcraftApp, ui: &mut Ui, space: &CanvasSpace, pass: O let task_bar = (app.ui.task_bar && !revolve_editing(app) && !strip && !dragging).then(|| task_bar::task_bar(app, ui, space)).flatten(); let bar = quick_pen_bar::quick_pen_bar(app, ui, space); // A Ctrl-wheel turn with the Quick Pen tool changes its arc size; the view stays as it was before the pass. - out.arc_turn = quick_pen_wheel::arc_size(app, space.wheel(), bar); + out.arc_turn = quick_pen_wheel::arc_size(app, ui.ctx(), space, bar); contour_bar::contour_bar(app, ui, space); // After the task bar, which the row of character alternates keeps clear of. alternates_bar::alternates_bar(app, ui, space, task_bar); diff --git a/crates/ui-egui/src/canvas/quick_pen_wheel.rs b/crates/ui-egui/src/canvas/quick_pen_wheel.rs index 06ee24dd50..b66ad3963e 100644 --- a/crates/ui-egui/src/canvas/quick_pen_wheel.rs +++ b/crates/ui-egui/src/canvas/quick_pen_wheel.rs @@ -17,6 +17,7 @@ use craft::behavior::{Wheel, WheelSource, WheelUnit}; use craft::keymap::{Mods, Platform}; +use craft::ui::canvas::CanvasSpace; use super::{VectorcraftApp, json}; @@ -48,16 +49,6 @@ fn lines(wheel: &Wheel, line: f32) -> f32 { if d.is_finite() { d } else { 0.0 } } -/// A wheel turn the Quick Pen tool reads, from the framework's gesture: whether a modal window was up -/// during it, whether the tool took it, and the touchpad motion it took, in wheel lines, not yet -/// turned into a step. -#[derive(Clone, Copy, Default, PartialEq)] -struct ArcTurn { - muted: bool, - taken: bool, - rest: f32, -} - /// Whether `wheel`, of `lines` wheel lines, comes from a touchpad and not from a mouse wheel's /// notches. egui names the source on macOS and reports it unknown elsewhere. There, point motion /// (Wayland, a Windows precision touchpad) and line motion that is not whole lines (Windows and X11) @@ -103,30 +94,34 @@ fn steps(wheel: &Wheel, line: f32, rest: &mut f32) -> f32 { /// or smaller (down). A touchpad gesture counts the keys held at any point of it, keys tapped /// between its events included. No step is made while a modal window is up, nor for the rest of a /// turn begun under one. Returns true while the tool takes the turn, so the view does not zoom or -/// scroll for the rest of it. A turn is the framework's wheel gesture. -pub(super) fn arc_size(app: &mut VectorcraftApp, wheel: Option<Wheel>, bar: Option<egui::Rect>) -> bool { - let Some(w) = wheel else { return false }; - let id = egui::Id::unique("quick-pen-arc-turn"); - // The framework's first share of a gesture gathers only itself. - let first = w.gathered == w.scroll && w.zoom_gathered == w.zoom_lines; - let before = if first { ArcTurn::default() } else { app.ui_ctx.as_ref().and_then(|ctx| ctx.data(|d| d.get_temp(id))).unwrap_or_default() }; - let mut turn = before; - // The framework marks a turn a modal layer held (`modal`); a turn that reached the canvas while - // one of the app's own modal windows was up stays muted until the framework starts a new one. - turn.muted |= w.modal || crate::panel_docking::modal_window_up(app); +/// scroll for the rest of it. A turn is the framework's wheel gesture, and the tool keeps no state of +/// its own: it claims each share it reads (`CanvasSpace::claim_wheel`), recording as `spent.x` the +/// touchpad motion it kept, in wheel lines, so `claimed_spent.x` is the motion of the turn not yet +/// turned into a step. +pub(super) fn arc_size(app: &mut VectorcraftApp, ctx: &egui::Context, space: &CanvasSpace, bar: Option<egui::Rect>) -> bool { + let Some(w) = space.wheel() else { return false }; + // The framework marks a turn a modal layer held (`modal`); a turn that reaches the canvas while one + // of the app's own modal windows is up is marked too, and stays muted until the framework starts a + // new one. + let app_modal = crate::panel_docking::modal_window_up(app); + if app_modal { + space.mark_wheel_modal(ctx); + } + let muted = w.modal || app_modal; let line = crate::app::view::navigation(&app.session.prefs).wheel_line.max(1.0); let mods = if fine(&w, lines(&w, line)) { w.held } else { w.mods }; let over_bar = w.at.zip(bar).is_some_and(|(at, bar)| bar.contains(at)); let quick_pen = app.session.tool_id() == vectorcraft_tools::quickpen::ID; + let mut taken = w.claimed; let mut runs = 0.0; - if quick_pen && !turn.muted && !over_bar && ctrl_alone(mods, crate::keymap::platform()) { - turn.taken = true; - runs = steps(&w, line, &mut turn.rest); - } - if (first || turn != before) - && let Some(ctx) = &app.ui_ctx - { - ctx.data_mut(|d| d.insert_temp(id, turn)); + if quick_pen && !muted && !over_bar && ctrl_alone(mods, crate::keymap::platform()) { + let mut rest = w.claimed_spent.x; + let made = steps(&w, line, &mut rest); + // A share of a gesture another scroller owns cannot be claimed; the tool still takes it, as the + // canvas's output keeps the view for this pass. + space.claim_wheel(ctx, egui::vec2(rest - w.claimed_spent.x, 0.0)); + taken = true; + runs = made; } let cmd = if runs > 0.0 { "tool.quickPen.arcLarger" } else { "tool.quickPen.arcSmaller" }; for _ in 0..(runs.abs() as u32) { @@ -139,5 +134,5 @@ pub(super) fn arc_size(app: &mut VectorcraftApp, wheel: Option<Wheel>, bar: Opti } } } - quick_pen && turn.taken + quick_pen && taken } From f4888892d02d7e7202f7ce162c3c7014957d8163 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Sun, 29 Nov 2026 22:36:16 -0800 Subject: [PATCH 023/112] Quick Pen: the first Ctrl+wheel share keeps the view; English-only labels The arc-size wheel is now read before the canvas body, so on the first share of a turn the controls, painting and tool host use the view the pass began with instead of the zoomed one. The framework reports a frame's wheel motion as signed totals, so opposite notches in one frame cancel; the docs say so. The arc size labels are English only, as new strings go through craft-i18n. --- crates/ui-egui/src/canvas.rs | 43 ++++++++++++++++--- crates/ui-egui/src/canvas/quick_pen_wheel.rs | 14 ++++-- crates/ui-egui/src/i18n/bg.tsv | 2 - crates/ui-egui/src/i18n/bs.tsv | 2 - crates/ui-egui/src/i18n/ca.tsv | 2 - crates/ui-egui/src/i18n/cs.tsv | 2 - crates/ui-egui/src/i18n/da.tsv | 2 - crates/ui-egui/src/i18n/de.tsv | 2 - crates/ui-egui/src/i18n/el.tsv | 2 - crates/ui-egui/src/i18n/es.tsv | 2 - crates/ui-egui/src/i18n/fi.tsv | 2 - crates/ui-egui/src/i18n/fr.tsv | 2 - crates/ui-egui/src/i18n/gu.tsv | 2 - crates/ui-egui/src/i18n/hi.tsv | 2 - crates/ui-egui/src/i18n/hu.tsv | 2 - crates/ui-egui/src/i18n/id.tsv | 2 - crates/ui-egui/src/i18n/it.tsv | 2 - crates/ui-egui/src/i18n/ja.tsv | 2 - crates/ui-egui/src/i18n/ka.tsv | 2 - crates/ui-egui/src/i18n/ko.tsv | 2 - crates/ui-egui/src/i18n/nl.tsv | 2 - crates/ui-egui/src/i18n/pl.tsv | 2 - crates/ui-egui/src/i18n/pt-br.tsv | 2 - crates/ui-egui/src/i18n/ru.tsv | 2 - crates/ui-egui/src/i18n/sv.tsv | 2 - crates/ui-egui/src/i18n/tr.tsv | 2 - crates/ui-egui/src/i18n/uk.tsv | 2 - crates/ui-egui/src/i18n/vi.tsv | 2 - crates/ui-egui/src/i18n/zh-hans.tsv | 2 - crates/ui-egui/src/i18n/zh-hant.tsv | 2 - crates/ui-egui/src/tests/quickpenwheel.rs | 45 ++++++++++++++++++++ docs/mcp.md | 11 +++-- 32 files changed, 99 insertions(+), 70 deletions(-) diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs index 34b6d7e5df..f6ac38176b 100644 --- a/crates/ui-egui/src/canvas.rs +++ b/crates/ui-egui/src/canvas.rs @@ -6,7 +6,7 @@ use craft::behavior::{CanvasView, PressPhase}; use craft::keymap::Mods; use craft::ui::canvas::{ Canvas, CanvasScrollbars, CanvasSpace, ContextSource, RotateView, ToolHostResponse, ToolPass, ViewCommands, ViewRequest, ViewTarget, - canvas_space, tool_pass, + canvas_space, tool_pass, with_canvas_space, }; use craft::ui::contract::{Bind, Props as _, Show as _, ShowContainer as _}; use craft::ui::primitives::PaintSlot; @@ -232,8 +232,31 @@ pub(crate) fn show_document(app: &mut VectorcraftApp, ui: &mut Ui, win: Win, kin }; let mut body = Body::default(); let shown = canvas.show(ui, |ui, env| { - if let Some(space) = canvas_space(&env.env) { - body = show_body(app, ui, &space, tool_pass(&env.env).as_ref(), win, kind); + if let Some(mut space) = canvas_space(&env.env) { + let mut pass = tool_pass(&env.env); + let bar_paint = PaintSlot::reserve(ui.painter()); + let arc_turn = if kind == BodyKind::Live && app.ui.screen_mode < 3 { + let mut bar_space = space; + if space.wheel().is_some_and(|w| w.claimed || quick_pen_wheel::control_turn(app, &w)) { + bar_space.set_view(given); + } + let bar = quick_pen_bar::quick_pen_bar(app, ui, &bar_space); + quick_pen_wheel::arc_size(app, ui.ctx(), &space, bar) + } else { + false + }; + let bar_shapes = bar_paint.take_after(ui.ctx()); + // The framework settles wheel navigation before the body. A claimed share uses the + // saved view for the controls, painting and tool host, including its first pass. + if arc_turn { + space.set_view(given); + if let Some(pass) = pass.as_mut() { + pass.space = Some(space); + pass.view = Some(given); + } + } + body = with_canvas_space(ui, space, |ui| show_body(app, ui, &space, pass.as_ref(), win, kind, bar_shapes)); + body.arc_turn = arc_turn; } }); let output = shown.output; @@ -289,7 +312,15 @@ pub(crate) fn show_document(app: &mut VectorcraftApp, ui: &mut Ui, win: Win, kin /// The body of the canvas in order: controls that take presses first, the tool host, the selection's marks, the /// picture last. -fn show_body(app: &mut VectorcraftApp, ui: &mut Ui, space: &CanvasSpace, pass: Option<&ToolPass>, win: Win, kind: BodyKind) -> Body { +fn show_body( + app: &mut VectorcraftApp, + ui: &mut Ui, + space: &CanvasSpace, + pass: Option<&ToolPass>, + win: Win, + kind: BodyKind, + bar_shapes: Vec<egui::Shape>, +) -> Body { let live = kind == BodyKind::Live; let presenting = app.ui.screen_mode == 3; let background = space.background(); @@ -327,9 +358,7 @@ fn show_body(app: &mut VectorcraftApp, ui: &mut Ui, space: &CanvasSpace, pass: O // The bars give way to a drag, not to a click. let dragging = in_gesture(app, ui.ctx()) && ui.input(|i| i.pointer.is_decidedly_dragging()); let task_bar = (app.ui.task_bar && !revolve_editing(app) && !strip && !dragging).then(|| task_bar::task_bar(app, ui, space)).flatten(); - let bar = quick_pen_bar::quick_pen_bar(app, ui, space); - // A Ctrl-wheel turn with the Quick Pen tool changes its arc size; the view stays as it was before the pass. - out.arc_turn = quick_pen_wheel::arc_size(app, ui.ctx(), space, bar); + PaintSlot::reserve(ui.painter()).extend(ui.ctx(), bar_shapes); contour_bar::contour_bar(app, ui, space); // After the task bar, which the row of character alternates keeps clear of. alternates_bar::alternates_bar(app, ui, space, task_bar); diff --git a/crates/ui-egui/src/canvas/quick_pen_wheel.rs b/crates/ui-egui/src/canvas/quick_pen_wheel.rs index b66ad3963e..f914413a95 100644 --- a/crates/ui-egui/src/canvas/quick_pen_wheel.rs +++ b/crates/ui-egui/src/canvas/quick_pen_wheel.rs @@ -4,7 +4,7 @@ //! and on macOS alike //! ([Quick Pen tool keyboard shortcuts](https://helpx.adobe.com/illustrator/web/add-and-edit-artwork/draw-and-edit-paths/quick-pen-tool-keyboard-shortcuts.html)). //! VectorCraft's own rules: a mouse wheel turned with Ctrl does the same; a mouse wheel makes one -//! step of 15°, as `[` and `]` do, for each notch (each whole wheel line, at least one for each share +//! step of 15°, as `[` and `]` do, for each net whole wheel line (at least one for each nonzero share //! of wheel motion the canvas reads), and a touchpad makes one step for each wheel line of its //! gesture's motion; up makes the arc larger and down smaller, and sideways motion makes no step //! (with Ctrl on Windows and Linux, where the wheel reaches the canvas as a zoom, sideways motion @@ -39,6 +39,9 @@ fn ctrl_alone(m: Mods, os: Platform) -> bool { /// lines in `zoom_lines`; sideways motion there adds to up and down, as egui's zoom factor does. /// Points of a touchpad or a browser are lines of `line` points. fn lines(wheel: &Wheel, line: f32) -> f32 { + // Wheel exposes only the share's signed totals, without individual events or separate up/down + // counts. Opposite notches in one pass cancel; their order and steps at the arc limits cannot + // be recovered. Count the net lines the framework reports. let d = if wheel.zoom_lines != egui::Vec2::ZERO { wheel.zoom_lines.x + wheel.zoom_lines.y } else if wheel.scroll.y != 0.0 { @@ -63,6 +66,12 @@ fn fine(wheel: &Wheel, lines: f32) -> bool { } } +pub(super) fn control_turn(app: &VectorcraftApp, wheel: &Wheel) -> bool { + let line = crate::app::view::navigation(&app.session.prefs).wheel_line.max(1.0); + let mods = if fine(wheel, lines(wheel, line)) { wheel.held } else { wheel.mods }; + ctrl_alone(mods, crate::keymap::platform()) +} + /// Whole lines in `v`, toward zero, with [`LINE_SLACK`] for rounding. fn whole(v: f32) -> f32 { (v + LINE_SLACK * v.signum()).trunc() @@ -109,12 +118,11 @@ pub(super) fn arc_size(app: &mut VectorcraftApp, ctx: &egui::Context, space: &Ca } let muted = w.modal || app_modal; let line = crate::app::view::navigation(&app.session.prefs).wheel_line.max(1.0); - let mods = if fine(&w, lines(&w, line)) { w.held } else { w.mods }; let over_bar = w.at.zip(bar).is_some_and(|(at, bar)| bar.contains(at)); let quick_pen = app.session.tool_id() == vectorcraft_tools::quickpen::ID; let mut taken = w.claimed; let mut runs = 0.0; - if quick_pen && !muted && !over_bar && ctrl_alone(mods, crate::keymap::platform()) { + if quick_pen && !muted && !over_bar && control_turn(app, &w) { let mut rest = w.claimed_spent.x; let made = steps(&w, line, &mut rest); // A share of a gesture another scroller owns cannot be claimed; the tool still takes it, as the diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index 66ae31f690..b7ad3eb99b 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -2885,8 +2885,6 @@ font-technology Variable Променливи Continuous Arc Непрекъсната дъга Sharp Corner Arc Дъга с остър ъгъл Flip Arc Обръщане на дъгата - Increase Arc Size Увеличаване на размера на дъгата - Decrease Arc Size Намаляване на размера на дъгата Hide Toolbar Скриване на лентата с инструменти Pin Toolbar Position Закачане на позицията на лентата с инструменти Reset Toolbar Position Нулиране на позицията на лентата с инструменти diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index 10fb6d4b59..b125e378f5 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -4254,8 +4254,6 @@ theme Appearance Izgled Continuous Arc Neprekidni luk Sharp Corner Arc Luk s oštrim uglom Flip Arc Preokreni luk - Increase Arc Size Povećaj veličinu luka - Decrease Arc Size Smanji veličinu luka Hide Toolbar Sakrij traku s alatima Pin Toolbar Position Prikvači položaj trake s alatima Reset Toolbar Position Vrati položaj trake s alatima na početno diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index 4416321fa2..555080655a 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -3500,8 +3500,6 @@ digits Malayalam Malaiàlam Continuous Arc Arc continu Sharp Corner Arc Arc de cantonada aguda Flip Arc Inverteix l’arc - Increase Arc Size Augmenta la mida de l’arc - Decrease Arc Size Redueix la mida de l’arc Hide Toolbar Amaga la barra d’eines Pin Toolbar Position Fixa la posició de la barra d’eines Reset Toolbar Position Restableix la posició de la barra d’eines diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 9dabe178f2..8d11266cdd 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -4361,8 +4361,6 @@ theme Appearance Motiv Continuous Arc Plynulý oblouk Sharp Corner Arc Oblouk s ostrým rohem Flip Arc Překlopit oblouk - Increase Arc Size Zvětšit velikost oblouku - Decrease Arc Size Zmenšit velikost oblouku Hide Toolbar Skrýt panel nástrojů Pin Toolbar Position Připnout polohu panelu nástrojů Reset Toolbar Position Obnovit polohu panelu nástrojů diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 22cfe3a223..9820804ff0 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -6932,8 +6932,6 @@ theme Appearance Udseende Continuous Arc Fortløbende bue Sharp Corner Arc Bue med skarpt hjørne Flip Arc Vend bue - Increase Arc Size Øg buestørrelse - Decrease Arc Size Formindsk buestørrelse Hide Toolbar Skjul værktøjslinjen Pin Toolbar Position Fastgør værktøjslinjens placering Reset Toolbar Position Nulstil værktøjslinjens placering diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 01a2aa40ef..d29f3c46c0 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -2809,8 +2809,6 @@ file-filter Templates Vorlagen Continuous Arc Fortlaufender Bogen Sharp Corner Arc Bogen mit scharfer Ecke Flip Arc Bogen spiegeln - Increase Arc Size Bogengröße erhöhen - Decrease Arc Size Bogengröße verringern Hide Toolbar Werkzeugleiste ausblenden Pin Toolbar Position Position der Werkzeugleiste fixieren Reset Toolbar Position Position der Werkzeugleiste zurücksetzen diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 87911e63b0..e4a651342a 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -2208,8 +2208,6 @@ font-technology Variable Μεταβλητές Continuous Arc Συνεχές τόξο Sharp Corner Arc Τόξο με αιχμηρή γωνία Flip Arc Αναστροφή τόξου - Increase Arc Size Αύξηση μεγέθους τόξου - Decrease Arc Size Μείωση μεγέθους τόξου Hide Toolbar Απόκρυψη γραμμής εργαλείων Pin Toolbar Position Σταθεροποίηση θέσης γραμμής εργαλείων Reset Toolbar Position Επαναφορά θέσης γραμμής εργαλείων diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index fb8b534363..008a0b6483 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -2847,8 +2847,6 @@ font-technology Variable Variables Continuous Arc Arco continuo Sharp Corner Arc Arco de esquina aguda Flip Arc Voltear arco - Increase Arc Size Aumentar tamaño del arco - Decrease Arc Size Reducir tamaño del arco Hide Toolbar Ocultar barra de herramientas Pin Toolbar Position Fijar posición de la barra de herramientas Reset Toolbar Position Restablecer posición de la barra de herramientas diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index b53af1e432..ffbeb6f49b 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -4278,8 +4278,6 @@ theme Appearance Ulkoasu Continuous Arc Jatkuva kaari Sharp Corner Arc Terävän kulman kaari Flip Arc Käännä kaari - Increase Arc Size Suurenna kaaren kokoa - Decrease Arc Size Pienennä kaaren kokoa Hide Toolbar Piilota työkalurivi Pin Toolbar Position Kiinnitä työkalurivin sijainti Reset Toolbar Position Palauta työkalurivin sijainti diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 597f36670e..7e03e3b7c4 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -2835,8 +2835,6 @@ font-technology Variable Variables Continuous Arc Arc continu Sharp Corner Arc Arc à angle vif Flip Arc Retourner l’arc - Increase Arc Size Augmenter la taille de l’arc - Decrease Arc Size Réduire la taille de l’arc Hide Toolbar Masquer la barre d’outils Pin Toolbar Position Épingler la position de la barre d’outils Reset Toolbar Position Réinitialiser la position de la barre d’outils diff --git a/crates/ui-egui/src/i18n/gu.tsv b/crates/ui-egui/src/i18n/gu.tsv index 981232e347..497ef4d6d8 100644 --- a/crates/ui-egui/src/i18n/gu.tsv +++ b/crates/ui-egui/src/i18n/gu.tsv @@ -2849,8 +2849,6 @@ Continuous Arc સતત આર્ક Sharp Corner Arc તીક્ષ્ણ ખૂણાવાળો આર્ક Flip Arc આર્ક ફ્લિપ કરો - Increase Arc Size આર્કનું કદ વધારો - Decrease Arc Size આર્કનું કદ ઘટાડો Hide Toolbar ટૂલબાર છુપાવો Pin Toolbar Position ટૂલબાર સ્થિતિ પિન કરો Reset Toolbar Position ટૂલબાર સ્થિતિ રીસેટ કરો diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index 0be240457b..8ad28968c5 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -4047,8 +4047,6 @@ arrowhead Feather पंख Continuous Arc सतत आर्क Sharp Corner Arc तीखे कोने वाला आर्क Flip Arc आर्क पलटें - Increase Arc Size आर्क का आकार बढ़ाएँ - Decrease Arc Size आर्क का आकार घटाएँ Hide Toolbar टूलबार छिपाएँ Pin Toolbar Position टूलबार स्थिति पिन करें Reset Toolbar Position टूलबार स्थिति रीसेट करें diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index d9d282b649..3116815efa 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -3379,8 +3379,6 @@ file-filter Templates Sablonok Continuous Arc Folytonos ív Sharp Corner Arc Éles sarkú ív Flip Arc Ív tükrözése - Increase Arc Size Ívméret növelése - Decrease Arc Size Ívméret csökkentése Hide Toolbar Eszköztár elrejtése Pin Toolbar Position Eszköztár helyének rögzítése Reset Toolbar Position Eszköztár helyének visszaállítása diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index e7c8d8be4a..b159d2bfb7 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -4797,8 +4797,6 @@ theme Appearance Tampilan Continuous Arc Busur bersambung Sharp Corner Arc Busur sudut tajam Flip Arc Balik busur - Increase Arc Size Perbesar ukuran busur - Decrease Arc Size Perkecil ukuran busur Hide Toolbar Sembunyikan bilah alat Pin Toolbar Position Sematkan posisi bilah alat Reset Toolbar Position Atur ulang posisi bilah alat diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 57601c82df..d6b341a367 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -2894,8 +2894,6 @@ file-filter Templates Modelli Continuous Arc Arco continuo Sharp Corner Arc Arco ad angolo vivo Flip Arc Capovolgi arco - Increase Arc Size Aumenta dimensione arco - Decrease Arc Size Riduci dimensione arco Hide Toolbar Nascondi barra degli strumenti Pin Toolbar Position Fissa posizione barra degli strumenti Reset Toolbar Position Ripristina posizione barra degli strumenti diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 681efb5f1b..48f6dd36cf 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -2972,8 +2972,6 @@ antiAlias Sharp シャープ Continuous Arc 連続円弧 Sharp Corner Arc 鋭角円弧 Flip Arc 円弧を反転 - Increase Arc Size 円弧のサイズを大きく - Decrease Arc Size 円弧のサイズを小さく Hide Toolbar ツールバーを隠す Pin Toolbar Position ツールバーの位置を固定 Reset Toolbar Position ツールバーの位置をリセット diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 646108c76d..cbb58ee5ab 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -6101,8 +6101,6 @@ theme Appearance იერსახე Continuous Arc უწყვეტი რკალი Sharp Corner Arc მახვილკუთხიანი რკალი Flip Arc რკალის არეკვლა - Increase Arc Size რკალის ზომის გაზრდა - Decrease Arc Size რკალის ზომის შემცირება Hide Toolbar ხელსაწყოთა ზოლის დამალვა Pin Toolbar Position ხელსაწყოთა ზოლის პოზიციის ჩამაგრება Reset Toolbar Position ხელსაწყოთა ზოლის პოზიციის ჩამოყრა diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 4dffe2d723..bd430d2fc1 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -2962,8 +2962,6 @@ antiAlias Sharp 날카롭게 Continuous Arc 연속 호 Sharp Corner Arc 뾰족한 모서리 호 Flip Arc 호 뒤집기 - Increase Arc Size 호 크기 늘리기 - Decrease Arc Size 호 크기 줄이기 Hide Toolbar 도구 모음 숨기기 Pin Toolbar Position 도구 모음 위치 고정 Reset Toolbar Position 도구 모음 위치 재설정 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 06535d7ea7..20365f1488 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -4793,8 +4793,6 @@ theme Appearance Vormgeving Continuous Arc Doorlopende boog Sharp Corner Arc Boog met scherpe hoek Flip Arc Boog spiegelen - Increase Arc Size Boog groter maken - Decrease Arc Size Boog kleiner maken Hide Toolbar Werkbalk verbergen Pin Toolbar Position Werkbalkpositie vastzetten Reset Toolbar Position Werkbalkpositie herstellen diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index fc2e60066f..4a22a1dd93 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -4224,8 +4224,6 @@ theme Appearance Wygląd Continuous Arc Łuk ciągły Sharp Corner Arc Łuk z ostrym narożnikiem Flip Arc Odwróć łuk - Increase Arc Size Zwiększ rozmiar łuku - Decrease Arc Size Zmniejsz rozmiar łuku Hide Toolbar Ukryj pasek narzędzi Pin Toolbar Position Przypnij położenie paska narzędzi Reset Toolbar Position Resetuj położenie paska narzędzi diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 7ccf71dad0..6d910ce85f 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -2337,8 +2337,6 @@ antiAlias Sharp Nítido Continuous Arc Arco Contínuo Sharp Corner Arc Arco de Canto Agudo Flip Arc Virar Arco - Increase Arc Size Aumentar Tamanho do Arco - Decrease Arc Size Diminuir Tamanho do Arco Hide Toolbar Ocultar Barra de Ferramentas Pin Toolbar Position Fixar Posição da Barra de Ferramentas Reset Toolbar Position Redefinir Posição da Barra de Ferramentas diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index 1d662a491c..60906af64a 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -2876,8 +2876,6 @@ file-filter Templates Шаблоны Continuous Arc Непрерывная дуга Sharp Corner Arc Дуга с острым углом Flip Arc Отразить дугу - Increase Arc Size Увеличить размер дуги - Decrease Arc Size Уменьшить размер дуги Hide Toolbar Скрыть панель инструментов Pin Toolbar Position Закрепить положение панели инструментов Reset Toolbar Position Сбросить положение панели инструментов diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 0c739b14d6..bf7420d255 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -2768,8 +2768,6 @@ font-technology Variable Variabla Continuous Arc Kontinuerlig båge Sharp Corner Arc Båge med skarpt hörn Flip Arc Vänd båge - Increase Arc Size Öka bågstorlek - Decrease Arc Size Minska bågstorlek Hide Toolbar Dölj verktygsfältet Pin Toolbar Position Fäst verktygsfältets position Reset Toolbar Position Återställ verktygsfältets position diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index ad7f1cc97f..830b60e56b 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -2611,8 +2611,6 @@ shape Open Açık Continuous Arc Sürekli Yay Sharp Corner Arc Keskin Köşeli Yay Flip Arc Yayı Çevir - Increase Arc Size Yay Boyutunu Artır - Decrease Arc Size Yay Boyutunu Azalt Hide Toolbar Araç Çubuğunu Gizle Pin Toolbar Position Araç Çubuğu Konumunu Sabitle Reset Toolbar Position Araç Çubuğu Konumunu Sıfırla diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index d898b8991b..09a9e4bf6d 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -2886,8 +2886,6 @@ file-filter Templates Шаблони Continuous Arc Неперервна дуга Sharp Corner Arc Дуга з гострим кутом Flip Arc Відобразити дугу - Increase Arc Size Збільшити розмір дуги - Decrease Arc Size Зменшити розмір дуги Hide Toolbar Сховати панель інструментів Pin Toolbar Position Закріпити положення панелі інструментів Reset Toolbar Position Скинути положення панелі інструментів diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index a04c6480be..bc63725d0f 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -3199,8 +3199,6 @@ digits Hindi Hindi Continuous Arc Cung liên tục Sharp Corner Arc Cung góc nhọn Flip Arc Lật cung - Increase Arc Size Tăng kích thước cung - Decrease Arc Size Giảm kích thước cung Hide Toolbar Ẩn thanh công cụ Pin Toolbar Position Ghim vị trí thanh công cụ Reset Toolbar Position Đặt lại vị trí thanh công cụ diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index c69caa23bf..9b7e1c7bbc 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -2737,8 +2737,6 @@ file-filter Templates 模板 Continuous Arc 连续弧线 Sharp Corner Arc 尖角弧线 Flip Arc 翻转弧线 - Increase Arc Size 增大弧线尺寸 - Decrease Arc Size 减小弧线尺寸 Hide Toolbar 隐藏工具栏 Pin Toolbar Position 固定工具栏位置 Reset Toolbar Position 重置工具栏位置 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 99cdf242e6..2e3bae2d60 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -4197,8 +4197,6 @@ liquify-list-end {0}, {1} {0}和{1} Continuous Arc 連續弧線 Sharp Corner Arc 尖角弧線 Flip Arc 翻轉弧線 - Increase Arc Size 增大弧線尺寸 - Decrease Arc Size 減小弧線尺寸 Hide Toolbar 隱藏工具列 Pin Toolbar Position 釘選工具列位置 Reset Toolbar Position 重設工具列位置 diff --git a/crates/ui-egui/src/tests/quickpenwheel.rs b/crates/ui-egui/src/tests/quickpenwheel.rs index 369e27847d..dba5367ebe 100644 --- a/crates/ui-egui/src/tests/quickpenwheel.rs +++ b/crates/ui-egui/src/tests/quickpenwheel.rs @@ -134,6 +134,51 @@ fn ctrl_wheel_changes_the_arc_size_and_not_the_view() { }); } +/// The first claimed share keeps both the stored view and the tool host's document point. +#[test] +fn the_first_ctrl_wheel_frame_keeps_the_view_and_pointer() { + let mut app = app(); + on_canvas(&mut app, |rig| { + rig.fx.settle(); + let at = center(rig) + vec2(80.0, 40.0); + rig.fx.frame(vec![Event::PointerMoved(at)]); + let still = view(rig); + let point = rig.app().hover_doc.expect("the pointer is over the canvas"); + let win = crate::doc_windows::current(&rig.app()).unwrap(); + let id = crate::canvas::canvas_id(win); + let shown = craft::ui::canvas::ToolHost::shown_space(rig.fx.ctx(), id).unwrap().view; + rig.fx.frame(vec![notch(1.0, ctrl())]); + assert_eq!(arc_size(rig), 195.0); + assert_eq!(view(rig).zoom, still.zoom, "the first share keeps the zoom"); + assert_eq!(view(rig).center, still.center, "the first share keeps the pan"); + assert_eq!(craft::ui::canvas::ToolHost::shown_space(rig.fx.ctx(), id).unwrap().view, shown, "the tool host sees the saved view"); + assert_eq!(rig.app().hover_doc, Some(point), "the tool host uses the saved view in the same frame"); + }); +} + +/// Opposite notches in one frame use the framework's net lines and keep the tool host's view. +#[test] +fn opposite_notches_use_the_frameworks_reported_net_motion() { + let mut app = app(); + on_canvas(&mut app, |rig| { + rig.fx.settle(); + rig.fx.frame(vec![Event::PointerMoved(center(rig) + vec2(80.0, 40.0))]); + let win = crate::doc_windows::current(&rig.app()).unwrap(); + let id = crate::canvas::canvas_id(win); + let shown = craft::ui::canvas::ToolHost::shown_space(rig.fx.ctx(), id).unwrap().view; + for (start, notches, expected) in + [(345, vec![1.0, -1.0], 345.0), (345, vec![1.0, 1.0, -1.0], 345.0), (180, vec![1.0, -1.0], 180.0), (180, vec![1.0, 1.0, -1.0], 195.0)] + { + rig.app().run("tool.setOption", json!({"key": "turn", "value": start})).unwrap(); + rig.fx.frame(notches.into_iter().map(|dy| notch(dy, ctrl())).collect()); + assert_eq!(arc_size(rig), expected, "the framework reports net lines, including at the arc limit"); + assert_eq!(craft::ui::canvas::ToolHost::shown_space(rig.fx.ctx(), id).unwrap().view, shown, "mixed notches keep the tool host's view"); + rig.fx.advance(1.5); + rig.fx.frame(vec![]); + } + }); +} + /// A touchpad steps once per wheel line of motion: half a line makes no step, the second half of the /// same gesture makes one, and momentum after it makes none (egui reports momentum on macOS). Half a /// line in a later turn does not add to the half before it. diff --git a/docs/mcp.md b/docs/mcp.md index 161289dff3..7cf9cd99f6 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -8841,9 +8841,12 @@ tool edit, then returns false, changing nothing more, when the Quick Pen tool is scroll on a touchpad over the canvas (the Control key on macOS too) changes the arc size as well, as [Quick Pen tool keyboard shortcuts](https://helpx.adobe.com/illustrator/web/add-and-edit-artwork/draw-and-edit-paths/quick-pen-tool-keyboard-shortcuts.html) lists: the touchpad makes one step for each wheel line of its motion, and motion that goes on after the fingers lift -makes none. A mouse wheel turned with Ctrl over the canvas does the same, one step for each wheel event (one per -notch). Up makes the arc size larger and down smaller, sideways motion makes no step, and the view does not zoom or -scroll for the rest of that wheel turn. During a drag, C, `[` `]` and the wheel change the sharp-corner arc being +makes none. A mouse wheel turned with Ctrl over the canvas does the same, one step for each net whole wheel line +reported by the canvas framework, with at least one step for a nonzero share. The framework sums events within a +frame, so opposite notches cancel and their order is unavailable. Up makes the arc size larger and down smaller. +Sideways motion makes no step, except when Ctrl on Windows or Linux makes the framework report it as zoom motion. +The view does not zoom or scroll for the rest of that wheel turn. During a drag, +C, `[` `]` and the wheel change the sharp-corner arc being dragged, and Alt switches its action. A dragged piece ends where the press is let go. A click on the first point closes the path, and a click on an end of an open path goes on drawing from that end. Escape or Enter ends the path, and so does an edit made to it by another command. An edit made by another command during a drag, to the path or to other art, also ends the path: the edit @@ -8852,7 +8855,7 @@ command edits the document adds no piece, and the edit stays. The path's points preview shows the piece the next click adds. Points snap to Smart Guides. Each piece is one undo step, together with the flips and size changes made during its drag, and each flip or size change made between presses is one undo step. The arc size of 180°, its 15° steps, the side an arc bulges to, what C, `[` `]` and the wheel do during a drag, Enter -ending the path, the mouse wheel changing the arc size, and the wheel's step per event or wheel line and its direction are +ending the path, the mouse wheel changing the arc size, and the wheel's step per net wheel line and its direction are VectorCraft's own rules. The tool keeps `action` and `turn` with the preferences (`tool.setOption {tool: "quickPen", key, value}`). From 9a843a5f0ef8d05ea4dc3b6159922712b6675dde Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Sun, 29 Nov 2026 22:58:22 -0800 Subject: [PATCH 024/112] Quick Pen: the arc-size wheel keeps other view changes and pinches A Ctrl+wheel share the tool takes now restores only the zoom, pan and rotation from before the wheel, so the content rect beside the rulers stays as the canvas settled it and a view command queued in the same frame still applies. A share outside the content rect makes no step, a native pinch with Control held zooms as usual, and the toolbar is shown in the restored space. The parity entry says one step per net whole wheel line. --- crates/ui-egui/src/canvas.rs | 30 +++++--- crates/ui-egui/src/canvas/quick_pen_wheel.rs | 7 +- crates/ui-egui/src/tests/quickpenwheel.rs | 75 ++++++++++++++++++++ docs/target-app-parity.md | 2 +- 4 files changed, 100 insertions(+), 14 deletions(-) diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs index f6ac38176b..85ad06e131 100644 --- a/crates/ui-egui/src/canvas.rs +++ b/crates/ui-egui/src/canvas.rs @@ -145,7 +145,7 @@ struct Body { /// A view a compass or scroll bar edit made this pass. edited: Option<CanvasView>, /// The Quick Pen tool took this pass's wheel for its arc size ([`quick_pen_wheel::arc_size`]). - arc_turn: bool, + arc_view: Option<CanvasView>, } /// Window `win`'s document in the framework canvas, filling the rest of `ui`. True when the canvas @@ -211,6 +211,7 @@ pub(crate) fn show_document(app: &mut VectorcraftApp, ui: &mut Ui, win: Win, kin // cursors the tools are told about. let precise = app.precise_cursors() != host_caps_lock; let prefs = &app.session.prefs; + let before_wheel = cv; let mut canvas = Canvas::new("Document") .id(canvas_id(win)) .view(Bind::bound(&mut cv)) @@ -235,12 +236,21 @@ pub(crate) fn show_document(app: &mut VectorcraftApp, ui: &mut Ui, win: Win, kin if let Some(mut space) = canvas_space(&env.env) { let mut pass = tool_pass(&env.env); let bar_paint = PaintSlot::reserve(ui.painter()); + let mut arc_view = space.target(); + if space.wheel().is_some_and(|w| !w.claimed && quick_pen_wheel::control_turn(app, &w)) { + arc_view.zoom = before_wheel.zoom; + arc_view.center = before_wheel.center; + arc_view.rotation = before_wheel.rotation; + for request in &queued { + request.command().apply(&mut arc_view, &target, Some(&layers), ppp, &scheme); + } + } let arc_turn = if kind == BodyKind::Live && app.ui.screen_mode < 3 { let mut bar_space = space; if space.wheel().is_some_and(|w| w.claimed || quick_pen_wheel::control_turn(app, &w)) { - bar_space.set_view(given); + bar_space.set_view(arc_view); } - let bar = quick_pen_bar::quick_pen_bar(app, ui, &bar_space); + let bar = with_canvas_space(ui, bar_space, |ui| quick_pen_bar::quick_pen_bar(app, ui, &bar_space)); quick_pen_wheel::arc_size(app, ui.ctx(), &space, bar) } else { false @@ -249,14 +259,14 @@ pub(crate) fn show_document(app: &mut VectorcraftApp, ui: &mut Ui, win: Win, kin // The framework settles wheel navigation before the body. A claimed share uses the // saved view for the controls, painting and tool host, including its first pass. if arc_turn { - space.set_view(given); + space.set_view(arc_view); if let Some(pass) = pass.as_mut() { pass.space = Some(space); - pass.view = Some(given); + pass.view = Some(arc_view); } } body = with_canvas_space(ui, space, |ui| show_body(app, ui, &space, pass.as_ref(), win, kind, bar_shapes)); - body.arc_turn = arc_turn; + body.arc_view = arc_turn.then_some(arc_view); } }); let output = shown.output; @@ -269,7 +279,7 @@ pub(crate) fn show_document(app: &mut VectorcraftApp, ui: &mut Ui, win: Win, kin rulers::apply(app, ui, out); } let pressed = matches!(output.press.phase, PressPhase::Down { .. }); - let Body { reply, context_at, context_key, edited, arc_turn } = body; + let Body { reply, context_at, context_key, edited, arc_view } = body; let request = reply .as_ref() .and_then(|r| r.context.as_ref()) @@ -277,13 +287,11 @@ pub(crate) fn show_document(app: &mut VectorcraftApp, ui: &mut Ui, win: Win, kin .or(context_at.map(|at| context_menu::Request { at, key: context_key })); let jumped = edited.is_some(); // Presentation Mode keeps its view through a drag of the middle button, which the canvas pans on its own, and a - // wheel turn the Quick Pen tool takes for its arc size keeps the view the pass began with. + // wheel turn the Quick Pen tool takes for its arc size leaves other view requests in place. let view_now = if presenting && ui.input(|i| i.pointer.middle_down()) { given - } else if arc_turn { - edited.unwrap_or(given) } else { - edited.or(reply.and_then(|r| r.view)).or(output.view).unwrap_or(cv) + edited.or(reply.and_then(|r| r.view)).or(arc_view).or(output.view).unwrap_or(cv) }; if let Some(view) = doc_windows::view_mut(app, win) { view.set_canvas(&view_now, scaling); diff --git a/crates/ui-egui/src/canvas/quick_pen_wheel.rs b/crates/ui-egui/src/canvas/quick_pen_wheel.rs index f914413a95..96616e3b1d 100644 --- a/crates/ui-egui/src/canvas/quick_pen_wheel.rs +++ b/crates/ui-egui/src/canvas/quick_pen_wheel.rs @@ -69,7 +69,9 @@ fn fine(wheel: &Wheel, lines: f32) -> bool { pub(super) fn control_turn(app: &VectorcraftApp, wheel: &Wheel) -> bool { let line = crate::app::view::navigation(&app.session.prefs).wheel_line.max(1.0); let mods = if fine(wheel, lines(wheel, line)) { wheel.held } else { wheel.mods }; - ctrl_alone(mods, crate::keymap::platform()) + let scrolling = + (wheel.scroll.is_finite() && wheel.scroll != egui::Vec2::ZERO) || (wheel.zoom_lines.is_finite() && wheel.zoom_lines != egui::Vec2::ZERO); + ctrl_alone(mods, crate::keymap::platform()) && (wheel.claimed || scrolling) } /// Whole lines in `v`, toward zero, with [`LINE_SLACK`] for rounding. @@ -119,10 +121,11 @@ pub(super) fn arc_size(app: &mut VectorcraftApp, ctx: &egui::Context, space: &Ca let muted = w.modal || app_modal; let line = crate::app::view::navigation(&app.session.prefs).wheel_line.max(1.0); let over_bar = w.at.zip(bar).is_some_and(|(at, bar)| bar.contains(at)); + let over_content = w.at.is_some_and(|at| space.view.rect.contains(at)); let quick_pen = app.session.tool_id() == vectorcraft_tools::quickpen::ID; let mut taken = w.claimed; let mut runs = 0.0; - if quick_pen && !muted && !over_bar && control_turn(app, &w) { + if quick_pen && !muted && !over_bar && over_content && control_turn(app, &w) { let mut rest = w.claimed_spent.x; let made = steps(&w, line, &mut rest); // A share of a gesture another scroller owns cannot be claimed; the tool still takes it, as the diff --git a/crates/ui-egui/src/tests/quickpenwheel.rs b/crates/ui-egui/src/tests/quickpenwheel.rs index dba5367ebe..98c3a82e13 100644 --- a/crates/ui-egui/src/tests/quickpenwheel.rs +++ b/crates/ui-egui/src/tests/quickpenwheel.rs @@ -2,6 +2,7 @@ //! is; the arc size commands step it as `[` and `]` do. use craft::behavior::CanvasView; +use craft::ui::canvas::{ViewCommands, ViewRequest}; use egui::{Event, Modifiers, MouseWheelSource, MouseWheelUnit, Pos2, TouchPhase, vec2}; use serde_json::json; use vectorcraft_doc::NodeKind; @@ -138,6 +139,7 @@ fn ctrl_wheel_changes_the_arc_size_and_not_the_view() { #[test] fn the_first_ctrl_wheel_frame_keeps_the_view_and_pointer() { let mut app = app(); + app.ui.view.rulers = true; on_canvas(&mut app, |rig| { rig.fx.settle(); let at = center(rig) + vec2(80.0, 40.0); @@ -151,11 +153,84 @@ fn the_first_ctrl_wheel_frame_keeps_the_view_and_pointer() { assert_eq!(arc_size(rig), 195.0); assert_eq!(view(rig).zoom, still.zoom, "the first share keeps the zoom"); assert_eq!(view(rig).center, still.center, "the first share keeps the pan"); + assert_eq!(view(rig).rect, still.rect, "the content stays inside the rulers"); assert_eq!(craft::ui::canvas::ToolHost::shown_space(rig.fx.ctx(), id).unwrap().view, shown, "the tool host sees the saved view"); assert_eq!(rig.app().hover_doc, Some(point), "the tool host uses the saved view in the same frame"); }); } +#[test] +fn a_queued_fit_survives_the_first_ctrl_wheel_frame() { + let mut app = app(); + app.session.prefs.animated_zoom = false; + on_canvas(&mut app, |rig| { + rig.fx.settle(); + let fitted = view(rig); + rig.app().run("view.zoomIn", json!({})).unwrap(); + rig.fx.settle(); + assert_ne!(view(rig).zoom, fitted.zoom); + rig.fx.frame(vec![Event::PointerMoved(center(rig))]); + rig.app().request_view(ViewRequest::Command(ViewCommands::FitArtboard), None); + rig.fx.frame(vec![notch(1.0, ctrl())]); + assert_eq!(arc_size(rig), 195.0); + assert_eq!(view(rig), fitted, "the queued fit reaches the stored view in the same frame"); + }); +} + +#[test] +fn the_toolbar_keeps_its_anchor_on_the_first_ctrl_wheel_frame() { + let mut app = app(); + on_canvas(&mut app, |rig| { + rig.fx.settle(); + click_doc(rig, 100.0, 150.0); + rig.fx.settle(); + let bar = rig.target("Quick Pen").unwrap().rect; + rig.fx.frame(vec![Event::PointerMoved(center(rig) + vec2(-120.0, -80.0))]); + rig.fx.frame(vec![notch(1.0, ctrl())]); + assert_eq!(arc_size(rig), 195.0); + assert_eq!(rig.target("Quick Pen").unwrap().rect, bar, "the toolbar maps its anchor through the saved space"); + }); +} + +#[test] +fn a_claimed_wheel_makes_no_step_outside_the_content() { + let mut app = app(); + app.ui.view.rulers = true; + on_canvas(&mut app, |rig| { + rig.fx.settle(); + rig.fx.frame(vec![Event::PointerMoved(center(rig))]); + let still = view(rig); + rig.fx.frame(vec![notch(1.0, ctrl())]); + assert_eq!(arc_size(rig), 195.0); + let outside = egui::pos2(still.rect.left() - 1.0, still.rect.center().y); + rig.fx.frame(vec![Event::PointerMoved(outside)]); + rig.fx.frame(vec![notch(1.0, ctrl())]); + assert_eq!(arc_size(rig), 195.0, "a share over a ruler makes no step"); + assert_eq!(view(rig), still, "the claimed gesture still keeps the view"); + rig.fx.frame(vec![Event::PointerMoved(center(rig))]); + rig.fx.frame(vec![notch(1.0, ctrl())]); + assert_eq!(arc_size(rig), 210.0, "the gesture resumes inside the content"); + }); +} + +#[test] +fn a_native_pinch_with_control_zooms_the_view() { + let mut app = app(); + on_canvas(&mut app, |rig| { + rig.fx.settle(); + rig.fx.hold(ctrl()); + rig.fx.frame(vec![Event::PointerMoved(center(rig))]); + let still = view(rig); + rig.fx.frame(vec![Event::Zoom(1.25)]); + assert!(view(rig).zoom > still.zoom, "a native pinch keeps its zoom"); + assert_eq!(arc_size(rig), 180.0); + let zoomed = view(rig); + rig.fx.frame(vec![Event::Zoom(1.25)]); + assert!(view(rig).zoom > zoomed.zoom, "the pinch was not claimed as an arc gesture"); + rig.fx.hold(Modifiers::NONE); + }); +} + /// Opposite notches in one frame use the framework's net lines and keep the tool host's view. #[test] fn opposite_notches_use_the_frameworks_reported_net_motion() { diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index cbf285df6c..4928ac34a6 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -706,7 +706,7 @@ since 2026-10-01. - **Recolor picker follow-up (#8031/#4028):** native Lab numeric entry, document/loaded-library swatches in the Color Picker, and Assign-row Pick from Swatches / Limit to Library menus. #4090 provided the double-click picker and #5113 the Assign sliders. Regression tests `native_lab_entry_in_color_picker` and `row_context_menu_pick_from_swatches_and_limit_to_library` exercise the fields and menu callbacks rather than writing their result state. Area score and hours unchanged. - **Quick Pen editing (#2660):** with no path being drawn, the Quick Pen tool moves an anchor or a segment of a selected path by a drag (`path.moveAnchors` with `interpolate`, one undo step; beside a moved corner anchor a line stays a line and an arc an arc, and at a moved smooth anchor the handles stay in line and the segments bend to meet), selects an anchor with a click and adds one with Shift-click, and the canvas context menu's Delete removes the selected anchors (`edit.clear`), as [Draw with the Quick Pen tool](https://helpx.adobe.com/illustrator/web/add-and-edit-artwork/draw-and-edit-paths/draw-with-quick-pen-tool.html) describes. Which presses select and which move, and the drag snapping only an anchor, are VectorCraft's own rules. Tests: tools `quickpen::tests::a_selected_paths_anchors_and_segments_show_the_edit_cursors`, engine `tests::quickpen` (`a_drag_on_an_anchor_moves_it_and_the_arc_stays_an_arc`, `a_drag_on_a_segment_moves_its_ends`, `a_drag_on_an_open_end_moves_it`, `a_release_past_the_drag_distance_moves_the_anchor`, `clicks_select_anchors_for_delete`, `escape_takes_back_an_anchor_drag`, `a_press_while_drawing_adds_a_piece`), ui-egui `tests::contextmenu::the_quick_pen_menu_deletes_the_selected_anchors`. Score and hours unchanged. - **Recolor with Preset asks for a library first:** Edit › Edit Colors › Recolor with Preset (1, 2 and 3 Color Job, Color Library) opens a Recolor with Preset dialog whose Limit to Library menu (None, Document Swatches or a library) is applied when Recolor Artwork opens (<https://web.archive.org/web/20210601162814/https://helpx.adobe.com/pdf/illustrator_reference.pdf#page=251>, "Quickly reduce colors using a preset"). A 1 Color Job limited to the document's swatches with a spot or global ink picked turns gray art into tints of that ink linked to its swatch, so editing the swatch recolors the art. Tests `recolor_with_preset_asks_for_a_library_first` and `a_one_color_job_limited_to_document_swatches_links_gray_art_to_the_ink`. Area score and hours unchanged. -- **Quick Pen tool (#2660, in part):** a tool in the Pen tool's group (Alt+P, Option+P on macOS) draws straight lines, continuous arcs and sharp-corner arcs, one undo step per piece; Alt pressed and let go on its own switches the action, C flips the last sharp-corner arc, `[` and `]` and Ctrl with a touchpad scroll or a mouse wheel over the canvas change the arc size by 15° (`tool.quickPen.arcLarger`, `tool.quickPen.arcSmaller`), a click on the first point closes the path, a click on an open end continues it, and Escape or Enter ends it (`path.quickPen`), as [Draw with the Quick Pen tool](https://helpx.adobe.com/illustrator/web/add-and-edit-artwork/draw-and-edit-paths/draw-with-quick-pen-tool.html) and [Quick Pen tool keyboard shortcuts](https://helpx.adobe.com/illustrator/web/add-and-edit-artwork/draw-and-edit-paths/quick-pen-tool-keyboard-shortcuts.html) describe. The 180° default arc, its 15° steps, the side an arc bulges to, a dragged piece ending where the press is let go, C, `[` and `]` changing the arc being dragged, the mouse wheel changing the arc size, and one step per wheel event of a mouse wheel are VectorCraft's own rules. Tests: tools `quickpen::tests`, engine `tests::quickpen`, ui-egui `shortcuts::alt_tap::tests`, `tests::quickpenwheel`, `alt_p_chooses_the_quick_pen_and_an_alt_tap_switches_its_action` and `brackets_size_the_quick_pen_arc_being_dragged`. Score and hours unchanged. +- **Quick Pen tool (#2660, in part):** a tool in the Pen tool's group (Alt+P, Option+P on macOS) draws straight lines, continuous arcs and sharp-corner arcs, one undo step per piece; Alt pressed and let go on its own switches the action, C flips the last sharp-corner arc, `[` and `]` and Ctrl with a touchpad scroll or a mouse wheel over the canvas change the arc size by 15° (`tool.quickPen.arcLarger`, `tool.quickPen.arcSmaller`), a click on the first point closes the path, a click on an open end continues it, and Escape or Enter ends it (`path.quickPen`), as [Draw with the Quick Pen tool](https://helpx.adobe.com/illustrator/web/add-and-edit-artwork/draw-and-edit-paths/draw-with-quick-pen-tool.html) and [Quick Pen tool keyboard shortcuts](https://helpx.adobe.com/illustrator/web/add-and-edit-artwork/draw-and-edit-paths/quick-pen-tool-keyboard-shortcuts.html) describe. The 180° default arc, its 15° steps, the side an arc bulges to, a dragged piece ending where the press is let go, C, `[` and `]` changing the arc being dragged, the mouse wheel changing the arc size, and one step per net whole wheel line of a mouse wheel are VectorCraft's own rules. Tests: tools `quickpen::tests`, engine `tests::quickpen`, ui-egui `shortcuts::alt_tap::tests`, `tests::quickpenwheel`, `alt_p_chooses_the_quick_pen_and_an_alt_tap_switches_its_action` and `brackets_size_the_quick_pen_arc_being_dragged`. Score and hours unchanged. - **Quick Pen protractor:** while an arc is drawn, by a drag or as the piece the next click adds, the Quick Pen tool shows a protractor around the arc's center: a tick every 15° from the arc's start, a longer one every 90°, and one at its end; the next click's piece shows it only with Enable Rubber Band for the Pen tool on. With Smart Guides on, the end of a continuous arc snaps onto the nearest tick within the snapping tolerance of the pointer when no other Smart Guide snaps the point and neither Snap to Grid nor Snap to Pixel snaps drawn points; Shift does not change it. A continuous arc that starts a path sweeps the arc size and does not snap to a tick, Alt tapped during a press moves the piece's end onto or off the tick for the new action, and a hover hides its preview after a snap setting changes until the pointer moves. The protractor, its 15° step and the tick snapping are VectorCraft's own behavior. Tests: tools `the_arc_circle_is_the_circle_the_arc_is_drawn_on`, `a_continuous_arc_end_goes_to_the_nearest_tick`, `a_tick_past_the_coordinate_limit_is_not_used`, `a_continuous_arc_without_a_direction_has_no_tick`, `the_protractor_ticks_lie_across_the_arc`; engine `a_continuous_arc_end_snaps_to_the_protractor`, `a_click_puts_a_continuous_arc_end_on_a_tick`, `an_alt_tap_during_a_press_moves_the_end_for_the_new_action`, `a_click_on_a_tick_leaves_no_preview_back_to_the_pointer`, `a_hover_snaps_to_a_tick_only_for_a_continuous_arc`, `a_hover_shows_nothing_after_smart_guides_change`, `a_click_that_adds_nothing_keeps_a_stale_hover_hidden`, `a_hover_is_hovered_again_when_the_art_changes`, `an_arc_drag_shows_the_protractor`, `a_hovered_arc_shows_the_protractor_with_the_rubber_band`. New tests of existing Quick Pen behavior: `a_point_snaps_to_a_smart_guide`, `hovering_shows_the_distance_label`. Score and hours unchanged. - **Quick Pen arc center:** wherever the Quick Pen tool shows an arc's protractor, it also marks the arc's center with a small cross. The cross is VectorCraft's own behavior. Test: engine `an_arc_shows_a_cross_at_its_center`. Score and hours unchanged. From e48c64551a030ec08ed41ad548ae8d0dc7fe1509 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Mon, 30 Nov 2026 08:39:39 -0800 Subject: [PATCH 025/112] Tests: overflowing panel tabs work from the keyboard, and footer buttons announce their state A docked group with more tabs than its strip fits is driven from the keyboard: Tab reaches the strip, Alt+Down opens More tabs with the focus on a row naming a hidden panel, the arrow keys move through the rows, Escape closes the menu and gives the focus back to the strip, and Enter shows the picked panel with the focus still on the strip. More tabs is a button that announces its menu and is expanded only while the menu is open. Appearance's footer actions are buttons without a pressed state. Swatches' footer actions are buttons; Show Swatch Kinds is pressed while a kind other than All shows, and Swatch Libraries while a swatch library panel is open. --- crates/ui-egui/src/panel_docking/tests.rs | 95 ++++++++++++++++++- crates/ui-egui/src/panels/appearance/tests.rs | 15 +++ crates/ui-egui/src/panels/swatches/tests.rs | 41 ++++++++ 3 files changed, 149 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/panel_docking/tests.rs b/crates/ui-egui/src/panel_docking/tests.rs index 3476f5c2b0..c839b5f232 100644 --- a/crates/ui-egui/src/panel_docking/tests.rs +++ b/crates/ui-egui/src/panel_docking/tests.rs @@ -17,6 +17,8 @@ struct Harness { ctx: egui::Context, time: f64, nodes: Vec<(egui::accesskit::NodeId, egui::accesskit::Node)>, + /// The node with key focus in the last frame's accessibility update. + focus: Option<egui::accesskit::NodeId>, shapes: Vec<egui::epaint::ClippedShape>, } @@ -27,7 +29,7 @@ impl Harness { app.run("file.new", json!({"width": 400, "height": 300})).unwrap(); let ctx = crate::testing::ui_context(); ctx.enable_accesskit(); - let mut h = Self { app, ctx, time: 0.0, nodes: Vec::new(), shapes: Vec::new() }; + let mut h = Self { app, ctx, time: 0.0, nodes: Vec::new(), focus: None, shapes: Vec::new() }; h.frames(3); h } @@ -47,7 +49,9 @@ impl Harness { /// Draw one application frame and retain its accessibility output and shapes for assertions. fn run(&mut self, input: egui::RawInput) { let out = crate::testing::app_frame(&mut self.app, &self.ctx, input); - self.nodes = out.platform_output.accesskit_update.map_or_else(Vec::new, |update| update.nodes); + let update = out.platform_output.accesskit_update; + self.focus = update.as_ref().map(|update| update.focus); + self.nodes = update.map_or_else(Vec::new, |update| update.nodes); self.shapes = out.shapes; } @@ -1107,6 +1111,93 @@ fn a_docked_column_is_never_narrower_than_the_panel_minimum() { assert!(body_width(&h, "Properties") >= PANEL_MIN_WIDTH - 0.5, "saved 100 pt wide: {}", body_width(&h, "Properties")); } +impl Harness { + /// The node with key focus in the last frame. + fn focused_node(&self) -> Option<&egui::accesskit::Node> { + let focus = self.focus?; + self.nodes.iter().find(|(id, _)| *id == focus).map(|(_, node)| node) + } + + /// The first node named `label` in the last frame. + fn node_named(&self, label: &str) -> Option<&egui::accesskit::Node> { + self.nodes.iter().map(|(_, node)| node).find(|node| node.label() == Some(label)) + } + + /// Whether key focus is on the tab strip of a panel group: the strip or one of its tabs. + fn strip_has_focus(&self) -> bool { + use egui::accesskit::Role; + self.focused_node().is_some_and(|node| node.role() == Role::Tab && !node.label().is_some_and(|l| l.starts_with("Untitled"))) + || self.focused_node().is_some_and(|node| node.role() == Role::TabList && node.label() == Some("Panels")) + } +} + +/// The tabs of a docked group that does not fit them are reached from the keyboard through the strip's More tabs menu: +/// Tab moves key focus onto the strip, Alt+Down opens the menu with the focus on its first row, the arrow keys move +/// through its rows, Escape closes it and gives the focus back to the strip, and Enter shows the picked panel, with +/// the focus still on the strip. More tabs is announced as a button that opens a menu, expanded only while the menu is +/// open, and Alt+Down opens this menu and not the group's other menus. +#[test] +fn the_overflow_menu_of_a_docked_group_is_reached_and_used_from_the_keyboard() { + use egui::accesskit::Role; + use egui::{Key, Modifiers}; + + let mut h = Harness::new(); + let panels = + "swatches stroke color gradient character paragraph appearance align pathfinder brushes symbols transparency graphicStyles transform"; + for panel in panels.split(' ') { + h.app.run("window.panel.dock", json!({"panel": panel, "onto": "layers"})).unwrap(); + } + h.frames(3); + assert!(showing(&h.app.ui, "transform"), "the last panel docked onto the group shows"); + let more = h.node_named("More tabs").expect("the group's tabs do not fit, so the strip has a More tabs button"); + assert_eq!(more.role(), Role::Button, "More tabs is a button"); + assert_eq!(more.has_popup(), Some(egui::accesskit::HasPopup::Menu), "More tabs announces the menu it opens"); + assert_eq!(more.is_expanded(), Some(false), "More tabs starts collapsed"); + assert!(h.tab("swatches").is_none(), "Swatches is one of the tabs that do not fit"); + let expanded = |h: &Harness| h.node_named("More tabs").and_then(|node| node.is_expanded()); + let menu_focus = |h: &Harness| h.focused_node().filter(|node| node.role() == Role::MenuItem).and_then(|node| node.label()).map(str::to_owned); + + // A press inside the group gives its strip key focus; Shift+Tab leaves the strip and Tab comes back to it. + let strip = h.named("Panels", Role::TabList).expect("the group's tab strip"); + h.click(pos2(strip.center().x, strip.bottom() + 25.0)); + assert!(h.strip_has_focus(), "a press in the group focuses its strip: {:?}", h.focused_node().map(|n| (n.role(), n.label()))); + h.press(Key::Tab, Modifiers::SHIFT); + assert!(!h.strip_has_focus(), "Shift+Tab moves the focus off the strip"); + h.press(Key::Tab, Modifiers::NONE); + assert!(h.strip_has_focus(), "Tab moves the focus back onto the strip"); + + // Alt+Down opens the overflow menu, listing the tabs that do not fit, with the focus on a row. + h.press(Key::ArrowDown, Modifiers::ALT); + assert_eq!(expanded(&h), Some(true), "More tabs is expanded while its menu is open"); + let first = menu_focus(&h).expect("the focus enters the overflow menu"); + let rows: Vec<&str> = h.nodes.iter().filter(|(_, n)| n.role() == Role::MenuItem).filter_map(|(_, n)| n.label()).collect(); + assert!(rows.contains(&"Swatches"), "the menu lists a tab that does not fit: {rows:?}"); + assert!(first != "Transform" && h.tab(&first).is_none(), "the focused row names a panel whose tab does not fit: {first}"); + h.press(Key::ArrowDown, Modifiers::NONE); + let second = menu_focus(&h).expect("the focus stays in the menu"); + assert_ne!(second, first, "Down moves the focus to the next row"); + h.press(Key::ArrowUp, Modifiers::NONE); + assert_eq!(menu_focus(&h).as_deref(), Some(first.as_str()), "Up moves it back"); + + // Escape closes the menu and gives the focus back to the strip, with the shown panel unchanged. + h.press(Key::Escape, Modifiers::NONE); + assert_eq!(expanded(&h), Some(false), "Escape closes the overflow menu"); + assert!(h.strip_has_focus(), "Escape gives the focus back to the strip"); + assert!(showing(&h.app.ui, "transform"), "Escape picks nothing"); + + // Enter on a row shows that panel; its tab is drawn and selected, and the focus stays on the strip. + h.press(Key::ArrowDown, Modifiers::ALT); + h.press(Key::ArrowDown, Modifiers::NONE); + let picked = menu_focus(&h).expect("a row has the focus"); + h.press(Key::Enter, Modifiers::NONE); + h.frames(1); + assert_eq!(expanded(&h), Some(false), "Enter closes the overflow menu"); + assert!(!showing(&h.app.ui, "transform"), "the picked panel replaces Transform"); + let tab = h.nodes.iter().map(|(_, n)| n).find(|n| n.role() == Role::Tab && n.label() == Some(picked.as_str())); + assert_eq!(tab.and_then(|n| n.is_selected()), Some(true), "the picked panel's tab, {picked}, is drawn and selected"); + assert!(h.strip_has_focus(), "the focus stays on the strip after the pick"); +} + /// A tab group dragged out of the icon column by its grip floats as an expanded panel: its tabs show /// in the window, and a click on each tab shows that panel. #[test] diff --git a/crates/ui-egui/src/panels/appearance/tests.rs b/crates/ui-egui/src/panels/appearance/tests.rs index 5e5a4fc5b4..0ca5b4caf2 100644 --- a/crates/ui-egui/src/panels/appearance/tests.rs +++ b/crates/ui-egui/src/panels/appearance/tests.rs @@ -23,6 +23,21 @@ fn picked(panel: &Panel) -> (Vec<RowKey>, Option<RowKey>, Option<RowKey>) { (s.items.clone(), s.lead, s.anchor) } +/// Every footer action is announced as a button named by its label, and none announces a pressed state: they are +/// plain actions. Add New Effect announces the menu it opens. +#[test] +fn the_footer_actions_are_buttons_without_a_pressed_state() { + use craft::ui::contract::{PopupKind, Role}; + + let panel = Panel::new(app_with_a_selected_rectangle(), show); + for name in ["Add New Stroke", "Add New Fill", "Add New Effect", "Delete Selected Item", "Duplicate Selected Item", "Clear Appearance"] { + assert!(panel.shows_role(name, Role::BUTTON), "{name} is a button"); + assert_eq!(panel.toggled(name), None, "{name} announces no pressed state"); + } + assert_eq!(panel.popup_kind("Add New Effect"), Some(PopupKind::Menu)); + assert_eq!(panel.popup_kind("Clear Appearance"), None); +} + /// Duplicating rows picks the copies, each right above its original, as the Layers panel does: /// the active row's copy becomes active, the anchor's copy the anchor. #[test] diff --git a/crates/ui-egui/src/panels/swatches/tests.rs b/crates/ui-egui/src/panels/swatches/tests.rs index f20c725ac0..9043858ed4 100644 --- a/crates/ui-egui/src/panels/swatches/tests.rs +++ b/crates/ui-egui/src/panels/swatches/tests.rs @@ -231,6 +231,47 @@ fn the_footer_menu_buttons_report_that_they_open_a_menu() { } } +/// Every footer action is announced as a button named by its label. Swatch Libraries and Show Swatch Kinds also +/// announce a pressed state that follows the panel: Show Swatch Kinds is pressed while a kind other than All shows, and +/// Swatch Libraries while a swatch library panel is open. The other actions announce no pressed state. +#[test] +fn the_footer_buttons_are_buttons_and_only_the_stateful_ones_announce_pressed() { + use crate::tests::panel_harness::Panel; + use craft::behavior::Mixed; + use craft::ui::contract::Role; + use egui::{Key, Modifiers}; + + let mut panel = Panel::new(app(), show); + for name in [SwatchLibraries::MENU, "Show Swatch Kinds", "Swatch Options", "Delete Swatch", "New Swatch", "New Color Group"] { + assert!(panel.shows_role(name, Role::BUTTON), "{name} is a button"); + } + for name in ["Swatch Options", "Delete Swatch", "New Swatch", "New Color Group"] { + assert_eq!(panel.toggled(name), None, "{name} announces no pressed state"); + } + assert_eq!(panel.toggled("Show Swatch Kinds"), Some(Mixed::Same(false)), "every kind shows"); + assert_eq!(panel.toggled(SwatchLibraries::MENU), Some(Mixed::Same(false)), "no library is open"); + + // Space on the focused footer button opens its menu; the footer sits below the harness's room. + let pick = |panel: &mut Panel, kind: &str| { + panel.focus("Show Swatch Kinds"); + panel.key(Key::Space, Modifiers::NONE); + panel.frame(); + panel.click_role(kind, Role::MENU_ITEM_RADIO); + panel.frame(); + }; + pick(&mut panel, "Show Color Swatches"); + assert_eq!(panel.app().ui.swatches_panel.kind, Kind::Color); + assert_eq!(panel.toggled("Show Swatch Kinds"), Some(Mixed::Same(true)), "a kind filter is on"); + pick(&mut panel, "Show All Swatches"); + assert_eq!(panel.app().ui.swatches_panel.kind, Kind::All); + assert_eq!(panel.toggled("Show Swatch Kinds"), Some(Mixed::Same(false)), "the filter is off again"); + + let id = library_panel::tests::menu_library_ids::<SwatchLibraries>(&panel.app()).into_iter().next().expect("a swatch library"); + panel.app().run("window.swatchLibrary", json!({"library": id})).unwrap(); + panel.frame(); + assert_eq!(panel.toggled(SwatchLibraries::MENU), Some(Mixed::Same(true)), "a library panel is open"); +} + /// The footer reads the panel's selection while the browser holds the panel's model: with one swatch selected, Swatch /// Options and Delete Swatch are enabled. #[test] From f5962eb16158d9ebec028b9df05ca3a06cd1340d Mon Sep 17 00:00:00 2001 From: Ruchir <113586074+ruchirguitar@users.noreply.github.com> Date: Thu, 26 Nov 2026 12:32:27 +0530 Subject: [PATCH 026/112] A right-click on a Glyphs cell inserts or applies that glyph. The menu item does what a double-click does, and stays disabled when the glyph cannot be applied. Co-authored-by: Cursor <cursoragent@cursor.com> --- crates/ui-egui/src/panels/glyphs.rs | 35 +++++++- crates/ui-egui/src/panels/glyphs/tests.rs | 101 ++++++++++++++++++++++ docs/gaps.md | 2 + 3 files changed, 134 insertions(+), 4 deletions(-) diff --git a/crates/ui-egui/src/panels/glyphs.rs b/crates/ui-egui/src/panels/glyphs.rs index e639ae3ea4..4d60dd59ef 100644 --- a/crates/ui-egui/src/panels/glyphs.rs +++ b/crates/ui-egui/src/panels/glyphs.rs @@ -15,6 +15,8 @@ //! as one of its alternates in its word. A glyph no feature reaches whose name does not belong to //! another letter is applied as a glyph choice, which may not join. Other glyphs are drawn dimmed, //! and their notes say why they cannot be applied to the selection. +//! A right-click on a character offers Insert Glyph. A right-click on a glyph without a +//! character offers Apply Alternate. Both use the same text target as double-click or Enter. //! With Show East Asian Options, the panel menu sets the selected characters' East Asian glyph //! form ([`menu_rows`]). //! After the framework's categories, the Show menu lists the OpenType categories the browsed font @@ -24,10 +26,10 @@ use std::collections::HashSet; use std::sync::Arc; -use craft::font_manager::glyphs::{CATEGORIES, CellInfo, GlyphCell, GlyphSource, GlyphsPanel, GlyphsWords}; +use craft::font_manager::glyphs::{CATEGORIES, CellInfo, GlyphCell, GlyphCellMenu, GlyphSource, GlyphsPanel, GlyphsWords}; use craft::keymap::CommandRef; -use craft::ui::contract::Bind; -use craft::ui::menu::PanelRow; +use craft::ui::contract::{Bind, Props as _, Show as _, ShowContainer as _}; +use craft::ui::menu::{Menu, MenuItem, PanelRow}; use craft::ui::runtime::commands::{CommandState, CommandStates}; use craft::ui::runtime::env::Env; use egui::{Color32, ColorImage, Ui}; @@ -483,7 +485,12 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { if out.font_changed { app.ui.glyphs_font = Some((family, style)); } - if let Some(cell) = out.activated { + let menu_cell = out + .menu + .as_ref() + .filter(|menu| !out.font_changed && cell_menu(ui, &source, can_insert, menu)) + .map(|menu| menu.cell); + if let Some(cell) = menu_cell.or(out.activated) { activate(app, cell); } if let Some(pick) = out.alternate { @@ -491,6 +498,26 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { } } +/// Offer the action for the clicked cell using the grid's face and text context for this pass. +fn cell_menu(ui: &mut Ui, source: &VcGlyphs<'_>, can_insert: bool, menu: &GlyphCellMenu) -> bool { + let Some(face) = &source.face else { return false }; + let (label, enabled) = match menu.cell { + GlyphCell::Char(c) => (tl!("Insert Glyph"), source.listing.is_none() && gid_of(face, c).is_some()), + GlyphCell::Glyph(gid) => { + let applies = match &source.listing { + Some(listing) => listing.variants.iter().any(|variant| variant.gid == gid), + None => source.fit.as_ref().is_some_and(|fit| fit.pick(face, gid).is_some()), + }; + (tl!("Apply Alternate"), applies) + } + _ => return false, + }; + Menu::context(label, &menu.opener) + .show(ui, |ui, _| MenuItem::new(label).enabled(can_insert && enabled).show(ui).ran) + .inner + .unwrap_or(false) +} + /// A double-click or Enter on `cell`: insert the character (its letter for an Arabic presentation /// form), or put the glyph on the selected character. pub(crate) fn activate(app: &mut VectorcraftApp, cell: GlyphCell) { diff --git a/crates/ui-egui/src/panels/glyphs/tests.rs b/crates/ui-egui/src/panels/glyphs/tests.rs index 0886975276..a4f6635324 100644 --- a/crates/ui-egui/src/panels/glyphs/tests.rs +++ b/crates/ui-egui/src/panels/glyphs/tests.rs @@ -1102,3 +1102,104 @@ fn the_grid_lists_the_same_cells_from_the_character_list_read_once() { assert!(list.iter().all(|c| matches!(c, GlyphCell::Glyph(_))), "no character is listed"); assert!(!list.is_empty(), "the glyphs are listed by glyph id"); } + +/// The name a glyph-id cell shows, as the grid names it. +fn glyph_cell_name(face: &vectorcraft_text::FontFace, gid: u32) -> String { + let name = face.glyph_name(gid).unwrap_or_else(|| format!("gid {gid}")); + format!("{name}, glyph {gid}") +} + +/// A right-click on an encoded cell offers Insert Glyph, and choosing it inserts that character in one undo step. +#[test] +fn right_clicking_a_glyph_cell_offers_insert_glyph() { + use vectorcraft_text::test_fonts::{ALIASED_JOINING_FAMILY, aliased_joining_font}; + FontDb::global().add_font(aliased_joining_font().expect("the test font builds")); + let (mut app, id) = editing("a"); + let id = id.as_u64().unwrap(); + app.run("text.setRangeStyle", json!({"id": id, "font": ALIASED_JOINING_FAMILY})).unwrap(); + select(&mut app, 1, 1); + crate::panels::character::end_typing(&mut app); + app.ui.glyphs_font = Some((ALIASED_JOINING_FAMILY.to_string(), "Regular".to_string())); + let undo = undo_len(&app); + let mut panel = crate::tests::panel_harness::Panel::new(app, super::show); + panel.secondary_click("B, U+0042"); + assert!(panel.menu_item_enabled("Insert Glyph")); + assert!(!panel.shows("Apply Alternate"), "a character cell offers Insert Glyph"); + panel.click_menu_item("Insert Glyph"); + { + let mut app = panel.app(); + crate::panels::character::end_typing(&mut app); + } + let app = panel.app(); + assert_eq!(plain_of(&app, id), "aB"); + assert_eq!(undo_len(&app), undo + 1, "one undo step"); + drop(app); + panel.app().run("edit.undo", json!({})).unwrap(); + assert_eq!(plain_of(&panel.app(), id), "a"); +} + +#[test] +fn insert_glyph_is_disabled_without_a_text_target() { + use vectorcraft_text::test_fonts::{ALIASED_JOINING_FAMILY, aliased_joining_font}; + FontDb::global().add_font(aliased_joining_font().expect("the test font builds")); + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + app.run("file.new", json!({"width": 400, "height": 200})).unwrap(); + app.ui.glyphs_font = Some((ALIASED_JOINING_FAMILY.to_string(), "Regular".to_string())); + let mut panel = crate::tests::panel_harness::Panel::new(app, super::show); + panel.secondary_click("B, U+0042"); + assert!(!panel.menu_item_enabled("Insert Glyph")); +} + +/// In Alternates for Selection a right-click offers Apply Alternate in one undo step. +#[test] +fn right_clicking_an_alternate_cell_offers_apply_alternate() { + use vectorcraft_text::test_fonts::{JOINING_ALTERNATES_FAMILY, joining_alternates_font, source_sans_gid}; + FontDb::global().add_font(joining_alternates_font().expect("the test font builds")); + let g = |c| u32::from(source_sans_gid(c).expect("a glyph")); + let (mut app, id) = editing("\u{628}\u{62A}\u{646}"); + let id = id.as_u64().unwrap(); + app.run("text.setRangeStyle", json!({"id": id, "font": JOINING_ALTERNATES_FAMILY})).unwrap(); + select(&mut app, 2, 4); + show_category(&mut app, "Alternates for Selection"); + let list = listed(&mut app, "Alternates for Selection"); + let GlyphCell::Glyph(gid) = list[2] else { panic!("an alternate is a glyph") }; + let face = FontDb::global().face(JOINING_ALTERNATES_FAMILY, "Regular").expect("the test face"); + let name = glyph_cell_name(&face, gid); + let undo = undo_len(&app); + let mut panel = crate::tests::panel_harness::Panel::new(app, super::show); + panel.secondary_click(&name); + assert!(panel.menu_item_enabled("Apply Alternate")); + assert!(!panel.shows("Insert Glyph"), "an alternate cell offers Apply Alternate"); + panel.click_menu_item("Apply Alternate"); + let app = panel.app(); + assert_eq!(undo_len(&app), undo + 1, "one undo step"); + assert_eq!(glyph_ids(&app, &json!(id)), [g('B'), g('x'), g('M')]); + drop(app); + panel.app().run("edit.undo", json!({})).unwrap(); + assert_eq!(glyph_ids(&panel.app(), &json!(id)), [g('B'), g('u'), g('M')]); +} + +/// A glyph a double-click would only explain has a disabled menu item, and choosing it changes nothing. +#[test] +fn a_glyph_that_cannot_be_applied_disables_the_menu_item() { + use vectorcraft_text::test_fonts::{JOINING_ALTERNATES_FAMILY, joining_alternates_font, source_sans_gid}; + FontDb::global().add_font(joining_alternates_font().expect("the test font builds")); + let (mut app, id) = editing("\u{0627}"); + let id = id.as_u64().unwrap(); + app.run("text.setRangeStyle", json!({"id": id, "font": JOINING_ALTERNATES_FAMILY})).unwrap(); + select(&mut app, 0, 2); + show_category(&mut app, "stylisticAlternates"); + let gid = u32::from(source_sans_gid('w').expect("a glyph")); + let face = FontDb::global().face(JOINING_ALTERNATES_FAMILY, "Regular").expect("the test face"); + assert!(cell_info(&mut app, GlyphCell::Glyph(gid)).dimmed, "w is not an alternate of alef"); + let name = glyph_cell_name(&face, gid); + let (undo, status, plain) = (undo_len(&app), app.ui.status.clone(), glyph_ids(&app, &json!(id))); + let mut panel = crate::tests::panel_harness::Panel::new(app, super::show); + panel.secondary_click(&name); + assert!(!panel.menu_item_enabled("Apply Alternate")); + panel.click_menu_item("Apply Alternate"); + let app = panel.app(); + assert_eq!(glyph_ids(&app, &json!(id)), plain); + assert_eq!(undo_len(&app), undo); + assert_eq!(app.ui.status, status); +} diff --git a/docs/gaps.md b/docs/gaps.md index 35587afab4..02049a64b7 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -551,6 +551,8 @@ macOS cursor delivery (#2292) is narrowed to a native host adapter using the exi ## G12 Preferences and panels that don't act yet +- Glyphs cells have an item context menu. A character offers **Insert Glyph** at the Type caret or in selected text. A glyph without a mapped character offers **Apply Alternate** for the character selected with the Type tool. The menu uses the same actions as Enter and double-click and disables the item when its text target cannot accept the glyph. + - **Implemented and tested (2026-11-21):** Properties panel Quick Actions follow every selected object. Ungroup (`object.ungroup`) is offered when any selected object is a group, including several groups, a group selected after a path, and a group that holds another group. Isolate Group (`object.isolate`) is offered only when that one group is the whole selection. Unite (`object.pathfinder.unite`) appears only for selections of at least two objects, each a non-guide path or a compound path. It appears alongside Group and Make Clipping Mask. Headless regressions: `panels::properties::tests::two_groups_offer_ungroup_without_isolate_group`, `one_group_offers_ungroup_and_isolate_group` and `several_paths_offer_group_clipping_mask_and_unite`. Other G12 gaps remain; scores and estimates unchanged. - **Implemented and tested (2026-11-21):** Document Info's panel menu Selection Only (`ui.docInfo.selectionOnly`; kept in memory for the session, not stored) asks `document.info` for the selection: object counts cover the selected nodes and their descendants, and with no artwork selected it shows `(No artwork selected)` instead of the document's counts, while artboards the Artboard tool has selected still show under Document. With the item off, counts stay for the whole document. Headless regressions: `panels::doc_info::tests::test_doc_info_counts_entire_document`, `test_doc_info_selection_only_toggles_and_filters_counts`, `test_doc_info_selection_only_keeps_selected_artboard` and `test_doc_info_panel_menu_toggles_state`. Scores and estimates unchanged. From e880f695a23ad838b9bf4b9db1a7c9e4391539eb Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Mon, 30 Nov 2026 20:40:26 -0800 Subject: [PATCH 027/112] New Document: Preset Details rows stand a stack gap apart The Preset Details rows stood a tight gap apart, so each caption touched the field above it. craft-libs now lays them out a stack gap apart, with a fixed details column and Create and Close at its foot (storytold/ craft-libs e93e6f62a and e433cdfa8). The pin moves to craft-libs main 26f293d78, which holds both; the egui and winit revisions are unchanged. - More Settings and Manage Profiles stand side by side, each as wide as its words, instead of two buttons across the whole column. - The pin brings two API changes: CanvasScrollbars::clear_of takes ShownBars, and a LegacyFile lists its paths and parses one slot per path. - Accessible names now read a line break as a space, so the Color Wheel document-color tests name a swatch "#0000ff Used 1 time". - The small-window test accepts the Bleed fields in one row when the fixed column holds them. --- Cargo.lock | 173 +++++++++--------- Cargo.toml | 76 ++++---- apps/vectorcraft-web/Cargo.toml | 2 +- apps/vectorcraft/src/prefs.rs | 13 +- crates/ui-egui/src/canvas.rs | 4 +- crates/ui-egui/src/dialogs/new_document.rs | 74 ++++++-- .../tests_color_wheel_document_colors.rs | 3 +- 7 files changed, 204 insertions(+), 141 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 772196967a..c831102d13 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1231,7 +1231,7 @@ dependencies = [ [[package]] name = "craft" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "craft-automation", "craft-behavior", @@ -1272,7 +1272,7 @@ dependencies = [ [[package]] name = "craft-affinity" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "crc32fast", "flate2", @@ -1283,7 +1283,7 @@ dependencies = [ [[package]] name = "craft-appkit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "block2 0.6.2", "objc2 0.6.5", @@ -1295,7 +1295,7 @@ dependencies = [ [[package]] name = "craft-atomic" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "rustix 1.1.6", ] @@ -1303,7 +1303,7 @@ dependencies = [ [[package]] name = "craft-automation" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -1328,7 +1328,7 @@ dependencies = [ [[package]] name = "craft-behavior" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "accesskit", "bitflags 2.13.2", @@ -1346,7 +1346,7 @@ dependencies = [ [[package]] name = "craft-browse" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "craft-behavior", "craft-docpath", @@ -1364,7 +1364,7 @@ dependencies = [ [[package]] name = "craft-cdr" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "crc32fast", "flate2", @@ -1373,7 +1373,7 @@ dependencies = [ [[package]] name = "craft-cloud-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "egui", ] @@ -1381,7 +1381,7 @@ dependencies = [ [[package]] name = "craft-cms" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "md-5", "rayon", @@ -1390,12 +1390,12 @@ dependencies = [ [[package]] name = "craft-codepage" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" [[package]] name = "craft-color-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "craft-behavior", "craft-cms", @@ -1415,7 +1415,7 @@ dependencies = [ [[package]] name = "craft-control" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "craft-control-protocol", "craft-platform", @@ -1426,7 +1426,7 @@ dependencies = [ [[package]] name = "craft-control-protocol" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "getrandom 0.3.4", "serde_json", @@ -1436,7 +1436,7 @@ dependencies = [ [[package]] name = "craft-dds" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "rayon", ] @@ -1444,7 +1444,7 @@ dependencies = [ [[package]] name = "craft-dialogs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "block2 0.6.2", "craft-appkit", @@ -1470,7 +1470,7 @@ dependencies = [ [[package]] name = "craft-doc" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "blake3", "craft-ecproj-format", @@ -1486,7 +1486,7 @@ dependencies = [ [[package]] name = "craft-docpath" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "serde", ] @@ -1494,7 +1494,7 @@ dependencies = [ [[package]] name = "craft-draw" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1513,7 +1513,7 @@ dependencies = [ [[package]] name = "craft-dxf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "craft-codepage", "encoding_rs", @@ -1525,7 +1525,7 @@ dependencies = [ [[package]] name = "craft-ecproj-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "serde", "serde_json", @@ -1535,12 +1535,12 @@ dependencies = [ [[package]] name = "craft-eps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "fontique", "harfrust 0.13.3", @@ -1555,7 +1555,7 @@ dependencies = [ [[package]] name = "craft-font-manager" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -1574,7 +1574,7 @@ dependencies = [ [[package]] name = "craft-font-os-windows" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "windows-registry", "windows-sys 0.61.2", @@ -1583,7 +1583,7 @@ dependencies = [ [[package]] name = "craft-font-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "cap-primitives", "craft-atomic", @@ -1606,12 +1606,12 @@ dependencies = [ [[package]] name = "craft-fonts-build" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" [[package]] name = "craft-gif" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "gif", ] @@ -1619,7 +1619,7 @@ dependencies = [ [[package]] name = "craft-gzip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "flate2", ] @@ -1627,7 +1627,7 @@ dependencies = [ [[package]] name = "craft-host" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "bitflags 2.13.2", "craft-i18n", @@ -1640,7 +1640,7 @@ dependencies = [ [[package]] name = "craft-i18n" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "brotli 9.1.3", "brotli-decompressor 6.3.2", @@ -1670,7 +1670,7 @@ dependencies = [ [[package]] name = "craft-image-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "craft-dds", "craft-jpeg", @@ -1697,7 +1697,7 @@ dependencies = [ [[package]] name = "craft-imaging" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1715,7 +1715,7 @@ dependencies = [ [[package]] name = "craft-jpeg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "thiserror 2.0.21", ] @@ -1723,7 +1723,7 @@ dependencies = [ [[package]] name = "craft-jxl" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "brotli-decompressor 5.0.3", "jixel", @@ -1734,7 +1734,7 @@ dependencies = [ [[package]] name = "craft-keymap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "craft-host", "craft-i18n", @@ -1749,7 +1749,7 @@ dependencies = [ [[package]] name = "craft-layers" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "craft-behavior", "craft-i18n", @@ -1763,7 +1763,7 @@ dependencies = [ [[package]] name = "craft-menu" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "craft-behavior", "craft-host", @@ -1781,7 +1781,7 @@ dependencies = [ [[package]] name = "craft-metadata" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "brotli-decompressor 6.3.2", "chrono", @@ -1793,7 +1793,7 @@ dependencies = [ [[package]] name = "craft-metafile" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "encoding_rs", "image", @@ -1804,7 +1804,7 @@ dependencies = [ [[package]] name = "craft-mime" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "chrono", "craft-codepage", @@ -1814,7 +1814,7 @@ dependencies = [ [[package]] name = "craft-nightly" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "uds_windows", "winsafe", @@ -1823,7 +1823,7 @@ dependencies = [ [[package]] name = "craft-pages" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "craft-behavior", "craft-keymap", @@ -1839,7 +1839,7 @@ dependencies = [ [[package]] name = "craft-pcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "flate2", "serde", @@ -1850,7 +1850,7 @@ dependencies = [ [[package]] name = "craft-pdf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "hayro-interpret", "hayro-syntax", @@ -1862,7 +1862,7 @@ dependencies = [ [[package]] name = "craft-platform" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "async-channel", "async-io", @@ -1895,7 +1895,7 @@ dependencies = [ [[package]] name = "craft-plotter" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "kurbo 0.13.1", "thiserror 2.0.21", @@ -1904,7 +1904,7 @@ dependencies = [ [[package]] name = "craft-print" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "craft-behavior", "craft-host", @@ -1928,7 +1928,7 @@ dependencies = [ [[package]] name = "craft-proof" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "log", "miniz_oxide 0.9.1", @@ -1939,7 +1939,7 @@ dependencies = [ [[package]] name = "craft-ps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "craft-eps", "flate2", @@ -1953,7 +1953,7 @@ dependencies = [ [[package]] name = "craft-psd" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "encoding_rs", "flate2", @@ -1964,7 +1964,7 @@ dependencies = [ [[package]] name = "craft-quit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "dispatch2", "egui", @@ -1977,7 +1977,7 @@ dependencies = [ [[package]] name = "craft-review" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -1996,7 +1996,7 @@ dependencies = [ [[package]] name = "craft-settings" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "craft-atomic", "craft-host", @@ -2013,7 +2013,7 @@ dependencies = [ [[package]] name = "craft-stream-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "fax", "hayro-ccitt", @@ -2024,7 +2024,7 @@ dependencies = [ [[package]] name = "craft-svg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "craft-image-codecs", "craft-xml", @@ -2045,7 +2045,7 @@ dependencies = [ [[package]] name = "craft-table" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "craft-behavior", "craft-keymap", @@ -2057,7 +2057,7 @@ dependencies = [ [[package]] name = "craft-text" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "craft-behavior", "craft-font-manager", @@ -2082,7 +2082,7 @@ dependencies = [ [[package]] name = "craft-theme" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "bitflags 2.13.2", "craft-tracked", @@ -2097,7 +2097,7 @@ dependencies = [ [[package]] name = "craft-theme-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "craft-atomic", "craft-behavior", @@ -2112,7 +2112,7 @@ dependencies = [ [[package]] name = "craft-tiff" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "serde", "thiserror 2.0.21", @@ -2122,7 +2122,7 @@ dependencies = [ [[package]] name = "craft-time" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "serde", "thiserror 2.0.21", @@ -2131,7 +2131,7 @@ dependencies = [ [[package]] name = "craft-timeline" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "craft-behavior", "craft-keymap", @@ -2146,12 +2146,12 @@ dependencies = [ [[package]] name = "craft-tracked" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" [[package]] name = "craft-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "craft-cloud-ui", "craft-ui-canvas", @@ -2165,9 +2165,10 @@ dependencies = [ [[package]] name = "craft-ui-canvas" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "craft-behavior", + "craft-font-catalog", "craft-i18n", "craft-keymap", "craft-theme", @@ -2181,7 +2182,7 @@ dependencies = [ [[package]] name = "craft-ui-contract" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "accesskit", "craft-behavior", @@ -2219,7 +2220,7 @@ dependencies = [ [[package]] name = "craft-ui-macros" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2230,7 +2231,7 @@ dependencies = [ [[package]] name = "craft-ui-panels" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "craft-behavior", "craft-host", @@ -2248,7 +2249,7 @@ dependencies = [ [[package]] name = "craft-ui-patterns" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "craft-behavior", "craft-host", @@ -2269,7 +2270,7 @@ dependencies = [ [[package]] name = "craft-ui-shell" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "craft-behavior", "craft-host", @@ -2290,7 +2291,7 @@ dependencies = [ [[package]] name = "craft-ui-widgets" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "craft-behavior", "craft-host", @@ -2309,7 +2310,7 @@ dependencies = [ [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "base64 0.22.1", "chrono", @@ -2341,7 +2342,7 @@ dependencies = [ [[package]] name = "craft-vectorcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "flate2", "serde", @@ -2352,7 +2353,7 @@ dependencies = [ [[package]] name = "craft-wayland" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "raw-window-handle", "wayland-backend", @@ -2362,7 +2363,7 @@ dependencies = [ [[package]] name = "craft-web-api" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "js-sys", "serde_json", @@ -2373,7 +2374,7 @@ dependencies = [ [[package]] name = "craft-win32" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "winsafe", ] @@ -2381,7 +2382,7 @@ dependencies = [ [[package]] name = "craft-window" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "craft-appkit", "craft-atomic", @@ -2413,7 +2414,7 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "quick-xml 0.41.0", "serde", @@ -3772,7 +3773,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a" [[package]] name = "hayro-cmap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "brotli 8.0.4", "hayro-postscript", @@ -3781,7 +3782,7 @@ dependencies = [ [[package]] name = "hayro-interpret" version = "0.7.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "bitflags 2.13.2", "hayro-cmap", @@ -3799,7 +3800,7 @@ dependencies = [ [[package]] name = "hayro-jbig2" version = "0.3.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "fearless_simd", "hayro-ccitt", @@ -3817,12 +3818,12 @@ dependencies = [ [[package]] name = "hayro-postscript" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" [[package]] name = "hayro-syntax" version = "0.7.2" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "flate2", "hayro-ccitt", @@ -4805,7 +4806,7 @@ dependencies = [ [[package]] name = "krilla" version = "0.8.2" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "base64 0.22.1", "bumpalo", @@ -4962,7 +4963,7 @@ checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" [[package]] name = "linesweeper" version = "0.5.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" dependencies = [ "arrayvec", "kurbo 0.13.1", diff --git a/Cargo.toml b/Cargo.toml index e1a20cac68..6cc18e4ea0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,51 +10,51 @@ license = "MIT OR Apache-2.0" rust-version = "1.95" [workspace.dependencies] -craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0", default-features = false, features = ["interpret", "write"] } -craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } +craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } +craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927", default-features = false, features = ["interpret", "write"] } +craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } +craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } # Language packs: the Craft apps' shared font store installs them (#4936). -craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } +craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } +craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } # The `.vectorcraft` envelope: its members, version, embedded images and the data after the JSON. -craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } +craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } +craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } # `.pcraft` documents: their manifest, full-size composite, preview, layer pixels and ICC profile. -craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0", features = ["pcraft-pixels"] } +craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927", features = ["pcraft-pixels"] } # Native Affinity documents (craft-libs#914). -craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } +craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } # Bounded CDR (v1-v27) and CMX (32-bit) reader (craft-libs#778). -craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } +craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } # SVG parsing, limits, SVGZ and writer (craft-libs#778). -craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0", features = ["tree"] } -craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } +craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927", features = ["tree"] } +craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } # EPS container, previews, ASCII85 and DSC comments (craft-libs#778). -craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } +craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } # DXF tags, reader and writer (craft-libs#778, #926, #927). -craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } +craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } +craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } # WMF, EMF and EMF+ reader (craft-libs#778). -craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0", default-features = false, features = ["read", "write"] } -craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } +craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } +craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } +craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } +craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } +craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } +craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927", default-features = false, features = ["read", "write"] } +craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } +craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } +craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } +craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } # The framework facade (`craft::ui`, `craft::settings`, `craft::platform`, ...). No default features: each crate names # the members it imports. -craft = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } +craft = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } # Below the egui layer, so not through the facade: the colour harmony rules and their settings (craft-color-ui # without its `ui` feature), the colour type they work in, and the craft-fonts tables the text crate's build writes. -craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } +craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } +craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } +craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } # Nightly profile isolation, launch protocol, and security fence. -craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } +craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } # internal vectorcraft-geom = { path = "crates/geom" } vectorcraft-color = { path = "crates/color" } @@ -194,13 +194,13 @@ lto = "thin" codegen-units = 1 [patch.crates-io] -hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -krilla = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } +hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } +hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } +hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } +hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } +hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } +krilla = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } +linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } ecolor = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } emath = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } epaint = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } diff --git a/apps/vectorcraft-web/Cargo.toml b/apps/vectorcraft-web/Cargo.toml index 30d529a5e7..aa3866728d 100644 --- a/apps/vectorcraft-web/Cargo.toml +++ b/apps/vectorcraft-web/Cargo.toml @@ -28,7 +28,7 @@ egui_extras = { workspace = true } # `wgpu` pulls egui-wgpu's defaults: WebGPU plus the WebGL2 fallback. eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit"] } # The page command API (storytold/craft-libs#413): the request plumbing behind window.vectorcraft. -craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0", version = "0.1.0" } +craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927", version = "0.1.0" } wasm-bindgen = "0.2" serde_json = { workspace = true } diff --git a/apps/vectorcraft/src/prefs.rs b/apps/vectorcraft/src/prefs.rs index 09c57f22e4..636b8c81ef 100644 --- a/apps/vectorcraft/src/prefs.rs +++ b/apps/vectorcraft/src/prefs.rs @@ -4,7 +4,7 @@ use std::path::PathBuf; use std::sync::{Mutex, PoisonError}; use std::time::{Duration, Instant}; -use craft::settings::{LegacyFile, LoadReport, Location, OpenOptions, SettingsStore, SharedSettings}; +use craft::settings::{LegacyFile, LoadReport, Location, OpenOptions, SectionError, SettingsStore, SharedSettings}; use vectorcraft_ui_egui::{AppSettings, from_app, parse_legacy}; use super::{VectorcraftApp, prefs_dir}; @@ -18,6 +18,15 @@ fn legacy_dir() -> Option<PathBuf> { prefs_dir::profile::prefs_dir(true) } +/// Parses the one `ui.json` slot of a legacy import: its bytes, or why it could not be read. +fn parse_legacy_slot(slots: &[Result<Option<&[u8]>, &std::io::Error>]) -> Result<(AppSettings, Vec<SectionError>), String> { + match slots.first() { + Some(Ok(Some(bytes))) => parse_legacy(bytes), + Some(Err(e)) => Err(e.to_string()), + _ => Err("the preferences file is missing".to_string()), + } +} + /// Where the log files live: `logs` in the preferences folder (see `logging`). pub(crate) fn log_dir() -> Option<PathBuf> { Some(prefs_dir::prefs_dir()?.join("logs")) @@ -34,7 +43,7 @@ pub(crate) fn prefs_enabled() -> bool { pub(crate) fn open_store() -> (SharedSettings<AppSettings>, LoadReport) { let (location, legacy) = match prefs_dir::prefs_dir().filter(|_| prefs_enabled()) { Some(dir) => { - let file = |dir: PathBuf| LegacyFile { path: dir.join(LEGACY_FILE), parse: parse_legacy }; + let file = |dir: PathBuf| LegacyFile { paths: vec![dir.join(LEGACY_FILE)], parse: parse_legacy_slot }; let legacy = std::iter::once(file(dir.clone())).chain(legacy_dir().map(file)).collect(); (Location::Dir(dir), legacy) } diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs index 08f859b025..0cc8ea7d1c 100644 --- a/crates/ui-egui/src/canvas.rs +++ b/crates/ui-egui/src/canvas.rs @@ -5,7 +5,7 @@ use craft::behavior::{CanvasView, PressPhase}; use craft::keymap::Mods; use craft::ui::canvas::{ - Canvas, CanvasScrollbars, CanvasSpace, ContextSource, RotateView, ToolHostResponse, ToolPass, ViewCommands, ViewRequest, ViewTarget, + Canvas, CanvasScrollbars, CanvasSpace, ContextSource, RotateView, ShownBars, ToolHostResponse, ToolPass, ViewCommands, ViewRequest, ViewTarget, canvas_space, tool_pass, }; use craft::ui::contract::{Bind, Props as _, Show as _, ShowContainer as _}; @@ -418,7 +418,7 @@ fn clear_of_scroll_bars(app: &VectorcraftApp, ui: &Ui, rect: egui::Rect) -> egui if app.ui.screen_mode >= 2 { return rect; } - CanvasScrollbars::clear_of(ui, rect, false, false) + CanvasScrollbars::clear_of(ui, rect, false, ShownBars::Both) } /// The scroll bars along the right and bottom edges (Normal and Full Screen with Menu Bar): the view diff --git a/crates/ui-egui/src/dialogs/new_document.rs b/crates/ui-egui/src/dialogs/new_document.rs index db83163e57..c4897d5c07 100644 --- a/crates/ui-egui/src/dialogs/new_document.rs +++ b/crates/ui-egui/src/dialogs/new_document.rs @@ -352,11 +352,11 @@ impl DocumentSettings for VcNewDocument { Section::new(text(tl!("Advanced Options"))).initially_open(false).show(ui, |ui, _| advanced(ui, s)); - // The two buttons across the column, one above the other. + // The two buttons side by side, each as wide as its words. let (mut more, mut manage) = (None, None); - Stack::new().fill_width().gap(Gap::Item).show(ui, |ui, _| { - more = Some(Button::new(text(tl!("More Settings"))).id_salt("more-settings").sizing(Sizing::FillWidth).show(ui)); - manage = Some(Button::new(text(tl!("Manage Profiles"))).id_salt("manage-profiles").sizing(Sizing::FillWidth).show(ui)); + Row::new().gap(Gap::Item).show(ui, |ui, _| { + more = Some(Button::new(text(tl!("More Settings"))).id_salt("more-settings").sizing(Sizing::Content).show(ui)); + manage = Some(Button::new(text(tl!("Manage Profiles"))).id_salt("manage-profiles").sizing(Sizing::Content).show(ui)); }); if let Some(more) = &more { let mut more_open = memory.more_open != clicked(more); @@ -1238,6 +1238,59 @@ mod tests { } } + /// The rows of Preset Details stand at least the framework's stack gap apart: the Height caption sits that far + /// below the Width field, and the Top bleed field that far below Height. Before, the rows were a tight gap apart + /// and each caption touched the field above it. + #[test] + fn preset_details_rows_stand_a_stack_gap_apart() { + use craft::ui::contract::Gap; + let mut stack = 0.0; + let mut theme = crate::testing::ui_context().run_ui(Default::default(), |ui| stack = Gap::Stack.points(ui)); + theme.textures_delta.clear(); + let mut app = app(); + open(&mut app); + let out = laid_out(&mut app); + let captions: Vec<(String, egui::Rect)> = crate::tests_labels::text_shapes(&out) + .into_iter() + .map(|(t, transform)| (t.galley.text().to_string(), transform * t.visual_bounding_rect())) + .collect(); + let nodes = out.platform_output.accesskit_update.map(|u| u.nodes).unwrap_or_default(); + let field = |label: &str| { + let (_, n) = nodes + .iter() + .find(|(_, n)| n.label() == Some(label) && n.role() == egui::accesskit::Role::SpinButton) + .unwrap_or_else(|| panic!("no field {label}")); + n.bounds().expect("bounds") + }; + let (width, height, top) = (field("Width"), field("Height"), field("Top")); + let caption_below = |text: &str, y: f64| { + captions.iter().filter(|(t, r)| t == text && f64::from(r.top()) >= y - 1.0).map(|(_, r)| f64::from(r.top())).fold(f64::INFINITY, f64::min) + }; + let height_caption = caption_below("Height", width.y1); + let gap = height_caption - width.y1; + assert!(gap + 0.5 >= f64::from(stack), "the Height caption stands {gap} below Width, at least the stack gap {stack}"); + let bleed_caption = caption_below("Bleed", height.y1); + assert!(bleed_caption < top.y0, "Bleed's caption {bleed_caption} stands above its Top field {top:?}"); + let gap = bleed_caption - height.y1; + assert!(gap + 0.5 >= f64::from(stack), "the Bleed caption stands {gap} below Height, at least the stack gap {stack}"); + } + + /// More Settings and Manage Profiles stand side by side, each as wide as its words, not across the whole column. + #[test] + fn more_settings_and_manage_profiles_stand_in_a_row() { + let mut app = app(); + open(&mut app); + let out = laid_out(&mut app); + let nodes = out.platform_output.accesskit_update.map(|u| u.nodes).unwrap_or_default(); + let bounds = |label: &str, role: egui::accesskit::Role| { + let (_, n) = nodes.iter().find(|(_, n)| n.label() == Some(label) && n.role() == role).unwrap_or_else(|| panic!("no {role:?} {label}")); + n.bounds().expect("bounds") + }; + let more = bounds("More Settings", egui::accesskit::Role::Button); + let manage = bounds("Manage Profiles", egui::accesskit::Role::Button); + assert!(more.x1 <= manage.x0 && (more.y0 - manage.y0).abs() < 1.0, "Manage Profiles {manage:?} follows More Settings {more:?} on its line"); + } + /// More Settings edits only the artboard layout, spacing and columns, and creates nothing. #[test] fn more_settings_is_a_popup_holding_only_the_artboard_layout() { @@ -1601,8 +1654,8 @@ mod tests { } } - /// In small windows Height and Artboards share a row, Orientation's two buttons stand side by side under them, and - /// the Bleed fields form two rows of two, Top and Bottom above Left and Right, with the link button after Right; + /// In small windows Height and Artboards share a row, Orientation's two buttons stand side by side, and the Bleed + /// fields stand in one row, or in two rows of two when the column is narrow, with the link button after Right; /// before, at 800 by 600 Orientation's buttons stood one above the other between Height and Artboards. #[test] fn new_document_details_stay_in_rows_in_small_windows() { @@ -1617,11 +1670,10 @@ mod tests { assert!(h.y0 == a.y0 && h.x1 <= a.x0, "{at}: Height {h:?} and Artboards {a:?} share a row"); assert!(a.y1 <= portrait.y0 || landscape.x1 <= a.x0, "{at}: Orientation {landscape:?} stays clear of Artboards {a:?}"); let [top, bottom, left, right] = ["Top", "Bottom", "Left", "Right"].map(|side| node(&nodes, side, Role::SpinButton)); - assert!(top.y0 == bottom.y0 && left.y0 == right.y0 && top.y1 <= left.y0, "{at}: two Bleed rows: {top:?} {bottom:?} {left:?} {right:?}"); - assert!( - top.x0 == left.x0 && bottom.x0 == right.x0 && top.x1 <= bottom.x0, - "{at}: two Bleed columns: {top:?} {bottom:?} {left:?} {right:?}" - ); + // A column wide enough holds the four fields in one row; a narrower one, in two rows of two. + let one_row = [bottom, left, right].iter().all(|f| f.y0 == top.y0) && top.x1 <= bottom.x0 && bottom.x1 <= left.x0 && left.x1 <= right.x0; + let two_rows = top.y0 == bottom.y0 && left.y0 == right.y0 && top.y1 <= left.y0 && top.x0 == left.x0 && bottom.x0 == right.x0; + assert!(one_row || two_rows, "{at}: the Bleed fields stand in one row or two: {top:?} {bottom:?} {left:?} {right:?}"); let link = node(&nodes, "Make all settings the same", Role::Button); assert!(right.x1 <= link.x0 && link.x1 <= dialog.x1, "{at}: the link button {link:?} follows Right {right:?} inside {dialog:?}"); } diff --git a/crates/ui-egui/src/panels/tests_color_wheel_document_colors.rs b/crates/ui-egui/src/panels/tests_color_wheel_document_colors.rs index 8ddf49910a..5d2b67be4d 100644 --- a/crates/ui-egui/src/panels/tests_color_wheel_document_colors.rs +++ b/crates/ui-egui/src/panels/tests_color_wheel_document_colors.rs @@ -30,8 +30,9 @@ fn app() -> (VectorcraftApp, Vec<Value>, Value) { (app, reds, blue) } +/// The accessible name of a color's swatch: its tip, with the line break read as a space. fn label(hex: &str, n: u64) -> String { - format!("{hex}\n{}", if n == 1 { "Used 1 time".to_string() } else { format!("Used {n} times") }) + format!("{hex} {}", if n == 1 { "Used 1 time".to_string() } else { format!("Used {n} times") }) } fn has(p: &Panel, label: &str) -> bool { From 946774792acf80f8a97bb939d12d969cd885c9b2 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Mon, 30 Nov 2026 20:40:43 -0800 Subject: [PATCH 028/112] Pin craft-libs at 965c7beeb --- Cargo.lock | 172 ++++++++++++++++---------------- Cargo.toml | 76 +++++++------- apps/vectorcraft-web/Cargo.toml | 2 +- 3 files changed, 125 insertions(+), 125 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c831102d13..344ae8dc34 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1231,7 +1231,7 @@ dependencies = [ [[package]] name = "craft" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "craft-automation", "craft-behavior", @@ -1272,7 +1272,7 @@ dependencies = [ [[package]] name = "craft-affinity" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "crc32fast", "flate2", @@ -1283,7 +1283,7 @@ dependencies = [ [[package]] name = "craft-appkit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "block2 0.6.2", "objc2 0.6.5", @@ -1295,7 +1295,7 @@ dependencies = [ [[package]] name = "craft-atomic" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "rustix 1.1.6", ] @@ -1303,7 +1303,7 @@ dependencies = [ [[package]] name = "craft-automation" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -1328,7 +1328,7 @@ dependencies = [ [[package]] name = "craft-behavior" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "accesskit", "bitflags 2.13.2", @@ -1346,7 +1346,7 @@ dependencies = [ [[package]] name = "craft-browse" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "craft-behavior", "craft-docpath", @@ -1364,7 +1364,7 @@ dependencies = [ [[package]] name = "craft-cdr" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "crc32fast", "flate2", @@ -1373,7 +1373,7 @@ dependencies = [ [[package]] name = "craft-cloud-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "egui", ] @@ -1381,7 +1381,7 @@ dependencies = [ [[package]] name = "craft-cms" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "md-5", "rayon", @@ -1390,12 +1390,12 @@ dependencies = [ [[package]] name = "craft-codepage" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" [[package]] name = "craft-color-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "craft-behavior", "craft-cms", @@ -1415,7 +1415,7 @@ dependencies = [ [[package]] name = "craft-control" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "craft-control-protocol", "craft-platform", @@ -1426,7 +1426,7 @@ dependencies = [ [[package]] name = "craft-control-protocol" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "getrandom 0.3.4", "serde_json", @@ -1436,7 +1436,7 @@ dependencies = [ [[package]] name = "craft-dds" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "rayon", ] @@ -1444,7 +1444,7 @@ dependencies = [ [[package]] name = "craft-dialogs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "block2 0.6.2", "craft-appkit", @@ -1470,7 +1470,7 @@ dependencies = [ [[package]] name = "craft-doc" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "blake3", "craft-ecproj-format", @@ -1486,7 +1486,7 @@ dependencies = [ [[package]] name = "craft-docpath" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "serde", ] @@ -1494,7 +1494,7 @@ dependencies = [ [[package]] name = "craft-draw" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1513,7 +1513,7 @@ dependencies = [ [[package]] name = "craft-dxf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "craft-codepage", "encoding_rs", @@ -1525,7 +1525,7 @@ dependencies = [ [[package]] name = "craft-ecproj-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "serde", "serde_json", @@ -1535,12 +1535,12 @@ dependencies = [ [[package]] name = "craft-eps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "fontique", "harfrust 0.13.3", @@ -1555,7 +1555,7 @@ dependencies = [ [[package]] name = "craft-font-manager" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -1574,7 +1574,7 @@ dependencies = [ [[package]] name = "craft-font-os-windows" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "windows-registry", "windows-sys 0.61.2", @@ -1583,7 +1583,7 @@ dependencies = [ [[package]] name = "craft-font-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "cap-primitives", "craft-atomic", @@ -1606,12 +1606,12 @@ dependencies = [ [[package]] name = "craft-fonts-build" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" [[package]] name = "craft-gif" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "gif", ] @@ -1619,7 +1619,7 @@ dependencies = [ [[package]] name = "craft-gzip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "flate2", ] @@ -1627,7 +1627,7 @@ dependencies = [ [[package]] name = "craft-host" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "bitflags 2.13.2", "craft-i18n", @@ -1640,7 +1640,7 @@ dependencies = [ [[package]] name = "craft-i18n" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "brotli 9.1.3", "brotli-decompressor 6.3.2", @@ -1670,7 +1670,7 @@ dependencies = [ [[package]] name = "craft-image-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "craft-dds", "craft-jpeg", @@ -1697,7 +1697,7 @@ dependencies = [ [[package]] name = "craft-imaging" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1715,7 +1715,7 @@ dependencies = [ [[package]] name = "craft-jpeg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "thiserror 2.0.21", ] @@ -1723,7 +1723,7 @@ dependencies = [ [[package]] name = "craft-jxl" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "brotli-decompressor 5.0.3", "jixel", @@ -1734,7 +1734,7 @@ dependencies = [ [[package]] name = "craft-keymap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "craft-host", "craft-i18n", @@ -1749,7 +1749,7 @@ dependencies = [ [[package]] name = "craft-layers" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "craft-behavior", "craft-i18n", @@ -1763,7 +1763,7 @@ dependencies = [ [[package]] name = "craft-menu" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "craft-behavior", "craft-host", @@ -1781,7 +1781,7 @@ dependencies = [ [[package]] name = "craft-metadata" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "brotli-decompressor 6.3.2", "chrono", @@ -1793,7 +1793,7 @@ dependencies = [ [[package]] name = "craft-metafile" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "encoding_rs", "image", @@ -1804,7 +1804,7 @@ dependencies = [ [[package]] name = "craft-mime" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "chrono", "craft-codepage", @@ -1814,7 +1814,7 @@ dependencies = [ [[package]] name = "craft-nightly" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "uds_windows", "winsafe", @@ -1823,7 +1823,7 @@ dependencies = [ [[package]] name = "craft-pages" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "craft-behavior", "craft-keymap", @@ -1839,7 +1839,7 @@ dependencies = [ [[package]] name = "craft-pcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "flate2", "serde", @@ -1850,7 +1850,7 @@ dependencies = [ [[package]] name = "craft-pdf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "hayro-interpret", "hayro-syntax", @@ -1862,7 +1862,7 @@ dependencies = [ [[package]] name = "craft-platform" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "async-channel", "async-io", @@ -1895,7 +1895,7 @@ dependencies = [ [[package]] name = "craft-plotter" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "kurbo 0.13.1", "thiserror 2.0.21", @@ -1904,7 +1904,7 @@ dependencies = [ [[package]] name = "craft-print" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "craft-behavior", "craft-host", @@ -1928,7 +1928,7 @@ dependencies = [ [[package]] name = "craft-proof" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "log", "miniz_oxide 0.9.1", @@ -1939,7 +1939,7 @@ dependencies = [ [[package]] name = "craft-ps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "craft-eps", "flate2", @@ -1953,7 +1953,7 @@ dependencies = [ [[package]] name = "craft-psd" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "encoding_rs", "flate2", @@ -1964,7 +1964,7 @@ dependencies = [ [[package]] name = "craft-quit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "dispatch2", "egui", @@ -1977,7 +1977,7 @@ dependencies = [ [[package]] name = "craft-review" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -1996,7 +1996,7 @@ dependencies = [ [[package]] name = "craft-settings" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "craft-atomic", "craft-host", @@ -2013,7 +2013,7 @@ dependencies = [ [[package]] name = "craft-stream-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "fax", "hayro-ccitt", @@ -2024,7 +2024,7 @@ dependencies = [ [[package]] name = "craft-svg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "craft-image-codecs", "craft-xml", @@ -2045,7 +2045,7 @@ dependencies = [ [[package]] name = "craft-table" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "craft-behavior", "craft-keymap", @@ -2057,7 +2057,7 @@ dependencies = [ [[package]] name = "craft-text" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "craft-behavior", "craft-font-manager", @@ -2082,7 +2082,7 @@ dependencies = [ [[package]] name = "craft-theme" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "bitflags 2.13.2", "craft-tracked", @@ -2097,7 +2097,7 @@ dependencies = [ [[package]] name = "craft-theme-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "craft-atomic", "craft-behavior", @@ -2112,7 +2112,7 @@ dependencies = [ [[package]] name = "craft-tiff" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "serde", "thiserror 2.0.21", @@ -2122,7 +2122,7 @@ dependencies = [ [[package]] name = "craft-time" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "serde", "thiserror 2.0.21", @@ -2131,7 +2131,7 @@ dependencies = [ [[package]] name = "craft-timeline" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "craft-behavior", "craft-keymap", @@ -2146,12 +2146,12 @@ dependencies = [ [[package]] name = "craft-tracked" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" [[package]] name = "craft-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "craft-cloud-ui", "craft-ui-canvas", @@ -2165,7 +2165,7 @@ dependencies = [ [[package]] name = "craft-ui-canvas" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -2182,7 +2182,7 @@ dependencies = [ [[package]] name = "craft-ui-contract" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "accesskit", "craft-behavior", @@ -2220,7 +2220,7 @@ dependencies = [ [[package]] name = "craft-ui-macros" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2231,7 +2231,7 @@ dependencies = [ [[package]] name = "craft-ui-panels" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "craft-behavior", "craft-host", @@ -2249,7 +2249,7 @@ dependencies = [ [[package]] name = "craft-ui-patterns" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "craft-behavior", "craft-host", @@ -2270,7 +2270,7 @@ dependencies = [ [[package]] name = "craft-ui-shell" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "craft-behavior", "craft-host", @@ -2291,7 +2291,7 @@ dependencies = [ [[package]] name = "craft-ui-widgets" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "craft-behavior", "craft-host", @@ -2310,7 +2310,7 @@ dependencies = [ [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "base64 0.22.1", "chrono", @@ -2342,7 +2342,7 @@ dependencies = [ [[package]] name = "craft-vectorcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "flate2", "serde", @@ -2353,7 +2353,7 @@ dependencies = [ [[package]] name = "craft-wayland" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "raw-window-handle", "wayland-backend", @@ -2363,7 +2363,7 @@ dependencies = [ [[package]] name = "craft-web-api" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "js-sys", "serde_json", @@ -2374,7 +2374,7 @@ dependencies = [ [[package]] name = "craft-win32" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "winsafe", ] @@ -2382,7 +2382,7 @@ dependencies = [ [[package]] name = "craft-window" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "craft-appkit", "craft-atomic", @@ -2414,7 +2414,7 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "quick-xml 0.41.0", "serde", @@ -3773,7 +3773,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a" [[package]] name = "hayro-cmap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "brotli 8.0.4", "hayro-postscript", @@ -3782,7 +3782,7 @@ dependencies = [ [[package]] name = "hayro-interpret" version = "0.7.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "bitflags 2.13.2", "hayro-cmap", @@ -3800,7 +3800,7 @@ dependencies = [ [[package]] name = "hayro-jbig2" version = "0.3.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "fearless_simd", "hayro-ccitt", @@ -3818,12 +3818,12 @@ dependencies = [ [[package]] name = "hayro-postscript" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" [[package]] name = "hayro-syntax" version = "0.7.2" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "flate2", "hayro-ccitt", @@ -4806,7 +4806,7 @@ dependencies = [ [[package]] name = "krilla" version = "0.8.2" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "base64 0.22.1", "bumpalo", @@ -4963,7 +4963,7 @@ checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" [[package]] name = "linesweeper" version = "0.5.0" -source = "git+https://github.com/storytold/craft-libs?rev=26f293d78494150f30b6d89d0375a62e54ef9927#26f293d78494150f30b6d89d0375a62e54ef9927" +source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" dependencies = [ "arrayvec", "kurbo 0.13.1", diff --git a/Cargo.toml b/Cargo.toml index 6cc18e4ea0..fcc2a1ad8f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,51 +10,51 @@ license = "MIT OR Apache-2.0" rust-version = "1.95" [workspace.dependencies] -craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } -craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927", default-features = false, features = ["interpret", "write"] } -craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } -craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } +craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6", default-features = false, features = ["interpret", "write"] } +craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } # Language packs: the Craft apps' shared font store installs them (#4936). -craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } -craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } +craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } # The `.vectorcraft` envelope: its members, version, embedded images and the data after the JSON. -craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } -craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } +craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } # `.pcraft` documents: their manifest, full-size composite, preview, layer pixels and ICC profile. -craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927", features = ["pcraft-pixels"] } +craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6", features = ["pcraft-pixels"] } # Native Affinity documents (craft-libs#914). -craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } +craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } # Bounded CDR (v1-v27) and CMX (32-bit) reader (craft-libs#778). -craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } +craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } # SVG parsing, limits, SVGZ and writer (craft-libs#778). -craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927", features = ["tree"] } -craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } +craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6", features = ["tree"] } +craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } # EPS container, previews, ASCII85 and DSC comments (craft-libs#778). -craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } +craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } # DXF tags, reader and writer (craft-libs#778, #926, #927). -craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } -craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } +craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } # WMF, EMF and EMF+ reader (craft-libs#778). -craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } -craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } -craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } -craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } -craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } -craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927", default-features = false, features = ["read", "write"] } -craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } -craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } -craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } -craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } +craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6", default-features = false, features = ["read", "write"] } +craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } # The framework facade (`craft::ui`, `craft::settings`, `craft::platform`, ...). No default features: each crate names # the members it imports. -craft = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } +craft = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } # Below the egui layer, so not through the facade: the colour harmony rules and their settings (craft-color-ui # without its `ui` feature), the colour type they work in, and the craft-fonts tables the text crate's build writes. -craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } -craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } -craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } +craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } # Nightly profile isolation, launch protocol, and security fence. -craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } +craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } # internal vectorcraft-geom = { path = "crates/geom" } vectorcraft-color = { path = "crates/color" } @@ -194,13 +194,13 @@ lto = "thin" codegen-units = 1 [patch.crates-io] -hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } -hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } -hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } -hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } -hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } -krilla = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } -linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927" } +hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +krilla = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } ecolor = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } emath = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } epaint = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } diff --git a/apps/vectorcraft-web/Cargo.toml b/apps/vectorcraft-web/Cargo.toml index aa3866728d..824600f90a 100644 --- a/apps/vectorcraft-web/Cargo.toml +++ b/apps/vectorcraft-web/Cargo.toml @@ -28,7 +28,7 @@ egui_extras = { workspace = true } # `wgpu` pulls egui-wgpu's defaults: WebGPU plus the WebGL2 fallback. eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit"] } # The page command API (storytold/craft-libs#413): the request plumbing behind window.vectorcraft. -craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "26f293d78494150f30b6d89d0375a62e54ef9927", version = "0.1.0" } +craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6", version = "0.1.0" } wasm-bindgen = "0.2" serde_json = { workspace = true } From 0e480bfde0b96f015a68ff5dbd1c9466904daaf4 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Mon, 30 Nov 2026 21:46:03 -0800 Subject: [PATCH 029/112] New document: pin the PDF check to the new craft-libs rev and require a Height caption xtask's pdf-deps check still named rev a5669ed2 after the workspace moved to 965c7bee, so it rejected the seven PDF packages. The layout test now fails when no Height caption stands below Width, instead of passing on an infinite gap. --- crates/ui-egui/src/dialogs/new_document.rs | 1 + xtask/src/pdf_deps.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/dialogs/new_document.rs b/crates/ui-egui/src/dialogs/new_document.rs index b3a4057a39..8e6ae908cd 100644 --- a/crates/ui-egui/src/dialogs/new_document.rs +++ b/crates/ui-egui/src/dialogs/new_document.rs @@ -1277,6 +1277,7 @@ mod tests { captions.iter().filter(|(t, r)| t == text && f64::from(r.top()) >= y - 1.0).map(|(_, r)| f64::from(r.top())).fold(f64::INFINITY, f64::min) }; let height_caption = caption_below("Height", width.y1); + assert!(height_caption.is_finite(), "no Height caption stands below the Width field {width:?}"); let gap = height_caption - width.y1; assert!(gap + 0.5 >= f64::from(stack), "the Height caption stands {gap} below Width, at least the stack gap {stack}"); let bleed_caption = caption_below("Bleed", height.y1); diff --git a/xtask/src/pdf_deps.rs b/xtask/src/pdf_deps.rs index 216d23d43d..337ba6325e 100644 --- a/xtask/src/pdf_deps.rs +++ b/xtask/src/pdf_deps.rs @@ -5,7 +5,7 @@ use std::process::Command; use serde_json::Value; -const REV: &str = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"; +const REV: &str = "965c7beeb6076480e016e448bddddcce0a738ff6"; const PACKAGES: &[(&str, &str, &str)] = &[ ("craft-pdf", "0.1.0", REV), ("krilla", "0.8.2", REV), From bbf0e146ce48352d9725c5be2c13e270ed0b948c Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Mon, 30 Nov 2026 22:10:15 -0800 Subject: [PATCH 030/112] New document: keep the overlap check for the two-row Bleed layout The two-row branch of the small-window test checked only where each column starts, so Top could reach into Bottom and Left into Right and still pass. --- crates/ui-egui/src/dialogs/new_document.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/ui-egui/src/dialogs/new_document.rs b/crates/ui-egui/src/dialogs/new_document.rs index 8e6ae908cd..f70cb66b3c 100644 --- a/crates/ui-egui/src/dialogs/new_document.rs +++ b/crates/ui-egui/src/dialogs/new_document.rs @@ -1684,6 +1684,7 @@ mod tests { // A column wide enough holds the four fields in one row; a narrower one, in two rows of two. let one_row = [bottom, left, right].iter().all(|f| f.y0 == top.y0) && top.x1 <= bottom.x0 && bottom.x1 <= left.x0 && left.x1 <= right.x0; let two_rows = top.y0 == bottom.y0 && left.y0 == right.y0 && top.y1 <= left.y0 && top.x0 == left.x0 && bottom.x0 == right.x0; + let two_rows = two_rows && top.x1 <= bottom.x0 && left.x1 <= right.x0; assert!(one_row || two_rows, "{at}: the Bleed fields stand in one row or two: {top:?} {bottom:?} {left:?} {right:?}"); let link = node(&nodes, "Make all settings the same", Role::Button); assert!(right.x1 <= link.x0 && link.x1 <= dialog.x1, "{at}: the link button {link:?} follows Right {right:?} inside {dialog:?}"); From 353e4d091f0dce1d0828019f23ca386cfba75efd Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Mon, 30 Nov 2026 22:30:20 -0800 Subject: [PATCH 031/112] Transform: Corner selects are as wide as the Corner Radius field A Corner select in a column of number fields is one number cell wide again, as the Corner Radius field of its column is: a live rectangle's linked Corner and a live polygon's Corner, in the Transform panel and the Properties panel's Transform section, and the Corner of a path's Direct-Selected corners in the Properties panel. The linked Corner was as wide as its content and the others took the field width. The selects use craft-libs' Select::number_cell, so every craft-libs rev is pinned to that pull request's head until it merges. --- Cargo.lock | 172 +++++++++--------- Cargo.toml | 76 ++++---- apps/vectorcraft-web/Cargo.toml | 2 +- crates/ui-egui/src/panels.rs | 12 +- .../panels/properties/transform_section.rs | 5 +- crates/ui-egui/src/panels/transform/shape.rs | 5 +- crates/ui-egui/src/panels/transform/tests.rs | 60 ++++++ xtask/src/pdf_deps.rs | 2 +- 8 files changed, 200 insertions(+), 134 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 772196967a..e3c8aba5c2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1231,7 +1231,7 @@ dependencies = [ [[package]] name = "craft" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "craft-automation", "craft-behavior", @@ -1272,7 +1272,7 @@ dependencies = [ [[package]] name = "craft-affinity" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "crc32fast", "flate2", @@ -1283,7 +1283,7 @@ dependencies = [ [[package]] name = "craft-appkit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "block2 0.6.2", "objc2 0.6.5", @@ -1295,7 +1295,7 @@ dependencies = [ [[package]] name = "craft-atomic" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "rustix 1.1.6", ] @@ -1303,7 +1303,7 @@ dependencies = [ [[package]] name = "craft-automation" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -1328,7 +1328,7 @@ dependencies = [ [[package]] name = "craft-behavior" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "accesskit", "bitflags 2.13.2", @@ -1346,7 +1346,7 @@ dependencies = [ [[package]] name = "craft-browse" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "craft-behavior", "craft-docpath", @@ -1364,7 +1364,7 @@ dependencies = [ [[package]] name = "craft-cdr" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "crc32fast", "flate2", @@ -1373,7 +1373,7 @@ dependencies = [ [[package]] name = "craft-cloud-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "egui", ] @@ -1381,7 +1381,7 @@ dependencies = [ [[package]] name = "craft-cms" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "md-5", "rayon", @@ -1390,12 +1390,12 @@ dependencies = [ [[package]] name = "craft-codepage" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" [[package]] name = "craft-color-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "craft-behavior", "craft-cms", @@ -1415,7 +1415,7 @@ dependencies = [ [[package]] name = "craft-control" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "craft-control-protocol", "craft-platform", @@ -1426,7 +1426,7 @@ dependencies = [ [[package]] name = "craft-control-protocol" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "getrandom 0.3.4", "serde_json", @@ -1436,7 +1436,7 @@ dependencies = [ [[package]] name = "craft-dds" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "rayon", ] @@ -1444,7 +1444,7 @@ dependencies = [ [[package]] name = "craft-dialogs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "block2 0.6.2", "craft-appkit", @@ -1470,7 +1470,7 @@ dependencies = [ [[package]] name = "craft-doc" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "blake3", "craft-ecproj-format", @@ -1486,7 +1486,7 @@ dependencies = [ [[package]] name = "craft-docpath" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "serde", ] @@ -1494,7 +1494,7 @@ dependencies = [ [[package]] name = "craft-draw" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1513,7 +1513,7 @@ dependencies = [ [[package]] name = "craft-dxf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "craft-codepage", "encoding_rs", @@ -1525,7 +1525,7 @@ dependencies = [ [[package]] name = "craft-ecproj-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "serde", "serde_json", @@ -1535,12 +1535,12 @@ dependencies = [ [[package]] name = "craft-eps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "fontique", "harfrust 0.13.3", @@ -1555,7 +1555,7 @@ dependencies = [ [[package]] name = "craft-font-manager" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -1574,7 +1574,7 @@ dependencies = [ [[package]] name = "craft-font-os-windows" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "windows-registry", "windows-sys 0.61.2", @@ -1583,7 +1583,7 @@ dependencies = [ [[package]] name = "craft-font-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "cap-primitives", "craft-atomic", @@ -1606,12 +1606,12 @@ dependencies = [ [[package]] name = "craft-fonts-build" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" [[package]] name = "craft-gif" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "gif", ] @@ -1619,7 +1619,7 @@ dependencies = [ [[package]] name = "craft-gzip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "flate2", ] @@ -1627,7 +1627,7 @@ dependencies = [ [[package]] name = "craft-host" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "bitflags 2.13.2", "craft-i18n", @@ -1640,7 +1640,7 @@ dependencies = [ [[package]] name = "craft-i18n" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "brotli 9.1.3", "brotli-decompressor 6.3.2", @@ -1670,7 +1670,7 @@ dependencies = [ [[package]] name = "craft-image-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "craft-dds", "craft-jpeg", @@ -1697,7 +1697,7 @@ dependencies = [ [[package]] name = "craft-imaging" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1715,7 +1715,7 @@ dependencies = [ [[package]] name = "craft-jpeg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "thiserror 2.0.21", ] @@ -1723,7 +1723,7 @@ dependencies = [ [[package]] name = "craft-jxl" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "brotli-decompressor 5.0.3", "jixel", @@ -1734,7 +1734,7 @@ dependencies = [ [[package]] name = "craft-keymap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "craft-host", "craft-i18n", @@ -1749,7 +1749,7 @@ dependencies = [ [[package]] name = "craft-layers" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "craft-behavior", "craft-i18n", @@ -1763,7 +1763,7 @@ dependencies = [ [[package]] name = "craft-menu" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "craft-behavior", "craft-host", @@ -1781,7 +1781,7 @@ dependencies = [ [[package]] name = "craft-metadata" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "brotli-decompressor 6.3.2", "chrono", @@ -1793,7 +1793,7 @@ dependencies = [ [[package]] name = "craft-metafile" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "encoding_rs", "image", @@ -1804,7 +1804,7 @@ dependencies = [ [[package]] name = "craft-mime" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "chrono", "craft-codepage", @@ -1814,7 +1814,7 @@ dependencies = [ [[package]] name = "craft-nightly" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "uds_windows", "winsafe", @@ -1823,7 +1823,7 @@ dependencies = [ [[package]] name = "craft-pages" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "craft-behavior", "craft-keymap", @@ -1839,7 +1839,7 @@ dependencies = [ [[package]] name = "craft-pcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "flate2", "serde", @@ -1850,7 +1850,7 @@ dependencies = [ [[package]] name = "craft-pdf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "hayro-interpret", "hayro-syntax", @@ -1862,7 +1862,7 @@ dependencies = [ [[package]] name = "craft-platform" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "async-channel", "async-io", @@ -1895,7 +1895,7 @@ dependencies = [ [[package]] name = "craft-plotter" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "kurbo 0.13.1", "thiserror 2.0.21", @@ -1904,7 +1904,7 @@ dependencies = [ [[package]] name = "craft-print" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "craft-behavior", "craft-host", @@ -1928,7 +1928,7 @@ dependencies = [ [[package]] name = "craft-proof" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "log", "miniz_oxide 0.9.1", @@ -1939,7 +1939,7 @@ dependencies = [ [[package]] name = "craft-ps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "craft-eps", "flate2", @@ -1953,7 +1953,7 @@ dependencies = [ [[package]] name = "craft-psd" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "encoding_rs", "flate2", @@ -1964,7 +1964,7 @@ dependencies = [ [[package]] name = "craft-quit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "dispatch2", "egui", @@ -1977,7 +1977,7 @@ dependencies = [ [[package]] name = "craft-review" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -1996,7 +1996,7 @@ dependencies = [ [[package]] name = "craft-settings" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "craft-atomic", "craft-host", @@ -2013,7 +2013,7 @@ dependencies = [ [[package]] name = "craft-stream-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "fax", "hayro-ccitt", @@ -2024,7 +2024,7 @@ dependencies = [ [[package]] name = "craft-svg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "craft-image-codecs", "craft-xml", @@ -2045,7 +2045,7 @@ dependencies = [ [[package]] name = "craft-table" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "craft-behavior", "craft-keymap", @@ -2057,7 +2057,7 @@ dependencies = [ [[package]] name = "craft-text" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "craft-behavior", "craft-font-manager", @@ -2082,7 +2082,7 @@ dependencies = [ [[package]] name = "craft-theme" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "bitflags 2.13.2", "craft-tracked", @@ -2097,7 +2097,7 @@ dependencies = [ [[package]] name = "craft-theme-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "craft-atomic", "craft-behavior", @@ -2112,7 +2112,7 @@ dependencies = [ [[package]] name = "craft-tiff" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "serde", "thiserror 2.0.21", @@ -2122,7 +2122,7 @@ dependencies = [ [[package]] name = "craft-time" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "serde", "thiserror 2.0.21", @@ -2131,7 +2131,7 @@ dependencies = [ [[package]] name = "craft-timeline" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "craft-behavior", "craft-keymap", @@ -2146,12 +2146,12 @@ dependencies = [ [[package]] name = "craft-tracked" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" [[package]] name = "craft-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "craft-cloud-ui", "craft-ui-canvas", @@ -2165,7 +2165,7 @@ dependencies = [ [[package]] name = "craft-ui-canvas" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "craft-behavior", "craft-i18n", @@ -2181,7 +2181,7 @@ dependencies = [ [[package]] name = "craft-ui-contract" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "accesskit", "craft-behavior", @@ -2219,7 +2219,7 @@ dependencies = [ [[package]] name = "craft-ui-macros" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2230,7 +2230,7 @@ dependencies = [ [[package]] name = "craft-ui-panels" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "craft-behavior", "craft-host", @@ -2248,7 +2248,7 @@ dependencies = [ [[package]] name = "craft-ui-patterns" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "craft-behavior", "craft-host", @@ -2269,7 +2269,7 @@ dependencies = [ [[package]] name = "craft-ui-shell" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "craft-behavior", "craft-host", @@ -2290,7 +2290,7 @@ dependencies = [ [[package]] name = "craft-ui-widgets" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "craft-behavior", "craft-host", @@ -2309,7 +2309,7 @@ dependencies = [ [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "base64 0.22.1", "chrono", @@ -2341,7 +2341,7 @@ dependencies = [ [[package]] name = "craft-vectorcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "flate2", "serde", @@ -2352,7 +2352,7 @@ dependencies = [ [[package]] name = "craft-wayland" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "raw-window-handle", "wayland-backend", @@ -2362,7 +2362,7 @@ dependencies = [ [[package]] name = "craft-web-api" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "js-sys", "serde_json", @@ -2373,7 +2373,7 @@ dependencies = [ [[package]] name = "craft-win32" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "winsafe", ] @@ -2381,7 +2381,7 @@ dependencies = [ [[package]] name = "craft-window" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "craft-appkit", "craft-atomic", @@ -2413,7 +2413,7 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "quick-xml 0.41.0", "serde", @@ -3772,7 +3772,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a" [[package]] name = "hayro-cmap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "brotli 8.0.4", "hayro-postscript", @@ -3781,7 +3781,7 @@ dependencies = [ [[package]] name = "hayro-interpret" version = "0.7.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "bitflags 2.13.2", "hayro-cmap", @@ -3799,7 +3799,7 @@ dependencies = [ [[package]] name = "hayro-jbig2" version = "0.3.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "fearless_simd", "hayro-ccitt", @@ -3817,12 +3817,12 @@ dependencies = [ [[package]] name = "hayro-postscript" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" [[package]] name = "hayro-syntax" version = "0.7.2" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "flate2", "hayro-ccitt", @@ -4805,7 +4805,7 @@ dependencies = [ [[package]] name = "krilla" version = "0.8.2" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "base64 0.22.1", "bumpalo", @@ -4962,7 +4962,7 @@ checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" [[package]] name = "linesweeper" version = "0.5.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5#a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" dependencies = [ "arrayvec", "kurbo 0.13.1", diff --git a/Cargo.toml b/Cargo.toml index e1a20cac68..2354a50e24 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,51 +10,51 @@ license = "MIT OR Apache-2.0" rust-version = "1.95" [workspace.dependencies] -craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0", default-features = false, features = ["interpret", "write"] } -craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } +craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" } +craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5", default-features = false, features = ["interpret", "write"] } +craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" } +craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" } # Language packs: the Craft apps' shared font store installs them (#4936). -craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } +craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" } +craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" } # The `.vectorcraft` envelope: its members, version, embedded images and the data after the JSON. -craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } +craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" } +craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" } # `.pcraft` documents: their manifest, full-size composite, preview, layer pixels and ICC profile. -craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0", features = ["pcraft-pixels"] } +craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5", features = ["pcraft-pixels"] } # Native Affinity documents (craft-libs#914). -craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } +craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" } # Bounded CDR (v1-v27) and CMX (32-bit) reader (craft-libs#778). -craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } +craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" } # SVG parsing, limits, SVGZ and writer (craft-libs#778). -craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0", features = ["tree"] } -craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } +craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5", features = ["tree"] } +craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" } # EPS container, previews, ASCII85 and DSC comments (craft-libs#778). -craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } +craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" } # DXF tags, reader and writer (craft-libs#778, #926, #927). -craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } +craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" } +craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" } # WMF, EMF and EMF+ reader (craft-libs#778). -craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0", default-features = false, features = ["read", "write"] } -craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } +craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" } +craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" } +craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" } +craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" } +craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" } +craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5", default-features = false, features = ["read", "write"] } +craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" } +craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" } +craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" } +craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" } # The framework facade (`craft::ui`, `craft::settings`, `craft::platform`, ...). No default features: each crate names # the members it imports. -craft = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } +craft = { git = "https://github.com/storytold/craft-libs", rev = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" } # Below the egui layer, so not through the facade: the colour harmony rules and their settings (craft-color-ui # without its `ui` feature), the colour type they work in, and the craft-fonts tables the text crate's build writes. -craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } +craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" } +craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" } +craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" } # Nightly profile isolation, launch protocol, and security fence. -craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } +craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" } # internal vectorcraft-geom = { path = "crates/geom" } vectorcraft-color = { path = "crates/color" } @@ -194,13 +194,13 @@ lto = "thin" codegen-units = 1 [patch.crates-io] -hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -krilla = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } +hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" } +hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" } +hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" } +hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" } +hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" } +krilla = { git = "https://github.com/storytold/craft-libs", rev = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" } +linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5" } ecolor = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } emath = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } epaint = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } diff --git a/apps/vectorcraft-web/Cargo.toml b/apps/vectorcraft-web/Cargo.toml index 30d529a5e7..d97df2b9ed 100644 --- a/apps/vectorcraft-web/Cargo.toml +++ b/apps/vectorcraft-web/Cargo.toml @@ -28,7 +28,7 @@ egui_extras = { workspace = true } # `wgpu` pulls egui-wgpu's defaults: WebGPU plus the WebGL2 fallback. eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit"] } # The page command API (storytold/craft-libs#413): the request plumbing behind window.vectorcraft. -craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0", version = "0.1.0" } +craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5", version = "0.1.0" } wasm-bindgen = "0.2" serde_json = { workspace = true } diff --git a/crates/ui-egui/src/panels.rs b/crates/ui-egui/src/panels.rs index 2d1ea7cfb9..aaabbaa41e 100644 --- a/crates/ui-egui/src/panels.rs +++ b/crates/ui-egui/src/panels.rs @@ -155,13 +155,17 @@ pub(crate) fn corner_radius_row(app: &mut VectorcraftApp, ui: &mut Ui, n: &Node) } /// The Corner select of a live rectangle whose corners share one radius field: the kind of all -/// four corners, also while some of them are Direct-Selected, blank when they differ. A pick sets -/// it on every corner of each selected live rectangle ([`set_rectangle_kinds`]). +/// four corners, also while some of them are Direct-Selected, blank when they differ. It is one +/// number cell wide, as the Corner Radius field above it is. A pick sets it on every corner of each +/// selected live rectangle ([`set_rectangle_kinds`]). fn corner_kind_row(app: &mut VectorcraftApp, ui: &mut Ui, n: &Node) { let Some(lc) = LiveCorners::of(n) else { return }; let entries = corner_entries(); - let current = lc.style(&lc.all()).1; - let picked = Field::new(tl!("Corner")).show(ui, |ui, _| corner_select(ui, tl!("Corner"), current, &entries)).inner.flatten(); + let current = lc.style(&lc.all()).1.map_or(Mixed::Mixed, Mixed::Same); + let picked = Field::new(tl!("Corner")) + .show(ui, |ui, _| Select::new(tl!("Corner"), Bind::given(current), &entries).number_cell().show(ui).events.committed().copied()) + .inner + .flatten(); if let Some(kind) = picked { set_rectangle_kinds(app, kind, None); } diff --git a/crates/ui-egui/src/panels/properties/transform_section.rs b/crates/ui-egui/src/panels/properties/transform_section.rs index ad887865dc..042d6165dd 100644 --- a/crates/ui-egui/src/panels/properties/transform_section.rs +++ b/crates/ui-egui/src/panels/properties/transform_section.rs @@ -105,11 +105,12 @@ pub(super) fn corner_rows(app: &mut VectorcraftApp, ui: &mut Ui) { Row::new().show(ui, |ui, _| panels::corners_link(app, ui)); return; } - // The corners differ in kind: no entry is the value. + // The corners differ in kind: no entry is the value. The select is one number cell wide, as + // the Corner Radius field under it is. let kind = picked.kind.map_or(Mixed::Mixed, Mixed::Same); let entries = panels::corner_entries(); let chosen = Field::new(tl!("Corner")) - .show(ui, |ui, _| Select::new(tl!("Corner"), Bind::given(kind), &entries).show(ui).events.committed().copied()) + .show(ui, |ui, _| Select::new(tl!("Corner"), Bind::given(kind), &entries).number_cell().show(ui).events.committed().copied()) .inner; if let Some(Some(kind)) = chosen { panels::set_picked_corners(app, &picked, json!({"kind": kind})); diff --git a/crates/ui-egui/src/panels/transform/shape.rs b/crates/ui-egui/src/panels/transform/shape.rs index f9cc3a64ab..8530a90390 100644 --- a/crates/ui-egui/src/panels/transform/shape.rs +++ b/crates/ui-egui/src/panels/transform/shape.rs @@ -229,12 +229,13 @@ fn sides_row(app: &mut VectorcraftApp, ui: &mut Ui, sides: u32) { } } -/// The polygon's Corner type select, blank while `kind` is `None` (the corners differ). +/// The polygon's Corner type select, blank while `kind` is `None` (the corners differ), one number cell wide as the +/// number fields of its column are. fn corner_kind_row(app: &mut VectorcraftApp, ui: &mut Ui, kind: Option<CornerKind>) { let entries = corner_entries(); let mut edit = None; Field::new(tl!("Corner")).show(ui, |ui, _| { - edit = Some(Select::new(tl!("Corner"), Bind::given(kind.map_or(Mixed::Mixed, Mixed::Same)), &entries).show(ui)); + edit = Some(Select::new(tl!("Corner"), Bind::given(kind.map_or(Mixed::Mixed, Mixed::Same)), &entries).number_cell().show(ui)); }); if let Some(edit) = edit { apply_edits(app, &edit, EditPath::Scope, |app, k, _| set_live_shape(app, json!({ "kind": k }))); diff --git a/crates/ui-egui/src/panels/transform/tests.rs b/crates/ui-egui/src/panels/transform/tests.rs index a5f37234e1..fa4b550289 100644 --- a/crates/ui-egui/src/panels/transform/tests.rs +++ b/crates/ui-egui/src/panels/transform/tests.rs @@ -246,6 +246,66 @@ fn unlinked_corner_labels_start_in_one_column() { } } +/// An app with a live rectangle selected whose Corner Radius is linked. +fn linked_rectangle_app() -> VectorcraftApp { + let mut app = new_app(); + app.run("shape.rectangle", json!({"x": 50, "y": 50, "width": 120, "height": 80, "radius": 10})).unwrap(); + set_pref(&mut app, "singleCornerRadius", true); + app +} + +/// An app with the Direct Selection tool chosen and corner 2 of a star selected. +fn star_corner_app() -> VectorcraftApp { + let mut app = new_app(); + let star = app.run("shape.star", json!({"cx": 200, "cy": 150, "radius1": 80, "radius2": 40})).unwrap()["id"].as_u64().unwrap(); + app.select_tool("directSelection"); + app.run("select.anchors", json!({"id": star, "anchors": [[0, 2]], "mode": "set"})).unwrap(); + app +} + +/// A Corner select in a column of number fields is one number cell wide, as the Corner Radius field of its column +/// is: a live rectangle's linked Corner and a live polygon's Corner, in the Transform panel and the Properties panel's +/// Transform section, and the Corner of a path's Direct-Selected corners in the Properties panel. Each still opens, +/// and Enter sets the kind highlighted in its list on the corner it reads. +#[test] +fn corner_selects_are_as_wide_as_the_corner_radius_field() { + use craft::ui::contract::Role; + use egui::{Key, Modifiers}; + use vectorcraft_doc::LiveCorners; + use vectorcraft_geom::shapes::CornerKind; + type Draw = fn(&mut VectorcraftApp, &mut Ui); + /// A case's name, the app it starts from, the panel it draws and the corner whose kind it reads. + type Case = (&'static str, fn() -> VectorcraftApp, Draw, usize); + let transform = show as Draw; + let properties = crate::panels::properties::transform_section as Draw; + let cases: [Case; 5] = [ + ("Transform panel, linked rectangle", linked_rectangle_app, transform, 0), + ("Properties panel, linked rectangle", linked_rectangle_app, properties, 0), + ("Transform panel, polygon", || polygon_app(6), transform, 0), + ("Properties panel, polygon", || polygon_app(6), properties, 0), + ("Properties panel, Direct-Selected corner", star_corner_app, crate::panels::properties::show, 2), + ]; + for (case, app, draw, corner) in cases { + let mut p = Panel::new(app(), draw); + let select = p.rect_role("Corner", Role::COMBO_BOX); + let field = p.rect_role("Corner Radius", Role::SPIN_BUTTON); + assert!( + (select.width() - field.width()).abs() < 0.5, + "{case}: the Corner select is {} wide, the Corner Radius field {}", + select.width(), + field.width() + ); + let kind = |p: &Panel| LiveCorners::of(&first_selected(&p.app()).unwrap()).unwrap().kind(corner); + assert_eq!(kind(&p), CornerKind::ALL[0], "{case}"); + let undo = undo_depth(&p.app()); + p.click_role("Corner", Role::COMBO_BOX); + p.key(Key::ArrowDown, Modifiers::NONE); + p.key(Key::Enter, Modifiers::NONE); + assert_eq!(kind(&p), CornerKind::ALL[1], "{case}: Enter sets the highlighted kind"); + assert_eq!(undo_depth(&p.app()), undo + 1, "{case}: the kind is one undo step"); + } +} + /// A corner kind set with no live rectangle selected leaves the selected polygon, the document and /// its undo history as they are. #[test] diff --git a/xtask/src/pdf_deps.rs b/xtask/src/pdf_deps.rs index 216d23d43d..dc825d2145 100644 --- a/xtask/src/pdf_deps.rs +++ b/xtask/src/pdf_deps.rs @@ -5,7 +5,7 @@ use std::process::Command; use serde_json::Value; -const REV: &str = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"; +const REV: &str = "a4b90eee40b1c50bb0230f2a12bb8348cec8b3a5"; const PACKAGES: &[(&str, &str, &str)] = &[ ("craft-pdf", "0.1.0", REV), ("krilla", "0.8.2", REV), From 010367e39efd0b05b9b425b00b9e13629657f02c Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 01:46:09 -0800 Subject: [PATCH 032/112] Tests: allow the 26 Windows and macOS tests that CI never runs Each test that a cfg limits to Windows, macOS or a case-insensitive file system gets a `test-lint: allow never-run` line naming its platform, so `cargo xtask test-lint` no longer reports them. The tests are unchanged and still run on their own platform. --- apps/vectorcraft-cli/src/perf.rs | 2 ++ apps/vectorcraft/src/mac_color_space.rs | 3 +++ apps/vectorcraft/src/mac_fonts.rs | 2 ++ apps/vectorcraft/src/open_documents.rs | 1 + crates/color/src/cms/tests.rs | 1 + crates/engine/src/file_access.rs | 2 ++ crates/engine/src/tests/fontfiles.rs | 1 + crates/engine/src/tests/link_paths.rs | 3 +++ crates/engine/src/tests/plugins.rs | 1 + crates/engine/src/tests/script_io.rs | 3 +++ crates/engine/src/tests/store.rs | 1 + crates/pdf/tests/gradient_forms.rs | 3 +++ crates/text/src/tests/sysfonts.rs | 3 +++ 13 files changed, 26 insertions(+) diff --git a/apps/vectorcraft-cli/src/perf.rs b/apps/vectorcraft-cli/src/perf.rs index e533d00b73..47686f6c2f 100644 --- a/apps/vectorcraft-cli/src/perf.rs +++ b/apps/vectorcraft-cli/src/perf.rs @@ -629,6 +629,7 @@ mod tests { /// On Windows `busy_cores` gives a number between 0 and the cores. #[cfg(windows)] + // test-lint: allow never-run Windows only; CI runs tests on Linux and FreeBSD #[test] fn windows_reads_how_many_cores_are_busy() { let cores = std::thread::available_parallelism().map_or(1, |c| c.get()); @@ -639,6 +640,7 @@ mod tests { /// On Windows `rss_mb` gives this process's working set: more than 0 MB and less than /// 10,000 MB. #[cfg(windows)] + // test-lint: allow never-run Windows only; CI runs tests on Linux and FreeBSD #[test] fn windows_reads_the_working_set() { let mb = rss_mb().map(|(mb, _)| mb); diff --git a/apps/vectorcraft/src/mac_color_space.rs b/apps/vectorcraft/src/mac_color_space.rs index 3fa1394804..ccdb340ec2 100644 --- a/apps/vectorcraft/src/mac_color_space.rs +++ b/apps/vectorcraft/src/mac_color_space.rs @@ -99,6 +99,7 @@ mod tests { } /// A layer without a color space is tagged sRGB once; the second call leaves it as it is. + // test-lint: allow never-run macOS only; CI runs tests on Linux and FreeBSD #[test] fn an_untagged_layer_becomes_srgb() { let layer = CAMetalLayer::new(); @@ -110,6 +111,7 @@ mod tests { } /// A layer with a color space of its own keeps it. + // test-lint: allow never-run macOS only; CI runs tests on Linux and FreeBSD #[test] fn a_layer_with_a_color_space_keeps_it() { let layer = CAMetalLayer::new(); @@ -121,6 +123,7 @@ mod tests { /// The Metal layer is found as the view's layer or as one of its sublayers, and only Metal /// layers are returned. + // test-lint: allow never-run macOS only; CI runs tests on Linux and FreeBSD #[test] fn metal_layers_are_found_under_the_view_layer() { let metal = CAMetalLayer::new(); diff --git a/apps/vectorcraft/src/mac_fonts.rs b/apps/vectorcraft/src/mac_fonts.rs index 36223c559f..4e9f996d62 100644 --- a/apps/vectorcraft/src/mac_fonts.rs +++ b/apps/vectorcraft/src/mac_fonts.rs @@ -52,6 +52,7 @@ mod tests { use objc2_core_text::{CTFontManagerRegisterFontsForURL, CTFontManagerScope, CTFontManagerUnregisterFontsForURL}; /// CoreText lists the installed fonts, by their files' full paths. + // test-lint: allow never-run macOS only; CI runs tests on Linux and FreeBSD #[test] fn coretext_lists_the_installed_font_files() { let files = super::font_files(); @@ -61,6 +62,7 @@ mod tests { /// A font registered with CoreText from another folder, as apps and font managers register /// fonts, is listed while it is registered. + // test-lint: allow never-run macOS only; CI runs tests on Linux and FreeBSD #[test] fn fonts_registered_from_other_folders_are_listed() { let dir = tempfile::Builder::new().prefix("vectorcraft-mac-fonts-").tempdir().unwrap(); diff --git a/apps/vectorcraft/src/open_documents.rs b/apps/vectorcraft/src/open_documents.rs index 67f409b0e8..a126618ee0 100644 --- a/apps/vectorcraft/src/open_documents.rs +++ b/apps/vectorcraft/src/open_documents.rs @@ -94,6 +94,7 @@ mod tests { use super::*; /// Files queue until the UI takes them; URLs that aren't files are left out. + // test-lint: allow never-run macOS only; CI runs tests on Linux and FreeBSD #[test] fn opened_files_wait_for_the_ui() { let web = NSURL::URLWithString(&NSString::from_str("https://example.com/a.svg")).unwrap(); diff --git a/crates/color/src/cms/tests.rs b/crates/color/src/cms/tests.rs index 761a121191..a6552029b2 100644 --- a/crates/color/src/cms/tests.rs +++ b/crates/color/src/cms/tests.rs @@ -323,6 +323,7 @@ fn bad_icc_rejected() { } #[cfg(target_os = "macos")] +// test-lint: allow never-run macOS only; CI runs tests on Linux and FreeBSD #[test] fn loads_system_cmyk_icc() { let path = std::path::Path::new("/System/Library/ColorSync/Profiles/Generic CMYK Profile.icc"); diff --git a/crates/engine/src/file_access.rs b/crates/engine/src/file_access.rs index ce6023fb4e..7daa75e0ae 100644 --- a/crates/engine/src/file_access.rs +++ b/crates/engine/src/file_access.rs @@ -1390,6 +1390,7 @@ mod tests { } #[cfg(windows)] + // test-lint: allow never-run Windows only; CI runs tests on Linux and FreeBSD #[test] fn windows_ignores_case_and_refuses_devices() { let (base, roots) = folders("case"); @@ -1471,6 +1472,7 @@ mod tests { } #[cfg(windows)] + // test-lint: allow never-run Windows only; CI runs tests on Linux and FreeBSD #[test] fn windows_refuses_a_stream_inside_a_write_root() { let (base, roots) = folders("streams"); diff --git a/crates/engine/src/tests/fontfiles.rs b/crates/engine/src/tests/fontfiles.rs index 52a8ff08a3..e90aec1df9 100644 --- a/crates/engine/src/tests/fontfiles.rs +++ b/crates/engine/src/tests/fontfiles.rs @@ -417,6 +417,7 @@ fn a_search_skips_font_files_too_large_to_add() { /// A suitcase font: a file without an extension or with `.suit`, empty but for the fonts in its /// resource fork, which only macOS keeps. A search finds it, and Add Fonts copies it with its fork. #[cfg(target_os = "macos")] +// test-lint: allow never-run macOS only; CI runs tests on Linux and FreeBSD #[test] fn suitcase_fonts_are_found_and_copied_with_their_fork() { use vectorcraft_testkit::fonts::{renamed, suitcase_fork}; diff --git a/crates/engine/src/tests/link_paths.rs b/crates/engine/src/tests/link_paths.rs index e39cf66896..ebc2b5d1c6 100644 --- a/crates/engine/src/tests/link_paths.rs +++ b/crates/engine/src/tests/link_paths.rs @@ -189,6 +189,7 @@ fn a_path_on_a_mapped_drive_is_on_the_share_behind_it() { } #[cfg(windows)] +// test-lint: allow never-run Windows only; CI runs tests on Linux and FreeBSD #[test] fn links_on_a_mapped_drives_share_are_followed() { use crate::cmd::fileio::{document_path_with, share_of}; @@ -208,6 +209,7 @@ fn links_on_a_mapped_drives_share_are_followed() { } #[cfg(windows)] +// test-lint: allow never-run Windows only; CI runs tests on Linux and FreeBSD #[test] fn links_on_a_drive_mapped_to_another_share_are_not_followed() { use crate::cmd::fileio::{document_path_on, drive_share_of, share_of}; @@ -228,6 +230,7 @@ fn links_on_a_drive_mapped_to_another_share_are_not_followed() { } #[cfg(windows)] +// test-lint: allow never-run Windows only; CI runs tests on Linux and FreeBSD #[test] fn links_on_the_documents_share_or_this_computer_are_followed() { use crate::cmd::fileio::{document_path_on, drive_share_of, share_of}; diff --git a/crates/engine/src/tests/plugins.rs b/crates/engine/src/tests/plugins.rs index 836daf8b05..f2858aec25 100644 --- a/crates/engine/src/tests/plugins.rs +++ b/crates/engine/src/tests/plugins.rs @@ -4110,6 +4110,7 @@ fn a_removal_deletes_only_folders_it_marked() { /// Windows keeps a file another program holds open without delete sharing, so the last grant can't /// be removed by deleting `grants.json`. #[cfg(windows)] +// test-lint: allow never-run Windows only; CI runs tests on Linux and FreeBSD #[test] fn a_grants_file_that_cannot_be_deleted_keeps_the_stored_module() { use std::os::windows::fs::OpenOptionsExt; diff --git a/crates/engine/src/tests/script_io.rs b/crates/engine/src/tests/script_io.rs index 1e2823aaa4..b5d7fe7ded 100644 --- a/crates/engine/src/tests/script_io.rs +++ b/crates/engine/src/tests/script_io.rs @@ -1020,6 +1020,7 @@ fn script_file_alias_is_not_left_behind_a_folder_replaced_by_a_link() { /// Where a hidden file is not one whose name starts with a dot, setting `hidden` and `createAlias` /// set `error` and change nothing. #[cfg(not(unix))] +// test-lint: allow never-run Windows only (not Unix); CI runs tests on Linux and FreeBSD #[test] fn script_file_hidden_and_aliases_are_refused_off_unix() { let base = folder("hiddenoff"); @@ -1637,6 +1638,7 @@ fn script_file_rename_does_not_take_the_settings_folders_name() { /// Where case does not matter, a folder named in another case is still the folder that holds the /// settings folder, or the settings folder itself: it is not renamed or removed. #[cfg(any(windows, target_os = "macos"))] +// test-lint: allow never-run needs a case-insensitive file system (Windows, macOS); CI runs tests on Linux and FreeBSD #[test] fn script_file_rename_does_not_move_the_settings_folder_named_in_another_case() { let base = folder("moveupcase"); @@ -1660,6 +1662,7 @@ fn script_file_rename_does_not_move_the_settings_folder_named_in_another_case() /// Where case does not matter, a folder renamed under its name in another case still moves the open /// objects of the files in it: changes are written under the new name, not lost at the old one. #[cfg(any(windows, target_os = "macos"))] +// test-lint: allow never-run needs a case-insensitive file system (Windows, macOS); CI runs tests on Linux and FreeBSD #[test] fn script_file_rename_of_a_folder_named_in_another_case_moves_its_open_files() { let base = folder("renamecase"); diff --git a/crates/engine/src/tests/store.rs b/crates/engine/src/tests/store.rs index dfc603dc59..380126535f 100644 --- a/crates/engine/src/tests/store.rs +++ b/crates/engine/src/tests/store.rs @@ -79,6 +79,7 @@ fn file_names(dir: &std::path::Path) -> Vec<String> { /// Windows does not allow replacing a read-only file or writing into it, so the write fails. #[cfg(windows)] +// test-lint: allow never-run Windows only; CI runs tests on Linux and FreeBSD #[test] fn a_rename_that_only_changes_case_and_cannot_be_written_keeps_the_old_file() { let root = fresh_dir("rename-case-fails"); diff --git a/crates/pdf/tests/gradient_forms.rs b/crates/pdf/tests/gradient_forms.rs index 7373ec8494..a904935fe5 100644 --- a/crates/pdf/tests/gradient_forms.rs +++ b/crates/pdf/tests/gradient_forms.rs @@ -159,6 +159,7 @@ mod quartz { } /// Quartz places RGB and CMYK radial centres, edges and masks with their translated art. + // test-lint: allow never-run macOS only; CI runs tests on Linux and FreeBSD #[test] fn quartz_keeps_off_centre_radials_in_transparency_and_layer_forms() { for mode in [ColorMode::Rgb, ColorMode::Cmyk] { @@ -179,6 +180,7 @@ mod quartz { } /// Quartz retains the linear ramp's direction inside forms on a translated artboard. + // test-lint: allow never-run macOS only; CI runs tests on Linux and FreeBSD #[test] fn quartz_keeps_linear_gradient_directions_in_forms() { for form in FORMS.into_iter().filter(|f| !matches!(f, Form::Mask | Form::Knockout)) { @@ -190,6 +192,7 @@ mod quartz { } /// A gradient's stop-opacity mask remains aligned with its colour through nested forms. + // test-lint: allow never-run macOS only; CI runs tests on Linux and FreeBSD #[test] fn quartz_keeps_gradient_stop_opacity_aligned_inside_nested_forms() { let (mut d, opts) = fixture(Form::Nested, GradientKind::Radial, ColorMode::Rgb, Point::ORIGIN); diff --git a/crates/text/src/tests/sysfonts.rs b/crates/text/src/tests/sysfonts.rs index 261cc1c54c..32cb04c30c 100644 --- a/crates/text/src/tests/sysfonts.rs +++ b/crates/text/src/tests/sysfonts.rs @@ -805,6 +805,7 @@ fn a_resource_fork_gives_up_its_font_files() { /// Office's fonts: a file with nothing in it but a resource fork holding the fonts, named /// without an extension. Only macOS keeps a resource fork in a file. #[cfg(target_os = "macos")] +// test-lint: allow never-run macOS only; CI runs tests on Linux and FreeBSD #[test] fn the_scan_reads_suitcase_fonts() { let dir = font_dir("suitcase"); @@ -1011,6 +1012,7 @@ fn a_search_reads_at_most_its_share_of_a_font_file() { /// A search reads a suitcase font only when its whole resource fork fits in the 8 MB a search reads /// of one file. #[cfg(target_os = "macos")] +// test-lint: allow never-run macOS only; CI runs tests on Linux and FreeBSD #[test] fn a_search_reads_a_suitcase_font_only_within_its_share() { use crate::fontdb::file_face_names_within; @@ -1036,6 +1038,7 @@ fn a_search_reads_a_suitcase_font_only_within_its_share() { /// A suitcase font read for one search (Retype) is read no further than one byte past the limit, /// and the bytes read are counted. #[cfg(target_os = "macos")] +// test-lint: allow never-run macOS only; CI runs tests on Linux and FreeBSD #[test] fn a_suitcase_font_read_for_a_search_counts_the_bytes_of_its_fork() { let dir = std::env::temp_dir().join(format!("vc-sysfonts-{}-unloaded-suitcase", std::process::id())); From 42a7b9ea08530f8c8f79166c852f3a0a704da990 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 02:05:41 -0800 Subject: [PATCH 033/112] Tests: check default swatches, nightly ids and panel places by behavior default_swatches_parse no longer reads swatch.rs as text: it checks that no default swatch outside the black and white ones falls back to black or white. The nightly id test compares the window id with the package id and id_for instead of echoing string literals. The library panel and Tab panel tests compare a panel's place with the saved place and the canvas instead of literal coordinates. --- crates/color/src/swatch.rs | 20 +++++++++++++------ crates/ui-egui/src/os_window.rs | 6 +++--- .../ui-egui/src/panels/library_panel/tests.rs | 6 ++++-- crates/ui-egui/src/panels/tabs/tests.rs | 4 +++- 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/crates/color/src/swatch.rs b/crates/color/src/swatch.rs index 12ae31220a..7b64d91d1b 100644 --- a/crates/color/src/swatch.rs +++ b/crates/color/src/swatch.rs @@ -187,12 +187,20 @@ mod tests { #[test] fn default_swatches_parse() { // `solid`/`grad` fall back to black or white on a bad literal instead of panicking; make sure - // none falls back. - let src = include_str!("swatch.rs"); - let hexes: Vec<&str> = src.split('"').filter(|t| t.starts_with('#') && t.len() == 7).collect(); - assert!(hexes.len() > 30); - for h in hexes { - assert!(Color::from_hex(h).is_some(), "{h}"); + // none falls back: only the swatches named for black or white carry those colors. + let (s, g) = default_swatches(Model::Rgb); + let all: Vec<&Swatch> = s.iter().chain(g.iter().flat_map(|g| &g.swatches)).collect(); + assert!(all.len() > 30); + for w in all { + let colors: Vec<Color> = match &w.paint { + Paint::Solid { color, .. } => vec![*color], + Paint::Gradient(gp) => gp.gradient.stops.iter().map(|st| st.color).collect(), + _ => vec![], + }; + for c in colors { + let fallback = c == Color::BLACK || c == Color::WHITE; + assert!(!fallback || w.name.contains("White") || w.name.contains("Black"), "{} fell back to {c:?}", w.name); + } } } } diff --git a/crates/ui-egui/src/os_window.rs b/crates/ui-egui/src/os_window.rs index 00ce8344e7..493dccbb92 100644 --- a/crates/ui-egui/src/os_window.rs +++ b/crates/ui-egui/src/os_window.rs @@ -119,9 +119,9 @@ mod tests { #[test] fn the_two_nightly_ids_are_the_contract_ones() { // The package and bundle identity ends in `.nightly`; the window and AUMID in `.nightly-v1`. - assert_eq!(NIGHTLY_PACKAGE_ID, "ai.storyteller.vectorcraft.nightly"); - assert_eq!(NIGHTLY_APP_ID, "ai.storyteller.vectorcraft.nightly-v1"); - assert_ne!(NIGHTLY_PACKAGE_ID, NIGHTLY_APP_ID); + assert_eq!(id_for(LaunchIdentity::NightlyV1), NIGHTLY_APP_ID); + assert!(NIGHTLY_PACKAGE_ID.ends_with(".nightly"), "{NIGHTLY_PACKAGE_ID}"); + assert_eq!(NIGHTLY_APP_ID.strip_suffix("-v1"), Some(NIGHTLY_PACKAGE_ID), "the window id is the package id plus -v1"); } #[test] diff --git a/crates/ui-egui/src/panels/library_panel/tests.rs b/crates/ui-egui/src/panels/library_panel/tests.rs index a08ea664f8..c6682d264c 100644 --- a/crates/ui-egui/src/panels/library_panel/tests.rs +++ b/crates/ui-egui/src/panels/library_panel/tests.rs @@ -486,13 +486,14 @@ fn persistent_panels_reopen_at_startup_with_their_settings() { assert_eq!((r["persistent"].as_bool(), r["view"].as_str(), r["showFind"].as_bool()), (Some(true), Some("largeList"), Some(false))); app.run("ui.libraryPanel", json!({"panel": brand, "persistent": true})).unwrap(); app.run("window.panel.float", json!({"panel": pastels, "x": 40, "y": 90})).unwrap(); + let saved = docking(&app).floating.iter().find(|g| g.contains(&pastels)).unwrap().rect; // A persistent panel reopens even when it was closed. app.run("window.panel.close", json!({"panel": brand})).unwrap(); let next = restarted(&app); assert!(is_open(&next.ui, &pastels) && is_open(&next.ui, &brand), "{}", next.ui.status); assert!(!is_open(&next.ui, &brights), "a panel that isn't persistent closed with the app"); let group = docking(&next).floating.iter().find(|g| g.contains(&pastels)).unwrap(); - assert_eq!(group.rect.min, Pos2::new(40.0, 90.0), "where it was"); + assert_eq!(group.rect.min, saved.min, "where it was"); let s = settings(&next.ui, "swatches", "pastels").unwrap(); assert_eq!((s.view, s.hide_find, s.persistent), (Some(View::LargeList), true, true)); let (_, id) = parse(&brand).unwrap(); @@ -711,11 +712,12 @@ fn previous_and_next_show_the_neighbouring_library_in_the_same_panel() { let first = panel_of(app.run("window.swatchLibrary", json!({"library": "pastels"})).unwrap()); app.run("window.panel.float", json!({"panel": first, "x": 50, "y": 60})).unwrap(); app.run("ui.libraryPanel", json!({"panel": first, "persistent": true, "view": "smallList"})).unwrap(); + let saved = docking(&app).floating.iter().find(|g| g.contains(&first)).unwrap().rect; step::<SwatchLibraries>(&mut app, "pastels", 1); let next = panel_id("swatches", SWATCH_IDS[5]); assert!(!is_open(&app.ui, &first) && is_open(&app.ui, &next), "{}", app.ui.status); let group = docking(&app).floating.iter().find(|g| g.contains(&next)).unwrap(); - assert_eq!((group.panels().count(), group.rect.min), (1, Pos2::new(50.0, 60.0)), "in its place"); + assert_eq!((group.panels().count(), group.rect.min), (1, saved.min), "in its place"); let s = settings(&app.ui, "swatches", SWATCH_IDS[5]).unwrap(); assert_eq!((s.view, s.persistent), (Some(View::SmallList), true), "the panel keeps its settings"); assert!(settings(&app.ui, "swatches", "pastels").is_none()); diff --git a/crates/ui-egui/src/panels/tabs/tests.rs b/crates/ui-egui/src/panels/tabs/tests.rs index 7aacaaf1f8..52ea6ea9ec 100644 --- a/crates/ui-egui/src/panels/tabs/tests.rs +++ b/crates/ui-egui/src/panels/tabs/tests.rs @@ -1088,6 +1088,8 @@ fn above_text_puts_the_panel_at_the_top_when_below_the_text_does_not_fit() { } let (node, _, span) = current(&app).unwrap(); above_text(&mut app, &node, span).unwrap(); - assert_eq!(tabs_rect(&app).min.y, 0.0, "view centered at y {center_y}"); + // Neither above the text (off the window) nor below it (inside the canvas): at the window's top. + let (top, canvas) = (tabs_rect(&app).min.y, app.canvas_view().unwrap().rect); + assert!(top >= 0.0 && top < canvas.top(), "view centered at y {center_y}: panel top {top}, canvas {canvas:?}"); } } From e7715d880be808cce91626a1937c4c053ac776c1 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 02:21:01 -0800 Subject: [PATCH 034/112] xtask: test-lint round trips, mod scopes, never-run allows and doc names - census: a lookup counts as a round trip only when its arguments read the loop entry, so `lookup("baseline") == expected` is a real check. - never-run: a `mod child;` inside an inline `mod platform { ... }` loads platform/child.rs, so it no longer gives its cfg to src/child.rs. - never-run: an allow covers only the test it sits above; a module cfg no longer stretches it over the next test in the module. - exact-pixel: document geometry is matched by identifier (`doc`, `document`, `doc_*`, `*_doc`), so `dock_rect` is checked. --- xtask/src/test_lint.rs | 70 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 61 insertions(+), 9 deletions(-) diff --git a/xtask/src/test_lint.rs b/xtask/src/test_lint.rs index a5fc3e4bbc..9b1f2f2d14 100644 --- a/xtask/src/test_lint.rs +++ b/xtask/src/test_lint.rs @@ -240,6 +240,10 @@ pub struct Hit { /// only near `line`. pub first: usize, pub last: usize, + /// The first line an allow comment may sit on to exempt the hit, when it differs from `first`: + /// a `never-run` hit spans an enclosing module's `cfg`, but only an allow at the test's own + /// attributes exempts it. + pub allow_from: Option<usize>, } impl Hit { @@ -1183,7 +1187,7 @@ struct File<'a> { impl File<'_> { fn hit(&self, at: usize, rule: Rule, test: &str, note: String) -> Hit { let line = self.lines.of(at); - Hit { path: self.path.to_owned(), line, rule, test: test.to_owned(), note, first: line, last: line } + Hit { path: self.path.to_owned(), line, rule, test: test.to_owned(), note, first: line, last: line, allow_from: None } } fn test_at(&self, pos: usize) -> &str { @@ -1223,7 +1227,7 @@ pub fn lint_file(path: &str, src: &str, ctx: &Ctx) -> Vec<Hit> { hits.extend(reads_source_hits(&file)); let allows = allows(src, &file.m); hits.retain(|h| { - let first = if h.rule == Rule::AllUnguarded { h.line } else { h.first }; + let first = if h.rule == Rule::AllUnguarded { h.line } else { h.allow_from.unwrap_or(h.first) }; !allows.iter().any(|&(line, rule)| rule == h.rule && line + 1 >= first && line <= h.line) }); hits.sort(); @@ -1612,7 +1616,7 @@ fn weak_census_check(name: &str, args: &[String], var: &str) -> bool { 1 => args.first().is_some_and(|a| weak_predicate(a)), 2 if name.ends_with("_ne") => false, 2 => match args { - [a, b, ..] => (round_trip_call(a) && is_entry(b, var)) || (round_trip_call(b) && is_entry(a, var)), + [a, b, ..] => (round_trip_call(a, var) && is_entry(b, var)) || (round_trip_call(b, var) && is_entry(a, var)), _ => false, }, _ => false, @@ -1621,8 +1625,10 @@ fn weak_census_check(name: &str, args: &[String], var: &str) -> bool { /// Whether a (whitespace-free) operand is the result of one of [`ROUND_TRIP`], called by its whole /// name and followed only by unwrapping (`.unwrap()`, `.ok()`, `.expect(…)`, `?` and the like), so -/// the operand is the parsed or looked-up entry itself and not a value derived from it. -fn round_trip_call(op: &str) -> bool { +/// the operand is the parsed or looked-up entry itself and not a value derived from it. The call's +/// arguments must read the loop entry `var` (`Kind::from_id(k.id())`); a lookup of a fixed key is +/// not a round trip of the entry. +fn round_trip_call(op: &str, var: &str) -> bool { let mut op = op.trim_start_matches(['&', '*']); loop { let wraps = |w: &&str| op.starts_with(*w) && matching(op.as_bytes(), w.len() - 1) == Some(op.len() - 1); @@ -1636,11 +1642,21 @@ fn round_trip_call(op: &str) -> bool { op.match_indices(&format!("{r}(")).any(|(at, _)| { let open = at + r.len(); !op.as_bytes()[..at].last().copied().is_some_and(is_ident) - && matching(op.as_bytes(), open).is_some_and(|close| only_unwraps(&op[close + 1..])) + && matching(op.as_bytes(), open).is_some_and(|close| only_unwraps(&op[close + 1..]) && reads_ident(&op[open + 1..close], var)) }) }) } +/// Whether `s` contains the identifier `var` as a whole word. +fn reads_ident(s: &str, var: &str) -> bool { + let b = s.as_bytes(); + !var.is_empty() + && s.match_indices(var).any(|(at, _)| { + let end = at + var.len(); + !(at > 0 && is_ident(b[at - 1])) && !b.get(end).copied().is_some_and(is_ident) + }) +} + /// Whether a (whitespace-free) call suffix only unwraps or copies the call's result. fn only_unwraps(mut rest: &str) -> bool { const UNWRAPS: &[&str] = &[".unwrap()", ".ok()", ".copied()", ".cloned()", ".clone()", ".as_ref()", ".as_deref()", "?"]; @@ -3283,7 +3299,7 @@ fn declared_cfgs(src: &str, name: &str) -> Option<Vec<String>> { let decl = words(&m, b"mod", 0, m.len()).into_iter().find(|&at| { let start = skip_ws(&m, at + 3); let end = start + m[start..].iter().take_while(|&&c| is_ident(c)).count(); - &m[start..end] == name.as_bytes() && m.get(skip_ws(&m, end)) == Some(&b';') + &m[start..end] == name.as_bytes() && m.get(skip_ws(&m, end)) == Some(&b';') && !in_inline_mod(&m, at) })?; let item = m[..decl].iter().rposition(|&c| matches!(c, b';' | b'{' | b'}')).map_or(0, |p| p + 1); let mut out = vec![]; @@ -3298,6 +3314,20 @@ fn declared_cfgs(src: &str, name: &str) -> Option<Vec<String>> { Some(out) } +/// Whether `at` in the masked text `m` is inside an inline `mod <name> { … }`, where a `mod x;` +/// loads a file under that module's directory instead of a sibling file. +fn in_inline_mod(m: &[u8], at: usize) -> bool { + m[..at].iter().enumerate().filter(|&(_, &c)| c == b'{').any(|(open, _)| { + if !matching(m, open).is_some_and(|close| close > at) { + return false; + } + let head = m[..open].trim_ascii_end(); + let name = head.iter().rev().take_while(|&&c| is_ident(c)).count(); + let before = head[..head.len() - name].trim_ascii_end(); + name > 0 && before.ends_with(b"mod") && !before[..before.len() - 3].last().copied().is_some_and(is_ident) + }) +} + /// For each of `paths`, the `cfg` predicates on the `mod` declarations of its module and the /// modules above it, read through `read`. fn module_cfgs(paths: &[String], read: &dyn Fn(&str) -> Option<String>) -> HashMap<String, Vec<String>> { @@ -3335,6 +3365,7 @@ fn never_run(v: &View, ctx: &Ctx) -> Option<Hit> { let shown: Vec<String> = preds.iter().filter(|p| p.as_str() != "test").map(|p| format!("cfg({p})")).collect(); let mut hit = v.whole(Rule::NeverRun, format!("{} leaves it out of every target CI tests on", shown.join(", "))); if let Some(at) = first_attr { + hit.allow_from = Some(hit.first); hit.first = hit.first.min(v.file.lines.of(at)); } return Some(hit); @@ -3363,7 +3394,11 @@ const RECT_PARTS: &[&str] = &[ /// [`RECT_PARTS`]. Document geometry (artboards, `x0`/`y0` corners, a document's nodes) and a rect /// passed on as an argument do not count. fn names_rect(op: &str) -> bool { - if ["artboard", "doc", ".x0", ".y0", ".x1", ".y1", "obox"].iter().any(|w| op.contains(w)) { + if ["artboard", ".x0", ".y0", ".x1", ".y1", "obox"].iter().any(|w| op.contains(w)) { + return false; + } + let document = |w: &str| w == "doc" || w == "document" || w.starts_with("doc_") || w.ends_with("_doc"); + if op.split(|c: char| !(c.is_ascii_alphanumeric() || c == '_')).any(document) { return false; } let b = op.as_bytes(); @@ -3459,6 +3494,15 @@ mod tests { assert_eq!(hits(mixed), [(3, "all-unguarded")]); } + #[test] + fn census_round_trips_look_up_the_entry() { + let census = |src: &str| hits(src).into_iter().filter(|h| h.1 == "census").collect::<Vec<_>>(); + let fixed = "#[test]\nfn t() {\n for expected in CASES {\n assert_eq!(lookup(\"baseline\"), expected);\n }\n}\n"; + assert_eq!(census(fixed), [], "a lookup of a fixed key is not a round trip of the entry"); + let derived = "#[test]\nfn t() {\n for k in Kind::ALL {\n assert_eq!(Kind::from_id(k.id()), Some(k));\n }\n}\n"; + assert_eq!(census(derived), [(2, "census")]); + } + #[test] fn census_loops_over_whole_tables_are_reported() { let census = |src: &str| hits(src).into_iter().filter(|h| h.1 == "census").collect::<Vec<_>>(); @@ -5041,7 +5085,11 @@ mod tests { let inner = "#![cfg(target_os = \"macos\")]\nmod child;\n"; assert_eq!(declared_cfgs(inner, "child"), Some(vec!["target_os=\"macos\"".to_owned()])); let block = "#[cfg(windows)]\nmod platform {\n mod child;\n}\n"; - assert_eq!(declared_cfgs(block, "child"), Some(vec!["windows".to_owned()])); + assert_eq!(declared_cfgs(block, "child"), None, "that `mod child;` loads platform/child.rs"); + let both = "#[cfg(windows)]\nmod platform {\n mod child;\n}\nmod child;\n"; + assert_eq!(declared_cfgs(both, "child"), Some(vec![]), "the root declaration, not the one in platform"); + let gated = "#[cfg(windows)]\nconst _: () = {\n mod child;\n};\n"; + assert_eq!(declared_cfgs(gated, "child"), Some(vec!["windows".to_owned()]), "a gated block that is not a module"); assert_eq!(declared_cfgs("mod child;\n", "child"), Some(vec![])); } @@ -5052,6 +5100,9 @@ mod tests { let hit = found.iter().find(|h| h.rule == Rule::NeverRun).map(|h| (h.first, h.line)); assert_eq!(hit, Some((1, 4))); assert!(touches(found.iter().find(|h| h.rule == Rule::NeverRun).unwrap(), Some(&[1].into_iter().collect())), "a change to the cfg alone"); + let two = "#[cfg(target_os = \"macos\")]\nmod mac {\n // test-lint: allow never-run checks the macOS menu bar\n #[test]\n fn t() {\n assert_eq!(f(), 1);\n }\n #[test]\n fn u() {\n assert_eq!(f(), 1);\n }\n}\n"; + let left: Vec<usize> = lint_file("crates/x/src/tests.rs", two, &ctx()).iter().filter(|h| h.rule == Rule::NeverRun).map(|h| h.line).collect(); + assert_eq!(left, [9], "an allow above one test leaves the next one reported"); } #[test] @@ -5067,6 +5118,7 @@ mod tests { assert_eq!(px("assert_eq!(correct, 3);"), [], "a word that only contains rect"); assert_eq!(px("assert_eq!(tabs_rect(&app).min.y, 0.0);"), [(4, "exact-pixel")], "a call that returns a rect"); assert_eq!(px("assert_eq!(doc.artboards[1].rect.width(), 100.0);"), [], "document geometry in a UI test"); + assert_eq!(px("assert_eq!(dock_rect.width(), 120.0);"), [(4, "exact-pixel")], "a name that only starts with doc"); assert_eq!(px("assert_eq!((rect.x0, rect.y0), (200.0, 200.0));"), [], "document corners"); assert_eq!(px("assert_eq!(rgb8(&fill_color(&app, rect)), [255, 255, 255]);"), [], "a rect passed on"); let engine = "#[test]\nfn t() {\n assert_eq!(art_rect.width(), 10.0);\n}\n"; From 7e1fe2afadba08c16f10080d0bd63ed3d03bba6a Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 02:27:41 -0800 Subject: [PATCH 035/112] Tests: check the nightly id against packaging and the panel at the window top The nightly id test now also reads the published package id from packaging/macos/nightly_plist.py and nightly-lib.sh, and the Position Panel Above Text test requires the panel top to equal the window top. --- crates/ui-egui/src/os_window.rs | 5 +++++ crates/ui-egui/src/panels/tabs/tests.rs | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/os_window.rs b/crates/ui-egui/src/os_window.rs index 493dccbb92..8d25c6e7d2 100644 --- a/crates/ui-egui/src/os_window.rs +++ b/crates/ui-egui/src/os_window.rs @@ -122,6 +122,11 @@ mod tests { assert_eq!(id_for(LaunchIdentity::NightlyV1), NIGHTLY_APP_ID); assert!(NIGHTLY_PACKAGE_ID.ends_with(".nightly"), "{NIGHTLY_PACKAGE_ID}"); assert_eq!(NIGHTLY_APP_ID.strip_suffix("-v1"), Some(NIGHTLY_PACKAGE_ID), "the window id is the package id plus -v1"); + // The packaging publishes the same package id. + let plist = include_str!("../../../packaging/macos/nightly_plist.py"); + assert!(plist.contains(&format!("IDENTIFIER = \"{NIGHTLY_PACKAGE_ID}\"")), "nightly_plist.py"); + let lib = include_str!("../../../packaging/macos/nightly-lib.sh"); + assert!(lib.contains(&format!("MAC_NIGHTLY_ID='{NIGHTLY_PACKAGE_ID}'")), "nightly-lib.sh"); } #[test] diff --git a/crates/ui-egui/src/panels/tabs/tests.rs b/crates/ui-egui/src/panels/tabs/tests.rs index 52ea6ea9ec..a30cf7b559 100644 --- a/crates/ui-egui/src/panels/tabs/tests.rs +++ b/crates/ui-egui/src/panels/tabs/tests.rs @@ -1090,6 +1090,7 @@ fn above_text_puts_the_panel_at_the_top_when_below_the_text_does_not_fit() { above_text(&mut app, &node, span).unwrap(); // Neither above the text (off the window) nor below it (inside the canvas): at the window's top. let (top, canvas) = (tabs_rect(&app).min.y, app.canvas_view().unwrap().rect); - assert!(top >= 0.0 && top < canvas.top(), "view centered at y {center_y}: panel top {top}, canvas {canvas:?}"); + assert!(canvas.top() > 0.0, "canvas {canvas:?}"); + assert_eq!(top, 0.0, "view centered at y {center_y}: panel top {top}, canvas {canvas:?}"); } } From 7330cf12d8e3c734e5051553a129fd3d50bdfce0 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 02:43:37 -0800 Subject: [PATCH 036/112] Tests: declare the packaging files the nightly-ids test reads The nightly-ids test in os_window.rs reads packaging/macos/nightly_plist.py and packaging/macos/nightly-lib.sh. List both under the crate's [package.metadata.craft] reads so test selection reruns it when they change. --- crates/ui-egui/Cargo.toml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/Cargo.toml b/crates/ui-egui/Cargo.toml index fa9d95b172..49fad8d56f 100644 --- a/crates/ui-egui/Cargo.toml +++ b/crates/ui-egui/Cargo.toml @@ -113,4 +113,9 @@ toml = "1" # The files of other crates that this crate's tests read, for CI's test selection. [package.metadata.craft] -reads = ["crates/engine/src/cmd/addons/cutting/banner.rs", "crates/plugins/tests/fixtures/desaturate.wasm"] +reads = [ + "crates/engine/src/cmd/addons/cutting/banner.rs", + "crates/plugins/tests/fixtures/desaturate.wasm", + "packaging/macos/nightly-lib.sh", + "packaging/macos/nightly_plist.py", +] From 2c1278280b374bfad13d86c458633825668f42bf Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 02:55:37 -0800 Subject: [PATCH 037/112] xtask: test-lint cfg_attr, #[path] and inline-module gates, changed parent declarations - never-run reads cfg(...) nested in cfg_attr, and blanks comments in cfg predicates. - A file's inherited gates come from the mod declaration that loads it: #[path] overrides are resolved, and a declaration inside an inline module gates the file under that module's directory. Several declarations of one file join with any(...). - In changed-files mode, a change to a parent mod declaration or its cfg counts for the never-run hits of the files it loads, including files that did not change. - Round trips reject arithmetic before the lookup (1 + lookup(k)). - reads-source ignores Rust paths that occur only in comments. - if let and while let bindings shadow outer bindings only inside their body. - The mirror allow test now starts from an assertion that is reported. --- xtask/src/test_lint.rs | 394 ++++++++++++++++++++++++++++++++++------- 1 file changed, 327 insertions(+), 67 deletions(-) diff --git a/xtask/src/test_lint.rs b/xtask/src/test_lint.rs index 9b1f2f2d14..168dd8ff79 100644 --- a/xtask/src/test_lint.rs +++ b/xtask/src/test_lint.rs @@ -262,6 +262,15 @@ pub struct Ctx { pub module_cfgs: HashMap<String, Vec<String>>, } +/// Whether a parent file's changed lines touch a `mod` declaration or `cfg` attribute that `gates` +/// came from. +fn gate_changed(gates: Option<&Gates>, changed: &BTreeMap<String, Option<BTreeSet<usize>>>) -> bool { + gates + .into_iter() + .flat_map(|g| &g.sources) + .any(|(parent, lines)| changed.get(parent).is_some_and(|c| c.as_ref().is_none_or(|set| lines.iter().any(|l| set.contains(l))))) +} + /// A source file read from the work tree, or `None` when it is missing or larger than [`MAX_FILE`]. fn read_small(root: &Path, path: &str) -> Option<String> { let full = root.join(path); @@ -287,18 +296,36 @@ pub fn run(root: &Path, args: &[&str]) -> Result<(), String> { let crates: BTreeSet<String> = changed.keys().map(|p| crate_of(p)).chain([TESTKIT.to_owned()]).collect(); let helper_files: Vec<String> = files.iter().filter(|p| crates.contains(&crate_of(p))).cloned().collect(); let present: Vec<String> = changed.keys().filter(|p| root.join(p).is_file()).cloned().collect(); - let module_cfgs = module_cfgs(&present, &|p| read_small(root, p)); + // Files under the module of a changed file: a `cfg` added to their `mod` declaration can turn + // their tests off without a change to them. + let module_dirs: Vec<String> = present + .iter() + .map(|p| { + let (dir, file) = p.rsplit_once('/').unwrap_or(("", p)); + if ["mod.rs", "lib.rs", "main.rs"].contains(&file) { format!("{dir}/") } else { format!("{}/", p.trim_end_matches(".rs")) } + }) + .collect(); + let below: Vec<String> = + files.iter().filter(|p| !changed.contains_key(*p) && module_dirs.iter().any(|d| p.starts_with(d.as_str()))).cloned().collect(); + let gated: Vec<String> = present.iter().chain(&below).cloned().collect(); + let gates = module_gates(&gated, &|p| read_small(root, p)); + let module_cfgs = gates.iter().map(|(p, g)| (p.clone(), g.preds.clone())).collect(); let ctx = Ctx { helpers: asserting_helpers(&read_all(root, &helper_files)?), ci_env, module_cfgs }; let (mut counted, mut older) = (vec![], 0usize); for (path, src) in read_all(root, &present)? { + let parent_changed = gate_changed(gates.get(&path), &changed); for hit in lint_file(&path, &src, &ctx) { - if touches(&hit, changed.get(&path).and_then(Option::as_ref)) { + if touches(&hit, changed.get(&path).and_then(Option::as_ref)) || (hit.rule == Rule::NeverRun && parent_changed) { counted.push(hit); } else { older += 1; } } } + for path in below.iter().filter(|p| gate_changed(gates.get(*p), &changed)) { + let Some(src) = read_small(root, path) else { continue }; + counted.extend(lint_file(path, &src, &ctx).into_iter().filter(|h| h.rule == Rule::NeverRun)); + } finish(&counted, older, present.len(), &base) } @@ -1624,7 +1651,7 @@ fn weak_census_check(name: &str, args: &[String], var: &str) -> bool { } /// Whether a (whitespace-free) operand is the result of one of [`ROUND_TRIP`], called by its whole -/// name and followed only by unwrapping (`.unwrap()`, `.ok()`, `.expect(…)`, `?` and the like), so +/// name with only a path or receiver before it (no arithmetic) and followed only by unwrapping (`.unwrap()`, `.ok()`, `.expect(…)`, `?` and the like), so /// the operand is the parsed or looked-up entry itself and not a value derived from it. The call's /// arguments must read the loop entry `var` (`Kind::from_id(k.id())`); a lookup of a fixed key is /// not a round trip of the entry. @@ -1642,6 +1669,7 @@ fn round_trip_call(op: &str, var: &str) -> bool { op.match_indices(&format!("{r}(")).any(|(at, _)| { let open = at + r.len(); !op.as_bytes()[..at].last().copied().is_some_and(is_ident) + && !op[..at].contains(['+', '-', '*', '/', '%', '^', '|', '!', '=', ',']) && matching(op.as_bytes(), open).is_some_and(|close| only_unwraps(&op[close + 1..]) && reads_ident(&op[open + 1..close], var)) }) }) @@ -2930,6 +2958,8 @@ fn reads_source_hits(file: &File) -> Vec<Hit> { return vec![]; } let m = &file.m; + // The source with comments blanked and literals kept: a path in a comment is not read. + let code = mask_parts(&String::from_utf8_lossy(file.src), true, false); let mut out = vec![]; let words_and_notes = [ (&b"include_str"[..], "includes a .rs file as text"), @@ -2940,7 +2970,7 @@ fn reads_source_hits(file: &File) -> Vec<Hit> { for at in words(m, word, 0, m.len()).into_iter().filter(|&at| in_regions(&file.regions, at)) { let open = skip_ws(m, at + word.len() + usize::from(m.get(at + word.len()) == Some(&b'!'))); let Some(close) = (m.get(open) == Some(&b'(')).then(|| matching(m, open)).flatten() else { continue }; - let arg = norm(&file.src[open + 1..close]); + let arg = norm(&code[open + 1..close]); // An ordinary or raw string literal: `".rs"`, `r".rs"`, `r#"…/lib.rs"#`. let raw = arg.strip_prefix('r').map(|a| a.trim_matches('#')).filter(|a| a.starts_with('"')); let literal = raw.unwrap_or(&arg); @@ -3109,6 +3139,20 @@ fn reaching_init(body: &[u8], name: &str, before: usize) -> Option<Option<(Strin let is_mut = body[start..].starts_with(b"mut") && body.get(start + 3).is_some_and(u8::is_ascii_whitespace); let n0 = if is_mut { skip_ws(body, start + 3) } else { start }; let n1 = n0 + body[n0..].iter().take_while(|&&c| is_ident(c)).count(); + let head = body[..at].trim_ascii_end(); + let keyword = + [&b"if"[..], b"while"].into_iter().find(|k| head.ends_with(k) && !head[..head.len() - k.len()].last().copied().is_some_and(is_ident)); + if keyword.is_some() { + // `if let` and `while let` bind the pattern's names inside their body only. + if let Some((open, close)) = let_body(body, n0) { + let pattern = norm(&body[n0..open]); + let pattern = pattern.split_once('=').map_or(pattern.as_str(), |(p, _)| p); + if open < before && before < close && !words(pattern.as_bytes(), name.as_bytes(), 0, pattern.len()).is_empty() { + found = Some(None); + } + } + continue; + } let stop = statement_end(body, n1); if stop > before || block_close(body, at) < before { continue; @@ -3130,6 +3174,22 @@ fn reaching_init(body: &[u8], name: &str, before: usize) -> Option<Option<(Strin found } +/// The braces of the body of an `if let` or `while let` whose pattern starts at `from`: the first +/// `{` outside parentheses and brackets, and its match. +fn let_body(body: &[u8], from: usize) -> Option<(usize, usize)> { + let mut depth = 0usize; + for (i, &c) in body.iter().enumerate().skip(from) { + match c { + b'(' | b'[' => depth += 1, + b')' | b']' => depth = depth.saturating_sub(1), + b'{' if depth == 0 => return matching(body, i).map(|close| (i, close)), + b';' | b'}' if depth == 0 => return None, + _ => {} + } + } + None +} + /// Where the innermost block holding `at` closes: its `}`, or the end of `body`. fn block_close(body: &[u8], at: usize) -> usize { let mut depth = 0usize; @@ -3240,23 +3300,67 @@ fn cfg_value(p: &str, t: &Target) -> Option<bool> { } } -/// The predicates of the `#[cfg(…)]` and `#![cfg(…)]` attributes whose item holds `pos`, each with -/// the offset of its attribute. `m` is the masked text of `src`. +/// A `cfg` attribute found by [`cfg_attrs`]. +struct CfgAttr { + pred: String, + /// The offset of the attribute's `cfg` or `cfg_attr`. + at: usize, + /// The offset of its closing `]`. + end: usize, + inner: bool, +} + +/// The `#[cfg(…)]`, `#![cfg(…)]` and `#[cfg_attr(<condition>, cfg(…))]` attributes in `m[from..to]`, +/// sorted by offset. A nested `cfg` becomes `any(not(<condition>),<predicate>)`: it removes the item +/// only when the condition holds. `m` is the masked text of `src`. +fn cfg_attrs(m: &[u8], src: &[u8], from: usize, to: usize) -> Vec<CfgAttr> { + let mut out = vec![]; + for (word, nested) in [(&b"cfg"[..], false), (&b"cfg_attr"[..], true)] { + for at in words(m, word, from, to) { + let before = m[..at].trim_ascii_end(); + let Some(hash) = before.strip_suffix(b"[").map(<[u8]>::trim_ascii_end) else { continue }; + let inner = hash.ends_with(b"#!"); + if !inner && !hash.ends_with(b"#") { + continue; + } + let open = skip_ws(m, at + word.len()); + let Some(close) = (m.get(open) == Some(&b'(')).then(|| matching(m, open)).flatten() else { continue }; + let end = skip_ws(m, close + 1); + if m.get(end) != Some(&b']') { + continue; + } + let text = pred_text(&src[open + 1..close]); + if !nested { + out.push(CfgAttr { pred: text, at, end, inner }); + continue; + } + let cuts = top_level_at(&text, ","); + let Some(&first) = cuts.first() else { continue }; + let cond = &text[..first]; + let mut start = first + 1; + for cut in cuts[1..].iter().copied().chain([text.len()]) { + if let Some(p) = text.get(start..cut).and_then(|p| p.strip_prefix("cfg(")).and_then(|p| p.strip_suffix(')')) { + out.push(CfgAttr { pred: format!("any(not({cond}),{p})"), at, end, inner }); + } + start = cut + 1; + } + } + } + out.sort_by_key(|a| a.at); + out +} + +/// A `cfg` predicate's source text without whitespace or comments. Masking would also blank the +/// string literals `target_os = "macos"` needs, so only comments are blanked. +fn pred_text(src: &[u8]) -> String { + norm(&mask_parts(&String::from_utf8_lossy(src), true, false)) +} + +/// The predicates of the `cfg` attributes ([`cfg_attrs`]) whose item holds `pos`, each with the +/// offset of its attribute. `m` is the masked text of `src`. fn cfgs_over(m: &[u8], src: &[u8], pos: usize) -> Vec<(String, usize)> { let mut out = vec![]; - for at in words(m, b"cfg", 0, m.len()) { - let before = m[..at].trim_ascii_end(); - let Some(hash) = before.strip_suffix(b"[").map(<[u8]>::trim_ascii_end) else { continue }; - let inner = hash.ends_with(b"#!"); - if !inner && !hash.ends_with(b"#") { - continue; - } - let open = skip_ws(m, at + "cfg".len()); - let Some(close) = (m.get(open) == Some(&b'(')).then(|| matching(m, open)).flatten() else { continue }; - let end = skip_ws(m, close + 1); - if m.get(end) != Some(&b']') { - continue; - } + for CfgAttr { pred, at, end, inner } in cfg_attrs(m, src, 0, m.len()) { let span = if inner { // An inner attribute covers the file (or the module) it opens. let enclosing = m[..at].iter().rposition(|&c| c == b'{'); @@ -3270,8 +3374,7 @@ fn cfgs_over(m: &[u8], src: &[u8], pos: usize) -> Vec<(String, usize)> { } }; if span.0 <= pos && pos <= span.1 { - // The source text: masking blanks the string literals `target_os = "macos"` needs. - out.push((norm(&src[open + 1..close]), at)); + out.push((pred, at)); } } out @@ -3292,58 +3395,168 @@ fn module_parent(path: &str) -> Option<(&str, Vec<String>)> { Some((name, candidates)) } -/// The predicates of the `#[cfg(…)]` attributes on a `mod <name>;` declaration in `src` and on the -/// items and file around it, or `None` when `src` declares no such module. -fn declared_cfgs(src: &str, name: &str) -> Option<Vec<String>> { - let m = mask(src); - let decl = words(&m, b"mod", 0, m.len()).into_iter().find(|&at| { - let start = skip_ws(&m, at + 3); - let end = start + m[start..].iter().take_while(|&&c| is_ident(c)).count(); - &m[start..end] == name.as_bytes() && m.get(skip_ws(&m, end)) == Some(&b';') && !in_inline_mod(&m, at) - })?; - let item = m[..decl].iter().rposition(|&c| matches!(c, b';' | b'{' | b'}')).map_or(0, |p| p + 1); - let mut out = vec![]; - for at in words(&m, b"cfg", item, decl) { - let open = skip_ws(&m, at + 3); - let attr = m[..at].trim_ascii_end().strip_suffix(b"[").is_some_and(|b| b.trim_ascii_end().ends_with(b"#")); - if let Some(close) = (attr && m.get(open) == Some(&b'(')).then(|| matching(&m, open)).flatten() { - out.push(norm(&src.as_bytes()[open + 1..close])); - } - } - out.extend(cfgs_over(&m, src.as_bytes(), decl).into_iter().map(|(p, _)| p)); - Some(out) +/// Where a module file is loaded from: the file `path`, the name `name` it declares by default and +/// the inline modules `chain` (outermost first) its declaration must sit in. +struct Loaded<'a> { + path: &'a str, + name: &'a str, + chain: &'a [String], } -/// Whether `at` in the masked text `m` is inside an inline `mod <name> { … }`, where a `mod x;` -/// loads a file under that module's directory instead of a sibling file. -fn in_inline_mod(m: &[u8], at: usize) -> bool { - m[..at].iter().enumerate().filter(|&(_, &c)| c == b'{').any(|(open, _)| { - if !matching(m, open).is_some_and(|close| close > at) { - return false; +/// The `cfg` predicates under which `src`, the file `parent`, loads `want`: those on the +/// `mod <name>;` declarations that load it (by name, or through a `#[path]` override) and on the +/// items, inline modules and file around them, with the 1-based lines of those declarations and +/// attributes. Several declarations that load the file join into one `any(all(…), …)`. `None` +/// when `src` loads no such file. +fn declared_cfgs(src: &str, parent: &str, want: &Loaded) -> Option<(Vec<String>, Vec<usize>)> { + let m = mask(src); + let lines = Lines::new(src); + let (dir, file) = parent.rsplit_once('/').unwrap_or(("", parent)); + let mod_rs = ["mod.rs", "lib.rs", "main.rs"].contains(&file); + let (mut each, mut at_lines) = (vec![], vec![]); + for at in words(&m, b"mod", 0, m.len()) { + let start = skip_ws(&m, at + 3); + let end = start + m[start..].iter().take_while(|&&c| is_ident(c)).count(); + if end == start || m.get(skip_ws(&m, end)) != Some(&b';') || inline_mods(&m, at) != want.chain { + continue; } - let head = m[..open].trim_ascii_end(); - let name = head.iter().rev().take_while(|&&c| is_ident(c)).count(); - let before = head[..head.len() - name].trim_ascii_end(); - name > 0 && before.ends_with(b"mod") && !before[..before.len() - 3].last().copied().is_some_and(is_ident) + let item = m[..at].iter().rposition(|&c| matches!(c, b';' | b'{' | b'}')).map_or(0, |p| p + 1); + let loads = match path_attr(&m, src.as_bytes(), item, at) { + Some(rel) => { + // A `#[path]` outside inline modules is relative to the file's directory; inside them, + // to the inline modules' directory under the file's module. + let mut base = dir.to_owned(); + if !want.chain.is_empty() && !mod_rs { + base = join_path(&base, file.strip_suffix(".rs").unwrap_or(file)); + } + for seg in want.chain { + base = join_path(&base, seg); + } + join_path(&base, &rel) == want.path + } + None => &m[start..end] == want.name.as_bytes(), + }; + if !loads { + continue; + } + // Inner attributes cover the file, and [`cfgs_over`] reads them. + let attrs: Vec<CfgAttr> = cfg_attrs(&m, src.as_bytes(), item, at).into_iter().filter(|a| !a.inner).collect(); + at_lines.push(lines.of(at)); + at_lines.extend(attrs.iter().map(|a| lines.of(a.at))); + let mut preds: Vec<String> = attrs.into_iter().map(|a| a.pred).collect(); + for (p, a) in cfgs_over(&m, src.as_bytes(), at) { + preds.push(p); + at_lines.push(lines.of(a)); + } + each.push(preds); + } + let preds = match each.len() { + 0 => return None, + 1 => each.pop().unwrap_or_default(), + _ => vec![format!("any({})", each.iter().map(|p| format!("all({})", p.join(","))).collect::<Vec<_>>().join(","))], + }; + Some((preds, at_lines)) +} + +/// The string value of a `#[path = "…"]` attribute in `m[from..to]`. +fn path_attr(m: &[u8], src: &[u8], from: usize, to: usize) -> Option<String> { + words(m, b"path", from, to).into_iter().find_map(|at| { + let attr = m[..at].trim_ascii_end().strip_suffix(b"[").is_some_and(|b| b.trim_ascii_end().ends_with(b"#")); + let eq = skip_ws(m, at + 4); + let q = skip_ws(m, eq + 1); + if !attr || m.get(eq) != Some(&b'=') || m.get(q) != Some(&b'"') { + return None; + } + let close = find(m, b"\"", q + 1)?; + Some(String::from_utf8_lossy(&src[q + 1..close]).into_owned()) }) } +/// `rel` joined to the directory `base`, with `.` and `..` resolved. +fn join_path(base: &str, rel: &str) -> String { + let mut parts: Vec<&str> = base.split('/').filter(|s| !s.is_empty()).collect(); + for seg in rel.split('/') { + match seg { + "" | "." => {} + ".." => { + parts.pop(); + } + s => parts.push(s), + } + } + parts.join("/") +} + +/// The names of the inline `mod <name> { … }` blocks around `at` in the masked text `m`, outermost +/// first. A `mod x;` inside them loads a file under their directory instead of a sibling file. +fn inline_mods(m: &[u8], at: usize) -> Vec<String> { + m[..at] + .iter() + .enumerate() + .filter(|&(open, &c)| c == b'{' && matching(m, open).is_some_and(|close| close > at)) + .filter_map(|(open, _)| { + let head = m[..open].trim_ascii_end(); + let name = head.iter().rev().take_while(|&&c| is_ident(c)).count(); + let before = head[..head.len() - name].trim_ascii_end(); + (name > 0 && before.ends_with(b"mod") && !before[..before.len() - 3].last().copied().is_some_and(is_ident)) + .then(|| String::from_utf8_lossy(&head[head.len() - name..]).into_owned()) + }) + .collect() +} + /// For each of `paths`, the `cfg` predicates on the `mod` declarations of its module and the /// modules above it, read through `read`. fn module_cfgs(paths: &[String], read: &dyn Fn(&str) -> Option<String>) -> HashMap<String, Vec<String>> { + module_gates(paths, read).into_iter().map(|(p, g)| (p, g.preds)).collect() +} + +/// The `cfg` predicates a module file inherits ([`module_cfgs`]) and, for each file that declares +/// them, the lines of those declarations and attributes. +#[derive(Default)] +struct Gates { + preds: Vec<String>, + sources: Vec<(String, Vec<usize>)>, +} + +/// [`Gates`] for each of `paths` that inherits a predicate. A file is looked up in the files that +/// may declare its module and, when none does, in the files above them through inline modules +/// (`mod platform { mod child; }` loads `platform/child.rs`). +fn module_gates(paths: &[String], read: &dyn Fn(&str) -> Option<String>) -> HashMap<String, Gates> { let mut out = HashMap::new(); for path in paths { - let (mut preds, mut at) = (vec![], path.clone()); - for _ in 0..16 { - let Some((name, candidates)) = module_parent(&at) else { break }; - let Some((parent, found)) = candidates.into_iter().find_map(|c| read(&c).and_then(|s| declared_cfgs(&s, name)).map(|f| (c, f))) else { + let (mut gates, mut at) = (Gates::default(), path.clone()); + 'up: for _ in 0..16 { + let Some((name, mut candidates)) = module_parent(&at) else { break }; + let name = name.to_owned(); + let file = at.rsplit_once('/').map_or(at.as_str(), |(_, f)| f); + let Some(mut module_dir) = (if file == "mod.rs" { + at.rsplit_once('/').and_then(|(d, _)| d.rsplit_once('/')).map(|(p, _)| p.to_owned()) + } else { + at.rsplit_once('/').map(|(d, _)| d.to_owned()) + }) else { break; }; - preds.extend(found); - at = parent; + let mut chain: Vec<String> = vec![]; + for _ in 0..4 { + let want = Loaded { path: &at, name: &name, chain: &chain }; + if let Some((parent, (preds, lines))) = + candidates.into_iter().find_map(|c| read(&c).and_then(|s| declared_cfgs(&s, &c, &want)).map(|f| (c, f))) + { + gates.preds.extend(preds); + gates.sources.push((parent.clone(), lines)); + at = parent; + continue 'up; + } + let Some((up, seg)) = module_dir.rsplit_once('/').map(|(u, s)| (u.to_owned(), s.to_owned())) else { break 'up }; + let Some((_, next)) = module_parent(&format!("{module_dir}.rs")) else { break 'up }; + chain.insert(0, seg); + candidates = next; + module_dir = up; + } + break; } - if !preds.is_empty() { - out.insert(path.clone(), preds); + if !gates.preds.is_empty() { + out.insert(path.clone(), gates); } } out @@ -3501,6 +3714,8 @@ mod tests { assert_eq!(census(fixed), [], "a lookup of a fixed key is not a round trip of the entry"); let derived = "#[test]\nfn t() {\n for k in Kind::ALL {\n assert_eq!(Kind::from_id(k.id()), Some(k));\n }\n}\n"; assert_eq!(census(derived), [(2, "census")]); + let successor = "#[test]\nfn t() {\n for k in KEYS {\n assert_eq!(1 + lookup(k), k);\n }\n}\n"; + assert_eq!(census(successor), [], "arithmetic before the lookup checks a successor, not a round trip"); } #[test] @@ -4997,9 +5212,8 @@ mod tests { assert_eq!(only("mirror", oracle), [], "two functions of the same name in different paths"); let ne = "#[test]\nfn t() {\n assert_ne!(hash(a), hash(b));\n}\n"; assert_eq!(only("mirror", ne), [], "two inputs that must differ"); - let allowed = - "#[test]\nfn t() {\n // test-lint: allow mirror both spellings parse to one value\n assert_eq!(parse(\"a\"), parse(\"A\"));\n}\n"; - assert_eq!(only("mirror", allowed), []); + let allowed = "#[test]\nfn t() {\n // test-lint: allow mirror scaling is linear by definition\n assert_eq!(scale(p, 2.0), scale(p, 1.0) * 2.0);\n}\n"; + assert_eq!(only("mirror", allowed), [], "the allow removes the hit `bad` reports"); } #[test] @@ -5029,6 +5243,8 @@ mod tests { assert_eq!(hits(scoped), [], "a binding in a block that has ended"); let later = "#[test]\nfn t() {\n let x = compute();\n let y = x;\n let x = 0;\n assert_eq!(y, 2);\n assert_eq!(x, 0);\n}\n"; assert_eq!(hits(later), [], "an initializer reads the binding that reaches it, not a later one"); + let if_let = "#[test]\nfn t() {\n let x = 0;\n if let Some(x) = compute() {\n assert_eq!(x, 2);\n }\n}\n"; + assert_eq!(only("fixture-only", if_let), [], "an `if let` binding shadows the outer one in its body"); } #[test] @@ -5082,15 +5298,57 @@ mod tests { #[test] fn never_run_follows_the_cfg_around_the_mod_declaration() { + let child = Loaded { path: "src/child.rs", name: "child", chain: &[] }; + let declared = |src: &str, want: &Loaded| declared_cfgs(src, "src/lib.rs", want).map(|(p, _)| p); let inner = "#![cfg(target_os = \"macos\")]\nmod child;\n"; - assert_eq!(declared_cfgs(inner, "child"), Some(vec!["target_os=\"macos\"".to_owned()])); + assert_eq!(declared(inner, &child), Some(vec!["target_os=\"macos\"".to_owned()])); let block = "#[cfg(windows)]\nmod platform {\n mod child;\n}\n"; - assert_eq!(declared_cfgs(block, "child"), None, "that `mod child;` loads platform/child.rs"); + assert_eq!(declared(block, &child), None, "that `mod child;` loads platform/child.rs"); + let platform = ["platform".to_owned()]; + let nested = Loaded { path: "src/platform/child.rs", name: "child", chain: &platform }; + assert_eq!(declared(block, &nested), Some(vec!["windows".to_owned()]), "the gate on the inline module"); let both = "#[cfg(windows)]\nmod platform {\n mod child;\n}\nmod child;\n"; - assert_eq!(declared_cfgs(both, "child"), Some(vec![]), "the root declaration, not the one in platform"); + assert_eq!(declared(both, &child), Some(vec![]), "the root declaration, not the one in platform"); let gated = "#[cfg(windows)]\nconst _: () = {\n mod child;\n};\n"; - assert_eq!(declared_cfgs(gated, "child"), Some(vec!["windows".to_owned()]), "a gated block that is not a module"); - assert_eq!(declared_cfgs("mod child;\n", "child"), Some(vec![])); + assert_eq!(declared(gated, &child), Some(vec!["windows".to_owned()]), "a gated block that is not a module"); + assert_eq!(declared("mod child;\n", &child), Some(vec![])); + let commented = "#[cfg(target_os = /* supported */ \"linux\")]\nmod child;\n"; + assert_eq!(declared(commented, &child), Some(vec!["target_os=\"linux\"".to_owned()]), "a comment in the predicate"); + let paths = "#[cfg(windows)]\n#[path = \"windows.rs\"]\nmod imp;\n#[cfg(not(windows))]\nmod imp;\n"; + let imp = Loaded { path: "src/imp.rs", name: "imp", chain: &[] }; + assert_eq!(declared(paths, &imp), Some(vec!["not(windows)".to_owned()]), "the declaration that loads imp.rs"); + let win = Loaded { path: "src/windows.rs", name: "windows", chain: &[] }; + assert_eq!(declared(paths, &win), Some(vec!["windows".to_owned()]), "the `#[path]` override"); + let twice = "#[cfg(target_os = \"macos\")]\nmod child;\n#[cfg(target_os = \"linux\")]\n#[path = \"child.rs\"]\nmod other;\n"; + assert_eq!(declared(twice, &child), Some(vec!["any(all(target_os=\"macos\"),all(target_os=\"linux\"))".to_owned()])); + let attr = "#[cfg_attr(unix, cfg(target_os = \"macos\"))]\nmod child;\n"; + assert_eq!(declared(attr, &child), Some(vec!["any(not(unix),target_os=\"macos\")".to_owned()])); + } + + #[test] + fn never_run_reads_cfg_attr_and_commented_predicates() { + let commented = "#[cfg(target_os = /* supported */ \"linux\")]\n#[test]\nfn t() {\n assert_eq!(f(), 1);\n}\n"; + assert_eq!(only("never-run", commented), [], "Linux runs it"); + let mac = "#[cfg(target_os = \"macos\")]\n#[test]\nfn t() {\n assert_eq!(f(), 1);\n}\n"; + assert_eq!(only("never-run", mac), [(3, "never-run")]); + let nested = "#[cfg_attr(unix, cfg(target_os = \"macos\"))]\n#[test]\nfn t() {\n assert_eq!(f(), 1);\n}\n"; + assert_eq!(only("never-run", nested), [(3, "never-run")], "unix holds on every CI target, so the nested cfg applies"); + let unknown = "#[cfg_attr(feature = \"gpu\", cfg(target_os = \"macos\"))]\n#[test]\nfn t() {\n assert_eq!(f(), 1);\n}\n"; + assert_eq!(only("never-run", unknown), [], "a condition that may not hold"); + } + + #[test] + fn a_changed_parent_declaration_counts_for_the_child_tests() { + let files: HashMap<&str, &str> = + [("crates/x/src/lib.rs", "mod plain;\n#[cfg(target_os = \"macos\")]\nmod child;\n"), ("crates/x/src/child.rs", "")].into_iter().collect(); + let read = |p: &str| files.get(p).map(|s| (*s).to_owned()); + let gates = module_gates(&["crates/x/src/child.rs".to_owned()], &read); + let lib = |lines: &[usize]| -> BTreeMap<String, Option<BTreeSet<usize>>> { + [("crates/x/src/lib.rs".to_owned(), Some(lines.iter().copied().collect()))].into_iter().collect() + }; + assert!(gate_changed(gates.get("crates/x/src/child.rs"), &lib(&[2])), "the cfg line"); + assert!(gate_changed(gates.get("crates/x/src/child.rs"), &lib(&[3])), "the declaration line"); + assert!(!gate_changed(gates.get("crates/x/src/child.rs"), &lib(&[1])), "another declaration"); } #[test] @@ -5131,5 +5389,7 @@ mod tests { assert_eq!(only("reads-source", read), [(3, "reads-source")]); let data = "#[test]\nfn t() {\n let s = fs::read_to_string(root.join(\"data.json\")).unwrap();\n assert!(s.contains(\"x\"));\n}\n"; assert_eq!(only("reads-source", data), []); + let comment = "#[test]\nfn t() {\n let s = fs::read_to_string(/* formerly \"input.rs\" */ \"data.json\").unwrap();\n assert!(s.contains(\"x\"));\n}\n"; + assert_eq!(only("reads-source", comment), [], "a Rust path only in a comment"); } } From d73142fbd2bd388ef50d1f4249ef4e2834b69679 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 03:39:16 -0800 Subject: [PATCH 038/112] Tests: read the active nightly id assignment in either quote style The nightly-ids test now reads the last uncommented IDENTIFIER and MAC_NIGHTLY_ID assignment and accepts single or double quotes, so a commented-out old line no longer satisfies it. --- crates/ui-egui/src/os_window.rs | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/os_window.rs b/crates/ui-egui/src/os_window.rs index 8d25c6e7d2..72575b951f 100644 --- a/crates/ui-egui/src/os_window.rs +++ b/crates/ui-egui/src/os_window.rs @@ -124,9 +124,29 @@ mod tests { assert_eq!(NIGHTLY_APP_ID.strip_suffix("-v1"), Some(NIGHTLY_PACKAGE_ID), "the window id is the package id plus -v1"); // The packaging publishes the same package id. let plist = include_str!("../../../packaging/macos/nightly_plist.py"); - assert!(plist.contains(&format!("IDENTIFIER = \"{NIGHTLY_PACKAGE_ID}\"")), "nightly_plist.py"); + assert_eq!(assigned(plist, "IDENTIFIER"), Some(NIGHTLY_PACKAGE_ID), "nightly_plist.py"); let lib = include_str!("../../../packaging/macos/nightly-lib.sh"); - assert!(lib.contains(&format!("MAC_NIGHTLY_ID='{NIGHTLY_PACKAGE_ID}'")), "nightly-lib.sh"); + assert_eq!(assigned(lib, "MAC_NIGHTLY_ID"), Some(NIGHTLY_PACKAGE_ID), "nightly-lib.sh"); + } + + /// The value of the last uncommented top-level `name = value` or `name=value` line, with one pair of + /// single or double quotes removed. + fn assigned<'a>(source: &'a str, name: &str) -> Option<&'a str> { + source + .lines() + .filter_map(|line| { + let rest = line.strip_prefix(name)?.trim_start().strip_prefix('=')?.trim(); + let unquoted = ['\'', '"'].iter().find_map(|q| rest.strip_prefix(*q)?.strip_suffix(*q)); + Some(unquoted.unwrap_or(rest)) + }) + .next_back() + } + + #[test] + fn assigned_reads_the_active_line_in_either_quote_style() { + assert_eq!(assigned("# ID='old'\nID=\"new\"\n", "ID"), Some("new")); + assert_eq!(assigned("ID = 'a'\n", "ID"), Some("a")); + assert_eq!(assigned("IDX='a'\n", "ID"), None); } #[test] From 3705c2be907f6632e456d069c6cb308fa8b22e3c Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 03:40:31 -0800 Subject: [PATCH 039/112] Type Tools: Make Numbers Sequence numbers the selected type objects Object > Plug-ins > Type Tools > Make Numbers Sequence... and the addon.type.numbers command fill the selected type objects with numbers from a start value by a step, optionally stopping at an end value. Each number replaces the whole text, every number in it, or every {%n} placeholder. Objects are taken in stacking order, by rows or by columns, or in a seeded random order, with optional leading and trailing zeros. The run is one undo step, records none when nothing changes, and refuses threaded type and bad parameters. Based on Sergey Osokin's MIT-licensed MakeNumbersSequence script. --- crates/engine/src/cmd/addons/typetools.rs | 10 + .../src/cmd/addons/typetools/numbers.rs | 352 ++++++++++++++++++ .../src/cmd/addons/typetools/numbers/tests.rs | 206 ++++++++++ crates/ui-egui/src/addons/dialogs.rs | 1 + crates/ui-egui/src/addons/typetools.rs | 8 +- .../ui-egui/src/addons/typetools/numbers.rs | 97 +++++ .../src/addons/typetools/numbers/tests.rs | 58 +++ docs/mcp.md | 40 +- 8 files changed, 770 insertions(+), 2 deletions(-) create mode 100644 crates/engine/src/cmd/addons/typetools/numbers.rs create mode 100644 crates/engine/src/cmd/addons/typetools/numbers/tests.rs create mode 100644 crates/ui-egui/src/addons/typetools/numbers.rs create mode 100644 crates/ui-egui/src/addons/typetools/numbers/tests.rs diff --git a/crates/engine/src/cmd/addons/typetools.rs b/crates/engine/src/cmd/addons/typetools.rs index 14a462d79f..30ad06f8b0 100644 --- a/crates/engine/src/cmd/addons/typetools.rs +++ b/crates/engine/src/cmd/addons/typetools.rs @@ -7,6 +7,7 @@ //! (#5532). The reference app has no command for it, so it goes beyond parity and changes no //! parity score. Its submenu (Object › Plug-ins › Type Tools) and dialogs are the UI's. +pub mod numbers; #[cfg(test)] mod tests; @@ -65,6 +66,15 @@ pub fn specs() -> Vec<CommandSpec> { has_selection, release_path ), + cmd!( + "addon.type.numbers", + "Make Numbers Sequence…", + ["Object", "Plug-ins", "Type Tools"], + None, + "{start?: number (1), step?: number (1; its sign is set to run toward `end`; 0: every object gets `start`), end?: number (omitted: the numbers run to the last type object; given: they stop past `end`, and the objects after the last number keep their text), order?: \"stacking\" (stacking order, from the back) | \"rows\" (top to bottom, each row left to right) | \"columns\" (left to right, each column top to bottom) (\"stacking\"; rows and columns group objects whose centers are within half the median height or width), replace?: \"all\" (the whole text) | \"numbers\" (every number in the text: digits, with any `.` or `,` between digits) | \"placeholder\" (every {%n}, in any case) (\"all\"; with numbers or placeholder, objects that hold none are skipped and get no number), shuffle?: false (true: the numbers go to the objects in random order, and order is not used), seed?: whole number (0; the same seed gives the same order), leadingZeros?: true (non-negative numbers are padded with zeros to the whole digits of the widest of start and end, or of the last number), digits?: 1..30 (with leadingZeros, at least this many whole digits), trailingZeros?: false (true: every number gets as many decimal places as the one with the most), removeUnused?: false (true, with end: the objects left without a number are deleted), ids?: [id…], id? (instead of ids; neither: the selection)} number the type objects among the objects (inside groups too), as one undo step. A frame of threaded type among them is an error. Values are -1e12..1e12, rounded to the most decimal places among start, step and end (at most 6). Replaced text takes the style of the text it replaces. Objects that already read so are left as they are, and when nothing changes no undo step is made → {count (objects changed), ids (numbered, in order), removed}", + has_selection, + numbers::make_numbers + ), ] } diff --git a/crates/engine/src/cmd/addons/typetools/numbers.rs b/crates/engine/src/cmd/addons/typetools/numbers.rs new file mode 100644 index 0000000000..0b6196d52d --- /dev/null +++ b/crates/engine/src/cmd/addons/typetools/numbers.rs @@ -0,0 +1,352 @@ +//! Make Numbers Sequence (`addon.type.numbers`): numbers the selected type objects from a start +//! value by a step, replacing each object's whole text, the numbers in it, or a `{%n}` placeholder. +//! The objects are taken in stacking order, by rows or by columns. Leading and trailing zeros pad +//! the numbers to one width. Based on Sergey Osokin's MIT-licensed MakeNumbersSequence script +//! (<https://github.com/creold/illustrator-scripts/blob/master/md/Text.md#makenumberssequence>). + +#[cfg(test)] +mod tests; + +use serde_json::{Value, json}; +use vectorcraft_color::recolor::Rng; +use vectorcraft_doc::{NodeId, NodeKind}; +use vectorcraft_geom::Rect; +use vectorcraft_render::effects; +use vectorcraft_text::edit; + +use super::super::super::menucmds::whole_or; +use super::super::super::object::choice; +use super::super::super::textedit::text_mut; +use super::super::super::threads; +use super::super::super::typecmd::refresh_bounds; +use super::super::super::typemenu::text_ids; +use super::super::super::{bad, number_or, switch_or, targets}; +use crate::{EngineError, Result, Session}; + +/// The command id. +pub const COMMAND: &str = "addon.type.numbers"; +/// The orders the objects are numbered in. +pub const ORDERS: [&str; 3] = ["stacking", "rows", "columns"]; +/// What each object's number replaces. +pub const REPLACES: [&str; 3] = ["all", "numbers", "placeholder"]; +/// The placeholder `replace: "placeholder"` replaces, in any case. +pub const PLACEHOLDER: &str = "{%n}"; +/// The largest start, end or step. +const MAX_VALUE: f64 = 1e12; +/// The most decimal places a number keeps. +const MAX_DECIMALS: usize = 6; +/// The largest fixed number of digits. +pub const MAX_DIGITS: u64 = 30; +/// The most type objects one run numbers. +const MAX_TEXTS: usize = 100_000; + +/// What one run does, read from its params. +#[derive(Debug, Clone, PartialEq)] +pub(crate) struct Options { + pub start: f64, + /// None: the numbers run to the last type object. + pub end: Option<f64>, + pub step: f64, + pub order: &'static str, + pub replace: &'static str, + /// Some(seed): the numbers go to the objects in random order. + pub shuffle: Option<u64>, + pub leading_zeros: bool, + /// The least number of whole digits with leading zeros; None: as many as the widest number. + pub digits: Option<usize>, + pub trailing_zeros: bool, + pub remove_unused: bool, +} + +impl Options { + pub(crate) fn parse(p: &Value) -> Result<Self> { + const C: &str = COMMAND; + let value = |key: &str, default: f64| -> Result<f64> { + let v = number_or(p, key, default, C)?; + if !v.is_finite() || v.abs() > MAX_VALUE { + return Err(bad(C, format!("`{key}` must be from -{MAX_VALUE} to {MAX_VALUE}"))); + } + Ok(v) + }; + let start = value("start", 1.0)?; + let step = value("step", 1.0)?; + let end = match p.get("end") { + None | Some(Value::Null) => None, + Some(_) => Some(value("end", 0.0)?), + }; + let order = pick(choice(p, C, "order", &ORDERS)?.unwrap_or("stacking"), &ORDERS); + let replace = pick(choice(p, C, "replace", &REPLACES)?.unwrap_or("all"), &REPLACES); + let shuffle = if switch_or(p, "shuffle", false, C)? { Some(whole_or(p, "seed", 0, C)?) } else { None }; + let digits = match p.get("digits") { + None | Some(Value::Null) => None, + Some(_) => { + let d = whole_or(p, "digits", 1, C)?; + if !(1..=MAX_DIGITS).contains(&d) { + return Err(bad(C, format!("`digits` must be from 1 to {MAX_DIGITS}"))); + } + Some(usize::try_from(d).unwrap_or(1)) + } + }; + let remove_unused = switch_or(p, "removeUnused", false, C)?; + if remove_unused && end.is_none() { + return Err(bad(C, "`removeUnused` needs an `end`")); + } + Ok(Self { + start, + end, + step, + order, + replace, + shuffle, + leading_zeros: switch_or(p, "leadingZeros", true, C)?, + digits, + trailing_zeros: switch_or(p, "trailingZeros", false, C)?, + remove_unused, + }) + } +} + +/// `v` as the static entry of `list` it equals. +fn pick(v: &str, list: &[&'static str]) -> &'static str { + list.iter().copied().find(|x| *x == v).unwrap_or(list[0]) +} + +/// The decimal places `v` is written with, at most [`MAX_DECIMALS`]. +fn decimals(v: f64) -> usize { + let s = format!("{v}"); + s.split_once('.').map_or(0, |(_, f)| f.len()).min(MAX_DECIMALS) +} + +/// Round the shortest decimal representation of `v` to fixed point at `places`. +fn scaled(v: f64, places: usize) -> i128 { + let s = format!("{v}"); + let magnitude = s.trim_start_matches('-'); + let (whole, fraction) = magnitude.split_once('.').unwrap_or((magnitude, "")); + let digits = whole.bytes().chain(fraction.bytes().chain(std::iter::repeat(b'0')).take(places)); + let mut value = digits.fold(0_i128, |n, digit| n * 10 + i128::from(digit - b'0')); + if fraction.as_bytes().get(places).is_some_and(|digit| *digit >= b'5') { + value += 1; + } + if v < 0.0 { -value } else { value } +} + +/// `v` scaled by `10^places`, without trailing zeros and with no minus sign on zero. +fn write(v: i128, places: usize) -> String { + let scale = 10_u128.pow(places as u32); + let magnitude = v.unsigned_abs(); + let sign = if v < 0 { "-" } else { "" }; + let whole = magnitude / scale; + if places == 0 { + return format!("{sign}{whole}"); + } + let fraction = magnitude % scale; + let s = format!("{sign}{whole}.{fraction:0places$}"); + s.trim_end_matches('0').trim_end_matches('.').to_string() +} + +/// The numbers for `count` objects as text: from `start` by `step` (its sign set to run toward +/// `end`), stopping past `end`, then padded with zeros as `o` says. +pub(crate) fn sequence(o: &Options, count: usize) -> Vec<String> { + let places = [Some(o.start), Some(o.step), o.end].into_iter().flatten().map(decimals).max().unwrap_or(0); + let step = match o.end { + Some(end) if (o.start <= end) == (o.step < 0.0) => -o.step, + _ => o.step, + }; + // Count steps at the supported decimal precision so an inclusive end survives rounding. + let scaled = |v: f64| scaled(v, places); + let start_i = scaled(o.start); + let step_i = scaled(step); + let fit = match o.end { + Some(end) if step_i != 0 => usize::try_from((scaled(end) - start_i) / step_i + 1).unwrap_or(usize::MAX), + _ => count, + }; + let values: Vec<i128> = (0..count.min(fit)).map(|i| start_i + i as i128 * step_i).collect(); + let mut out: Vec<String> = values.iter().map(|v| write(*v, places)).collect(); + if o.trailing_zeros { + let most = out.iter().map(|s| s.split_once('.').map_or(0, |(_, f)| f.len())).max().unwrap_or(0); + if most > 0 { + for s in &mut out { + let have = s.split_once('.').map_or(0, |(_, f)| f.len()); + if have == 0 { + s.push('.'); + } + s.extend(std::iter::repeat_n('0', most - have)); + } + } + } + if o.leading_zeros { + let last = o.end.map(scaled).unwrap_or_else(|| values.last().copied().unwrap_or(start_i)); + // Whole digits as written, after rounding to `places`. + let whole = |v: i128| { + let s = write(v, places); + let s = s.trim_start_matches('-'); + s.split_once('.').map_or(s.len(), |(w, _)| w.len()) + }; + let width = whole(start_i).max(whole(last)).max(o.digits.unwrap_or(1)); + for s in &mut out { + if s.starts_with('-') { + continue; + } + let have = s.split_once('.').map_or(s.len(), |(w, _)| w.len()); + if have < width { + s.insert_str(0, &"0".repeat(width - have)); + } + } + } + out +} + +/// The byte ranges of `text` a number replaces: each run of ASCII digits, with any `.` or `,` +/// followed by more digits inside it. +pub(crate) fn number_spans(text: &str) -> Vec<(usize, usize)> { + let b = text.as_bytes(); + let mut out = vec![]; + let mut i = 0; + while i < b.len() { + if !b[i].is_ascii_digit() { + i += 1; + continue; + } + let start = i; + while i < b.len() && b[i].is_ascii_digit() { + i += 1; + } + while i + 1 < b.len() && matches!(b[i], b'.' | b',') && b[i + 1].is_ascii_digit() { + i += 1; + while i < b.len() && b[i].is_ascii_digit() { + i += 1; + } + } + out.push((start, i)); + } + out +} + +/// The byte ranges of `text` that hold the placeholder, in any case. +pub(crate) fn placeholder_spans(text: &str) -> Vec<(usize, usize)> { + let lower = text.to_ascii_lowercase(); + lower.match_indices(PLACEHOLDER).map(|(i, m)| (i, i + m.len())).collect() +} + +/// `ids` in rows (top to bottom, each row left to right) or columns (left to right, each top to +/// bottom), by the centres of `bounds`. Objects whose centres are within half the median height +/// (width for columns) of a row's first object share its row. +fn by_position(ids: Vec<(NodeId, Rect)>, rows: bool) -> Vec<NodeId> { + let along = |r: &Rect| if rows { r.center().y } else { r.center().x }; + let across = |r: &Rect| if rows { r.center().x } else { r.center().y }; + let mut sizes: Vec<f64> = ids.iter().map(|(_, r)| if rows { r.height() } else { r.width() }).collect(); + sizes.sort_by(f64::total_cmp); + let tolerance = if ids.len() < 2 { 0.0 } else { sizes[sizes.len() / 2] / 2.0 }; + let mut ids = ids; + ids.sort_by(|a, b| along(&a.1).total_cmp(&along(&b.1))); + let mut out = Vec::with_capacity(ids.len()); + let mut row: Vec<(NodeId, Rect)> = vec![]; + for item in ids { + if row.first().is_some_and(|first| along(&item.1) - along(&first.1) > tolerance) { + row.sort_by(|a, b| across(&a.1).total_cmp(&across(&b.1))); + out.extend(row.drain(..).map(|(id, _)| id)); + } + row.push(item); + } + row.sort_by(|a, b| across(&a.1).total_cmp(&across(&b.1))); + out.extend(row.into_iter().map(|(id, _)| id)); + out +} + +/// One replacement in a text: its start and end bytes and the number that goes there. +type Edit = (usize, usize, String); + +/// Each span of `spans` replaced by `number`, as edits from the last to the first. +fn edits(spans: Vec<(usize, usize)>, number: &str) -> Vec<Edit> { + spans.into_iter().rev().map(|(a, b)| (a, b, number.to_string())).collect() +} + +pub(crate) fn make_numbers(s: &mut Session, p: &Value) -> Result<Value> { + const C: &str = COMMAND; + let o = Options::parse(p)?; + let named = targets(s, p)?; + let d = &s.doc()?.doc; + if let Some(id) = named.iter().find(|id| d.node(**id).is_none()) { + return Err(EngineError::NoNode(*id)); + } + // Type objects, groups' included, in stacking order from the back. + let mut texts = text_ids(d, &named); + let paths = d.index_paths(texts.iter().copied()); + texts.sort_by(|a, b| paths.get(a).cmp(&paths.get(b))); + if texts.len() > MAX_TEXTS { + return Err(bad(C, format!("too many type objects: at most {MAX_TEXTS}"))); + } + let threads = threads::ThreadIndex::of(d); + if texts.iter().any(|id| threads.threaded(*id)) { + return Err(bad(C, "threaded type can't be numbered: its frames share one story")); + } + let plain = |id: NodeId| match d.node(id).map(|n| &n.kind) { + Some(NodeKind::Text(t)) => t.plain_text(), + _ => String::new(), + }; + if o.order != "stacking" && o.shuffle.is_none() { + let placed: Vec<(NodeId, Rect)> = texts + .iter() + .map(|id| (*id, effects::preview::bounds_of(d, &[*id], false).unwrap_or(Rect::new(f64::MAX, f64::MAX, f64::MAX, f64::MAX)))) + .collect(); + texts = by_position(placed, o.order == "rows"); + } + // Only objects that hold a number or the placeholder count. + let texts: Vec<(NodeId, String)> = texts + .into_iter() + .map(|id| (id, plain(id))) + .filter(|(_, t)| match o.replace { + "numbers" => t.bytes().any(|b| b.is_ascii_digit()), + "placeholder" => !placeholder_spans(t).is_empty(), + _ => true, + }) + .collect(); + let mut numbers = sequence(&o, texts.len()); + if let Some(seed) = o.shuffle { + let mut rng = Rng::new(seed); + for i in (1..numbers.len()).rev() { + let j = usize::try_from(rng.next_u64() % (i as u64 + 1)).unwrap_or(0); + numbers.swap(i, j); + } + } + let mut plans: Vec<(NodeId, Vec<Edit>)> = vec![]; + for ((id, text), number) in texts.iter().zip(&numbers) { + let changes = match o.replace { + "numbers" => edits(number_spans(text), number), + "placeholder" => edits(placeholder_spans(text), number), + _ => vec![(0, text.len(), number.clone())], + }; + // The text it would have, to leave out objects that already read so. + let mut after = text.clone(); + for (a, b, n) in &changes { + after.replace_range(*a..*b, n); + } + if after != *text { + plans.push((*id, changes)); + } + } + let numbered: Vec<u64> = texts.iter().take(numbers.len()).map(|(id, _)| id.0).collect(); + let removed: Vec<NodeId> = if o.remove_unused { texts.iter().skip(numbers.len()).map(|(id, _)| *id).collect() } else { vec![] }; + if plans.is_empty() && removed.is_empty() { + return Ok(json!({ "count": 0, "ids": numbered, "removed": [] })); + } + let count = plans.len(); + let kept: Vec<NodeId> = numbered.iter().map(|n| NodeId(*n)).collect(); + s.edit("Make Numbers Sequence", |d, sel| { + for (id, changes) in &plans { + let t = text_mut(d, *id).ok_or(EngineError::NoNode(*id))?; + for (a, b, n) in changes { + t.splice_paras(*a, *b, n); + edit::replace_range(&mut t.runs, *a, *b, n); + t.ruby_after_replace(*a, *b, n.len()); + } + refresh_bounds(t); + } + d.remove_many(&removed)?; + if !removed.is_empty() { + sel.set(kept.iter().copied()); + } + Ok(()) + })?; + Ok(json!({ "count": count, "ids": numbered, "removed": removed.iter().map(|id| id.0).collect::<Vec<_>>() })) +} diff --git a/crates/engine/src/cmd/addons/typetools/numbers/tests.rs b/crates/engine/src/cmd/addons/typetools/numbers/tests.rs new file mode 100644 index 0000000000..f1db2d725f --- /dev/null +++ b/crates/engine/src/cmd/addons/typetools/numbers/tests.rs @@ -0,0 +1,206 @@ +//! Make Numbers Sequence: the numbers a sequence gives, what each replace mode changes, the +//! orders, removed objects, one undo step, and bad params refused without a change. + +use serde_json::{Value, json}; +use vectorcraft_doc::{NodeId, NodeKind}; + +use super::{COMMAND as C, Options, number_spans, placeholder_spans, sequence}; +use crate::Session; + +fn session() -> Session { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 600, "height": 400})).unwrap(); + s +} + +fn text_at(s: &mut Session, x: f64, y: f64, words: &str) -> NodeId { + NodeId(s.execute("text.create", &json!({"x": x, "y": y, "text": words, "size": 20})).unwrap()["id"].as_u64().unwrap()) +} + +fn plain(s: &Session, id: NodeId) -> String { + match &s.doc().unwrap().doc.node(id).unwrap().kind { + NodeKind::Text(t) => t.plain_text(), + _ => panic!("not text"), + } +} + +fn steps(s: &Session) -> usize { + s.doc().unwrap().history.undo.len() +} + +fn seq(p: Value, count: usize) -> Vec<String> { + sequence(&Options::parse(&p).unwrap(), count) +} + +#[test] +fn a_sequence_steps_toward_its_end_and_pads_with_zeros() { + assert_eq!(seq(json!({"start": 1, "step": 5, "end": 20}), 10), ["01", "06", "11", "16"], "stops past the end"); + assert_eq!(seq(json!({"start": 10, "step": 3, "end": 1, "leadingZeros": false}), 10), ["10", "7", "4", "1"], "the step turns to run down"); + assert_eq!(seq(json!({"start": 8, "digits": 3}), 3), ["008", "009", "010"]); + assert_eq!(seq(json!({"start": -1, "step": 1}), 3), ["-1", "0", "1"], "negative numbers get no zeros"); + assert_eq!(seq(json!({"start": 0.1, "step": 0.1, "leadingZeros": false}), 3), ["0.1", "0.2", "0.3"], "no rounding noise"); + assert_eq!(seq(json!({"start": 1, "step": 0.25, "trailingZeros": true}), 3), ["1.00", "1.25", "1.50"]); + assert_eq!(seq(json!({"start": 4, "step": 0}), 3), ["4", "4", "4"]); + assert_eq!( + seq(json!({"start": 1e9 + 0.1, "step": 0.1, "end": 1e9 + 0.3}), 5), + ["1000000000.1", "1000000000.2", "1000000000.3"], + "a value that rounds to the end counts" + ); + assert_eq!( + seq(json!({"start": 10000000000.1, "step": 0.1, "end": 10000000000.3}), 5), + ["10000000000.1", "10000000000.2", "10000000000.3"], + "large values keep the inclusive decimal end" + ); + assert_eq!(seq(json!({"start": 1e12, "step": 0.000001, "end": 1e12}), 3), ["1000000000000"], "an end equal to the start counts"); + assert_eq!( + seq(json!({"start": 999999999999.9_f64, "step": 0.000001}), 3), + ["999999999999.9", "999999999999.900001", "999999999999.900002"], + "large values keep their decimal digits when scaled for a small step" + ); + assert_eq!( + seq(json!({"start": 999999999999.9_f64, "step": 0.000001, "end": 999999999999.9_f64}), 3), + ["999999999999.9"], + "the end uses the same decimal scaling as the start" + ); + assert_eq!(seq(json!({"start": 0.1, "step": 3.3}), 4), ["00.1", "03.4", "06.7", "10"], "padded to the rounded last number"); + assert_eq!(seq(json!({"start": 1, "step": 1_000_000_000_000_u64}), 9009).last().map(String::as_str), Some("9008000000000001")); + assert_eq!(seq(json!({"start": -0.25, "step": 0.125}), 5), ["-0.25", "-0.125", "0", "0.125", "0.25"]); + assert_eq!(seq(json!({"start": -0.0000001, "step": 0}), 1), ["0"], "rounded zero has no minus sign"); + assert_eq!(seq(json!({"start": 9.9999999, "step": 0}), 1), ["10"], "width uses the rounded whole part"); + assert_eq!(seq(json!({"start": -0.0000005, "step": 0}), 1), ["-0.000001"], "decimal ties round away from zero"); +} + +#[test] +fn unthreaded_type_checks_the_threads_once() { + let mut s = session(); + let ids: Vec<NodeId> = (0..3).map(|i| text_at(&mut s, 40.0, 100.0 + 40.0 * f64::from(i), "x")).collect(); + let scans = super::threads::thread_scans(); + super::make_numbers(&mut s, &json!({"ids": ids.iter().map(|id| id.0).collect::<Vec<_>>()})).unwrap(); + assert_eq!(super::threads::thread_scans() - scans, 1, "selection size does not multiply thread scans"); + assert_eq!(ids.iter().map(|id| plain(&s, *id)).collect::<Vec<_>>(), ["1", "2", "3"]); +} + +#[test] +fn threaded_type_is_refused() { + let mut s = session(); + let a = + s.execute("text.create", &json!({"x": 10, "y": 10, "text": "1 2 3", "area": {"width": 150, "height": 60}})).unwrap()["id"].as_u64().unwrap(); + let b = s.execute("shape.rectangle", &json!({"x": 200, "y": 10, "width": 150, "height": 200})).unwrap()["id"].as_u64().unwrap(); + s.execute("select.set", &json!({"ids": [a, b]})).unwrap(); + s.execute("text.thread.create", &json!({})).unwrap(); + let n = steps(&s); + assert!(s.execute(C, &json!({"ids": [a, b]})).is_err()); + assert_eq!((plain(&s, NodeId(a)), steps(&s)), ("1 2 3".to_string(), n)); +} + +#[test] +fn the_spans_find_numbers_and_placeholders() { + assert_eq!(number_spans("No. 12, page 3.5 of 1,000."), [(4, 6), (13, 16), (20, 25)]); + assert!(number_spans("none").is_empty()); + assert_eq!(placeholder_spans("a{%N}b{%n}"), [(1, 5), (6, 10)]); +} + +#[test] +fn the_whole_text_gets_numbered_in_stacking_order_as_one_step() { + let mut s = session(); + let ids: Vec<NodeId> = (0..3).map(|i| text_at(&mut s, 40.0, 100.0 + 40.0 * f64::from(i), "x")).collect(); + let n = steps(&s); + let out = s.execute(C, &json!({"ids": [ids[2].0, ids[0].0, ids[1].0], "start": 7})).unwrap(); + assert_eq!(out["count"], json!(3)); + assert_eq!(ids.iter().map(|id| plain(&s, *id)).collect::<Vec<_>>(), ["7", "8", "9"], "from the back"); + assert_eq!(steps(&s), n + 1, "one undo step"); + s.execute("edit.undo", &json!({})).unwrap(); + assert!(ids.iter().all(|id| plain(&s, *id) == "x"), "undone"); +} + +#[test] +fn numbers_and_placeholders_are_replaced_inside_the_text() { + let mut s = session(); + let a = text_at(&mut s, 40.0, 100.0, "Seat 99, row 4"); + let b = text_at(&mut s, 40.0, 140.0, "no digits"); + let c = text_at(&mut s, 40.0, 180.0, "Seat 1"); + s.execute(C, &json!({"ids": [a.0, b.0, c.0], "replace": "numbers", "start": 5})).unwrap(); + assert_eq!([plain(&s, a), plain(&s, b), plain(&s, c)], ["Seat 5, row 5", "no digits", "Seat 6"], "text with no number is skipped"); + let d = text_at(&mut s, 40.0, 220.0, "Tag {%N} / {%n}"); + let e = text_at(&mut s, 40.0, 260.0, "Tag 3"); + s.execute(C, &json!({"ids": [d.0, e.0], "replace": "placeholder", "start": 2})).unwrap(); + assert_eq!([plain(&s, d), plain(&s, e)], ["Tag 2 / 2", "Tag 3"]); +} + +#[test] +fn ruby_follows_each_number_or_placeholder_replacement() { + let mut s = session(); + let word = "漢字"; + for (replace, words) in [("numbers", "1 2 漢字"), ("placeholder", "{%n} {%N} 漢字")] { + let id = text_at(&mut s, 40.0, 100.0, words); + let start = words.find(word).unwrap(); + s.execute("type.ruby", &json!({"ids": [id.0], "start": start, "end": start + word.len(), "text": "かんじ"})).unwrap(); + s.execute(C, &json!({"ids": [id.0], "replace": replace, "start": 123456})).unwrap(); + let NodeKind::Text(t) = &s.doc().unwrap().doc.node(id).unwrap().kind else { panic!("not text") }; + let text = t.plain_text(); + assert_eq!(text, "123456 123456 漢字"); + assert_eq!(t.ruby.len(), 1); + let ruby = &t.ruby[0]; + assert_eq!(&text[ruby.start..ruby.end], word, "ruby follows both replacements in {replace} mode"); + assert_eq!(ruby.text, "かんじ"); + } +} + +#[test] +fn rows_and_columns_order_by_position() { + let mut s = session(); + // Created bottom-right first, so stacking order differs from both positions. + let br = text_at(&mut s, 300.0, 200.0, "x"); + let tl = text_at(&mut s, 40.0, 100.0, "x"); + let bl = text_at(&mut s, 40.0, 200.0, "x"); + let tr = text_at(&mut s, 300.0, 102.0, "x"); + let ids = json!([br.0, tl.0, bl.0, tr.0]); + s.execute(C, &json!({"ids": ids, "order": "rows"})).unwrap(); + assert_eq!([tl, tr, bl, br].map(|id| plain(&s, id)), ["1", "2", "3", "4"], "a small offset stays in its row"); + s.execute(C, &json!({"ids": ids, "order": "columns"})).unwrap(); + assert_eq!([tl, bl, tr, br].map(|id| plain(&s, id)), ["1", "2", "3", "4"]); +} + +#[test] +fn an_end_leaves_the_rest_or_removes_it() { + let mut s = session(); + let ids: Vec<NodeId> = (0..4).map(|i| text_at(&mut s, 40.0, 100.0 + 40.0 * f64::from(i), "x")).collect(); + let all = json!(ids.iter().map(|id| id.0).collect::<Vec<_>>()); + s.execute(C, &json!({"ids": all, "end": 2})).unwrap(); + assert_eq!(ids.iter().map(|id| plain(&s, *id)).collect::<Vec<_>>(), ["1", "2", "x", "x"]); + let out = s.execute(C, &json!({"ids": all, "start": 5, "end": 6, "removeUnused": true})).unwrap(); + assert_eq!(out["removed"], json!([ids[2].0, ids[3].0])); + assert!(s.doc().unwrap().doc.node(ids[3]).is_none()); +} + +#[test] +fn shuffle_gives_every_number_once() { + let mut s = session(); + let ids: Vec<NodeId> = (0..6).map(|i| text_at(&mut s, 40.0, 60.0 + 40.0 * f64::from(i), "x")).collect(); + let all = json!(ids.iter().map(|id| id.0).collect::<Vec<_>>()); + s.execute(C, &json!({"ids": all, "shuffle": true, "seed": 3, "leadingZeros": false})).unwrap(); + let mut got: Vec<String> = ids.iter().map(|id| plain(&s, *id)).collect(); + assert_ne!(got, ["1", "2", "3", "4", "5", "6"], "seed 3 moves them"); + got.sort(); + assert_eq!(got, ["1", "2", "3", "4", "5", "6"]); +} + +#[test] +fn a_run_that_changes_nothing_makes_no_step_and_bad_params_fail() { + let mut s = session(); + let a = text_at(&mut s, 40.0, 100.0, "1"); + let n = steps(&s); + assert_eq!(s.execute(C, &json!({"ids": [a.0]})).unwrap()["count"], json!(0)); + assert_eq!(steps(&s), n); + for p in [ + json!({"ids": [a.0], "start": "one"}), + json!({"ids": [a.0], "step": 1e13}), + json!({"ids": [a.0], "order": "diagonal"}), + json!({"ids": [a.0], "digits": 0}), + json!({"ids": [a.0], "removeUnused": true}), + json!({"ids": [a.0], "shuffle": "yes"}), + ] { + assert!(s.execute(C, &p).is_err(), "{p} fails"); + } + assert_eq!((plain(&s, a), steps(&s)), ("1".to_string(), n)); +} diff --git a/crates/ui-egui/src/addons/dialogs.rs b/crates/ui-egui/src/addons/dialogs.rs index a1c9dcf5b8..24f3d95de5 100644 --- a/crates/ui-egui/src/addons/dialogs.rs +++ b/crates/ui-egui/src/addons/dialogs.rs @@ -107,6 +107,7 @@ pub(crate) fn open_from_menu(app: &mut VectorcraftApp, id: &str) -> Option<Resul pathtools::bridge::COMMAND => pathtools::bridge::open, pathtools::tangent_circle::COMMAND => pathtools::tangent_circle::open, typetools::COMMAND => typetools::open, + typetools::numbers::COMMAND => typetools::numbers::open, color::legend::COMMAND => color::legend::open, color::nearest::COMMAND => color::nearest::open, select::COMMAND => select::open, diff --git a/crates/ui-egui/src/addons/typetools.rs b/crates/ui-egui/src/addons/typetools.rs index 3f73b835ee..7be80f09fd 100644 --- a/crates/ui-egui/src/addons/typetools.rs +++ b/crates/ui-egui/src/addons/typetools.rs @@ -12,6 +12,8 @@ use crate::VectorcraftApp; use crate::addons::dialogs::{self, Spec}; use crate::menus::{c, cp}; +pub mod numbers; + /// The command the dialog runs. pub const COMMAND: &str = "addon.type.textTweaker"; /// An attribute: (param, label, unit, decimals, values taken, default start and end), as the @@ -40,7 +42,11 @@ pub const RELEASE_MODES: &[(&str, &str)] = &[("Text and Path", "both"), ("Path O /// Object › Plug-ins › Type Tools. pub fn menu() -> Vec<Node> { - vec![c("Text Tweaker…", COMMAND), cp("Release Type on a Path…", RELEASE, json!({"mode": "both", "keepOriginal": false}))] + vec![ + c("Text Tweaker…", COMMAND), + cp("Release Type on a Path…", RELEASE, json!({"mode": "both", "keepOriginal": false})), + c("Make Numbers Sequence…", numbers::COMMAND), + ] } /// The attribute row of param `key` (the first, Font Size, for an unknown one). diff --git a/crates/ui-egui/src/addons/typetools/numbers.rs b/crates/ui-egui/src/addons/typetools/numbers.rs new file mode 100644 index 0000000000..68351ad068 --- /dev/null +++ b/crates/ui-egui/src/addons/typetools/numbers.rs @@ -0,0 +1,97 @@ +//! Make Numbers Sequence's dialog: the start, end and step, zeros, the order the type objects are +//! numbered in and what each number replaces. It previews on the canvas and runs +//! `addon.type.numbers` on OK. + +use craft::ui::contract::Bind; +use craft::ui::patterns::form_dialogs::{DialogFields, FieldValue, Param, ParamDialog, ParamKind}; +use serde_json::{Value, json}; + +use crate::VectorcraftApp; +use crate::addons::dialogs::{self, Spec}; + +/// The command the dialog runs. +pub const COMMAND: &str = "addon.type.numbers"; +const ORDERS: [(&str, &str); 3] = [("stacking", "By Stacking Order"), ("rows", "By Rows"), ("columns", "By Columns")]; +const REPLACES: [(&str, &str); 3] = [("all", "Whole Text"), ("numbers", "Numbers in Text"), ("placeholder", "Only {%n} Placeholder")]; +/// The seeds the dialog offers. +const SEEDS: u64 = 1_000_000; +/// The largest start, end or step, as the command takes it. +const MAX_VALUE: f64 = 1e12; + +/// How the dialog's values reach the command. +pub(crate) static SPEC: Spec = Spec { command: COMMAND, params, found: None }; + +/// The command's parameters from the dialog's fields. +pub(crate) fn params(fields: &DialogFields) -> Value { + let to_last = fields.bool("toLast").unwrap_or(true); + let mut p = json!({ + "start": fields.number("start").unwrap_or(1.0), + "step": fields.number("step").unwrap_or(1.0), + "order": fields.text("order").unwrap_or("stacking"), + "replace": fields.text("replace").unwrap_or("all"), + "shuffle": fields.bool("shuffle").unwrap_or(false), + "seed": fields.int("seed").unwrap_or(0), + "leadingZeros": fields.bool("leadingZeros").unwrap_or(true), + "trailingZeros": fields.bool("trailingZeros").unwrap_or(false), + }); + if !to_last { + p["end"] = json!(fields.number("end").unwrap_or(10.0)); + p["removeUnused"] = json!(fields.bool("removeUnused").unwrap_or(false)); + } + if fields.bool("leadingZeros").unwrap_or(true) && fields.bool("fixedDigits").unwrap_or(false) { + p["digits"] = json!(fields.int("digits").unwrap_or(3)); + } + p +} + +/// The radio choice over `list`'s `(id, label)` pairs, on its first. +fn radio(list: &[(&str, &'static str)]) -> ParamKind { + ParamKind::radio(list.iter().map(|&(id, label)| (id.to_string(), tl!(label).into())).collect(), list.first().map(|(id, _)| id.to_string())) +} + +/// Opens the dialog numbering from 1 by 1 to the last type object, in stacking order, replacing the +/// whole text, with a new seed each time the document has changed. +pub(crate) fn open(app: &mut VectorcraftApp) -> Result<Value, String> { + let seed = app.session.active().map_or(0, |st| st.revision % SEEDS); + let fields = DialogFields::from_pairs([ + ("start", FieldValue::Number(1.0)), + ("step", FieldValue::Number(1.0)), + ("toLast", FieldValue::Bool(true)), + ("end", FieldValue::Number(10.0)), + ("removeUnused", FieldValue::Bool(false)), + ("shuffle", FieldValue::Bool(false)), + ("seed", FieldValue::Int(i64::try_from(seed).unwrap_or(0))), + ("leadingZeros", FieldValue::Bool(true)), + ("fixedDigits", FieldValue::Bool(false)), + ("digits", FieldValue::Int(3)), + ("trailingZeros", FieldValue::Bool(false)), + ("order", FieldValue::Text("stacking".into())), + ("replace", FieldValue::Text("all".into())), + ]); + dialogs::open(app, &SPEC, fields, |fields| { + let value = |key: &'static str, label, start| Param::number(key, label, start, 1.0, 6).bounds(Some(-MAX_VALUE), Some(MAX_VALUE)); + let last = FieldValue::Bool(false); + let rows = vec![ + Param::section(tl!("Numbers")), + value("start", tl!("Start:"), 1.0), + value("step", tl!("Step:"), 1.0), + Param::new("toLast", tl!("Number to Last Text"), ParamKind::bool(true)), + value("end", tl!("End:"), 10.0).enabled_when("toLast", last.clone()), + Param::new("removeUnused", tl!("Remove Unused Texts"), ParamKind::bool(false)).enabled_when("toLast", last), + Param::new("shuffle", tl!("Shuffle Numbers"), ParamKind::bool(false)), + Param::new("seed", tl!("Seed:"), ParamKind::int(Some(0), Some(i64::try_from(SEEDS - 1).unwrap_or(i64::MAX)), 0)) + .enabled_when("shuffle", FieldValue::Bool(true)), + Param::section(tl!("Zeros")), + Param::new("leadingZeros", tl!("Leading Zeros"), ParamKind::bool(true)), + Param::new("fixedDigits", tl!("Fixed Number of Digits"), ParamKind::bool(false)).enabled_when("leadingZeros", FieldValue::Bool(true)), + Param::new("digits", tl!("Digits:"), ParamKind::int(Some(1), Some(30), 3)).enabled_when("fixedDigits", FieldValue::Bool(true)), + Param::new("trailingZeros", tl!("Trailing Zeros"), ParamKind::bool(false)), + Param::new("order", tl!("Order:"), radio(&ORDERS)).enabled_when("shuffle", FieldValue::Bool(false)), + Param::new("replace", tl!("Replace:"), radio(&REPLACES)), + ]; + ParamDialog::new(COMMAND, tl!("Make Numbers Sequence"), rows).values(Bind::bound(fields)).previews(true) + }) +} + +#[cfg(test)] +mod tests; diff --git a/crates/ui-egui/src/addons/typetools/numbers/tests.rs b/crates/ui-egui/src/addons/typetools/numbers/tests.rs new file mode 100644 index 0000000000..79acbf8ef1 --- /dev/null +++ b/crates/ui-egui/src/addons/typetools/numbers/tests.rs @@ -0,0 +1,58 @@ +use serde_json::json; +use vectorcraft_engine::Session; + +use crate::VectorcraftApp; +use crate::addons::dialogs::tests::{confirm, dialog_id, frame, open_item, read, set}; + +/// A window's app with three type objects in a column, selected. +fn app() -> (VectorcraftApp, Vec<u64>) { + let mut app = crate::testing::windowed(VectorcraftApp::new(Session::new(), Default::default())); + app.run("file.new", json!({"width": 400, "height": 300})).unwrap(); + let ids: Vec<u64> = (0..3) + .map(|i| app.run("text.create", json!({"x": 40, "y": 60 + 40 * i, "text": "Seat 0", "size": 20})).unwrap()["id"].as_u64().unwrap()) + .collect(); + app.run("select.set", json!({"ids": ids})).unwrap(); + (app, ids) +} + +fn texts(app: &VectorcraftApp, ids: &[u64]) -> Vec<String> { + let state = app.session.active().unwrap(); + ids.iter() + .map(|id| match &state.doc.node(vectorcraft_doc::NodeId(*id)).unwrap().kind { + vectorcraft_doc::NodeKind::Text(t) => t.plain_text(), + _ => panic!("not text"), + }) + .collect() +} + +/// The dialog's fields reach the command: an end and fixed digits only when turned on, and OK +/// numbers the objects as one undo step. +#[test] +fn the_dialog_numbers_the_selection_on_ok() { + let (mut app, ids) = app(); + let undo = app.session.active().unwrap().history.undo.len(); + open_item(&mut app, "Type Tools", "Make Numbers Sequence…"); + let dialog = dialog_id(&app); + let p = read(&app, dialog, super::params); + assert!(p.get("end").is_none() && p.get("digits").is_none(), "to the last text, auto digits: {p}"); + for (key, value) in [("start", json!(5.0)), ("replace", json!("numbers")), ("fixedDigits", json!(true)), ("digits", json!(2))] { + set(&app, dialog, key, value); + } + set(&app, dialog, "toLast", json!(false)); + set(&app, dialog, "end", json!(6.0)); + frame(&mut app); + let p = read(&app, dialog, super::params); + assert_eq!( + (p["start"].clone(), p["end"].clone(), p["digits"].clone(), p["replace"].clone()), + (json!(5.0), json!(6.0), json!(2), json!("numbers")) + ); + let mut expected = self::app(); + expected.0.run(super::COMMAND, p).unwrap(); + let want = texts(&expected.0, &expected.1); + assert_eq!(want, ["Seat 05", "Seat 06", "Seat 0"]); + assert!(confirm(&app, dialog)); + frame(&mut app); + assert!(!app.any_dialog_open()); + assert_eq!(texts(&app, &ids), want); + assert_eq!(app.session.active().unwrap().history.undo.len(), undo + 1); +} diff --git a/docs/mcp.md b/docs/mcp.md index f1fa488694..db01689c0f 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -18122,7 +18122,7 @@ enabled only when a selected image has a mask. → `{changed, ids}` ## Type Tools add-on -Type Tools is a built-in add-on for type: its commands are `addon.type.textTweaker` and `addon.type.releasePath`, and +Type Tools is a built-in add-on for type: its commands are `addon.type.textTweaker`, `addon.type.releasePath` and `addon.type.numbers`, and in the desktop app it lives in Object › Plug-ins › Type Tools (#4924, #5532). Text Tweaker gives one character attribute to the characters letter by letter, from a start value to an end value along a shape, as one undo step; the text stays live and editable. Each value is set as `text.setRangeStyle` sets it (the Character panel), in its units and ranges ([formatting type](https://helpx.adobe.com/illustrator/using/formatting-type.html)), so on scaled @@ -18187,6 +18187,44 @@ Path Options' Preview does (#5360). {"name":"run_command","arguments":{"command":"addon.type.releasePath","params":{"mode":"path","keepOriginal":true}}} ``` +### Make Numbers Sequence + +`addon.type.numbers` numbers the type objects among `ids` (or `id`, else the selection), groups included, from `start` +by `step`, as one undo step. Each number replaces the object's whole text, every number in it, or every `{%n}` +placeholder in it. It is based on Sergey Osokin's MIT-licensed +[MakeNumbersSequence](https://github.com/creold/illustrator-scripts/blob/master/md/Text.md#makenumberssequence) +script. + +- With `end` omitted the numbers run to the last object. With `end`, they stop past it and the objects after the last + number keep their text, or are deleted with `removeUnused`. The sign of `step` is set to run toward `end`. +- With `replace` `numbers` or `placeholder`, objects that hold no number or placeholder are skipped and get no number. + A number is a run of digits with any `.` or `,` between digits. Replaced text takes the style of the text it + replaces. +- Values are rounded to the most decimal places among `start`, `step` and `end` (at most 6), so 0.1 by 0.1 gives + 0.1, 0.2, 0.3. +- Objects that already read so are left as they are; when nothing changes no undo step is made. +- A frame of threaded type among the objects is an error, and nothing changes. + +| Parameter | Values (default) | +|---|---| +| `start`, `step` | numbers −1e12…1e12 (1, 1; `step` 0: every object gets `start`) | +| `end` | number −1e12…1e12 (omitted: to the last object) | +| `order` | `stacking` (from the back), `rows` (top to bottom, each row left to right), `columns` (left to right, each column top to bottom) (`stacking`). Objects whose centers are within half the median height (width for columns) of a row's first object share its row | +| `replace` | `all`, `numbers`, `placeholder` (`all`) | +| `shuffle`, `seed` | false; true: the numbers go to the objects in random order, the same `seed` (0) giving the same order, and `order` is not used | +| `leadingZeros` | true: non-negative numbers are padded with zeros to the whole digits of the wider of `start` and `end` (or the last number) | +| `digits` | 1…30: with `leadingZeros`, at least this many whole digits | +| `trailingZeros` | false; true: every number gets as many decimal places as the one with the most | +| `removeUnused` | false; true needs `end` | + +→ `{count (objects changed), ids (numbered, in order), removed}`. Make Numbers Sequence… opens a dialog (`ui.menuDialog +{command}`, dialog key `addon.type.numbers`) whose fields are the command's parameters, with Preview. + +```json +{"name":"run_command","arguments":{"command":"addon.type.numbers","params":{"start":1,"order":"rows"}}} +{"name":"run_command","arguments":{"command":"addon.type.numbers","params":{"start":5,"end":50,"step":5,"replace":"placeholder","digits":3}}} +``` + ## Unit Converter add-on Unit Converter is a built-in add-on that shows one length in every unit at once (#5528): its commands are From 44c8e3451307c62f644eb1cae158d4005ba6b0ca Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 03:42:46 -0800 Subject: [PATCH 040/112] xtask: test-lint review fixes for spans, cfg_attr, shared roots and bindings - A negated .contains(...) check forbids a value and is no longer treated as a presence check; !items.is_empty() still is. - reads-source matches the last path literal of a read_to_string argument, and its span runs through the argument's closing paren. - A for pattern binding shadows an outer let inside the loop body. - Nested cfg_attr conditions are combined before the inner cfg applies. - A never-run hit counts edits to the enclosing cfg lines and to the test, not to code between them. - A parent declaration edit counts against a child's test only when the test still ran in CI at the base. - A module loaded by several roots is off only when every root leaves it out. - docs/development.md lists reads-source and never-run as failing rules. --- docs/development.md | 2 +- xtask/src/test_lint.rs | 190 +++++++++++++++++++++++++++++++++-------- 2 files changed, 154 insertions(+), 38 deletions(-) diff --git a/docs/development.md b/docs/development.md index a1ceccaf59..c833a400e8 100644 --- a/docs/development.md +++ b/docs/development.md @@ -353,7 +353,7 @@ The app decides which cursors exist; whoever draws them works from the list. For ## Test lint -`cargo xtask test-lint` (part of `cargo xtask ci`) checks tests that a wrong result can pass, in the lines and tests changed since a base. It fails on an `assert_eq!` or `assert_ne!` of an expression with itself, such as `assert_eq!(x, x)` (`self-compare`), `#[ignore]` without a reason (`ignore-without-reason`) and `thread::sleep` in test code (`sleep`). It lists the hits of the other rules without failing: a test whose only checks are that a value exists or a collection is not empty (`is_ok`, `is_some`, `!is_empty`, `len() > 0`: `only-weak`), `assert!(….all(…))` on a collection the test does not show to be non-empty (`all-unguarded`), a process test that checks only the exit status, a test with no assertion and no asserting helper, a silent early `return` on a value from the code under test, an environment variable that no CI leg sets, and test code that reads Rust source outside the audits listed in `SOURCE_AUDITS`. The base is `--base <rev>` or `TEST_LINT_BASE`; in CI it is the first parent of the checked-out commit, and elsewhere the merge base with `upstream/main` or `origin/main`. Hits on unchanged lines are counted but do not fail it. A `// test-lint: allow <rule> <reason>` comment exempts its own line and the line below it; `xtask/src/test_lint.rs` lists the rules and their ids. `cargo xtask test-lint --all` lists every hit in the workspace by crate and rule, and does not fail. +`cargo xtask test-lint` (part of `cargo xtask ci`) checks tests that a wrong result can pass, in the lines and tests changed since a base. It fails on an `assert_eq!` or `assert_ne!` of an expression with itself, such as `assert_eq!(x, x)` (`self-compare`), `#[ignore]` without a reason (`ignore-without-reason`), `thread::sleep` in test code (`sleep`), test code that reads Rust source outside the audits listed in `SOURCE_AUDITS` (`reads-source`), and a test that a `cfg` keeps out of every CI test build (`never-run`). It lists the hits of the other rules without failing: a test whose only checks are that a value exists or a collection is not empty (`is_ok`, `is_some`, `!is_empty`, `len() > 0`: `only-weak`), `assert!(….all(…))` on a collection the test does not show to be non-empty (`all-unguarded`), a process test that checks only the exit status, a test with no assertion and no asserting helper, a silent early `return` on a value from the code under test, and an environment variable that no CI leg sets. The base is `--base <rev>` or `TEST_LINT_BASE`; in CI it is the first parent of the checked-out commit, and elsewhere the merge base with `upstream/main` or `origin/main`. Hits on unchanged lines are counted but do not fail it. A `// test-lint: allow <rule> <reason>` comment exempts its own line and the line below it; `xtask/src/test_lint.rs` lists the rules and their ids. `cargo xtask test-lint --all` lists every hit in the workspace by crate and rule, and does not fail. ## Tests diff --git a/xtask/src/test_lint.rs b/xtask/src/test_lint.rs index 168dd8ff79..5384b51e4c 100644 --- a/xtask/src/test_lint.rs +++ b/xtask/src/test_lint.rs @@ -235,15 +235,14 @@ pub struct Hit { /// The first and last line of what the hit covers: the test, from its attribute to its closing /// brace, for a rule about a whole test or `all-unguarded`, through the second operand for /// `self-compare`, through the variable's name for `env-gate-unset`, through the attribute's - /// `]` for `ignore-without-reason`, else `line`. This span + /// `]` for `ignore-without-reason`, through the call's `)` for `reads-source`, else `line`. This span /// controls changed-line detection; `all-unguarded` and `self-compare` exemptions still apply /// only near `line`. pub first: usize, pub last: usize, - /// The first line an allow comment may sit on to exempt the hit, when it differs from `first`: - /// a `never-run` hit spans an enclosing module's `cfg`, but only an allow at the test's own - /// attributes exempts it. - pub allow_from: Option<usize>, + /// Lines outside `first..=last` that also count as changes to the hit: the enclosing `cfg` + /// attributes of a `never-run` test. An allow comment there does not exempt it. + pub gates: Vec<usize>, } impl Hit { @@ -311,11 +310,20 @@ pub fn run(root: &Path, args: &[&str]) -> Result<(), String> { let gates = module_gates(&gated, &|p| read_small(root, p)); let module_cfgs = gates.iter().map(|(p, g)| (p.clone(), g.preds.clone())).collect(); let ctx = Ctx { helpers: asserting_helpers(&read_all(root, &helper_files)?), ci_env, module_cfgs }; + // The gates the parent declarations gave at the base: a parent edit counts against a child's + // test only when the test ran in CI before it. + let read_base = |p: &str| git(root, &["show", &format!("{base}:{p}")]).ok().filter(|s| s.len() as u64 <= MAX_FILE); + let base_cfgs = module_gates(&gated, &read_base).into_iter().map(|(p, g)| (p, g.preds)).collect(); + let base_ctx = Ctx { helpers: ctx.helpers.clone(), ci_env: ctx.ci_env.clone(), module_cfgs: base_cfgs }; + let newly_off = + |path: &str, src: &str, hit: &Hit| !lint_file(path, src, &base_ctx).iter().any(|h| h.rule == Rule::NeverRun && h.test == hit.test); let (mut counted, mut older) = (vec![], 0usize); for (path, src) in read_all(root, &present)? { let parent_changed = gate_changed(gates.get(&path), &changed); for hit in lint_file(&path, &src, &ctx) { - if touches(&hit, changed.get(&path).and_then(Option::as_ref)) || (hit.rule == Rule::NeverRun && parent_changed) { + if touches(&hit, changed.get(&path).and_then(Option::as_ref)) + || (hit.rule == Rule::NeverRun && parent_changed && newly_off(&path, &src, &hit)) + { counted.push(hit); } else { older += 1; @@ -324,7 +332,7 @@ pub fn run(root: &Path, args: &[&str]) -> Result<(), String> { } for path in below.iter().filter(|p| gate_changed(gates.get(*p), &changed)) { let Some(src) = read_small(root, path) else { continue }; - counted.extend(lint_file(path, &src, &ctx).into_iter().filter(|h| h.rule == Rule::NeverRun)); + counted.extend(lint_file(path, &src, &ctx).into_iter().filter(|h| h.rule == Rule::NeverRun && newly_off(path, &src, h))); } finish(&counted, older, present.len(), &base) } @@ -575,7 +583,7 @@ fn hunk_range(hunk: &str) -> Option<(usize, usize)> { /// Whether `hit` covers a changed line (`None`: the whole file is new). fn touches(hit: &Hit, changed: Option<&BTreeSet<usize>>) -> bool { - changed.is_none_or(|lines| lines.range(hit.first..=hit.last).next().is_some()) + changed.is_none_or(|lines| lines.range(hit.first..=hit.last).next().is_some() || hit.gates.iter().any(|l| lines.contains(l))) } // ---- What CI sets ---- @@ -1214,7 +1222,7 @@ struct File<'a> { impl File<'_> { fn hit(&self, at: usize, rule: Rule, test: &str, note: String) -> Hit { let line = self.lines.of(at); - Hit { path: self.path.to_owned(), line, rule, test: test.to_owned(), note, first: line, last: line, allow_from: None } + Hit { path: self.path.to_owned(), line, rule, test: test.to_owned(), note, first: line, last: line, gates: vec![] } } fn test_at(&self, pos: usize) -> &str { @@ -1254,7 +1262,7 @@ pub fn lint_file(path: &str, src: &str, ctx: &Ctx) -> Vec<Hit> { hits.extend(reads_source_hits(&file)); let allows = allows(src, &file.m); hits.retain(|h| { - let first = if h.rule == Rule::AllUnguarded { h.line } else { h.allow_from.unwrap_or(h.first) }; + let first = if h.rule == Rule::AllUnguarded { h.line } else { h.first }; !allows.iter().any(|&(line, rule)| rule == h.rule && line + 1 >= first && line <= h.line) }); hits.sort(); @@ -1624,7 +1632,12 @@ fn weak_predicate(pred: &str) -> bool { if let Some(at) = boolean_split(pred) { return weak_predicate(&pred[..at]) && weak_predicate(&pred[at + 2..]); } + let negated = pred.starts_with('!'); let pred = pred.trim_start_matches('!'); + // A negated membership or presence check forbids a value; only `!….is_empty()` stays a presence check. + if negated && !pred.ends_with(".is_empty()") { + return false; + } if let Some(list) = pred.strip_suffix(".len()>0") { return !list.contains(['=', '<', '>']); } @@ -2976,18 +2989,29 @@ fn reads_source_hits(file: &File) -> Vec<Hit> { let literal = raw.unwrap_or(&arg); let rs = match word { b"ends_with" => literal == "\".rs\"", - // A path literal anywhere in the argument: `root.join("src/lib.rs")`, `concat!(…, "/x.rs")`. - b"read_to_string" => arg.contains(".rs\""), + // The last path literal in the argument names the file read: `root.join("src/lib.rs")`, + // `concat!(…, "/x.rs")`, but not `root.join("fixtures.rs").join("data.json")`. + b"read_to_string" => last_literal(&arg).is_some_and(|l| l.ends_with(".rs\"")), _ => arg.trim_end_matches('#').ends_with(".rs\""), }; if rs { - out.push(file.hit(at, Rule::ReadsSource, file.test_at(at), note.into())); + let mut hit = file.hit(at, Rule::ReadsSource, file.test_at(at), note.into()); + // The span runs through the argument, so a change to a path on a later line counts. + hit.last = file.lines.of(close); + out.push(hit); } } } out } +/// The last string literal in a (whitespace-free) expression, quotes included. +fn last_literal(arg: &str) -> Option<&str> { + let close = arg.rfind('"')?; + let open = arg[..close].rfind('"')?; + Some(&arg[open..=close]) +} + // ---- Mirrors, echoes, never-run tests and exact pixels ---- /// Names a `mirror` comparison may call on both sides: builders, conversions and accessors. @@ -3133,6 +3157,24 @@ fn inert(op: &str, local: &dyn Fn(&str) -> Option<bool>) -> Option<bool> { /// none, `Some(None)` when the reaching binding is `mut`, a pattern or has no initializer. The /// initializer comes with the offset of its `let`, where the names it reads are resolved. fn reaching_init(body: &[u8], name: &str, before: usize) -> Option<Option<(String, usize)>> { + let found = let_init(body, name, before); + // A `for` pattern binds its names inside the loop body only, to values the loop produces. + let loop_at = words(body, b"for", 0, before).into_iter().rev().find(|&at| { + let Some((open, close)) = let_body(body, at + 3) else { return false }; + let head = String::from_utf8_lossy(&body[at + 3..open]); + let Some((pattern, _)) = head.split_once(" in ") else { return false }; + let pattern = norm(pattern.as_bytes()); + open < before && before < close && !words(pattern.as_bytes(), name.as_bytes(), 0, pattern.len()).is_empty() + }); + match (loop_at, &found) { + (Some(l), Some((_, at))) if *at > l => found.map(|(init, _)| init), + (Some(_), _) => Some(None), + (None, _) => found.map(|(init, _)| init), + } +} + +/// [`reaching_init`] over `let` bindings alone, with the position of the binding that decides it. +fn let_init(body: &[u8], name: &str, before: usize) -> Option<(Option<(String, usize)>, usize)> { let mut found = None; for at in words(body, b"let", 0, before) { let start = skip_ws(body, at + 3); @@ -3148,7 +3190,7 @@ fn reaching_init(body: &[u8], name: &str, before: usize) -> Option<Option<(Strin let pattern = norm(&body[n0..open]); let pattern = pattern.split_once('=').map_or(pattern.as_str(), |(p, _)| p); if open < before && before < close && !words(pattern.as_bytes(), name.as_bytes(), 0, pattern.len()).is_empty() { - found = Some(None); + found = Some((None, at)); } } continue; @@ -3161,13 +3203,13 @@ fn reaching_init(body: &[u8], name: &str, before: usize) -> Option<Option<(Strin let plain = n1 > n0 && (rest.is_empty() || rest.starts_with(':') || rest.starts_with('=')); if plain && &body[n0..n1] == name.as_bytes() { let init = rest.split_once('=').filter(|(ty, _)| ty.is_empty() || ty.starts_with(':')).map(|(_, init)| (init.to_owned(), at)); - found = Some(if is_mut { None } else { init }); + found = Some((if is_mut { None } else { init }, at)); } else if !plain { // A pattern that binds the name (`let (a, b) = …`, `let Foo { a, .. } = …`). let pattern = norm(&body[n0..stop]); let pattern = pattern.split_once('=').map_or(pattern.as_str(), |(p, _)| p); if !words(pattern.as_bytes(), name.as_bytes(), 0, pattern.len()).is_empty() { - found = Some(None); + found = Some((None, at)); } } } @@ -3334,15 +3376,8 @@ fn cfg_attrs(m: &[u8], src: &[u8], from: usize, to: usize) -> Vec<CfgAttr> { out.push(CfgAttr { pred: text, at, end, inner }); continue; } - let cuts = top_level_at(&text, ","); - let Some(&first) = cuts.first() else { continue }; - let cond = &text[..first]; - let mut start = first + 1; - for cut in cuts[1..].iter().copied().chain([text.len()]) { - if let Some(p) = text.get(start..cut).and_then(|p| p.strip_prefix("cfg(")).and_then(|p| p.strip_suffix(')')) { - out.push(CfgAttr { pred: format!("any(not({cond}),{p})"), at, end, inner }); - } - start = cut + 1; + for pred in cfg_attr_preds(&text, None) { + out.push(CfgAttr { pred, at, end, inner }); } } } @@ -3350,6 +3385,30 @@ fn cfg_attrs(m: &[u8], src: &[u8], from: usize, to: usize) -> Vec<CfgAttr> { out } +/// The `cfg` predicates inside the arguments of a `cfg_attr(<condition>, …)`, each made +/// `any(not(<conditions>),<predicate>)`. A nested `cfg_attr` adds its condition to the enclosing +/// ones: `cfg_attr(unix, cfg_attr(test, cfg(p)))` gives `any(not(all(unix,test)),p)`. +fn cfg_attr_preds(text: &str, outer: Option<&str>) -> Vec<String> { + let cuts = top_level_at(text, ","); + let Some(&first) = cuts.first() else { return vec![] }; + let cond = match outer { + Some(o) => format!("all({o},{})", &text[..first]), + None => text[..first].to_owned(), + }; + let mut out = vec![]; + let mut start = first + 1; + for cut in cuts[1..].iter().copied().chain([text.len()]) { + let arg = text.get(start..cut).unwrap_or(""); + if let Some(p) = arg.strip_prefix("cfg(").and_then(|p| p.strip_suffix(')')) { + out.push(format!("any(not({cond}),{p})")); + } else if let Some(n) = arg.strip_prefix("cfg_attr(").and_then(|p| p.strip_suffix(')')) { + out.extend(cfg_attr_preds(n, Some(&cond))); + } + start = cut + 1; + } + out +} + /// A `cfg` predicate's source text without whitespace or comments. Masking would also blank the /// string literals `target_os = "macos"` needs, so only comments are blanked. fn pred_text(src: &[u8]) -> String { @@ -3539,11 +3598,18 @@ fn module_gates(paths: &[String], read: &dyn Fn(&str) -> Option<String>) -> Hash let mut chain: Vec<String> = vec![]; for _ in 0..4 { let want = Loaded { path: &at, name: &name, chain: &chain }; - if let Some((parent, (preds, lines))) = - candidates.into_iter().find_map(|c| read(&c).and_then(|s| declared_cfgs(&s, &c, &want)).map(|f| (c, f))) - { - gates.preds.extend(preds); - gates.sources.push((parent.clone(), lines)); + // Every file that loads the module is another way in (a library and a binary root + // can both load it): its tests are off only when every one of them leaves them out. + let found: Vec<_> = + candidates.iter().filter_map(|c| read(c).and_then(|s| declared_cfgs(&s, c, &want)).map(|f| (c.clone(), f))).collect(); + if let Some(parent) = found.first().map(|(p, _)| p.clone()) { + if let [(_, (preds, _))] = found.as_slice() { + gates.preds.extend(preds.iter().cloned()); + } else { + let each: Vec<String> = found.iter().map(|(_, (p, _))| format!("all({})", p.join(","))).collect(); + gates.preds.push(format!("any({})", each.join(","))); + } + gates.sources.extend(found.into_iter().map(|(p, (_, lines))| (p, lines))); at = parent; continue 'up; } @@ -3566,7 +3632,7 @@ fn module_gates(paths: &[String], read: &dyn Fn(&str) -> Option<String>) -> Hash fn never_run(v: &View, ctx: &Ctx) -> Option<Hit> { let local = cfgs_over(&v.file.m, v.file.src, v.t.fn_at); // A change to an attribute that turns the test off counts as a change to the test. - let first_attr = local.iter().map(|&(_, at)| at).min(); + let attr_lines: Vec<usize> = local.iter().map(|&(_, at)| v.file.lines.of(at)).collect(); let mut preds: Vec<String> = local.into_iter().map(|(p, _)| p).collect(); preds.extend(ctx.module_cfgs.get(v.file.path).into_iter().flatten().cloned()); if preds.is_empty() { @@ -3577,10 +3643,9 @@ fn never_run(v: &View, ctx: &Ctx) -> Option<Hit> { if CI_TARGETS.iter().chain(windows).all(off) { let shown: Vec<String> = preds.iter().filter(|p| p.as_str() != "test").map(|p| format!("cfg({p})")).collect(); let mut hit = v.whole(Rule::NeverRun, format!("{} leaves it out of every target CI tests on", shown.join(", "))); - if let Some(at) = first_attr { - hit.allow_from = Some(hit.first); - hit.first = hit.first.min(v.file.lines.of(at)); - } + // Enclosing attributes count as separate lines, so an edit to code between them and the + // test does not count. + hit.gates = attr_lines.into_iter().filter(|&l| l < hit.first).collect(); return Some(hit); } None @@ -5355,9 +5420,14 @@ mod tests { fn never_run_hits_cover_the_attribute_that_turns_the_test_off() { let src = "#[cfg(target_os = \"macos\")]\nmod mac {\n #[test]\n fn t() {\n assert_eq!(f(), 1);\n }\n}\n"; let found = lint_file("crates/x/src/tests.rs", src, &ctx()); - let hit = found.iter().find(|h| h.rule == Rule::NeverRun).map(|h| (h.first, h.line)); - assert_eq!(hit, Some((1, 4))); + let hit = found.iter().find(|h| h.rule == Rule::NeverRun).map(|h| (h.first, h.line, h.gates.clone())); + assert_eq!(hit, Some((3, 4, vec![1]))); assert!(touches(found.iter().find(|h| h.rule == Rule::NeverRun).unwrap(), Some(&[1].into_iter().collect())), "a change to the cfg alone"); + let helper = + "#[cfg(target_os = \"macos\")]\nmod mac {\n fn helper() {}\n #[test]\n fn t() {\n assert_eq!(f(), 1);\n }\n}\n"; + let found = lint_file("crates/x/src/tests.rs", helper, &ctx()); + let hit = found.iter().find(|h| h.rule == Rule::NeverRun).unwrap(); + assert!(!touches(hit, Some(&[3].into_iter().collect())), "a helper between the module cfg and the test"); let two = "#[cfg(target_os = \"macos\")]\nmod mac {\n // test-lint: allow never-run checks the macOS menu bar\n #[test]\n fn t() {\n assert_eq!(f(), 1);\n }\n #[test]\n fn u() {\n assert_eq!(f(), 1);\n }\n}\n"; let left: Vec<usize> = lint_file("crates/x/src/tests.rs", two, &ctx()).iter().filter(|h| h.rule == Rule::NeverRun).map(|h| h.line).collect(); assert_eq!(left, [9], "an allow above one test leaves the next one reported"); @@ -5391,5 +5461,51 @@ mod tests { assert_eq!(only("reads-source", data), []); let comment = "#[test]\nfn t() {\n let s = fs::read_to_string(/* formerly \"input.rs\" */ \"data.json\").unwrap();\n assert!(s.contains(\"x\"));\n}\n"; assert_eq!(only("reads-source", comment), [], "a Rust path only in a comment"); + let dir = "#[test]\nfn t() {\n let s = fs::read_to_string(root.join(\"fixtures.rs\").join(\"data.json\")).unwrap();\n assert!(s.contains(\"x\"));\n}\n"; + assert_eq!(only("reads-source", dir), [], "a directory named like a Rust file"); + let split = "#[test]\nfn t() {\n let s = fs::read_to_string(\n \"src/lib.rs\",\n )\n .unwrap();\n assert!(s.contains(\"x\"));\n}\n"; + let found = lint_file("crates/x/src/tests.rs", split, &ctx()); + let hit = found.iter().find(|h| h.rule == Rule::ReadsSource).unwrap(); + assert_eq!((hit.line, hit.last), (3, 5), "the span runs through the path on the next line"); + assert!(touches(hit, Some(&[4].into_iter().collect()))); + } + + #[test] + fn negated_membership_checks_are_not_presence_checks() { + assert!(!weak_predicate("!errors_for(c).contains(&Error::Unexpected)")); + assert!(!weak_predicate("!map.contains_key(&k)")); + assert!(weak_predicate("!items.is_empty()")); + assert!(weak_predicate("errors_for(c).contains(&Error::Expected)")); + } + + #[test] + fn a_for_binding_shadows_the_outer_one_in_its_body() { + let looped = "#[test]\nfn t() {\n let n = 0;\n for n in results() {\n assert_eq!(n, 1);\n }\n}\n"; + assert_eq!(only("fixture-only", looped), []); + let after = "#[test]\nfn t() {\n let n = 0;\n for n in results() {\n consume(n);\n }\n assert_eq!(n, 0);\n}\n"; + assert_eq!(only("fixture-only", after), [(2, "fixture-only")], "the outer binding after the loop"); + } + + #[test] + fn nested_cfg_attr_gates_apply() { + let nested = "#[cfg_attr(unix, cfg_attr(test, cfg(target_os = \"macos\")))]\n#[test]\nfn t() {\n assert_eq!(f(), 1);\n}\n"; + assert_eq!(only("never-run", nested), [(3, "never-run")]); + let unknown = "#[cfg_attr(unix, cfg_attr(feature = \"gpu\", cfg(target_os = \"macos\")))]\n#[test]\nfn t() {\n assert_eq!(f(), 1);\n}\n"; + assert_eq!(only("never-run", unknown), []); + } + + #[test] + fn a_module_loaded_by_two_roots_runs_if_either_runs_it() { + let files: HashMap<&str, &str> = [ + ("crates/x/src/lib.rs", "#[cfg(target_os = \"macos\")]\nmod shared;\n"), + ("crates/x/src/main.rs", "mod shared;\n"), + ("crates/x/src/shared.rs", ""), + ] + .into_iter() + .collect(); + let read = |p: &str| files.get(p).map(|s| (*s).to_owned()); + let ctx = Ctx { module_cfgs: module_cfgs(&["crates/x/src/shared.rs".to_owned()], &read), ..ctx() }; + let test = "#[test]\nfn t() {\n assert_eq!(f(), 1);\n}\n"; + assert_eq!(hits_in("crates/x/src/shared.rs", test, &ctx), []); } } From 4c8e40c19166258459aa7a53e9d91008d9c19bf1 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 04:18:47 -0800 Subject: [PATCH 041/112] Tests: ignore a trailing comment after the nightly id assignment The packaging check's `assigned` helper now drops a `#` comment that follows the value, quoted or bare, so `IDENTIFIER = "x" # bundle ID` still reads as `x`. --- crates/ui-egui/src/os_window.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/os_window.rs b/crates/ui-egui/src/os_window.rs index 72575b951f..49f7190275 100644 --- a/crates/ui-egui/src/os_window.rs +++ b/crates/ui-egui/src/os_window.rs @@ -130,14 +130,20 @@ mod tests { } /// The value of the last uncommented top-level `name = value` or `name=value` line, with one pair of - /// single or double quotes removed. + /// single or double quotes removed and a trailing `#` comment after the value ignored. fn assigned<'a>(source: &'a str, name: &str) -> Option<&'a str> { source .lines() .filter_map(|line| { let rest = line.strip_prefix(name)?.trim_start().strip_prefix('=')?.trim(); - let unquoted = ['\'', '"'].iter().find_map(|q| rest.strip_prefix(*q)?.strip_suffix(*q)); - Some(unquoted.unwrap_or(rest)) + let quoted = ['\'', '"'].iter().find_map(|q| { + let inner = rest.strip_prefix(*q)?; + let end = inner.find(*q)?; + let after = inner[end + 1..].trim(); + (after.is_empty() || after.starts_with('#')).then(|| &inner[..end]) + }); + let bare = rest.split_once(" #").map_or(rest, |(value, _)| value.trim_end()); + Some(quoted.unwrap_or(bare)) }) .next_back() } @@ -147,6 +153,9 @@ mod tests { assert_eq!(assigned("# ID='old'\nID=\"new\"\n", "ID"), Some("new")); assert_eq!(assigned("ID = 'a'\n", "ID"), Some("a")); assert_eq!(assigned("IDX='a'\n", "ID"), None); + assert_eq!(assigned("ID = 'a' # bundle ID\n", "ID"), Some("a")); + assert_eq!(assigned("ID=\"a\" # bundle ID\n", "ID"), Some("a")); + assert_eq!(assigned("ID=a # bundle ID\n", "ID"), Some("a")); } #[test] From 579fa0c247c7d0f11773d930771946d0b2ef831a Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 04:31:47 -0800 Subject: [PATCH 042/112] xtask: test-lint mirror leaves out reads at two entries and shared arithmetic - Two calls that differ only in the entry they name (a string or integer literal, a local, a field or an indexed element) relate two entries, as in at("B") == at("A") + 1 or bounds(&s, copy) == bounds(&s, id) + dv, and are no longer reported. - The same arithmetic on both sides (rotate_deg(-270.0) * v == rotate_deg(90.0) * v) checks that two inputs agree and is no longer reported. On main, test-lint --all reports 1 mirror hit instead of 14. --- xtask/src/test_lint.rs | 72 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 63 insertions(+), 9 deletions(-) diff --git a/xtask/src/test_lint.rs b/xtask/src/test_lint.rs index 5384b51e4c..baf93450e6 100644 --- a/xtask/src/test_lint.rs +++ b/xtask/src/test_lint.rs @@ -48,7 +48,9 @@ //! parse of the entry, or asserts `.all(…)` of such a predicate over a whole table; //! * `mirror`: `assert_eq!(f(a), f(b) <op> …)`, where the expected side derives its value from a //! second call of the same function (same path) with arithmetic, so a fault in `f` moves both -//! sides; builders and conversions (`new`, `from`, `to_string` …) are left out; +//! sides; builders and conversions (`new`, `from`, `to_string` …) are left out, as are the same +//! arithmetic on both sides and two reads that differ only in the entry they name (a string or +//! integer literal, a local or an indexed element); //! * `constant-echo`: every assertion of the test compares only constants, literals and enum //! variants; //! * `fixture-only`: every assertion reads only constants, literals and immutable locals of the @@ -3066,22 +3068,59 @@ fn head_call(op: &str) -> Option<&str> { } } -/// `assert_eq!(f(a), f(b))`: both sides start by calling the same function, so a fault in `f` can -/// move both sides together. Identical sides are `self-compare`'s. +/// The offset of the first top-level `+`, `-`, `*` or `/` in a whitespace-free operand. +fn first_arithmetic(op: &str) -> Option<usize> { + ["+", "-", "*", "/"].iter().flat_map(|o| top_level_at(op, o)).min() +} + +/// The whitespace-free source text of the arguments of the call an operand starts with, read from +/// the unmasked source so string literals keep their text. +fn head_args(f: &File, (from, to): (usize, usize)) -> Option<Vec<String>> { + let open = from + f.m.get(from..to)?.iter().position(|&c| c == b'(')?; + let close = matching(&f.m, open)?; + Some(split_args(&f.m, open + 1, close).into_iter().map(|(a, b)| norm(&f.src[a..b])).collect()) +} + +/// An argument that names an entry rather than a quantity: a string or integer literal, or a local, +/// field or indexed element (`"Swatches"`, `3`, `&doc`, `front[0]`). +fn key_like(arg: &str) -> bool { + let arg = arg.trim_start_matches("&mut").trim_start_matches('&'); + match arg.as_bytes().first() { + Some(b'"') => arg.len() > 1 && arg.ends_with('"'), + Some(c) if c.is_ascii_digit() => arg.bytes().all(|c| c.is_ascii_digit() || c == b'_'), + Some(_) => arg.bytes().all(|c| is_ident(c) || matches!(c, b'.' | b'[' | b']' | b':')), + None => false, + } +} + +/// `assert_eq!(f(a), f(b) <op> …)`: the expected side derives its value from a second call of the +/// same function with arithmetic, so a fault in `f` can move both sides together. Identical sides +/// are `self-compare`'s. Left out: the same arithmetic on both sides (`f(a) * v == f(b) * v` +/// checks that two inputs agree, as a periodicity check does), and two reads at different entries +/// (`at("B") == at("A") + 1`, `bounds(&s, copy) == bounds(&s, id) + dv`), which relate two entries. fn mirrors(v: &View) -> Vec<Hit> { v.asserts .iter() .filter(|a| a.name.ends_with("_eq")) .filter_map(|a| { - let (l, r) = (norm(&v.file.m[a.args.first()?.0..a.args.first()?.1]), norm(&v.file.m[a.args.get(1)?.0..a.args.get(1)?.1])); + let (lr, rr) = (*a.args.first()?, *a.args.get(1)?); + let (l, r) = (norm(&v.file.m[lr.0..lr.1]), norm(&v.file.m[rr.0..rr.1])); let (l, r) = (l.trim_start_matches('&'), r.trim_start_matches('&')); let name = head_call(l)?; - // The expected side derives its value from a second call with arithmetic; two calls - // compared as they are check that two inputs agree, which is a real check. - let derived = ["+", "-", "*", "/"].iter().any(|op| !top_level_at(r, op).is_empty()); + // Two calls compared as they are check that two inputs agree, which is a real check. + let derived = match (first_arithmetic(l), first_arithmetic(r)) { + (_, None) => false, + (Some(i), Some(j)) => l[i..] != r[j..], + (None, Some(_)) => true, + }; let last = name.rsplit("::").next().unwrap_or(name); - (l != r && derived && head_call(r) == Some(name) && !MIRROR_NEUTRAL.contains(&last)) - .then(|| v.hit(a.at, Rule::Mirror, format!("{}! calls `{name}` on both sides", a.name))) + if l == r || !derived || head_call(r) != Some(name) || MIRROR_NEUTRAL.contains(&last) { + return None; + } + let (la, ra) = (head_args(v.file, lr)?, head_args(v.file, rr)?); + let mut differing = la.iter().zip(&ra).filter(|(x, y)| x != y).peekable(); + let entries = la.len() == ra.len() && differing.peek().is_some() && differing.all(|(x, y)| key_like(x) && key_like(y)); + (!entries).then(|| v.hit(a.at, Rule::Mirror, format!("{}! calls `{name}` on both sides", a.name))) }) .collect() } @@ -5279,6 +5318,21 @@ mod tests { assert_eq!(only("mirror", ne), [], "two inputs that must differ"); let allowed = "#[test]\nfn t() {\n // test-lint: allow mirror scaling is linear by definition\n assert_eq!(scale(p, 2.0), scale(p, 1.0) * 2.0);\n}\n"; assert_eq!(only("mirror", allowed), [], "the allow removes the hit `bad` reports"); + let derived_arg = "#[test]\nfn t() {\n assert_eq!(area(grow(s, 2.0)), area(s) * 4.0);\n}\n"; + assert_eq!(only("mirror", derived_arg), [(3, "mirror")], "a computed input is a quantity, not an entry"); + } + + #[test] + fn mirrors_leave_out_reads_at_two_entries_and_shared_arithmetic() { + let order = "#[test]\nfn t() {\n assert_eq!(at(\"Graphic styles\"), at(\"Swatches\") + 1);\n assert_eq!(at(front[0]), at(a) + 1);\n}\n"; + assert_eq!(only("mirror", order), [], "positions of two entries in one list"); + let offset = + "#[test]\nfn t() {\n assert_eq!(bounds(&s, copies[0]), bounds(&s, id) + dv);\n assert_eq!(board(&s, 3), board(&s, 2) + step);\n}\n"; + assert_eq!(only("mirror", offset), [], "two objects of one document, one moved from the other"); + let period = "#[test]\nfn t() {\n assert_eq!(rotate_deg(-270.0) * v, rotate_deg(90.0) * v);\n}\n"; + assert_eq!(only("mirror", period), [], "the same arithmetic on both sides"); + let tails = "#[test]\nfn t() {\n assert_eq!(rotate_deg(-270.0) * v, rotate_deg(90.0) * w);\n}\n"; + assert_eq!(only("mirror", tails), [(3, "mirror")], "different arithmetic on each side still derives one from the other"); } #[test] From 7307781c1dfdf45176d4f756c3c6ca0bbea937fa Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 06:15:20 -0800 Subject: [PATCH 043/112] Tests: a # glued to the closing quote is no shell comment In nightly-lib.sh, MAC_NIGHTLY_ID='x'#y assigns x#y, so the helper now treats a # right after the closing quote as a comment only for the Python file. Both readings have a case in assigned_reads_the_active_line_in_either_quote_style. --- crates/ui-egui/src/os_window.rs | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/crates/ui-egui/src/os_window.rs b/crates/ui-egui/src/os_window.rs index 49f7190275..2c4abd98cd 100644 --- a/crates/ui-egui/src/os_window.rs +++ b/crates/ui-egui/src/os_window.rs @@ -124,14 +124,15 @@ mod tests { assert_eq!(NIGHTLY_APP_ID.strip_suffix("-v1"), Some(NIGHTLY_PACKAGE_ID), "the window id is the package id plus -v1"); // The packaging publishes the same package id. let plist = include_str!("../../../packaging/macos/nightly_plist.py"); - assert_eq!(assigned(plist, "IDENTIFIER"), Some(NIGHTLY_PACKAGE_ID), "nightly_plist.py"); + assert_eq!(assigned(plist, "IDENTIFIER", false), Some(NIGHTLY_PACKAGE_ID), "nightly_plist.py"); let lib = include_str!("../../../packaging/macos/nightly-lib.sh"); - assert_eq!(assigned(lib, "MAC_NIGHTLY_ID"), Some(NIGHTLY_PACKAGE_ID), "nightly-lib.sh"); + assert_eq!(assigned(lib, "MAC_NIGHTLY_ID", true), Some(NIGHTLY_PACKAGE_ID), "nightly-lib.sh"); } /// The value of the last uncommented top-level `name = value` or `name=value` line, with one pair of - /// single or double quotes removed and a trailing `#` comment after the value ignored. - fn assigned<'a>(source: &'a str, name: &str) -> Option<&'a str> { + /// single or double quotes removed and a trailing `#` comment after the value ignored. With `shell`, a `#` + /// after a closing quote starts a comment only when whitespace comes before it; Python needs no whitespace. + fn assigned<'a>(source: &'a str, name: &str, shell: bool) -> Option<&'a str> { source .lines() .filter_map(|line| { @@ -139,8 +140,9 @@ mod tests { let quoted = ['\'', '"'].iter().find_map(|q| { let inner = rest.strip_prefix(*q)?; let end = inner.find(*q)?; - let after = inner[end + 1..].trim(); - (after.is_empty() || after.starts_with('#')).then(|| &inner[..end]) + let after = &inner[end + 1..]; + let comment = (!shell || after.starts_with(char::is_whitespace)) && after.trim_start().starts_with('#'); + (after.trim().is_empty() || comment).then(|| &inner[..end]) }); let bare = rest.split_once(" #").map_or(rest, |(value, _)| value.trim_end()); Some(quoted.unwrap_or(bare)) @@ -150,12 +152,17 @@ mod tests { #[test] fn assigned_reads_the_active_line_in_either_quote_style() { - assert_eq!(assigned("# ID='old'\nID=\"new\"\n", "ID"), Some("new")); - assert_eq!(assigned("ID = 'a'\n", "ID"), Some("a")); - assert_eq!(assigned("IDX='a'\n", "ID"), None); - assert_eq!(assigned("ID = 'a' # bundle ID\n", "ID"), Some("a")); - assert_eq!(assigned("ID=\"a\" # bundle ID\n", "ID"), Some("a")); - assert_eq!(assigned("ID=a # bundle ID\n", "ID"), Some("a")); + for shell in [false, true] { + assert_eq!(assigned("# ID='old'\nID=\"new\"\n", "ID", shell), Some("new")); + assert_eq!(assigned("ID = 'a'\n", "ID", shell), Some("a")); + assert_eq!(assigned("IDX='a'\n", "ID", shell), None); + assert_eq!(assigned("ID = 'a' # bundle ID\n", "ID", shell), Some("a")); + assert_eq!(assigned("ID=\"a\" # bundle ID\n", "ID", shell), Some("a")); + assert_eq!(assigned("ID=a # bundle ID\n", "ID", shell), Some("a")); + } + // In Python a `#` right after the closing quote starts a comment; in a shell it is part of the word. + assert_eq!(assigned("ID='a'#b\n", "ID", false), Some("a")); + assert_eq!(assigned("ID='a'#b\n", "ID", true), Some("'a'#b")); } #[test] From 07acf0bf370b7e1631a8e039997ac2898d5f4069 Mon Sep 17 00:00:00 2001 From: Ruchir <113586074+ruchirguitar@users.noreply.github.com> Date: Tue, 1 Dec 2026 19:50:07 +0530 Subject: [PATCH 044/112] Keep Glyphs menus open across unrelated font changes --- crates/ui-egui/src/panels/glyphs.rs | 51 +++++++++++++---------- crates/ui-egui/src/panels/glyphs/tests.rs | 10 ++++- 2 files changed, 36 insertions(+), 25 deletions(-) diff --git a/crates/ui-egui/src/panels/glyphs.rs b/crates/ui-egui/src/panels/glyphs.rs index 4d60dd59ef..ad1bc48c1f 100644 --- a/crates/ui-egui/src/panels/glyphs.rs +++ b/crates/ui-egui/src/panels/glyphs.rs @@ -24,6 +24,7 @@ //! as Entire Font shows them. use std::collections::HashSet; +use std::hash::{DefaultHasher, Hash, Hasher}; use std::sync::Arc; use craft::font_manager::glyphs::{CATEGORIES, CellInfo, GlyphCell, GlyphCellMenu, GlyphSource, GlyphsPanel, GlyphsWords}; @@ -299,11 +300,11 @@ fn insert(app: &mut VectorcraftApp, ch: char) -> bool { /// character, all read when it is made, so it borrows nothing from the app. Every method uses the /// held face whatever family and style it is given: the face of the canvas row or of the selected /// text can be an instance of variable axes that no family and style name reaches. -pub(crate) struct VcGlyphs<'a> { - db: &'a FontDb, +pub(crate) struct VcGlyphs { family: String, style: String, face: Option<Arc<FontFace>>, + revision: u64, /// What a glyph no character maps can do to the selected character; none for a face without one /// and in Alternates for Selection. fit: Option<Fit>, @@ -313,7 +314,7 @@ pub(crate) struct VcGlyphs<'a> { empty: Option<String>, } -impl VcGlyphs<'static> { +impl VcGlyphs { /// The source of the panel: the browsed face, or the face of the selected character's alternates /// in Alternates for Selection. pub(crate) fn of(app: &mut VectorcraftApp) -> Self { @@ -321,44 +322,42 @@ impl VcGlyphs<'static> { if app.ui.glyphs_panel.category == ALTERNATES { return match alternates_listing(app) { Ok(listing) => VcGlyphs { - db: FontDb::global(), family: listing.face.family.clone(), style: listing.face.style.clone(), face: Some(listing.face.clone()), + revision: listing.revision(), fit: None, listing: Some(listing), empty: None, }, - Err(note) => VcGlyphs { db: FontDb::global(), family, style, face: None, fit: None, listing: None, empty: Some(note) }, + Err(note) => VcGlyphs { family, style, face: None, revision: 0, fit: None, listing: None, empty: Some(note) }, }; } let fit = face.as_ref().map(|f| Fit::of(app, f)); let empty = face.is_none().then(|| tl!("No fonts are available.").to_string()); - VcGlyphs { db: FontDb::global(), family, style, face, fit, listing: None, empty } + let revision = face.as_ref().map_or(0, |face| u64::from(face.id())); + VcGlyphs { family, style, face, revision, fit, listing: None, empty } } /// The source of `face` alone: it draws glyphs and describes nothing about the selection. fn bare(face: Arc<FontFace>) -> Self { VcGlyphs { - db: FontDb::global(), family: face.family.clone(), style: face.style.clone(), + revision: u64::from(face.id()), face: Some(face), fit: None, listing: None, empty: None, } } -} - -impl VcGlyphs<'_> { /// The family and style the panel shows. fn font(&self) -> (&str, &str) { (&self.family, &self.style) } } -impl GlyphSource for VcGlyphs<'_> { +impl GlyphSource for VcGlyphs { fn cells(&self, _family: &str, _style: &str, category: &str) -> Vec<GlyphCell> { let Some(face) = &self.face else { return vec![] }; if category == ALTERNATES { @@ -398,7 +397,9 @@ impl GlyphSource for VcGlyphs<'_> { } fn revision(&self) -> u64 { - self.db.generation() + // The grid uses this for both cached cells and open glyph-ID menus. Changes + // elsewhere in the font catalog leave the displayed face and its glyph IDs valid. + self.revision } fn categories(&self, _family: &str, _style: &str) -> Vec<(String, String)> { @@ -485,11 +486,7 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { if out.font_changed { app.ui.glyphs_font = Some((family, style)); } - let menu_cell = out - .menu - .as_ref() - .filter(|menu| !out.font_changed && cell_menu(ui, &source, can_insert, menu)) - .map(|menu| menu.cell); + let menu_cell = out.menu.as_ref().filter(|menu| !out.font_changed && cell_menu(ui, &source, can_insert, menu)).map(|menu| menu.cell); if let Some(cell) = menu_cell.or(out.activated) { activate(app, cell); } @@ -499,7 +496,7 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { } /// Offer the action for the clicked cell using the grid's face and text context for this pass. -fn cell_menu(ui: &mut Ui, source: &VcGlyphs<'_>, can_insert: bool, menu: &GlyphCellMenu) -> bool { +fn cell_menu(ui: &mut Ui, source: &VcGlyphs, can_insert: bool, menu: &GlyphCellMenu) -> bool { let Some(face) = &source.face else { return false }; let (label, enabled) = match menu.cell { GlyphCell::Char(c) => (tl!("Insert Glyph"), source.listing.is_none() && gid_of(face, c).is_some()), @@ -512,10 +509,7 @@ fn cell_menu(ui: &mut Ui, source: &VcGlyphs<'_>, can_insert: bool, menu: &GlyphC } _ => return false, }; - Menu::context(label, &menu.opener) - .show(ui, |ui, _| MenuItem::new(label).enabled(can_insert && enabled).show(ui).ran) - .inner - .unwrap_or(false) + Menu::context(label, &menu.opener).show(ui, |ui, _| MenuItem::new(label).enabled(can_insert && enabled).show(ui).ran).inner.unwrap_or(false) } /// A double-click or Enter on `cell`: insert the character (its letter for an Arabic presentation @@ -648,6 +642,17 @@ struct Listing { } impl Listing { + /// The visible alternates can change at another text target in the same face. + fn revision(&self) -> u64 { + let mut revision = DefaultHasher::new(); + (self.face.id(), self.id, self.bytes, self.variants.len()).hash(&mut revision); + for variant in &self.variants { + variant.gid.hash(&mut revision); + } + // Face-only revisions are u32 IDs. Keep a listing in a separate range. + revision.finish() | (1 << 63) + } + /// Draw the character with glyph `gid` of the listing, as one undo step. fn apply(&self, app: &mut VectorcraftApp, gid: u32) { if let Some(variant) = self.variants.iter().find(|v| v.gid == gid) { @@ -775,7 +780,7 @@ impl OnCanvas { } /// The source that draws the offered glyphs ([`Self::face`]). - pub fn source(&self) -> VcGlyphs<'static> { + pub fn source(&self) -> VcGlyphs { VcGlyphs::bare(self.face.clone()) } diff --git a/crates/ui-egui/src/panels/glyphs/tests.rs b/crates/ui-egui/src/panels/glyphs/tests.rs index a4f6635324..8a797f4fec 100644 --- a/crates/ui-egui/src/panels/glyphs/tests.rs +++ b/crates/ui-egui/src/panels/glyphs/tests.rs @@ -43,7 +43,7 @@ fn browsed(app: &VectorcraftApp) -> (String, String) { } /// The panel's cell source, as the panel builds it. -fn source(app: &mut VectorcraftApp) -> VcGlyphs<'static> { +fn source(app: &mut VectorcraftApp) -> VcGlyphs { VcGlyphs::of(app) } @@ -1153,7 +1153,7 @@ fn insert_glyph_is_disabled_without_a_text_target() { /// In Alternates for Selection a right-click offers Apply Alternate in one undo step. #[test] fn right_clicking_an_alternate_cell_offers_apply_alternate() { - use vectorcraft_text::test_fonts::{JOINING_ALTERNATES_FAMILY, joining_alternates_font, source_sans_gid}; + use vectorcraft_text::test_fonts::{JOINING_ALTERNATES_FAMILY, joining_alternates_font, source_sans_gid, thai_font}; FontDb::global().add_font(joining_alternates_font().expect("the test font builds")); let g = |c| u32::from(source_sans_gid(c).expect("a glyph")); let (mut app, id) = editing("\u{628}\u{62A}\u{646}"); @@ -1170,6 +1170,12 @@ fn right_clicking_an_alternate_cell_offers_apply_alternate() { panel.secondary_click(&name); assert!(panel.menu_item_enabled("Apply Alternate")); assert!(!panel.shows("Insert Glyph"), "an alternate cell offers Apply Alternate"); + // Registering a different family between the menu's opening and the click + // must leave its glyph-ID target valid. + let unrelated = thai_font("VectorCraft Glyph Menu Unrelated Fixture", true).expect("the unrelated test font builds"); + assert!(FontDb::global().add_font(unrelated) > 0); + panel.frame(); + assert!(panel.menu_item_enabled("Apply Alternate")); panel.click_menu_item("Apply Alternate"); let app = panel.app(); assert_eq!(undo_len(&app), undo + 1, "one undo step"); From 0d52591ba9e6b672e1edbed4194861ea19a75395 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 06:22:00 -0800 Subject: [PATCH 045/112] Plug-ins: list addon.type.numbers as a command plug-ins may not call every_command_is_reviewed failed because the new addon.type.numbers command was in neither reviewed list. It goes in DENIED: it edits a type object's text once per matched number or placeholder, with no limit on the matches in one call, and the plug-in runtime checks its deadline only after a host command returns. --- crates/engine/src/cmd/plugin_call/reviewed.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/cmd/plugin_call/reviewed.rs b/crates/engine/src/cmd/plugin_call/reviewed.rs index 97214fff13..dec69e96d1 100644 --- a/crates/engine/src/cmd/plugin_call/reviewed.rs +++ b/crates/engine/src/cmd/plugin_call/reviewed.rs @@ -755,12 +755,13 @@ pub(super) const ALLOWED: &[&str] = &[ /// Commands a plug-in may not call although no rule refuses them, in order: they change the /// preferences, a tool's options, a drag's state or the font names the whole app knows, list the -/// fonts installed on the system as `text.fontList` does, run plug-ins again, or read a file and -/// report where it is on disk. +/// fonts installed on the system as `text.fontList` does, run plug-ins again, read a file and +/// report where it is on disk, or edit text once per match with no limit on the matches in one call. pub(super) const DENIED: &[&str] = &[ "addon.cleanup.splitText", "addon.pathtools.movePointsTogether", "addon.pen.nextSegment", + "addon.type.numbers", "color.contrast", "effect.refreshDeferred", "graphicStyle.setOptions", From d61d946a3df86a41ff24b6fb2648c5b725e29533 Mon Sep 17 00:00:00 2001 From: ruchirguitar <113586074+ruchirguitar@users.noreply.github.com> Date: Tue, 1 Dec 2026 19:59:45 +0530 Subject: [PATCH 046/112] Color Themes: add a context menu to saved theme rows --- crates/ui-egui/src/panels/color_themes.rs | 106 ++++++++++++++++------ docs/target-app-parity.md | 1 + 2 files changed, 80 insertions(+), 27 deletions(-) diff --git a/crates/ui-egui/src/panels/color_themes.rs b/crates/ui-egui/src/panels/color_themes.rs index 3d1b32f037..7ba34fe65a 100644 --- a/crates/ui-egui/src/panels/color_themes.rs +++ b/crates/ui-egui/src/panels/color_themes.rs @@ -10,7 +10,7 @@ // framework crates' layout (racheck-fw); none of them is imported anywhere else in the app yet. use std::borrow::Cow; -use craft::behavior::{DisplayOrder, IconId, ItemSource, Selection, SelectionChange}; +use craft::behavior::{DisplayOrder, IconId, ItemSource, Selection, SelectionChange, keyed}; use craft::color_ui::ui::{ChannelRow, ColorPanelMode, HarmonyWheel}; use craft::theme::variant::Tone; use craft::theme::{ModelValues, Rgba, Srgba}; @@ -19,7 +19,7 @@ use craft::ui::choice::{SwatchSpacing, SwatchTable}; use craft::ui::contract::{Bind, CollectionEvent, Entry, Props as _, Scroll, Show as _, ShowCollection as _, ShowContainer as _}; use craft::ui::layout_components::{Row, Stack}; use craft::ui::list::{List, ListRow, ThumbSize}; -use craft::ui::menu::PanelRow; +use craft::ui::menu::{Menu, MenuItem, PanelRow}; use craft::ui::notices::Notice; use craft::ui::pickers::Select; use craft::ui::primitives::IconSpec; @@ -592,44 +592,45 @@ fn my_themes(app: &mut VectorcraftApp, ui: &mut Ui) { } else if rows.is_empty() { Notice::new(Tone::Neutral, tl!("No matches.")).show(ui); } else { - let names: Vec<String> = rows.iter().map(|(n, _)| n.clone()).collect(); - let mut selection = app - .ui - .color_themes_panel - .picked - .as_ref() - .and_then(|p| names.iter().position(|n| n == p)) - .map_or_else(Selection::default, Selection::single); - let out = List::new(tl!("My Themes")).select(craft::ui::contract::SelectMode::Single).selection(Bind::bound(&mut selection)).show_items( - ui, - &Names(&names), - &mut |key, _| { - let colors = rows.get(*key).map(|(_, c)| c.clone()).unwrap_or_default(); - let name = names.get(*key).cloned().unwrap_or_default(); - ListRow::new(name).thumb(ThumbSize::Small, move |cx, rect| { + let document = app.session.active().map(|st| st.uid); + let selection = picked(app).map_or_else(Selection::default, Selection::single); + let out = List::new(tl!("My Themes")) + .id(ui.scope_id().with(("my-themes", document))) + .select(craft::ui::contract::SelectMode::Single) + .selection(Bind::given(selection)) + .row_menu() + .show_items(ui, &keyed(&rows, |(name, _)| name.clone()), &mut |name, icx| { + let colors = rows[icx.at].1.clone(); + ListRow::new(name.clone()).thumb(ThumbSize::Small, move |cx, rect| { let w = rect.width() / colors.len().max(1) as f32; cx.data_shapes(colors.iter().enumerate().map(|(i, c)| { egui::Shape::rect_filled(Rect::from_min_size(rect.min + vec2(i as f32 * w, 0.0), vec2(w, rect.height())), 0.0, c32(c)) })); }) - }, - ); + }); for event in out.events { match event { CollectionEvent::Selection { change: SelectionChange::Set(keys), .. } => { - if let Some(name) = keys.last().and_then(|k| names.get(*k)) { - app.ui.color_themes_panel.picked = Some(name.clone()); - } + app.ui.color_themes_panel.picked = keys.last().cloned(); } + CollectionEvent::ContextMenu(request) => app.ui.color_themes_panel.picked = Some(request.key), // Enter and a double click edit the theme. - CollectionEvent::Activate(key) => { - if let Some(name) = names.get(key) { - edit_saved(app, name); - } - } + CollectionEvent::Activate(name) => edit_saved(app, &name), _ => {} } } + if let Some(request) = out.menu + && app.ui.color_themes_panel.tab == MY_THEMES + && app.ui.color_themes_panel.picked.as_ref() == Some(&request.key) + { + Menu::context(request.key, &out.response).show(ui, |ui, _| { + for (id, label) in [(EDIT, tl!("Edit Theme")), (ADD_TO_SWATCHES, tl!("Add to Swatches")), (DELETE, tl!("Delete Theme"))] { + if MenuItem::new(label).enabled(enabled(app, id)).show(ui).ran { + run(app, id, &Value::Null); + } + } + }); + } } let labels = vec![Label::from(tl!("Delete theme")), Label::from(tl!("Add to Swatches")), Label::from(tl!("Edit theme"))]; footer(app, ui, &[DELETE, ADD_TO_SWATCHES, EDIT], &["trash-2", "dc-folder", "pencil"], labels); @@ -831,6 +832,57 @@ mod tests { assert_eq!(picked(&app), None); } + #[test] + fn the_theme_menu_follows_its_row_when_the_list_is_filtered() { + use crate::tests::panel_harness::Panel; + + let mut app = three_themes(""); + app.ui.color_themes_panel.picked = Some("Forest".into()); + let mut panel = Panel::new(app, show); + panel.secondary_click("Harvest"); + assert_eq!(picked(&panel.app()).as_deref(), Some("Harvest")); + panel.app().ui.color_themes_panel.find = "vest".into(); + panel.frame(); + panel.click_menu_item("Delete Theme"); + assert_eq!(themes(&panel.app()).iter().map(|t| t.name.as_str()).collect::<Vec<_>>(), ["Harbor", "Forest"]); + } + + #[test] + fn keyboard_theme_menu_uses_the_focused_row_without_a_document() { + use crate::tests::panel_harness::Panel; + + let mut app = three_themes(""); + assert!(app.session.close_document(0)); + let mut panel = Panel::new(app, show); + panel.click("Forest"); + panel.key(egui::Key::F10, egui::Modifiers::SHIFT); + panel.frame(); + assert!(panel.menu_item_enabled("Edit Theme")); + assert!(panel.menu_item_enabled("Delete Theme")); + assert!(!panel.menu_item_enabled("Add to Swatches")); + panel.key(egui::Key::Escape, egui::Modifiers::NONE); + panel.frame(); + assert!(!panel.shows_role("Edit Theme", Role::MENU_ITEM)); + assert!(panel.focused("Forest")); + } + + #[test] + fn the_theme_menu_closes_when_its_row_disappears_or_the_document_changes() { + use crate::tests::panel_harness::Panel; + + let mut panel = Panel::new(three_themes(""), show); + panel.secondary_click("Harbor"); + assert!(panel.menu_item_enabled("Edit Theme")); + panel.app().ui.color_themes_panel.find = "Forest".into(); + panel.frame(); + assert!(!panel.shows_role("Edit Theme", Role::MENU_ITEM)); + panel.secondary_click("Forest"); + assert!(panel.menu_item_enabled("Add to Swatches")); + panel.app().run("file.new", json!({"width": 300, "height": 200})).unwrap(); + panel.frame(); + assert!(!panel.shows_role("Add to Swatches", Role::MENU_ITEM)); + } + /// The find field lists the themes whose names hold its text, in any letter case, anywhere in /// the name, in their saved order; it reads names only, and its text is plain text. #[test] diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 5f5f9644d5..1eac724072 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -2203,6 +2203,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - **Coated CMYK (FOGRA51) and Uncoated CMYK (FOGRA52):** VectorCraft's own press models, computed when first used from the characterization data Fogra publishes (<https://fogra.org/en/downloads/work-tools/characterisation-data>), which ships unmodified: the measured paper, solids and overprints, a tone curve fitted to each ink's ramp, and a smoothed Lab correction lattice fitted to all 1,617 patches. The models reproduce the patches within a mean ΔE2000 of 0.04 (largest 0.37), and patches left out of the fit within 0.15 to 0.17 (largest 1.67). A PDF/X output intent made with one embeds the profile; with the condition identifier left blank it names `FOGRA51` or `FOGRA52`, in the `http://www.color.org` registry unless the settings give a registry, and an identifier the settings give is written as given. The 300% ink limit and black generation are VectorCraft's own values. - **Swatches made from a shown color in a CMYK document:** the Color panel menu's Create New Swatch, an Alt-click on the Swatches panel's New Swatch button, the New Swatch dialog for a gradient, a Fill or Stroke proxy or the Gradient panel's thumbnail dropped on the Swatches panel (or Alt-dropped on a swatch of its kind), and the Gradient panel's Add to Swatches and Save to Swatches keep each color's model, as the Color Guide's and Color Themes' saved colors do: an RGB object's color gives an RGB swatch, and a gradient's RGB stops stay RGB. - **Color Themes Set Active Color:** a button on the Color Themes panel's Create tab makes the selected theme color the current color, the action the [help page](https://web.archive.org/web/20210601162814/https://helpx.adobe.com/pdf/illustrator_reference.pdf#page=222) describes for creating a color theme. VectorCraft's own rules: the color goes to the proxy in front (Fill or Stroke), on the selection and the default for new art, in its own color model, through `paint.setFill` or `paint.setStroke`; with characters selected with the Type tool, only those characters take it and the default for new art stays as it was, as with a swatch click; a click is one undo step, a click that changes no art adds none, and the button is off without a document. Tests: `set_active_color_*` in `crates/ui-egui/src/panels/color_themes.rs`. + - **My Themes row menu:** Opening a saved theme's row menu selects it and offers Edit Theme, Add to Swatches and Delete Theme. Add to Swatches requires an active document. - **Color Themes find field:** on the Color Themes panel's My Themes tab, Show Find Field in the panel menu shows a Find field that lists only the saved themes whose names hold its text; the [help page](https://web.archive.org/web/20210601162814/https://helpx.adobe.com/pdf/illustrator_reference.pdf#page=255) describes looking up a saved theme by its name this way (printed page 249). VectorCraft's own rules: the menu item is checked while the field shows and is off in a new session; a name matches when it holds the text anywhere, in any letter case, with spaces at either end of the text ignored; colors are not searched; the list keeps its saved order and shows No matches. when nothing matches; a picked theme the field hides stays picked, but Edit Theme, Add to Swatches and Delete Theme are off until the list shows it again; turning the field off lists every theme, and turning it on again in the same session restores its text. The field does not change the saved themes or `colorTheme.list`. Tests: `show_find_field_toggles_the_find_field_on_my_themes`, `the_find_field_lists_themes_whose_names_hold_its_text`, `no_saved_themes_is_not_no_matches`, `a_theme_the_find_field_hides_is_not_acted_on` and `footer_buttons_are_off_for_a_hidden_pick` in `crates/ui-egui/src/panels/color_themes.rs`. - **Color Themes sliders:** on the Color Themes panel's Create tab, a Color Mode menu (CMYK, RGB, Lab and HSB) shows a rail and a number field for each component of the selected theme color, beside its hex field; the [help page](https://web.archive.org/web/20210601162814/https://helpx.adobe.com/pdf/illustrator_reference.pdf#page=221) describes changing the selected color's values in these color systems or as hex while making a theme. VectorCraft's own rules: the menu starts in the selected color's own model (HSB for a gray) and keeps the mode picked while the app runs; picking a mode changes no color; the ranges and whole-number steps are the Color panel's (Lab a and b from -128 to 127), a number past the range sets its end and text that is not a number changes nothing; a CMYK edit keeps the color CMYK and a Lab edit keeps it Lab, while RGB and HSB edits make it RGB, and the theme saves and goes to Swatches in those models; an edit works as a hex edit does: with a harmony rule the edited color becomes the theme's base and is selected, and in Custom only the selected color changes. Tests: `the_create_tab_offers_cmyk_rgb_lab_and_hsb_sliders`, `a_slider_edit_changes_only_the_selected_custom_color`, `the_sliders_keep_the_numbers_they_set`, `with_a_rule_a_slider_edit_rebuilds_the_theme_from_the_edited_color` and `cmyk_and_lab_slider_edits_keep_their_models` in `crates/ui-egui/src/panels/color_themes.rs`. - **Sample Color from Screen:** an eyedropper button in the Color Picker and `ui.sampleScreenColor` (which can be given a key in Keyboard Shortcuts) pick a color anywhere on the screen with the system's sampler: `NSColorSampler` on macOS, the XDG desktop portal's [PickColor](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.Screenshot.html) on Linux, a still copy of every monitor under a crosshair on Windows, and the EyeDropper API in browsers that have it. The color becomes the fill or the stroke as one undo step, or the Color Picker's color, converted from display sRGB into the working RGB space. On Linux, a session without a portal that has PickColor, a portal that does not return from the call within 25 seconds (VectorCraft's own limit) or leaves the bus before it answers, and a portal that ends the request another way each show a status message and end the wait. On Windows, the copy is read as sRGB, so the colors of HDR and wide-gamut displays are not converted; Escape, a click of another mouse button or switching to another window cancels (VectorCraft's own rules). The BSDs and other browsers have no sampler yet; the button is gray there. From 3d2b663b9e61206d2ef31b6ad4f75f2af0719c62 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 06:27:27 -0800 Subject: [PATCH 047/112] xtask: test-lint never-run follows #[path] modules and multiline gates never-run now finds the files that load a module through `#[path]`, including a sibling such as `graphics.rs` loading `tests_graphics.rs`, and follows them in both `--all` and changed-file mode. A changed file now reaches every file it loads, directly or through other modules, so a `cfg` added to its `mod` declaration flags the unchanged child's tests. - Every route to a module counts: inline-module routes, `#[path]` routes and several routes from one file are joined, each with its own ancestors, and a crate root keeps its own route. - A default `mod x;` matches only the file it really loads. - Every line of a multiline `cfg` attribute counts as a gate line, for the test's own gates and for the parent declarations. - The base comparison reads `#[path]` declarations from the base tree, so a moved declaration is not reported as newly off. --- xtask/src/test_lint.rs | 675 +++++++++++++++++++++++++++++++++++------ 1 file changed, 579 insertions(+), 96 deletions(-) diff --git a/xtask/src/test_lint.rs b/xtask/src/test_lint.rs index baf93450e6..dc10c00fe7 100644 --- a/xtask/src/test_lint.rs +++ b/xtask/src/test_lint.rs @@ -81,7 +81,7 @@ //! changed. Hits on unchanged lines are counted but do not fail it. `--all` lists every hit in the //! workspace by crate and rule, and does not fail. -use std::cell::OnceCell; +use std::cell::{OnceCell, RefCell}; use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet}; use std::path::Path; use std::process::Command; @@ -272,20 +272,43 @@ fn gate_changed(gates: Option<&Gates>, changed: &BTreeMap<String, Option<BTreeSe .any(|(parent, lines)| changed.get(parent).is_some_and(|c| c.as_ref().is_none_or(|set| lines.iter().any(|l| set.contains(l))))) } +/// Whether a change touches the declarations that gate the module file `path` now +/// ([`gate_changed`]), or any file that declared it at the base: an edit there can remove a way for +/// its tests to run, and the base lines may no longer match. +fn route_gate_changed( + path: &str, + gates: Option<&Gates>, + base_gates: Option<&Gates>, + base_overrides: &Overrides, + changed: &BTreeMap<String, Option<BTreeSet<usize>>>, +) -> bool { + gate_changed(gates, changed) + || base_gates.is_some_and(|g| g.sources.iter().any(|(parent, _)| changed.contains_key(parent))) + || base_overrides.get(path).is_some_and(|routes| routes.iter().any(|(parent, _)| changed.contains_key(parent))) +} + /// A source file read from the work tree, or `None` when it is missing or larger than [`MAX_FILE`]. fn read_small(root: &Path, path: &str) -> Option<String> { let full = root.join(path); (std::fs::metadata(&full).ok()?.len() <= MAX_FILE).then(|| std::fs::read_to_string(full).ok()).flatten() } +/// Cache successful and missing reads for one source tree. +fn cached_read(read: impl Fn(&str) -> Option<String>) -> impl Fn(&str) -> Option<String> { + let cache = RefCell::new(HashMap::<String, Option<String>>::new()); + move |path| cache.borrow_mut().entry(path.to_owned()).or_insert_with(|| read(path)).clone() +} + pub fn run(root: &Path, args: &[&str]) -> Result<(), String> { let opts = Options::parse(args)?; + let read_work = cached_read(|p| read_small(root, p)); let repo = crate::repo_files(root)?; let ci_env = ci_env(root, &repo)?; let files: Vec<String> = repo.into_iter().filter(|p| is_scanned(p)).collect(); if opts.all { let sources = read_all(root, &files)?; - let module_cfgs = module_cfgs(&files, &|p| read_small(root, p)); + let overrides = path_overrides(sources.iter().map(|(p, s)| (p.as_str(), s.as_str()))); + let module_cfgs = module_cfgs(&files, &read_work, &overrides); let ctx = Ctx { helpers: asserting_helpers(&sources), ci_env, module_cfgs }; let hits: Vec<Hit> = sources.iter().flat_map(|(p, s)| lint_file(p, s, &ctx)).collect(); print!("{}", report(&hits, sources.len())); @@ -297,31 +320,27 @@ pub fn run(root: &Path, args: &[&str]) -> Result<(), String> { let crates: BTreeSet<String> = changed.keys().map(|p| crate_of(p)).chain([TESTKIT.to_owned()]).collect(); let helper_files: Vec<String> = files.iter().filter(|p| crates.contains(&crate_of(p))).cloned().collect(); let present: Vec<String> = changed.keys().filter(|p| root.join(p).is_file()).cloned().collect(); - // Files under the module of a changed file: a `cfg` added to their `mod` declaration can turn - // their tests off without a change to them. - let module_dirs: Vec<String> = present - .iter() - .map(|p| { - let (dir, file) = p.rsplit_once('/').unwrap_or(("", p)); - if ["mod.rs", "lib.rs", "main.rs"].contains(&file) { format!("{dir}/") } else { format!("{}/", p.trim_end_matches(".rs")) } - }) - .collect(); - let below: Vec<String> = - files.iter().filter(|p| !changed.contains_key(*p) && module_dirs.iter().any(|d| p.starts_with(d.as_str()))).cloned().collect(); + // Files that load a module through `#[path]`, found with `git grep` (untracked files included) + // instead of reading the tree. + let overrides = discover_path_overrides(root, None, &read_work); + let read_base = cached_read(|p| git(root, &["show", &format!("{base}:{p}")]).ok().filter(|s| s.len() as u64 <= MAX_FILE)); + let base_overrides = discover_path_overrides(root, Some(&base), &read_base); + // Files a changed file loads, directly or through other modules: a `cfg` added to their `mod` + // declaration can turn their tests off without a change to them. + let below: Vec<String> = descendants(&present, &files, &overrides, &base_overrides).into_iter().filter(|p| !changed.contains_key(p)).collect(); let gated: Vec<String> = present.iter().chain(&below).cloned().collect(); - let gates = module_gates(&gated, &|p| read_small(root, p)); + let gates = module_gates(&gated, &read_work, &overrides); let module_cfgs = gates.iter().map(|(p, g)| (p.clone(), g.preds.clone())).collect(); let ctx = Ctx { helpers: asserting_helpers(&read_all(root, &helper_files)?), ci_env, module_cfgs }; // The gates the parent declarations gave at the base: a parent edit counts against a child's // test only when the test ran in CI before it. - let read_base = |p: &str| git(root, &["show", &format!("{base}:{p}")]).ok().filter(|s| s.len() as u64 <= MAX_FILE); - let base_cfgs = module_gates(&gated, &read_base).into_iter().map(|(p, g)| (p, g.preds)).collect(); + let base_gates = module_gates(&gated, &read_base, &base_overrides); + let base_cfgs = base_gates.iter().map(|(p, g)| (p.clone(), g.preds.clone())).collect(); let base_ctx = Ctx { helpers: ctx.helpers.clone(), ci_env: ctx.ci_env.clone(), module_cfgs: base_cfgs }; - let newly_off = - |path: &str, src: &str, hit: &Hit| !lint_file(path, src, &base_ctx).iter().any(|h| h.rule == Rule::NeverRun && h.test == hit.test); + let newly_off = |path: &str, src: &str, hit: &Hit| !already_off(&lint_file(path, src, &base_ctx), hit); let (mut counted, mut older) = (vec![], 0usize); for (path, src) in read_all(root, &present)? { - let parent_changed = gate_changed(gates.get(&path), &changed); + let parent_changed = route_gate_changed(&path, gates.get(&path), base_gates.get(&path), &base_overrides, &changed); for hit in lint_file(&path, &src, &ctx) { if touches(&hit, changed.get(&path).and_then(Option::as_ref)) || (hit.rule == Rule::NeverRun && parent_changed && newly_off(&path, &src, &hit)) @@ -332,13 +351,50 @@ pub fn run(root: &Path, args: &[&str]) -> Result<(), String> { } } } - for path in below.iter().filter(|p| gate_changed(gates.get(*p), &changed)) { - let Some(src) = read_small(root, path) else { continue }; + for path in below.iter().filter(|p| route_gate_changed(p, gates.get(*p), base_gates.get(*p), &base_overrides, &changed)) { + let Some(src) = read_work(path) else { continue }; counted.extend(lint_file(path, &src, &ctx).into_iter().filter(|h| h.rule == Rule::NeverRun && newly_off(path, &src, h))); } finish(&counted, older, present.len(), &base) } +/// Whether `base`, the hits of the same source under the base's gates, has a `never-run` hit for the +/// test of `hit`. Tests of one name in different inline modules are told apart by their line. +fn already_off(base: &[Hit], hit: &Hit) -> bool { + base.iter().any(|h| h.rule == Rule::NeverRun && h.test == hit.test && h.line == hit.line) +} + +/// The directory holding the modules that the file `p` declares by name: its own directory for +/// `mod.rs`, `lib.rs` and `main.rs`, and the directory named after it otherwise. +fn module_dir(p: &str) -> String { + let (dir, file) = p.rsplit_once('/').unwrap_or(("", p)); + if ["mod.rs", "lib.rs", "main.rs"].contains(&file) { format!("{dir}/") } else { format!("{}/", p.trim_end_matches(".rs")) } +} + +/// The files of `files` that the files `start` load, directly or through modules in between: the +/// files under their module directories and the files their current or base `#[path]` declarations load. +fn descendants(start: &[String], files: &[String], overrides: &Overrides, base_overrides: &Overrides) -> Vec<String> { + let mut seen: BTreeSet<String> = start.iter().cloned().collect(); + let mut frontier: Vec<String> = start.to_vec(); + let mut out = vec![]; + while !frontier.is_empty() { + let dirs: Vec<String> = frontier.iter().map(|p| module_dir(p)).collect(); + let next: Vec<String> = files + .iter() + .filter(|p| !seen.contains(*p)) + .filter(|p| { + dirs.iter().any(|d| p.starts_with(d.as_str())) + || overrides.get(*p).into_iter().chain(base_overrides.get(*p)).flatten().any(|(parent, _)| frontier.contains(parent)) + }) + .cloned() + .collect(); + seen.extend(next.iter().cloned()); + out.extend(next.iter().cloned()); + frontier = next; + } + out +} + /// The command line: `--all`, `--base <rev>`. #[derive(Debug, Default, PartialEq)] struct Options { @@ -3365,6 +3421,8 @@ fn cfg_value(p: &str, t: &Target) -> Option<bool> { } } if let Some(arg) = p.strip_prefix("not(").and_then(|a| a.strip_suffix(')')) { + let arg = arg.trim(); + let arg = arg.strip_suffix(',').unwrap_or(arg).trim_end(); return cfg_value(arg, t).map(|v| !v); } // An ordinary or raw string value: `"linux"`, `r"linux"`, `r#"linux"#`. @@ -3455,8 +3513,8 @@ fn pred_text(src: &[u8]) -> String { } /// The predicates of the `cfg` attributes ([`cfg_attrs`]) whose item holds `pos`, each with the -/// offset of its attribute. `m` is the masked text of `src`. -fn cfgs_over(m: &[u8], src: &[u8], pos: usize) -> Vec<(String, usize)> { +/// offsets where its attribute starts and ends. `m` is the masked text of `src`. +fn cfgs_over(m: &[u8], src: &[u8], pos: usize) -> Vec<(String, usize, usize)> { let mut out = vec![]; for CfgAttr { pred, at, end, inner } in cfg_attrs(m, src, 0, m.len()) { let span = if inner { @@ -3472,7 +3530,7 @@ fn cfgs_over(m: &[u8], src: &[u8], pos: usize) -> Vec<(String, usize)> { } }; if span.0 <= pos && pos <= span.1 { - out.push((pred, at)); + out.push((pred, at, end)); } } out @@ -3480,10 +3538,12 @@ fn cfgs_over(m: &[u8], src: &[u8], pos: usize) -> Vec<(String, usize)> { /// The module name a file declares and the files that may declare it with `mod <name>;`, or `None` /// for a crate root (`lib.rs`, `main.rs`, `build.rs`, a file directly in `tests`, `benches` or -/// `examples`). +/// `examples` beside a crate's `src`, or a file directly in `src/bin`). A `tests` directory under +/// `src` holds modules, not test targets. fn module_parent(path: &str) -> Option<(&str, Vec<String>)> { let (dir, file) = path.rsplit_once('/')?; - let root_dir = ["/tests", "/benches", "/examples"].iter().any(|d| dir.ends_with(d)); + let outside_src = |d: &str| dir.strip_suffix(d).is_some_and(|crate_dir| !crate_dir.split('/').any(|s| s == "src")); + let root_dir = ["/tests", "/benches", "/examples"].iter().any(|d| outside_src(d)) || dir.ends_with("/src/bin"); if ["lib.rs", "main.rs", "build.rs"].contains(&file) || (root_dir && file != "mod.rs") { return None; } @@ -3511,6 +3571,10 @@ fn declared_cfgs(src: &str, parent: &str, want: &Loaded) -> Option<(Vec<String>, let lines = Lines::new(src); let (dir, file) = parent.rsplit_once('/').unwrap_or(("", parent)); let mod_rs = ["mod.rs", "lib.rs", "main.rs"].contains(&file); + let mut default_dir = if mod_rs { dir.to_owned() } else { join_path(dir, file.strip_suffix(".rs").unwrap_or(file)) }; + for seg in want.chain { + default_dir = join_path(&default_dir, seg); + } let (mut each, mut at_lines) = (vec![], vec![]); for at in words(&m, b"mod", 0, m.len()) { let start = skip_ws(&m, at + 3); @@ -3520,19 +3584,11 @@ fn declared_cfgs(src: &str, parent: &str, want: &Loaded) -> Option<(Vec<String>, } let item = m[..at].iter().rposition(|&c| matches!(c, b';' | b'{' | b'}')).map_or(0, |p| p + 1); let loads = match path_attr(&m, src.as_bytes(), item, at) { - Some(rel) => { - // A `#[path]` outside inline modules is relative to the file's directory; inside them, - // to the inline modules' directory under the file's module. - let mut base = dir.to_owned(); - if !want.chain.is_empty() && !mod_rs { - base = join_path(&base, file.strip_suffix(".rs").unwrap_or(file)); - } - for seg in want.chain { - base = join_path(&base, seg); - } - join_path(&base, &rel) == want.path + Some(rel) => override_path(dir, file, mod_rs, want.chain, &rel) == want.path, + None => { + &m[start..end] == want.name.as_bytes() + && [format!("{}.rs", want.name), format!("{}/mod.rs", want.name)].iter().any(|rel| join_path(&default_dir, rel) == want.path) } - None => &m[start..end] == want.name.as_bytes(), }; if !loads { continue; @@ -3540,11 +3596,12 @@ fn declared_cfgs(src: &str, parent: &str, want: &Loaded) -> Option<(Vec<String>, // Inner attributes cover the file, and [`cfgs_over`] reads them. let attrs: Vec<CfgAttr> = cfg_attrs(&m, src.as_bytes(), item, at).into_iter().filter(|a| !a.inner).collect(); at_lines.push(lines.of(at)); - at_lines.extend(attrs.iter().map(|a| lines.of(a.at))); + // Every line of a multiline attribute counts: an edit inside its predicate changes it. + at_lines.extend(attrs.iter().flat_map(|a| lines.of(a.at)..=lines.of(a.end))); let mut preds: Vec<String> = attrs.into_iter().map(|a| a.pred).collect(); - for (p, a) in cfgs_over(&m, src.as_bytes(), at) { + for (p, a, e) in cfgs_over(&m, src.as_bytes(), at) { preds.push(p); - at_lines.push(lines.of(a)); + at_lines.extend(lines.of(a)..=lines.of(e)); } each.push(preds); } @@ -3556,6 +3613,90 @@ fn declared_cfgs(src: &str, parent: &str, want: &Loaded) -> Option<(Vec<String>, Some((preds, at_lines)) } +/// The file a `#[path = "<rel>"]` declaration in the file `dir/file` loads. Outside inline modules +/// `rel` is relative to the file's directory; inside them (`chain`, outermost first), to the inline +/// modules' directory under the file's module. +fn override_path(dir: &str, file: &str, mod_rs: bool, chain: &[String], rel: &str) -> String { + let mut base = dir.to_owned(); + if !chain.is_empty() && !mod_rs { + base = join_path(&base, file.strip_suffix(".rs").unwrap_or(file)); + } + for seg in chain { + base = join_path(&base, seg); + } + join_path(&base, rel) +} + +/// The files that `#[path]` declarations in `src`, the file `parent`, load, each with the inline +/// modules its declaration sits in. +fn path_children(src: &str, parent: &str) -> Vec<(String, Vec<String>)> { + let m = mask(src); + let (dir, file) = parent.rsplit_once('/').unwrap_or(("", parent)); + let mod_rs = ["mod.rs", "lib.rs", "main.rs"].contains(&file); + let mut out = vec![]; + for at in words(&m, b"mod", 0, m.len()) { + let start = skip_ws(&m, at + 3); + let end = start + m[start..].iter().take_while(|&&c| is_ident(c)).count(); + if end == start || m.get(skip_ws(&m, end)) != Some(&b';') { + continue; + } + let item = m[..at].iter().rposition(|&c| matches!(c, b';' | b'{' | b'}')).map_or(0, |p| p + 1); + if let Some(rel) = path_attr(&m, src.as_bytes(), item, at) { + let chain = inline_mods(&m, at); + out.push((override_path(dir, file, mod_rs, &chain, &rel), chain)); + } + } + out +} + +/// The files that load a module file through `#[path]`, keyed by the file they load: a sibling such +/// as `graphics.rs` loading `tests_graphics.rs` is not among the files [`module_parent`] names. +type Overrides = HashMap<String, Vec<(String, Vec<String>)>>; + +/// Find the files carrying `#[path]` in the work tree or at `base`, then read that tree's sources. +fn discover_path_overrides(root: &Path, base: Option<&str>, read: &dyn Fn(&str) -> Option<String>) -> Overrides { + let with_path = match base { + Some(base) => git(root, &["grep", "-l", "-w", "path", base, "--", "*.rs"]), + None => git(root, &["grep", "--untracked", "-l", "-w", "path", "--", "*.rs"]), + } + .unwrap_or_default(); + listed_path_overrides(&with_path, base, read) +} + +/// Read paths from `git grep -l`, removing the revision prefix for a base-tree listing. +fn listed_path_overrides(list: &str, base: Option<&str>, read: &dyn Fn(&str) -> Option<String>) -> Overrides { + let prefix = base.map(|b| format!("{b}:")); + let sources: Vec<(String, String)> = list + .lines() + .filter_map(|p| match &prefix { + Some(prefix) => p.strip_prefix(prefix), + None => Some(p), + }) + .filter(|p| is_scanned(p)) + .filter_map(|p| read(p).map(|s| (p.to_owned(), s))) + .collect(); + path_overrides(sources.iter().map(|(p, s)| (p.as_str(), s.as_str()))) +} + +/// [`Overrides`] for the files `sources`, as `(path, source)` pairs. +fn path_overrides<'a>(sources: impl IntoIterator<Item = (&'a str, &'a str)>) -> Overrides { + let mut out: Overrides = HashMap::new(); + for (parent, src) in sources { + if !src.contains("path") { + continue; + } + for (child, chain) in path_children(src, parent) { + // One entry per parent and inline modules: [`declared_cfgs`] joins the declarations of + // one file in one module. + let routes = out.entry(child).or_default(); + if !routes.iter().any(|(p, c)| p == parent && *c == chain) { + routes.push((parent.to_owned(), chain)); + } + } + } + out +} + /// The string value of a `#[path = "…"]` attribute in `m[from..to]`. fn path_attr(m: &[u8], src: &[u8], from: usize, to: usize) -> Option<String> { words(m, b"path", from, to).into_iter().find_map(|at| { @@ -3604,8 +3745,8 @@ fn inline_mods(m: &[u8], at: usize) -> Vec<String> { /// For each of `paths`, the `cfg` predicates on the `mod` declarations of its module and the /// modules above it, read through `read`. -fn module_cfgs(paths: &[String], read: &dyn Fn(&str) -> Option<String>) -> HashMap<String, Vec<String>> { - module_gates(paths, read).into_iter().map(|(p, g)| (p, g.preds)).collect() +fn module_cfgs(paths: &[String], read: &dyn Fn(&str) -> Option<String>, overrides: &Overrides) -> HashMap<String, Vec<String>> { + module_gates(paths, read, overrides).into_iter().map(|(p, g)| (p, g.preds)).collect() } /// The `cfg` predicates a module file inherits ([`module_cfgs`]) and, for each file that declares @@ -3617,62 +3758,85 @@ struct Gates { } /// [`Gates`] for each of `paths` that inherits a predicate. A file is looked up in the files that -/// may declare its module and, when none does, in the files above them through inline modules -/// (`mod platform { mod child; }` loads `platform/child.rs`). -fn module_gates(paths: &[String], read: &dyn Fn(&str) -> Option<String>) -> HashMap<String, Gates> { - let mut out = HashMap::new(); - for path in paths { - let (mut gates, mut at) = (Gates::default(), path.clone()); - 'up: for _ in 0..16 { - let Some((name, mut candidates)) = module_parent(&at) else { break }; - let name = name.to_owned(); - let file = at.rsplit_once('/').map_or(at.as_str(), |(_, f)| f); - let Some(mut module_dir) = (if file == "mod.rs" { - at.rsplit_once('/').and_then(|(d, _)| d.rsplit_once('/')).map(|(p, _)| p.to_owned()) - } else { - at.rsplit_once('/').map(|(d, _)| d.to_owned()) - }) else { - break; - }; - let mut chain: Vec<String> = vec![]; - for _ in 0..4 { - let want = Loaded { path: &at, name: &name, chain: &chain }; - // Every file that loads the module is another way in (a library and a binary root - // can both load it): its tests are off only when every one of them leaves them out. - let found: Vec<_> = - candidates.iter().filter_map(|c| read(c).and_then(|s| declared_cfgs(&s, c, &want)).map(|f| (c.clone(), f))).collect(); - if let Some(parent) = found.first().map(|(p, _)| p.clone()) { - if let [(_, (preds, _))] = found.as_slice() { - gates.preds.extend(preds.iter().cloned()); - } else { - let each: Vec<String> = found.iter().map(|(_, (p, _))| format!("all({})", p.join(","))).collect(); - gates.preds.push(format!("any({})", each.join(","))); - } - gates.sources.extend(found.into_iter().map(|(p, (_, lines))| (p, lines))); - at = parent; - continue 'up; - } - let Some((up, seg)) = module_dir.rsplit_once('/').map(|(u, s)| (u.to_owned(), s.to_owned())) else { break 'up }; - let Some((_, next)) = module_parent(&format!("{module_dir}.rs")) else { break 'up }; - chain.insert(0, seg); - candidates = next; - module_dir = up; - } - break; - } - if !gates.preds.is_empty() { - out.insert(path.clone(), gates); - } +/// may declare its module and in the files above them through inline modules +/// (`mod platform { mod child; }` loads `platform/child.rs`), and in the files of `overrides` that +/// load it through `#[path]`. +fn module_gates(paths: &[String], read: &dyn Fn(&str) -> Option<String>, overrides: &Overrides) -> HashMap<String, Gates> { + let read = cached_read(read); + paths + .iter() + .filter_map(|path| { + let gates = module_gate(path, &read, overrides, 0); + (!gates.preds.is_empty()).then(|| (path.clone(), gates)) + }) + .collect() +} + +/// Resolve each route's ancestors before joining routes, with a bound for cyclic module paths. +fn module_gate(at: &str, read: &dyn Fn(&str) -> Option<String>, overrides: &Overrides, depth: usize) -> Gates { + let mut gates = Gates::default(); + if depth >= 16 { + return gates; } - out + let by_path = overrides.get(at).map_or(&[][..], Vec::as_slice); + // A crate root runs independently of any module declarations that also load it. + let Some((name, mut candidates)) = module_parent(at) else { return gates }; + let name = name.to_owned(); + let file = at.rsplit_once('/').map_or(at, |(_, f)| f); + let Some(mut module_dir) = (if file == "mod.rs" { + at.rsplit_once('/').and_then(|(d, _)| d.rsplit_once('/')).map(|(p, _)| p.to_owned()) + } else { + at.rsplit_once('/').map(|(d, _)| d.to_owned()) + }) else { + return gates; + }; + let mut chain: Vec<String> = vec![]; + let mut found = vec![]; + for _ in 0..4 { + let want = Loaded { path: at, name: &name, chain: &chain }; + // Every file that loads the module is another way in (a library and a binary root + // can both load it): its tests are off only when every one of them leaves them out. + found.extend(candidates.iter().filter_map(|c| read(c).and_then(|s| declared_cfgs(&s, c, &want)).map(|f| (c.clone(), f)))); + if chain.is_empty() { + for (c, inline) in by_path { + // A candidate was read with no inline modules; another route through the + // same file still counts. + if inline.is_empty() && candidates.contains(c) { + continue; + } + let want = Loaded { path: at, name: &name, chain: inline }; + found.extend(read(c).and_then(|s| declared_cfgs(&s, c, &want)).map(|f| (c.clone(), f))); + } + } + let Some((up, seg)) = module_dir.rsplit_once('/').map(|(u, s)| (u.to_owned(), s.to_owned())) else { break }; + let Some((_, next)) = module_parent(&format!("{module_dir}.rs")) else { break }; + chain.insert(0, seg); + candidates = next; + module_dir = up; + } + let mut each = vec![]; + for (parent, (mut preds, lines)) in found { + let ancestors = module_gate(&parent, read, overrides, depth + 1); + preds.extend(ancestors.preds); + gates.sources.push((parent, lines)); + gates.sources.extend(ancestors.sources); + each.push(preds); + } + gates.preds = match each.len() { + 0 => vec![], + 1 => each.pop().unwrap_or_default(), + _ => vec![format!("any({})", each.iter().map(|p| format!("all({})", p.join(","))).collect::<Vec<_>>().join(","))], + }; + gates } /// A test that a `cfg` compiles out on every target CI runs tests on. fn never_run(v: &View, ctx: &Ctx) -> Option<Hit> { let local = cfgs_over(&v.file.m, v.file.src, v.t.fn_at); - // A change to an attribute that turns the test off counts as a change to the test. - let attr_lines: Vec<usize> = local.iter().map(|&(_, at)| v.file.lines.of(at)).collect(); - let mut preds: Vec<String> = local.into_iter().map(|(p, _)| p).collect(); + // A change to an attribute that turns the test off counts as a change to the test, on any line + // of a multiline attribute. + let attr_lines: Vec<usize> = local.iter().flat_map(|&(_, at, end)| v.file.lines.of(at)..=v.file.lines.of(end)).collect(); + let mut preds: Vec<String> = local.into_iter().map(|(p, _, _)| p).collect(); preds.extend(ctx.module_cfgs.get(v.file.path).into_iter().flatten().cloned()); if preds.is_empty() { return None; @@ -5366,6 +5530,18 @@ mod tests { assert_eq!(only("fixture-only", if_let), [], "an `if let` binding shadows the outer one in its body"); } + #[test] + fn never_run_accepts_trailing_commas_in_cfg_predicates() { + for pred in ["not(unix,)", "not( unix , )", "all(not(unix,),)", "any(not(unix,),)"] { + let src = format!("#[cfg({pred})]\n#[test]\nfn t() {{\n assert_eq!(f(), 1);\n}}\n"); + assert_eq!(only("never-run", &src), [(3, "never-run")], "{pred}"); + } + for pred in ["all(unix,)", "any(unix,)"] { + let src = format!("#[cfg({pred})]\n#[test]\nfn t() {{\n assert_eq!(f(), 1);\n}}\n"); + assert_eq!(only("never-run", &src), [], "{pred}"); + } + } + #[test] fn never_run_tests_are_compiled_out_on_every_ci_target() { let mac = "#[cfg(target_os = \"macos\")]\n#[test]\nfn t() {\n assert_eq!(f(), 1);\n}\n"; @@ -5391,6 +5567,27 @@ mod tests { assert_eq!(only("never-run", other), [], "a cfg on another item"); } + #[test] + fn module_gates_reads_each_candidate_once() { + let paths: Vec<String> = (0..32).map(|i| format!("crates/x/src/parent/child{i}.rs")).collect(); + let parent = (0..32).map(|i| format!("mod child{i};\n")).collect::<String>(); + let files = [("crates/x/src/lib.rs", "#[cfg(target_os = \"macos\")]\nmod parent;\n"), ("crates/x/src/parent.rs", parent.as_str())]; + let reads = RefCell::new(HashMap::<String, usize>::new()); + let read = |p: &str| { + *reads.borrow_mut().entry(p.to_owned()).or_default() += 1; + files.iter().find(|(path, _)| *path == p).map(|(_, s)| (*s).to_owned()) + }; + let gates = module_gates(&paths, &read, &Overrides::new()); + assert_eq!(gates.len(), paths.len(), "every child inherits the parent gate"); + let reads = reads.borrow(); + assert_eq!(reads.get("crates/x/src/lib.rs"), Some(&1), "a shared ancestor"); + assert_eq!(reads.get("crates/x/src/parent.rs"), Some(&1), "a shared parent"); + assert_eq!(reads.get("crates/x/src/parent/mod.rs"), Some(&1), "a missing candidate"); + for (path, count) in reads.iter() { + assert_eq!(*count, 1, "candidate {path}"); + } + } + #[test] fn never_run_follows_the_cfg_of_the_mod_declaration() { let files: HashMap<&str, &str> = [ @@ -5405,7 +5602,7 @@ mod tests { .into_iter() .map(String::from) .collect(); - let cfgs = module_cfgs(&paths, &read); + let cfgs = module_cfgs(&paths, &read, &Overrides::new()); assert_eq!(cfgs.get("crates/x/src/mac.rs").map(Vec::as_slice), Some(&["target_os=\"macos\"".to_owned()][..])); assert!(cfgs.contains_key("crates/x/src/mac/inner.rs"), "inherited through mac.rs"); assert!(!cfgs.contains_key("crates/x/src/plain.rs") && !cfgs.contains_key("crates/x/tests/it.rs")); @@ -5461,13 +5658,299 @@ mod tests { let files: HashMap<&str, &str> = [("crates/x/src/lib.rs", "mod plain;\n#[cfg(target_os = \"macos\")]\nmod child;\n"), ("crates/x/src/child.rs", "")].into_iter().collect(); let read = |p: &str| files.get(p).map(|s| (*s).to_owned()); - let gates = module_gates(&["crates/x/src/child.rs".to_owned()], &read); + let gates = module_gates(&["crates/x/src/child.rs".to_owned()], &read, &Overrides::new()); let lib = |lines: &[usize]| -> BTreeMap<String, Option<BTreeSet<usize>>> { [("crates/x/src/lib.rs".to_owned(), Some(lines.iter().copied().collect()))].into_iter().collect() }; assert!(gate_changed(gates.get("crates/x/src/child.rs"), &lib(&[2])), "the cfg line"); assert!(gate_changed(gates.get("crates/x/src/child.rs"), &lib(&[3])), "the declaration line"); assert!(!gate_changed(gates.get("crates/x/src/child.rs"), &lib(&[1])), "another declaration"); + let multiline: HashMap<&str, &str> = [ + ("crates/x/src/lib.rs", "#[cfg(all(\n unix,\n target_os = \"macos\",\n))]\nmod child;\nmod plain;\n"), + ("crates/x/src/child.rs", ""), + ] + .into_iter() + .collect(); + let read = |p: &str| multiline.get(p).map(|s| (*s).to_owned()); + let gates = module_gates(&["crates/x/src/child.rs".to_owned()], &read, &Overrides::new()); + assert!(gate_changed(gates.get("crates/x/src/child.rs"), &lib(&[3])), "a line inside a multiline predicate"); + assert!(!gate_changed(gates.get("crates/x/src/child.rs"), &lib(&[6])), "another declaration"); + let enclosing: HashMap<&str, &str> = [ + ("crates/x/src/lib.rs", "#[cfg(all(\n unix,\n target_os = \"macos\",\n))]\nmod platform {\n mod child;\n}\nmod plain;\n"), + ("crates/x/src/platform/child.rs", ""), + ] + .into_iter() + .collect(); + let read = |p: &str| enclosing.get(p).map(|s| (*s).to_owned()); + let gates = module_gates(&["crates/x/src/platform/child.rs".to_owned()], &read, &Overrides::new()); + assert!(gate_changed(gates.get("crates/x/src/platform/child.rs"), &lib(&[3])), "a line inside the inline module's predicate"); + assert!(!gate_changed(gates.get("crates/x/src/platform/child.rs"), &lib(&[8])), "a declaration outside the inline module"); + } + + #[test] + fn never_run_follows_a_path_override_in_a_sibling_file() { + let files: HashMap<&str, &str> = [ + ("crates/x/src/lib.rs", "mod solids;\n"), + ("crates/x/src/solids/mod.rs", "mod graphics;\n"), + ("crates/x/src/solids/graphics.rs", "#[cfg(target_os = \"macos\")]\n#[path = \"tests_graphics.rs\"]\nmod tests;\n"), + ("crates/x/src/solids/tests_graphics.rs", ""), + ] + .into_iter() + .collect(); + let read = |p: &str| files.get(p).map(|s| (*s).to_owned()); + let overrides = path_overrides(files.iter().map(|(p, s)| (*p, *s))); + let child = "crates/x/src/solids/tests_graphics.rs".to_owned(); + let gates = module_gates(std::slice::from_ref(&child), &read, &overrides); + assert_eq!(gates.get(&child).map(|g| g.preds.clone()), Some(vec!["target_os=\"macos\"".to_owned()])); + let changed: BTreeMap<String, Option<BTreeSet<usize>>> = + [("crates/x/src/solids/graphics.rs".to_owned(), Some([1].into_iter().collect()))].into_iter().collect(); + assert!(gate_changed(gates.get(&child), &changed), "a cfg added to the sibling's declaration"); + } + + #[test] + fn never_run_keeps_crate_roots_independent_of_path_overrides() { + for child in [ + "crates/x/tests/shared.rs", + "crates/x/src/lib.rs", + "crates/x/src/main.rs", + "crates/x/src/bin/tool.rs", + "crates/x/examples/demo.rs", + "crates/x/benches/speed.rs", + "crates/x/build.rs", + ] { + let declaration = format!("#[cfg(target_os = \"macos\")]\n#[path = \"{}\"]\nmod shared;\n", child.strip_prefix("crates/x/").unwrap()); + let files = [("crates/x/other.rs", declaration.as_str())]; + let read = |p: &str| files.iter().find(|(path, _)| *path == p).map(|(_, s)| (*s).to_owned()); + let overrides = path_overrides(files); + let ctx = Ctx { module_cfgs: module_cfgs(&[child.to_owned()], &read, &overrides), ..ctx() }; + let test = "#[test]\nfn t() {\n assert_eq!(f(), 1);\n}\n"; + assert_eq!(hits_in(child, test, &ctx), [], "the crate root runs independently: {child}"); + let gated = format!("#[cfg(target_os = \"macos\")]\n{test}"); + assert_eq!(hits_in(child, &gated, &ctx), [(3, "never-run")], "the root's own cfg still applies: {child}"); + } + } + + #[test] + fn a_namesake_already_off_does_not_hide_a_newly_off_test() { + let src = "#[cfg(target_os = \"macos\")]\nmod a {\n #[test]\n fn t() {\n assert_eq!(f(), 1);\n }\n}\nmod b {\n #[test]\n fn t() {\n assert_eq!(f(), 1);\n }\n}\n"; + let path = "crates/x/src/child.rs"; + let base = lint_file(path, src, &ctx()); + let now = + lint_file(path, src, &Ctx { module_cfgs: [(path.to_owned(), vec!["target_os=\"macos\"".to_owned()])].into_iter().collect(), ..ctx() }); + let off: Vec<usize> = now.iter().filter(|h| h.rule == Rule::NeverRun && !already_off(&base, h)).map(|h| h.line).collect(); + assert_eq!(off.len(), 1, "only the test in `b` is newly off: {off:?}"); + } + + #[test] + fn never_run_follows_a_tests_module_directory_under_src() { + let files: HashMap<&str, &str> = + [("crates/x/src/lib.rs", "#[cfg(target_os = \"macos\")]\nmod tests;\n"), ("crates/x/src/tests.rs", "mod fonts;\n")].into_iter().collect(); + let read = |p: &str| files.get(p).map(|s| (*s).to_owned()); + let child = "crates/x/src/tests/fonts.rs".to_owned(); + let ctx = Ctx { module_cfgs: module_cfgs(std::slice::from_ref(&child), &read, &Overrides::new()), ..ctx() }; + let test = "#[test]\nfn t() {\n assert_eq!(f(), 1);\n}\n"; + assert_eq!(hits_in(&child, test, &ctx), [(2, "never-run")], "src/tests holds modules, not test targets"); + assert_eq!(module_parent("crates/x/tests/fonts.rs"), None, "a test target beside src"); + } + + #[test] + fn path_override_discovery_accepts_attribute_whitespace_in_both_trees() { + let unique = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap().as_nanos(); + let root = std::env::temp_dir().join(format!("test-lint-path-{}-{unique}", std::process::id())); + std::fs::create_dir_all(root.join("crates/x/src")).unwrap(); + git(&root, &["init", "--quiet"]).unwrap(); + let files = [ + ("crates/x/src/a.rs", "#[cfg(target_os = \"macos\")]\n#[ path = \"shared.rs\"]\nmod s;\n"), + ("crates/x/src/b.rs", "#[cfg(target_os = \"macos\")]\n#[\npath = \"shared.rs\"]\nmod s;\n"), + ("crates/x/src/decoy.rs", "// path is not a module attribute\nmod other;\n"), + ]; + for (path, src) in files { + std::fs::write(root.join(path), src).unwrap(); + } + git(&root, &["add", "."]).unwrap(); + let base = git(&root, &["write-tree"]).unwrap(); + for revision in [None, Some(base.as_str())] { + let read = |p: &str| match revision { + Some(base) => git(&root, &["show", &format!("{base}:{p}")]).ok(), + None => read_small(&root, p), + }; + let overrides = discover_path_overrides(&root, revision, &read); + let child = "crates/x/src/shared.rs"; + let parents: BTreeSet<&str> = overrides.get(child).into_iter().flatten().map(|(p, _)| p.as_str()).collect(); + assert_eq!(parents, [files[0].0, files[1].0].into_iter().collect(), "both whitespace forms: {revision:?}"); + let ctx = Ctx { module_cfgs: module_cfgs(&[child.to_owned()], &read, &overrides), ..ctx() }; + let test = "#[test]\nfn t() {\n assert_eq!(f(), 1);\n}\n"; + assert_eq!(hits_in(child, test, &ctx), [(2, "never-run")], "the discovered gates apply: {revision:?}"); + } + std::fs::remove_dir_all(root).unwrap(); + } + + #[test] + fn never_run_joins_inline_and_override_routes() { + for (lib, child) in [ + ("mod platform { mod child; }\nmod a;\n", "crates/x/src/platform/child.rs"), + ("mod platform { mod nested { mod child; } }\nmod a;\n", "crates/x/src/platform/nested/child.rs"), + ] { + let a = format!("#[cfg(target_os = \"macos\")]\n#[path = \"{}\"]\nmod other;\n", child.strip_prefix("crates/x/src/").unwrap_or(child)); + let files = [("crates/x/src/lib.rs", lib), ("crates/x/src/a.rs", a.as_str())]; + let read = |p: &str| files.iter().find(|(path, _)| *path == p).map(|(_, s)| (*s).to_owned()); + let overrides = path_overrides(files); + let gates = module_gates(&[child.to_owned()], &read, &overrides); + let ctx = Ctx { module_cfgs: gates.iter().map(|(p, g)| (p.clone(), g.preds.clone())).collect(), ..ctx() }; + let test = "#[test]\nfn t() {\n assert_eq!(f(), 1);\n}\n"; + assert_eq!(hits_in(child, test, &ctx), [], "the ungated inline route runs it"); + for parent in ["crates/x/src/lib.rs", "crates/x/src/a.rs"] { + let changed = [(parent.to_owned(), Some([1].into_iter().collect()))].into_iter().collect(); + assert!(gate_changed(gates.get(child), &changed), "both routes contribute their source lines: {parent}"); + } + } + } + + #[test] + fn never_run_keeps_default_and_override_files_separate() { + let files = [ + ("crates/x/src/lib.rs", "mod a;\n"), + ("crates/x/src/a.rs", "mod shared;\n#[cfg(target_os = \"macos\")]\n#[path = \"shared.rs\"]\nmod other;\n"), + ]; + let read = |p: &str| files.iter().find(|(path, _)| *path == p).map(|(_, s)| (*s).to_owned()); + let overrides = path_overrides(files); + let paths = ["crates/x/src/shared.rs".to_owned(), "crates/x/src/a/shared.rs".to_owned()]; + let gates = module_gates(&paths, &read, &overrides); + let ctx = Ctx { module_cfgs: gates.iter().map(|(p, g)| (p.clone(), g.preds.clone())).collect(), ..ctx() }; + let test = "#[test]\nfn t() {\n assert_eq!(f(), 1);\n}\n"; + assert_eq!(hits_in(&paths[0], test, &ctx), [(2, "never-run")], "only the macOS override loads this file"); + assert_eq!(hits_in(&paths[1], test, &ctx), [], "the default declaration loads the file under a/"); + let changed = [("crates/x/src/a.rs".to_owned(), Some([1].into_iter().collect()))].into_iter().collect(); + assert!(!gate_changed(gates.get(&paths[0]), &changed), "the default declaration belongs to the other file"); + } + + #[test] + fn never_run_resolves_every_routes_ancestors() { + for (a, b, child) in [ + ("#[path = \"shared.rs\"]\nmod s;\n", "#[path = \"shared.rs\"]\nmod s;\n", "crates/x/src/shared.rs"), + ("mod shared;\n", "#[path = \"a/shared.rs\"]\nmod s;\n", "crates/x/src/a/shared.rs"), + ] { + for target in ["linux", "macos"] { + let lib = format!("#[cfg(target_os = \"macos\")]\nmod a;\n#[cfg(target_os = \"{target}\")]\nmod b;\n"); + let files = [("crates/x/src/lib.rs", lib.as_str()), ("crates/x/src/a.rs", a), ("crates/x/src/b.rs", b)]; + let read = |p: &str| files.iter().find(|(path, _)| *path == p).map(|(_, s)| (*s).to_owned()); + let overrides = path_overrides(files); + let gates = module_gates(&[child.to_owned()], &read, &overrides); + let ctx = Ctx { module_cfgs: gates.iter().map(|(p, g)| (p.clone(), g.preds.clone())).collect(), ..ctx() }; + let test = "#[test]\nfn t() {\n assert_eq!(f(), 1);\n}\n"; + let expected = if target == "linux" { vec![] } else { vec![(2, "never-run")] }; + assert_eq!(hits_in(child, test, &ctx), expected, "the second route's ancestors decide whether Linux runs it"); + for (parent, line) in [ + ("crates/x/src/a.rs", if a.starts_with("#[path") { 2 } else { 1 }), + ("crates/x/src/b.rs", 2), + ("crates/x/src/lib.rs", 2), + ("crates/x/src/lib.rs", 4), + ] { + let changed = [(parent.to_owned(), Some([line].into_iter().collect()))].into_iter().collect(); + assert!(gate_changed(gates.get(child), &changed), "every route and its ancestors: {parent}:{line}"); + } + } + } + } + + #[test] + fn removed_module_routes_count_only_newly_off_tests() { + let a = "crates/x/src/a.rs"; + let child = "crates/x/src/shared.rs"; + let declaration = "#[path = \"shared.rs\"]\nmod s;\n"; + let mac = "#[cfg(target_os = \"macos\")]\n#[path = \"shared.rs\"]\nmod s;\n"; + let work_files = [("crates/x/src/lib.rs", "mod a;\nmod b;\n"), (a, ""), ("crates/x/src/b.rs", mac)]; + let read_work = |p: &str| work_files.iter().find(|(path, _)| *path == p).map(|(_, s)| (*s).to_owned()); + let overrides = path_overrides(work_files); + let paths = [child.to_owned()]; + let gates = module_gates(&paths, &read_work, &overrides); + let work_ctx = Ctx { module_cfgs: module_cfgs(&paths, &read_work, &overrides), ..ctx() }; + let test = "#[test]\nfn t() {\n assert_eq!(f(), 1);\n}\n"; + let hit = lint_file(child, test, &work_ctx).into_iter().find(|h| h.rule == Rule::NeverRun).unwrap(); + for (before, ran) in [(declaration, true), (mac, false)] { + let base_files = [("crates/x/src/lib.rs", work_files[0].1), (a, before), ("crates/x/src/b.rs", mac)]; + let read_base = |p: &str| base_files.iter().find(|(path, _)| *path == p).map(|(_, s)| (*s).to_owned()); + let base_overrides = path_overrides(base_files); + let base_gates = module_gates(&paths, &read_base, &base_overrides); + let base_ctx = Ctx { module_cfgs: module_cfgs(&paths, &read_base, &base_overrides), ..ctx() }; + let files = work_files.iter().map(|(p, _)| (*p).to_owned()).chain(paths.iter().cloned()).collect::<Vec<_>>(); + assert!( + descendants(&[a.to_owned()], &files, &overrides, &base_overrides).contains(&child.to_owned()), + "the removed route still reaches the shared tests" + ); + for lines in [Some(BTreeSet::new()), Some([20].into_iter().collect()), None] { + let changed = [(a.to_owned(), lines)].into_iter().collect(); + assert!(!gate_changed(gates.get(child), &changed), "the surviving route was not edited"); + let parent_changed = route_gate_changed(child, gates.get(child), base_gates.get(child), &base_overrides, &changed); + assert!(parent_changed, "deletions and shifted lines still change a base route"); + assert_eq!(parent_changed && !already_off(&lint_file(child, test, &base_ctx), &hit), ran); + assert!( + route_gate_changed(child, gates.get(child), None, &base_overrides, &changed), + "a base route parent counts even without inherited predicates" + ); + } + let changed = [("crates/x/src/lib.rs".to_owned(), Some([20].into_iter().collect()))].into_iter().collect(); + assert!( + route_gate_changed(child, gates.get(child), base_gates.get(child), &base_overrides, &changed), + "an edited base ancestor counts even when its old line numbers do not match" + ); + } + } + + #[test] + fn base_path_overrides_follow_declarations_before_a_move() { + let a = "crates/x/src/a.rs"; + let b = "crates/x/src/b.rs"; + let child = "crates/x/src/shared.rs"; + let lib = "#[cfg(target_os = \"macos\")]\nmod a;\n#[cfg(target_os = \"macos\")]\nmod b;\n"; + let declaration = "#[path = \"shared.rs\"]\nmod s;\n"; + let base_files = [("crates/x/src/lib.rs", lib), (a, declaration), (b, "")]; + let work_files = [("crates/x/src/lib.rs", lib), (a, ""), (b, declaration)]; + let read_base = |p: &str| base_files.iter().find(|(path, _)| *path == p).map(|(_, s)| (*s).to_owned()); + let read_work = |p: &str| work_files.iter().find(|(path, _)| *path == p).map(|(_, s)| (*s).to_owned()); + let base_overrides = listed_path_overrides(&format!("before:{a}\n"), Some("before"), &read_base); + let work_overrides = listed_path_overrides(&format!("{b}\n"), None, &read_work); + let paths = [child.to_owned()]; + let base_ctx = Ctx { module_cfgs: module_cfgs(&paths, &read_base, &base_overrides), ..ctx() }; + let work_ctx = Ctx { module_cfgs: module_cfgs(&paths, &read_work, &work_overrides), ..ctx() }; + let test = "#[test]\nfn t() {\n assert_eq!(f(), 1);\n}\n"; + assert_eq!(hits_in(child, test, &work_ctx), [(2, "never-run")]); + assert_eq!(hits_in(child, test, &base_ctx), [(2, "never-run")], "the test was already off before the equally gated declaration moved"); + } + + #[test] + fn never_run_joins_two_inline_routes_from_one_file() { + let a = "#[cfg(target_os = \"macos\")]\nmod m {\n #[path = \"../shared.rs\"]\n mod s;\n}\nmod n {\n #[path = \"../shared.rs\"]\n mod s;\n}\n"; + let files: HashMap<&str, &str> = [("crates/x/src/lib.rs", "mod a;\n"), ("crates/x/src/a.rs", a)].into_iter().collect(); + let read = |p: &str| files.get(p).map(|s| (*s).to_owned()); + let overrides = path_overrides(files.iter().map(|(p, s)| (*p, *s))); + let shared = "crates/x/src/a/shared.rs".to_owned(); + let ctx = Ctx { module_cfgs: module_cfgs(std::slice::from_ref(&shared), &read, &overrides), ..ctx() }; + let test = "#[test]\nfn t() {\n assert_eq!(f(), 1);\n}\n"; + assert_eq!(hits_in(&shared, test, &ctx), [], "the ungated route through `n` runs it"); + } + + #[test] + fn a_changed_file_reaches_the_files_its_path_loaded_modules_load() { + let files: Vec<String> = ["src/solids/graphics.rs", "src/solids/map_art.rs", "src/solids/tests_map_art.rs", "src/solids/other.rs"] + .into_iter() + .map(String::from) + .collect(); + let overrides = path_overrides([ + ("src/solids/graphics.rs", "#[path = \"map_art.rs\"]\nmod art;\n"), + ("src/solids/map_art.rs", "#[path = \"tests_map_art.rs\"]\nmod tests;\n"), + ]); + let found = descendants(&["src/solids/graphics.rs".to_owned()], &files, &overrides, &Overrides::new()); + assert_eq!(found, ["src/solids/map_art.rs", "src/solids/tests_map_art.rs"], "through map_art.rs, and not other.rs"); + } + + #[test] + fn never_run_counts_every_line_of_a_multiline_test_gate() { + let src = + "#[cfg(all(\n unix,\n target_os = \"macos\",\n))]\nmod mac {\n #[test]\n fn t() {\n assert_eq!(f(), 1);\n }\n}\n"; + let found = lint_file("crates/x/src/tests.rs", src, &ctx()); + let hit = found.iter().find(|h| h.rule == Rule::NeverRun).unwrap(); + assert!(touches(hit, Some(&[3].into_iter().collect())), "an edit inside the predicate"); } #[test] @@ -5558,7 +6041,7 @@ mod tests { .into_iter() .collect(); let read = |p: &str| files.get(p).map(|s| (*s).to_owned()); - let ctx = Ctx { module_cfgs: module_cfgs(&["crates/x/src/shared.rs".to_owned()], &read), ..ctx() }; + let ctx = Ctx { module_cfgs: module_cfgs(&["crates/x/src/shared.rs".to_owned()], &read, &Overrides::new()), ..ctx() }; let test = "#[test]\nfn t() {\n assert_eq!(f(), 1);\n}\n"; assert_eq!(hits_in("crates/x/src/shared.rs", test, &ctx), []); } From 6dd0d708e0803289656cff158cd672ae28ba7953 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 06:52:27 -0800 Subject: [PATCH 048/112] Type: Make Numbers Sequence shuffles the objects, not the numbers With an end limit, shuffling only the generated numbers always numbered the first objects in stacking order, and removeUnused always removed the rest. The eligible objects are now shuffled before the numbers are assigned, so any of them can be numbered or removed. --- .../engine/src/cmd/addons/typetools/numbers.rs | 9 +++++---- .../src/cmd/addons/typetools/numbers/tests.rs | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/crates/engine/src/cmd/addons/typetools/numbers.rs b/crates/engine/src/cmd/addons/typetools/numbers.rs index 0b6196d52d..770820f488 100644 --- a/crates/engine/src/cmd/addons/typetools/numbers.rs +++ b/crates/engine/src/cmd/addons/typetools/numbers.rs @@ -292,7 +292,7 @@ pub(crate) fn make_numbers(s: &mut Session, p: &Value) -> Result<Value> { texts = by_position(placed, o.order == "rows"); } // Only objects that hold a number or the placeholder count. - let texts: Vec<(NodeId, String)> = texts + let mut texts: Vec<(NodeId, String)> = texts .into_iter() .map(|id| (id, plain(id))) .filter(|(_, t)| match o.replace { @@ -301,14 +301,15 @@ pub(crate) fn make_numbers(s: &mut Session, p: &Value) -> Result<Value> { _ => true, }) .collect(); - let mut numbers = sequence(&o, texts.len()); + // The objects are shuffled, not the numbers, so an end limit can number any of them. if let Some(seed) = o.shuffle { let mut rng = Rng::new(seed); - for i in (1..numbers.len()).rev() { + for i in (1..texts.len()).rev() { let j = usize::try_from(rng.next_u64() % (i as u64 + 1)).unwrap_or(0); - numbers.swap(i, j); + texts.swap(i, j); } } + let numbers = sequence(&o, texts.len()); let mut plans: Vec<(NodeId, Vec<Edit>)> = vec![]; for ((id, text), number) in texts.iter().zip(&numbers) { let changes = match o.replace { diff --git a/crates/engine/src/cmd/addons/typetools/numbers/tests.rs b/crates/engine/src/cmd/addons/typetools/numbers/tests.rs index f1db2d725f..9dcc095170 100644 --- a/crates/engine/src/cmd/addons/typetools/numbers/tests.rs +++ b/crates/engine/src/cmd/addons/typetools/numbers/tests.rs @@ -185,6 +185,22 @@ fn shuffle_gives_every_number_once() { assert_eq!(got, ["1", "2", "3", "4", "5", "6"]); } +#[test] +fn shuffle_with_an_end_can_number_any_object() { + let mut numbered = [false; 6]; + for seed in 0..40 { + let mut s = session(); + let ids: Vec<NodeId> = (0..6).map(|i| text_at(&mut s, 40.0, 60.0 + 40.0 * f64::from(i), "x")).collect(); + let all = json!(ids.iter().map(|id| id.0).collect::<Vec<_>>()); + let out = s.execute(C, &json!({"ids": all, "shuffle": true, "seed": seed, "end": 2, "removeUnused": true})).unwrap(); + assert_eq!(out["removed"].as_array().unwrap().len(), 4); + for (i, id) in ids.iter().enumerate() { + numbered[i] |= s.doc().unwrap().doc.node(*id).is_some(); + } + } + assert_eq!(numbered, [true; 6], "every object is numbered for some seed"); +} + #[test] fn a_run_that_changes_nothing_makes_no_step_and_bad_params_fail() { let mut s = session(); From fca9f00cd474c43a26f1dcceb629d2a1f1190c1b Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 07:10:54 -0800 Subject: [PATCH 049/112] Tests: check the contrast answer for a Difference square in an isolating group a_blend_mode_inside_an_isolating_group_answers_over_art_of_several_colors only checked that color.contrast returned Ok. It now checks that the answer has a ratio above 1 and a background color, and that the same square in Normal mode gives a different ratio, so a contrast reading that drops the blend mode fails the test. --- crates/engine/src/tests/colorcontrast.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/tests/colorcontrast.rs b/crates/engine/src/tests/colorcontrast.rs index fecd16ed2a..152e48a837 100644 --- a/crates/engine/src/tests/colorcontrast.rs +++ b/crates/engine/src/tests/colorcontrast.rs @@ -1184,7 +1184,14 @@ fn a_blend_mode_inside_an_isolating_group_answers_over_art_of_several_colors() { s.execute("object.group", &json!({"ids": [back, square]})).unwrap(); s.execute("transparency.set", &json!({"opacity": 50, "isolate": true})).unwrap(); s.execute("select.set", &json!({"ids": [square]})).unwrap(); - s.execute("color.contrast", &json!({})).unwrap(); + let r = s.execute("color.contrast", &json!({})).unwrap(); + let isolated = ratio(&r); + assert!(isolated > 1.0, "{r}"); + assert!(r["against"].as_str().is_some_and(|h| vectorcraft_color::Color::from_hex(h).is_some()), "{r}"); + // The Difference mode is applied: in Normal mode the same square gives another answer. + s.execute("transparency.set", &json!({"blend": "normal"})).unwrap(); + let normal = ratio(&s.execute("color.contrast", &json!({})).unwrap()); + assert!((isolated - normal).abs() > 0.1, "difference {isolated} against normal {normal}"); } /// With a fill of None, what a pick would be measured against is still read: the Color Wheel's From e1c1b04f25f1979ff5be4b2b3a182534a41d1a22 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 07:27:46 -0800 Subject: [PATCH 050/112] xtask: test-lint follows deleted and detached routes and decoded cfg values - A deleted file stays in the changed set and seeds the descendant walk, so a module it loaded through #[path] is checked for a lost CI route. - A parent file that no crate target loads (its mod line removed) no longer counts as an ungated route to the module it declares. - #[path] on an inline module sets the directory of the modules inside it. - git grep lists #[path] parents with -z, so non-ASCII paths are read verbatim in both trees. - cfg string values are compared decoded ("\x6cinux" is linux); raw strings stay as written. - mirror reports arithmetic on either side of the equality, and ignores comments beside lookup keys. - reads-source does not take a format! argument as the file name. - The base never-run hits are computed once per file. --- xtask/src/test_lint.rs | 253 +++++++++++++++++++++++++++++++++++------ 1 file changed, 217 insertions(+), 36 deletions(-) diff --git a/xtask/src/test_lint.rs b/xtask/src/test_lint.rs index f70326e737..0c7d793c0f 100644 --- a/xtask/src/test_lint.rs +++ b/xtask/src/test_lint.rs @@ -327,7 +327,9 @@ pub fn run(root: &Path, args: &[&str]) -> Result<(), String> { let base_overrides = discover_path_overrides(root, Some(&base), &read_base); // Files a changed file loads, directly or through other modules: a `cfg` added to their `mod` // declaration can turn their tests off without a change to them. - let below: Vec<String> = descendants(&present, &files, &overrides, &base_overrides).into_iter().filter(|p| !changed.contains_key(p)).collect(); + // Deleted files seed the walk too: a module they loaded at the base may have lost its only CI route. + let seeds: Vec<String> = changed.keys().cloned().collect(); + let below: Vec<String> = descendants(&seeds, &files, &overrides, &base_overrides).into_iter().filter(|p| !changed.contains_key(p)).collect(); let gated: Vec<String> = present.iter().chain(&below).cloned().collect(); let gates = module_gates(&gated, &read_work, &overrides); let module_cfgs = gates.iter().map(|(p, g)| (p.clone(), g.preds.clone())).collect(); @@ -337,7 +339,15 @@ pub fn run(root: &Path, args: &[&str]) -> Result<(), String> { let base_gates = module_gates(&gated, &read_base, &base_overrides); let base_cfgs = base_gates.iter().map(|(p, g)| (p.clone(), g.preds.clone())).collect(); let base_ctx = Ctx { helpers: ctx.helpers.clone(), ci_env: ctx.ci_env.clone(), module_cfgs: base_cfgs }; - let newly_off = |path: &str, src: &str, hit: &Hit| !already_off(&lint_file(path, src, &base_ctx), hit); + // The base's `never-run` hits, computed once per file on its first parent-attributed hit. + let base_off: RefCell<HashMap<String, HashSet<(String, usize)>>> = RefCell::new(HashMap::new()); + let newly_off = |path: &str, src: &str, hit: &Hit| { + let mut cache = base_off.borrow_mut(); + let off = cache.entry(path.to_owned()).or_insert_with(|| { + lint_file(path, src, &base_ctx).into_iter().filter(|h| h.rule == Rule::NeverRun).map(|h| (h.test, h.line)).collect() + }); + !off.contains(&(hit.test.clone(), hit.line)) + }; let (mut counted, mut older) = (vec![], 0usize); for (path, src) in read_all(root, &present)? { let parent_changed = route_gate_changed(&path, gates.get(&path), base_gates.get(&path), &base_overrides, &changed); @@ -360,6 +370,7 @@ pub fn run(root: &Path, args: &[&str]) -> Result<(), String> { /// Whether `base`, the hits of the same source under the base's gates, has a `never-run` hit for the /// test of `hit`. Tests of one name in different inline modules are told apart by their line. +#[cfg(test)] fn already_off(base: &[Hit], hit: &Hit) -> bool { base.iter().any(|h| h.rule == Rule::NeverRun && h.test == hit.test && h.line == hit.line) } @@ -570,15 +581,21 @@ fn parse_diff(diff: &str) -> BTreeMap<String, Option<BTreeSet<usize>>> { let mut current: Option<String> = None; // Inside a file's header (from `diff --git` to its first hunk), where `+++ ` names the file. let (mut header, mut new_file) = (false, false); + let mut old: Option<String> = None; for line in diff.lines() { if line.starts_with("diff --git ") { - (header, new_file) = (true, false); + (header, new_file, old) = (true, false, None); } else if header && line.starts_with("new file mode") { new_file = true; + } else if let Some(path) = line.strip_prefix("--- ").filter(|_| header) { + old = patch_path(path).and_then(|p| p.strip_prefix("a/").map(str::to_owned)); } else if let Some(path) = line.strip_prefix("+++ ").filter(|_| header) { current = patch_path(path).and_then(|p| p.strip_prefix("b/").map(str::to_owned)); if let Some(p) = ¤t { out.insert(p.clone(), if new_file { None } else { Some(BTreeSet::new()) }); + } else if let Some(p) = old.take().filter(|_| path == "/dev/null") { + // A deleted file is kept, wholly changed: it may have been a route that loaded a module. + out.insert(p, None); } } else if let (Some(hunk), Some(path)) = (line.strip_prefix("@@ "), ¤t) { header = false; @@ -3082,10 +3099,30 @@ fn reads_source_hits(file: &File) -> Vec<Hit> { out } -/// The last string literal in a (whitespace-free) expression, quotes included. +/// The last string literal in a (whitespace-free) expression, quotes included. Inside a +/// `format!`-family call, an argument is not the file name, so the format string is returned +/// instead: `format!("fixtures/{}.txt", "lib.rs")` names a `.txt` file. fn last_literal(arg: &str) -> Option<&str> { let close = arg.rfind('"')?; let open = arg[..close].rfind('"')?; + let b = arg.as_bytes(); + let mut depth = 0usize; + for i in (0..open).rev() { + match b[i] { + b')' => depth += 1, + b'(' if depth > 0 => depth -= 1, + b'(' => { + let head = arg[..i].strip_suffix('!').unwrap_or(""); + let name = head.rsplit(|c: char| !(c.is_ascii_alphanumeric() || c == '_')).next().unwrap_or(""); + if matches!(name, "format" | "format_args") { + let first = arg[i + 1..].strip_prefix('"')?; + let end = first.find('"')?; + return Some(&arg[i + 1..i + 2 + end + 1]); + } + } + _ => {} + } + } Some(&arg[open..=close]) } @@ -3149,11 +3186,12 @@ fn first_arithmetic(op: &str) -> Option<usize> { } /// The whitespace-free source text of the arguments of the call an operand starts with, read from -/// the unmasked source so string literals keep their text. -fn head_args(f: &File, (from, to): (usize, usize)) -> Option<Vec<String>> { +/// `code` (the source with comments blanked and string literals kept), so a comment beside a key +/// is not part of it. +fn head_args(f: &File, code: &[u8], (from, to): (usize, usize)) -> Option<Vec<String>> { let open = from + f.m.get(from..to)?.iter().position(|&c| c == b'(')?; let close = matching(&f.m, open)?; - Some(split_args(&f.m, open + 1, close).into_iter().map(|(a, b)| norm(&f.src[a..b])).collect()) + Some(split_args(&f.m, open + 1, close).into_iter().map(|(a, b)| norm(code.get(a..b).unwrap_or(&f.src[a..b]))).collect()) } /// An argument that names an entry rather than a quantity: a string or integer literal, or a local, @@ -3174,6 +3212,7 @@ fn key_like(arg: &str) -> bool { /// checks that two inputs agree, as a periodicity check does), and two reads at different entries /// (`at("B") == at("A") + 1`, `bounds(&s, copy) == bounds(&s, id) + dv`), which relate two entries. fn mirrors(v: &View) -> Vec<Hit> { + let code = std::cell::OnceCell::new(); v.asserts .iter() .filter(|a| a.name.ends_with("_eq")) @@ -3183,16 +3222,18 @@ fn mirrors(v: &View) -> Vec<Hit> { let (l, r) = (l.trim_start_matches('&'), r.trim_start_matches('&')); let name = head_call(l)?; // Two calls compared as they are check that two inputs agree, which is a real check. + // Arithmetic on exactly one side, in either order, derives that side from the other call. let derived = match (first_arithmetic(l), first_arithmetic(r)) { - (_, None) => false, + (None, None) => false, (Some(i), Some(j)) => l[i..] != r[j..], - (None, Some(_)) => true, + _ => true, }; let last = name.rsplit("::").next().unwrap_or(name); if l == r || !derived || head_call(r) != Some(name) || MIRROR_NEUTRAL.contains(&last) { return None; } - let (la, ra) = (head_args(v.file, lr)?, head_args(v.file, rr)?); + let code: &Vec<u8> = code.get_or_init(|| mask_parts(&String::from_utf8_lossy(v.file.src), true, false)); + let (la, ra) = (head_args(v.file, code, lr)?, head_args(v.file, code, rr)?); let mut differing = la.iter().zip(&ra).filter(|(x, y)| x != y).peekable(); let entries = la.len() == ra.len() && differing.peek().is_some() && differing.all(|(x, y)| key_like(x) && key_like(y)); (!entries).then(|| v.hit(a.at, Rule::Mirror, format!("{}! calls `{name}` on both sides", a.name))) @@ -3417,6 +3458,46 @@ fn windows_runs(path: &str) -> bool { path.starts_with("apps/vectorcraft/") || path == "crates/ui-egui/src/tests/printps.rs" } +/// The value of the contents of an ordinary Rust string literal: `\x`, `\u{…}` and the single-character +/// escapes decoded. An escape it cannot read is kept as written. +fn unescape(s: &str) -> String { + let mut out = String::with_capacity(s.len()); + let mut chars = s.chars().peekable(); + while let Some(c) = chars.next() { + if c != '\\' { + out.push(c); + continue; + } + match chars.next() { + Some('n') => out.push('\n'), + Some('t') => out.push('\t'), + Some('r') => out.push('\r'), + Some('0') => out.push('\0'), + Some(c @ ('\\' | '"' | '\'')) => out.push(c), + Some('x') => { + let hex: String = chars.by_ref().take(2).collect(); + match u8::from_str_radix(&hex, 16) { + Ok(v) if v < 0x80 => out.push(char::from(v)), + _ => out.push_str(&format!("\\x{hex}")), + } + } + Some('u') if chars.peek() == Some(&'{') => { + let body: String = chars.by_ref().take_while(|&c| c != '}').collect(); + match u32::from_str_radix(&body[1..].replace('_', ""), 16).ok().and_then(char::from_u32) { + Some(v) => out.push(v), + None => out.push_str(&format!("\\u{body}}}")), + } + } + Some(other) => { + out.push('\\'); + out.push(other); + } + None => out.push('\\'), + } + } + out +} + /// Whether a (whitespace-free) `cfg` predicate holds on `t`: `None` when it depends on something /// else (a feature, `debug_assertions`, an unknown key). fn cfg_value(p: &str, t: &Target) -> Option<bool> { @@ -3445,7 +3526,13 @@ fn cfg_value(p: &str, t: &Target) -> Option<bool> { return cfg_value(arg, t).map(|v| !v); } // An ordinary or raw string value: `"linux"`, `r"linux"`, `r#"linux"#`. - let (key, value) = p.split_once('=').map_or((p, ""), |(k, v)| (k, v.strip_prefix('r').unwrap_or(v).trim_matches('#').trim_matches('"'))); + // An ordinary string is compared by its decoded value (`"\x6cinux"` is `linux`); a raw string's + // contents are kept as written. + let (key, value) = p.split_once('=').map_or((p, String::new()), |(k, v)| match v.strip_prefix('r') { + Some(raw) => (k, raw.trim_matches('#').trim_matches('"').to_owned()), + None => (k, unescape(v.strip_prefix('"').and_then(|v| v.strip_suffix('"')).unwrap_or(v))), + }); + let value = value.as_str(); match key { "test" => Some(true), "unix" => Some(t.family == "unix"), @@ -3598,7 +3685,7 @@ fn declared_cfgs(src: &str, parent: &str, want: &Loaded) -> Option<(Vec<String>, for at in words(&m, b"mod", 0, m.len()) { let start = skip_ws(&m, at + 3); let end = start + m[start..].iter().take_while(|&&c| is_ident(c)).count(); - if end == start || m.get(skip_ws(&m, end)) != Some(&b';') || inline_mods(&m, at) != want.chain { + if end == start || m.get(skip_ws(&m, end)) != Some(&b';') || inline_mods(&m, src.as_bytes(), at) != want.chain { continue; } let item = m[..at].iter().rposition(|&c| matches!(c, b';' | b'{' | b'}')).map_or(0, |p| p + 1); @@ -3661,7 +3748,7 @@ fn path_children(src: &str, parent: &str) -> Vec<(String, Vec<String>)> { } let item = m[..at].iter().rposition(|&c| matches!(c, b';' | b'{' | b'}')).map_or(0, |p| p + 1); if let Some(rel) = path_attr(&m, src.as_bytes(), item, at) { - let chain = inline_mods(&m, at); + let chain = inline_mods(&m, src.as_bytes(), at); out.push((override_path(dir, file, mod_rs, &chain, &rel), chain)); } } @@ -3675,18 +3762,20 @@ type Overrides = HashMap<String, Vec<(String, Vec<String>)>>; /// Find the files carrying `#[path]` in the work tree or at `base`, then read that tree's sources. fn discover_path_overrides(root: &Path, base: Option<&str>, read: &dyn Fn(&str) -> Option<String>) -> Overrides { let with_path = match base { - Some(base) => git(root, &["grep", "-l", "-w", "path", base, "--", "*.rs"]), - None => git(root, &["grep", "--untracked", "-l", "-w", "path", "--", "*.rs"]), + // `-z` lists each path verbatim, NUL-terminated: without it Git quotes a non-ASCII path. + Some(base) => git(root, &["grep", "-z", "-l", "-w", "path", base, "--", "*.rs"]), + None => git(root, &["grep", "-z", "--untracked", "-l", "-w", "path", "--", "*.rs"]), } .unwrap_or_default(); listed_path_overrides(&with_path, base, read) } -/// Read paths from `git grep -l`, removing the revision prefix for a base-tree listing. +/// Read paths from `git grep -z -l` (NUL-separated), removing the revision prefix for a base-tree listing. fn listed_path_overrides(list: &str, base: Option<&str>, read: &dyn Fn(&str) -> Option<String>) -> Overrides { let prefix = base.map(|b| format!("{b}:")); let sources: Vec<(String, String)> = list - .lines() + .split('\0') + .filter(|p| !p.is_empty()) .filter_map(|p| match &prefix { Some(prefix) => p.strip_prefix(prefix), None => Some(p), @@ -3745,21 +3834,25 @@ fn join_path(base: &str, rel: &str) -> String { parts.join("/") } -/// The names of the inline `mod <name> { … }` blocks around `at` in the masked text `m`, outermost -/// first. A `mod x;` inside them loads a file under their directory instead of a sibling file. -fn inline_mods(m: &[u8], at: usize) -> Vec<String> { - m[..at] - .iter() - .enumerate() - .filter(|&(open, &c)| c == b'{' && matching(m, open).is_some_and(|close| close > at)) - .filter_map(|(open, _)| { - let head = m[..open].trim_ascii_end(); - let name = head.iter().rev().take_while(|&&c| is_ident(c)).count(); - let before = head[..head.len() - name].trim_ascii_end(); - (name > 0 && before.ends_with(b"mod") && !before[..before.len() - 3].last().copied().is_some_and(is_ident)) - .then(|| String::from_utf8_lossy(&head[head.len() - name..]).into_owned()) - }) - .collect() +/// The directory segments of the inline `mod <name> { … }` blocks around `at` in the masked text +/// `m` (`src` unmasked), outermost first. A `mod x;` inside them loads a file under their directory +/// instead of a sibling file. A block's directory is its name, or the value of a `#[path]` on it +/// (`#[path = "platform_impl"] mod platform { mod child; }` loads `platform_impl/child.rs`). +fn inline_mods(m: &[u8], src: &[u8], at: usize) -> Vec<String> { + let mut dir = String::new(); + for open in (0..at).filter(|&open| m[open] == b'{' && matching(m, open).is_some_and(|close| close > at)) { + let head = m[..open].trim_ascii_end(); + let name = head.iter().rev().take_while(|&&c| is_ident(c)).count(); + let before = head[..head.len() - name].trim_ascii_end(); + if name == 0 || !before.ends_with(b"mod") || before[..before.len() - 3].last().copied().is_some_and(is_ident) { + continue; + } + let kw = before.len() - 3; + let item = m[..kw].iter().rposition(|&c| matches!(c, b';' | b'{' | b'}')).map_or(0, |p| p + 1); + let seg = path_attr(m, src, item, kw).unwrap_or_else(|| String::from_utf8_lossy(&head[head.len() - name..]).into_owned()); + dir = join_path(&dir, &seg); + } + dir.split('/').filter(|s| !s.is_empty()).map(str::to_owned).collect() } /// For each of `paths`, the `cfg` predicates on the `mod` declarations of its module and the @@ -3774,6 +3867,8 @@ fn module_cfgs(paths: &[String], read: &dyn Fn(&str) -> Option<String>, override struct Gates { preds: Vec<String>, sources: Vec<(String, Vec<usize>)>, + /// Whether a crate target loads the file through at least one route. + reached: bool, } /// [`Gates`] for each of `paths` that inherits a predicate. A file is looked up in the files that @@ -3799,7 +3894,10 @@ fn module_gate(at: &str, read: &dyn Fn(&str) -> Option<String>, overrides: &Over } let by_path = overrides.get(at).map_or(&[][..], Vec::as_slice); // A crate root runs independently of any module declarations that also load it. - let Some((name, mut candidates)) = module_parent(at) else { return gates }; + let Some((name, mut candidates)) = module_parent(at) else { + gates.reached = true; + return gates; + }; let name = name.to_owned(); let file = at.rsplit_once('/').map_or(at, |(_, f)| f); let Some(mut module_dir) = (if file == "mod.rs" { @@ -3807,15 +3905,23 @@ fn module_gate(at: &str, read: &dyn Fn(&str) -> Option<String>, overrides: &Over } else { at.rsplit_once('/').map(|(d, _)| d.to_owned()) }) else { + gates.reached = true; return gates; }; let mut chain: Vec<String> = vec![]; let mut found = vec![]; + // Whether a file that could declare the module exists: when none does, the module's parent is + // unknown and the file counts as reached. + let mut parent_read = false; for _ in 0..4 { let want = Loaded { path: at, name: &name, chain: &chain }; // Every file that loads the module is another way in (a library and a binary root // can both load it): its tests are off only when every one of them leaves them out. - found.extend(candidates.iter().filter_map(|c| read(c).and_then(|s| declared_cfgs(&s, c, &want)).map(|f| (c.clone(), f)))); + found.extend( + candidates + .iter() + .filter_map(|c| read(c).inspect(|_| parent_read = true).and_then(|s| declared_cfgs(&s, c, &want)).map(|f| (c.clone(), f))), + ); if chain.is_empty() { for (c, inline) in by_path { // A candidate was read with no inline modules; another route through the @@ -3834,8 +3940,15 @@ fn module_gate(at: &str, read: &dyn Fn(&str) -> Option<String>, overrides: &Over module_dir = up; } let mut each = vec![]; + gates.reached = found.is_empty() && !parent_read; for (parent, (mut preds, lines)) in found { let ancestors = module_gate(&parent, read, overrides, depth + 1); + // A parent that no crate target loads (a file left on disk after its `mod` line was + // removed) is not a route, so it cannot stand in for an ungated one. + if !ancestors.reached { + continue; + } + gates.reached = true; preds.extend(ancestors.preds); gates.sources.push((parent, lines)); gates.sources.extend(ancestors.sources); @@ -5537,12 +5650,16 @@ mod tests { assert_eq!(only("mirror", allowed), [], "the allow removes the hit `bad` reports"); let derived_arg = "#[test]\nfn t() {\n assert_eq!(area(grow(s, 2.0)), area(s) * 4.0);\n}\n"; assert_eq!(only("mirror", derived_arg), [(3, "mirror")], "a computed input is a quantity, not an entry"); + let swapped = "#[test]\nfn t() {\n assert_eq!(scale(p, 1.0) * 2.0, scale(p, 2.0));\n}\n"; + assert_eq!(only("mirror", swapped), [(3, "mirror")], "the arithmetic on the left side"); } #[test] fn mirrors_leave_out_reads_at_two_entries_and_shared_arithmetic() { let order = "#[test]\nfn t() {\n assert_eq!(at(\"Graphic styles\"), at(\"Swatches\") + 1);\n assert_eq!(at(front[0]), at(a) + 1);\n}\n"; assert_eq!(only("mirror", order), [], "positions of two entries in one list"); + let commented = "#[test]\nfn t() {\n assert_eq!(at(\"B\" /* later entry */), at(\"A\") + 1);\n}\n"; + assert_eq!(only("mirror", commented), [], "a comment beside a key"); let offset = "#[test]\nfn t() {\n assert_eq!(bounds(&s, copies[0]), bounds(&s, id) + dv);\n assert_eq!(board(&s, 3), board(&s, 2) + step);\n}\n"; assert_eq!(only("mirror", offset), [], "two objects of one document, one moved from the other"); @@ -5961,8 +6078,8 @@ mod tests { let work_files = [("crates/x/src/lib.rs", lib), (a, ""), (b, declaration)]; let read_base = |p: &str| base_files.iter().find(|(path, _)| *path == p).map(|(_, s)| (*s).to_owned()); let read_work = |p: &str| work_files.iter().find(|(path, _)| *path == p).map(|(_, s)| (*s).to_owned()); - let base_overrides = listed_path_overrides(&format!("before:{a}\n"), Some("before"), &read_base); - let work_overrides = listed_path_overrides(&format!("{b}\n"), None, &read_work); + let base_overrides = listed_path_overrides(&format!("before:{a}\0"), Some("before"), &read_base); + let work_overrides = listed_path_overrides(&format!("{b}\0"), None, &read_work); let paths = [child.to_owned()]; let base_ctx = Ctx { module_cfgs: module_cfgs(&paths, &read_base, &base_overrides), ..ctx() }; let work_ctx = Ctx { module_cfgs: module_cfgs(&paths, &read_work, &work_overrides), ..ctx() }; @@ -5983,6 +6100,65 @@ mod tests { assert_eq!(hits_in(&shared, test, &ctx), [], "the ungated route through `n` runs it"); } + #[test] + fn a_detached_module_is_not_an_ungated_route() { + let decl = "#[path = \"shared.rs\"]\nmod s;\n"; + let test = "#[test]\nfn t() {\n assert_eq!(f(), 1);\n}\n"; + let shared = "crates/x/src/shared.rs".to_owned(); + for (lib, off) in [("#[cfg(target_os = \"macos\")]\nmod b;\n", true), ("mod a;\n#[cfg(target_os = \"macos\")]\nmod b;\n", false)] { + let files: HashMap<&str, &str> = + [("crates/x/src/lib.rs", lib), ("crates/x/src/a.rs", decl), ("crates/x/src/b.rs", decl)].into_iter().collect(); + let read = |p: &str| files.get(p).map(|s| (*s).to_owned()); + let overrides = path_overrides(files.iter().map(|(p, s)| (*p, *s))); + let ctx = Ctx { module_cfgs: module_cfgs(std::slice::from_ref(&shared), &read, &overrides), ..ctx() }; + let want: &[(usize, &str)] = if off { &[(2, "never-run")] } else { &[] }; + assert_eq!(hits_in(&shared, test, &ctx), want, "{lib}"); + } + } + + #[test] + fn a_path_on_an_inline_module_sets_its_directory() { + let lib = "#[cfg(target_os = \"macos\")]\n#[path = \"platform_impl\"]\nmod platform {\n mod child;\n}\n"; + let files: HashMap<&str, &str> = [("crates/x/src/lib.rs", lib)].into_iter().collect(); + let read = |p: &str| files.get(p).map(|s| (*s).to_owned()); + let child = "crates/x/src/platform_impl/child.rs".to_owned(); + let ctx = Ctx { module_cfgs: module_cfgs(std::slice::from_ref(&child), &read, &Overrides::new()), ..ctx() }; + let test = "#[test]\nfn t() {\n assert_eq!(f(), 1);\n}\n"; + assert_eq!(hits_in(&child, test, &ctx), [(2, "never-run")]); + } + + #[test] + fn cfg_values_compare_decoded_strings() { + let linux = &CI_TARGETS[0]; + assert_eq!(cfg_value("target_os=\"\\x6cinux\"", linux), Some(true)); + assert_eq!(cfg_value("target_os=\"\\u{6c}inux\"", linux), Some(true)); + assert_eq!(cfg_value("target_os=r\"linux\"", linux), Some(true)); + assert_eq!(cfg_value("target_os=r\"\\x6cinux\"", linux), Some(false), "a raw string is not decoded"); + } + + #[test] + fn path_override_listings_are_nul_separated() { + let files: HashMap<&str, &str> = + [("crates/x/src/a.rs", "#[path = \"s.rs\"]\nmod s;\n"), ("crates/x/src/caf\u{e9}.rs", "#[path = \"t.rs\"]\nmod t;\n")] + .into_iter() + .collect(); + let read = |p: &str| files.get(p).map(|s| (*s).to_owned()); + let got = listed_path_overrides("base:crates/x/src/a.rs\0base:crates/x/src/caf\u{e9}.rs\0", Some("base"), &read); + assert!(got.contains_key("crates/x/src/s.rs"), "{got:?}"); + assert!(got.contains_key("crates/x/src/t.rs"), "{got:?}"); + } + + #[test] + fn deleted_files_are_kept_as_changed() { + let diff = "diff --git a/crates/x/src/bin/tool.rs b/crates/x/src/bin/tool.rs\ndeleted file mode 100644\n--- a/crates/x/src/bin/tool.rs\n+++ /dev/null\n@@ -1,2 +0,0 @@\n-#[path = \"../shared.rs\"]\n-mod shared;\n"; + let got = parse_diff(diff); + assert_eq!(got.get("crates/x/src/bin/tool.rs"), Some(&None), "{got:?}"); + let base: Overrides = [("crates/x/src/shared.rs".to_owned(), vec![("crates/x/src/bin/tool.rs".to_owned(), vec![])])].into_iter().collect(); + let seeds: Vec<String> = got.keys().cloned().collect(); + let files = ["crates/x/src/shared.rs".to_owned()]; + assert_eq!(descendants(&seeds, &files, &Overrides::new(), &base), ["crates/x/src/shared.rs"]); + } + #[test] fn a_changed_file_reaches_the_files_its_path_loaded_modules_load() { let files: Vec<String> = ["src/solids/graphics.rs", "src/solids/map_art.rs", "src/solids/tests_map_art.rs", "src/solids/other.rs"] @@ -6053,6 +6229,11 @@ mod tests { assert_eq!(only("reads-source", comment), [], "a Rust path only in a comment"); let dir = "#[test]\nfn t() {\n let s = fs::read_to_string(root.join(\"fixtures.rs\").join(\"data.json\")).unwrap();\n assert!(s.contains(\"x\"));\n}\n"; assert_eq!(only("reads-source", dir), [], "a directory named like a Rust file"); + let formatted = "#[test]\nfn t() {\n let s = fs::read_to_string(format!(\"fixtures/{}.txt\", \"lib.rs\")).unwrap();\n assert!(s.contains(\"x\"));\n}\n"; + assert_eq!(only("reads-source", formatted), [], "a format argument is not the file read"); + let format_rs = + "#[test]\nfn t() {\n let s = fs::read_to_string(format!(\"{}/lib.rs\", dir)).unwrap();\n assert!(s.contains(\"x\"));\n}\n"; + assert_eq!(only("reads-source", format_rs), [(3, "reads-source")], "a format string that names a .rs file"); let split = "#[test]\nfn t() {\n let s = fs::read_to_string(\n \"src/lib.rs\",\n )\n .unwrap();\n assert!(s.contains(\"x\"));\n}\n"; let found = lint_file("crates/x/src/tests.rs", split, &ctx()); let hit = found.iter().find(|h| h.rule == Rule::ReadsSource).unwrap(); From 66c01445d5237d3744f3d83a7054c1f829f6d2f9 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 07:34:06 -0800 Subject: [PATCH 051/112] Pathfinder: Divide and Live Paint report paths too complex to map When the planar map is skipped because the paths have too many pieces (SHAPE_BUILDER_MAX_MAP_EDGES, added in 7a46d5ec564), too many segments or exceed the sweep's work budget, Divide with open paths fell back to the filled areas. It replaced the selection with the uncut shapes and deleted the cutting paths without saying so. Live Paint built no faces: Make reported the paths as too degenerate to paint, and with Gap Detection a group could get its edges and no faces. pathops now has try_pathfinder_with, try_live_paint and try_live_paint_with_gaps, which return TooManyPieces in those cases without sweeping the filled areas. Divide, Live Paint Make, Merge and Gap Options use them and stop with an error that leaves the art unchanged. The caps, and the fallbacks of pathfinder_with, live_paint, live_paint_with_gaps and the Shape Builder, are unchanged. When a Gap Options preview fails after one that found gaps, the dialog no longer keeps drawing the earlier preview's gaps over the groups the failure put back. Docs: docs/mcp.md, the commands' params text and the Divide line in docs/target-app-parity.md. --- crates/engine/src/cmd/buildcmds.rs | 11 ++-- crates/engine/src/cmd/pathops.rs | 5 +- crates/pathops/src/lib.rs | 5 +- crates/pathops/src/pathfinder.rs | 41 ++++++++++--- crates/pathops/src/planar.rs | 8 +-- crates/pathops/src/planar/live_paint.rs | 60 ++++++++++++++++--- crates/pathops/src/planar/map.rs | 34 ++++++++--- crates/pathops/src/planar/shape_builder.rs | 45 ++++++++++++-- crates/pathops/src/planar/tests.rs | 30 +++++++++- crates/ui-egui/src/dialogs/live_paint_gaps.rs | 20 ++++++- crates/ui-egui/src/menus/ui_commands.rs | 2 +- docs/mcp.md | 14 +++-- docs/target-app-parity.md | 4 +- 13 files changed, 227 insertions(+), 52 deletions(-) diff --git a/crates/engine/src/cmd/buildcmds.rs b/crates/engine/src/cmd/buildcmds.rs index 426f374a5c..21618367b6 100644 --- a/crates/engine/src/cmd/buildcmds.rs +++ b/crates/engine/src/cmd/buildcmds.rs @@ -86,7 +86,7 @@ pub fn specs() -> Vec<CommandSpec> { "Make", ["Object", "Live Paint"], Some("Cmd+Alt+X"), - "{ids?|id?} build a Live Paint group from the selected paths (paths, compound paths and groups of them; type, images and other objects are refused, nothing changes); each covered face starts with the fill rows that draw (shown, with paint and an opacity above 0) of its front-most covering source that has one and an opacity above 0, and each edge with the stroke rows that draw (also a weight above 0) of its source, in order with their settings and with that source's opacity and blending mode (on a path cut into several edges, dashes go on along the path with the lengths set, without the fit of dashes aligned to corners and path ends, arrowheads stay at its own ends, and a width profile or brush stays only on an edge that runs the whole path); a face or edge given no such row has one unpainted row; with a Live Paint group among them, add the others to it as livePaint.merge does; a Live Paint group alone has nothing to add, so it is selected and nothing changes (no undo step) → {id, faces, edges}", + "{ids?|id?} build a Live Paint group from the selected paths (paths, compound paths and groups of them; type, images and other objects are refused, nothing changes); each covered face starts with the fill rows that draw (shown, with paint and an opacity above 0) of its front-most covering source that has one and an opacity above 0, and each edge with the stroke rows that draw (also a weight above 0) of its source, in order with their settings and with that source's opacity and blending mode (on a path cut into several edges, dashes go on along the path with the lengths set, without the fit of dashes aligned to corners and path ends, arrowheads stay at its own ends, and a width profile or brush stays only on an edge that runs the whole path); a face or edge given no such row has one unpainted row; with a Live Paint group among them, add the others to it as livePaint.merge does; a Live Paint group alone has nothing to add, so it is selected and nothing changes (no undo step). The command stops with an error and leaves the art unchanged when the paths are too many or too complex to map. This happens when the paths have more than 131,072 pieces once cut where they meet, or exceed the sweep's work budget, which counts pairs of segments with overlapping bounds. → {id, faces, edges}", has_selection_or_ids, lp_make ), @@ -95,7 +95,7 @@ pub fn specs() -> Vec<CommandSpec> { "Merge", ["Object", "Live Paint"], None, - "{ids?|id?} add the other selected paths (compound paths, groups of paths and Live Paint groups too; type, images and other objects are refused, nothing changes) to the bottom-most Live Paint group, keeping its id, its paint and its own properties (name, lock, visibility, transparency, appearance, opacity mask, graphic style link); a Live Paint group alone has nothing to add, so it is selected and nothing changes (no undo step) → {id, faces, edges}", + "{ids?|id?} add the other selected paths (compound paths, groups of paths and Live Paint groups too; type, images and other objects are refused, nothing changes) to the bottom-most Live Paint group, keeping its id, its paint and its own properties (name, lock, visibility, transparency, appearance, opacity mask, graphic style link); a Live Paint group alone has nothing to add, so it is selected and nothing changes (no undo step). The command stops with an error and leaves the art unchanged when the paths are too many or too complex to map. This happens when the paths have more than 131,072 pieces once cut where they meet, or exceed the sweep's work budget, which counts pairs of segments with overlapping bounds. → {id, faces, edges}", has_multi_or_ids, lp_merge ), @@ -122,7 +122,7 @@ pub fn specs() -> Vec<CommandSpec> { "Gap Options", [], None, - "{id?, ids?: [id…] (instead of id; default: the selected Live Paint groups), detect?: bool (Gap Detection: paint stops at gaps up to size wide), size?: \"small\" (3 pt) | \"medium\" (6 pt) | \"large\" (12 pt) | pt (custom, over 0 up to 72) (Paint Stops At), color?: #rrggbb or a layer color's name such as \"Red\" (Gap Preview Color; a hex color with an alpha part, #rrggbbaa or #rgba, is an error), closeGaps?: bool (add an unpainted path across each gap up to size wide to the group's paths)} set the Gap Options of Live Paint groups (what is not given stays as it was; a group starts with detect false, small and Red) and make their faces again, keeping their paint; when every group already has the options and closeGaps finds no gap, nothing changes (no undo step) → {ids, faces, gaps: [[x0,y0,x1,y1]…] (the gaps up to size wide that no path closes, from a loose end of a path to where it closes to; detect closes them for paint), closed (paths added)}", + "{id?, ids?: [id…] (instead of id; default: the selected Live Paint groups), detect?: bool (Gap Detection: paint stops at gaps up to size wide), size?: \"small\" (3 pt) | \"medium\" (6 pt) | \"large\" (12 pt) | pt (custom, over 0 up to 72) (Paint Stops At), color?: #rrggbb or a layer color's name such as \"Red\" (Gap Preview Color; a hex color with an alpha part, #rrggbbaa or #rgba, is an error), closeGaps?: bool (add an unpainted path across each gap up to size wide to the group's paths)} set the Gap Options of Live Paint groups (what is not given stays as it was; a group starts with detect false, small and Red) and make their faces again, keeping their paint; when every group already has the options and closeGaps finds no gap, nothing changes (no undo step). The command stops with an error and leaves the art unchanged when a group's paths are too many or too complex to map. This happens when the paths have more than 131,072 pieces once cut where they meet, or exceed the sweep's work budget, which counts pairs of segments with overlapping bounds. The paths include lines across the gaps when detect is on. → {ids, faces, gaps: [[x0,y0,x1,y1]…] (the gaps up to size wide that no path closes, from a loose end of a path to where it closes to; detect closes them for paint), closed (paths added)}", has_selection_or_ids, lp_gap_options ), @@ -740,12 +740,13 @@ fn build_children(d: &mut Document, sources: Vec<Arc<Node>>, max_gap: Option<f64 src_group.visible = false; children.push(Arc::new(src_group)); // Every path is an edge, open ones included; faces are the areas they enclose. + let too_many = |e: po::TooManyPieces| EngineError::Other(format!("Live Paint: {e} to paint")); let (regs, edges) = match max_gap { Some(gap) => { - let (regs, edges, _) = po::live_paint_with_gaps(&shapes, gap); + let (regs, edges, _) = po::try_live_paint_with_gaps(&shapes, gap).map_err(too_many)?; (regs, edges) } - None => po::live_paint(&shapes), + None => po::try_live_paint(&shapes).map_err(too_many)?, }; if regs.is_empty() && edges.is_empty() { return Err(EngineError::Other("Live Paint: these paths are too degenerate to paint".into())); diff --git a/crates/engine/src/cmd/pathops.rs b/crates/engine/src/cmd/pathops.rs index 61406fdc61..2132375a44 100644 --- a/crates/engine/src/cmd/pathops.rs +++ b/crates/engine/src/cmd/pathops.rs @@ -63,7 +63,7 @@ pub fn specs() -> Vec<CommandSpec> { "Divide", ["Window", "Pathfinder"], None, - "{ids?: [id…] (selected first; default: the selection), precision?: pt 0.001..10, removeRedundantPoints?: bool, removeUnpainted?: bool (default: the Pathfinder Options, see object.pathfinder.options; the values used join the journal entry)} operate on the selected objects (back → front) → {ids}", + "{ids?: [id…] (selected first; default: the selection), precision?: pt 0.001..10, removeRedundantPoints?: bool, removeUnpainted?: bool (default: the Pathfinder Options, see object.pathfinder.options; the values used join the journal entry)} operate on the selected objects (back → front). When open paths are among them, the command stops with an error and leaves the art unchanged if the paths are too many or too complex to map. This happens when the paths it maps, as it prepares them from the selection, have more than 65,536 segments, have more than 131,072 pieces once cut where they meet, or exceed the sweep's work budget, which counts pairs of segments with overlapping bounds. → {ids}", has_selection, |s, p| run_pf(s, p, PathfinderOp::Divide) ), @@ -823,7 +823,8 @@ fn run_pf(s: &mut Session, p: &Value, op: PathfinderOp) -> Result<Value> { if shapes.iter().any(|s| s.path.subpaths.iter().any(|sp| sp.anchors.iter().any(|a| !(a.p.x.is_finite() && a.p.y.is_finite())))) { return Err(EngineError::Other("paths contain invalid coordinates".into())); } - let mut results = po::pathfinder_with(op, &shapes, options.precision); + let mut results = po::try_pathfinder_with(op, &shapes, options.precision) + .map_err(|e| EngineError::Other(format!("{label}: {e} to cut with the open paths; select fewer paths")))?; if options.remove_unpainted && matches!(op, PathfinderOp::Divide | PathfinderOp::Outline) { // Pathfinder Options › Divide and Outline Will Remove Unpainted Artwork: the pieces // of objects with no fill (or only hidden ones) go. diff --git a/crates/pathops/src/lib.rs b/crates/pathops/src/lib.rs index 61d03ecbc1..da7960af0f 100644 --- a/crates/pathops/src/lib.rs +++ b/crates/pathops/src/lib.rs @@ -31,11 +31,12 @@ pub use fit::{fit_cubics, fit_cubics_through}; pub use offset::{Cap, Join, MAX_OFFSET_SEGMENT_PAIRS, offset_path, outline_stroke, stroke_region, try_offset_path}; pub use pathfinder::{ FaceMerger, PathfinderOp, Region, Shape, merge_regions, pathfinder, pathfinder_with, region_at, regions, regions_with, regions_within, + try_pathfinder_with, }; pub use planar::{ Adjacency, BuilderArrangement, MapEdge, MapFace, MapOutline, SHAPE_BUILDER_MAX_GAP, SHAPE_BUILDER_MAX_MAP_EDGES, SHAPE_BUILDER_MAX_SEGMENTS, - adjacency, cut_out, encloses_area, find_gaps, has_open_path, interior_point, live_paint, live_paint_with_gaps, run_around, shape_builder, - shape_builder_with_gap, + TooManyPieces, adjacency, cut_out, encloses_area, find_gaps, has_open_path, interior_point, live_paint, live_paint_with_gaps, run_around, + shape_builder, shape_builder_with_gap, try_live_paint, try_live_paint_with_gaps, }; pub use thickness::{MAX_DOCUMENT_THICKNESS_WORK, MAX_THICKNESS_PIECES, ThicknessBudget, thinner_than, thinner_than_within}; pub use trap::{TRAP_HEIGHT_WIDTH_RANGE, TRAP_MAX_WIDTH, TRAP_MIN_WIDTH, trap_band}; diff --git a/crates/pathops/src/pathfinder.rs b/crates/pathops/src/pathfinder.rs index 3caddb4bc0..8389fd2dbb 100644 --- a/crates/pathops/src/pathfinder.rs +++ b/crates/pathops/src/pathfinder.rs @@ -109,6 +109,36 @@ pub fn pathfinder(op: PathfinderOp, shapes: &[Shape]) -> Vec<Shape> { pathfinder_with(op, shapes, DEFAULT_PRECISION) } +/// [`pathfinder_with`], or [`TooManyPieces`](crate::TooManyPieces) when Divide's open paths and the +/// shapes they cut have more than [`SHAPE_BUILDER_MAX_SEGMENTS`](crate::SHAPE_BUILDER_MAX_SEGMENTS) +/// segments, or the sweep cuts them into more than +/// [`SHAPE_BUILDER_MAX_MAP_EDGES`](crate::SHAPE_BUILDER_MAX_MAP_EDGES) pieces, or they exceed the +/// sweep's work budget. [`pathfinder_with`] then divides only the filled areas and leaves the open +/// paths out. +pub fn try_pathfinder_with(op: PathfinderOp, shapes: &[Shape], precision: f64) -> Result<Vec<Shape>, crate::TooManyPieces> { + if op == PathfinderOp::Divide && crate::has_open_path(shapes) { + let precision = if precision.is_finite() && precision > 0.0 { precision } else { DEFAULT_PRECISION }; + let (faces, capped) = divide_with_open_paths(shapes, precision, false); + return if capped { Err(crate::TooManyPieces) } else { Ok(faces) }; + } + Ok(pathfinder_with(op, shapes, precision)) +} + +/// Divide with open paths as cutting edges, through the Shape Builder's bounded planar map (and, +/// with `fallback`, its filled-area fallback), and whether that map was skipped for its size. +fn divide_with_open_paths(shapes: &[Shape], precision: f64, fallback: bool) -> (Vec<Shape>, bool) { + let (arrangement, capped) = crate::planar::builder_capped(shapes, false, 0.0, precision, fallback); + let faces = arrangement + .regions + .into_iter() + .filter_map(|r| { + let key = shapes.get(r.top()?)?.key; + Some(Shape::new(r.path, FillRule::NonZero, key)) + }) + .collect(); + (faces, capped) +} + /// [`pathfinder`] at Pathfinder Options › Precision: results are refit to within `precision` /// (document units) and pieces thinner than it are dropped. A smaller value follows the inputs more /// closely. A value that isn't positive and finite is [`DEFAULT_PRECISION`]. @@ -130,14 +160,7 @@ pub fn pathfinder_with(op: PathfinderOp, shapes: &[Shape], precision: f64) -> Ve // Open paths are cutting edges for Divide; the filled-only operations keep their // implicit closure. Reuse Shape Builder's bounded planar map and its fallback. if op == PathfinderOp::Divide && crate::has_open_path(shapes) { - return crate::planar::builder(shapes, false, 0.0, precision) - .regions - .into_iter() - .filter_map(|r| { - let key = shapes.get(r.top()?)?.key; - Some(Shape::new(r.path, FillRule::NonZero, key)) - }) - .collect(); + return divide_with_open_paths(shapes, precision, true).0; } let Some(arr) = arrangement(shapes, precision) else { return Vec::new() }; let p = &arr.tidy; @@ -1645,6 +1668,8 @@ mod tests { assert_eq!(faces.len(), 1, "a segment past the cap falls back to filled areas"); assert_eq!(faces[0].key, 7); assert!((crate::area(&faces[0].path, faces[0].rule) - 10000.0).abs() < 1e-6); + // The checked Divide reports that it left the lines out. + assert_eq!(try_pathfinder_with(PathfinderOp::Divide, &inputs, DEFAULT_PRECISION), Err(crate::TooManyPieces)); } fn old_trim(shapes: &[Shape], precision: f64) -> Vec<Shape> { diff --git a/crates/pathops/src/planar.rs b/crates/pathops/src/planar.rs index ca473dd839..2d1eee08c9 100644 --- a/crates/pathops/src/planar.rs +++ b/crates/pathops/src/planar.rs @@ -37,14 +37,14 @@ pub use adjacency::{Adjacency, MapEdge, MapFace, MapOutline, adjacency}; pub(crate) use graph::pin_ends; #[cfg(test)] use index::{Crossings, RectIndex, reference_budget, segment_footprint, work_done}; -pub use live_paint::{find_gaps, live_paint, live_paint_with_gaps}; +pub use live_paint::{find_gaps, live_paint, live_paint_with_gaps, try_live_paint, try_live_paint_with_gaps}; pub use map::interior_point; pub(crate) use map::{Map, Rest, map}; pub use shape_builder::{ - BuilderArrangement, SHAPE_BUILDER_MAX_GAP, SHAPE_BUILDER_MAX_MAP_EDGES, SHAPE_BUILDER_MAX_SEGMENTS, cut_out, encloses_area, has_open_path, - run_around, shape_builder, shape_builder_with_gap, + BuilderArrangement, SHAPE_BUILDER_MAX_GAP, SHAPE_BUILDER_MAX_MAP_EDGES, SHAPE_BUILDER_MAX_SEGMENTS, TooManyPieces, cut_out, encloses_area, + has_open_path, run_around, shape_builder, shape_builder_with_gap, }; -pub(crate) use shape_builder::{builder, gap_inputs}; +pub(crate) use shape_builder::{builder_capped, gap_inputs}; #[cfg(test)] mod tests; diff --git a/crates/pathops/src/planar/live_paint.rs b/crates/pathops/src/planar/live_paint.rs index 1b9d5b6177..a98449dd0a 100644 --- a/crates/pathops/src/planar/live_paint.rs +++ b/crates/pathops/src/planar/live_paint.rs @@ -6,26 +6,72 @@ use super::*; /// Faces are the bounded areas the paths enclose, holes included, each with the inputs whose fill /// covers it (ascending; empty for an area only enclosed by paths). Edges are the paths split /// wherever they meet another path, keyed by the input they came from (the front-most where -/// inputs share one). Empty when the paths can't be swept (non-finite or too degenerate). +/// inputs share one). Empty when the paths can't be swept (non-finite or too degenerate), or when +/// the sweep cuts them into more than [`SHAPE_BUILDER_MAX_MAP_EDGES`] pieces or the inputs exceed +/// the sweep's work budget ([`try_live_paint`] reports either limit). pub fn live_paint(shapes: &[Shape]) -> (Vec<Region>, Vec<Shape>) { - build(shapes, DEFAULT_PRECISION).map(|(faces, edges, _)| (faces, edges)).unwrap_or_default() + try_live_paint(shapes).unwrap_or_default() } +/// [`live_paint`], or [`TooManyPieces`] when the sweep cuts the paths into more than +/// [`SHAPE_BUILDER_MAX_MAP_EDGES`] pieces or the inputs exceed the sweep's work budget. +/// No faces or edges are built in either case. +pub fn try_live_paint(shapes: &[Shape]) -> Result<(Vec<Region>, Vec<Shape>), TooManyPieces> { + Ok(build(shapes, DEFAULT_PRECISION)?.map(|(faces, edges, _)| (faces, edges)).unwrap_or_default()) +} + +/// Faces, edges and gaps, as [`live_paint_with_gaps`] gives them. +type WithGaps = (Vec<Region>, Vec<Shape>, Vec<[Point; 2]>); + +type Capped<T> = Result<T, TooManyPieces>; + +type CappedWithGaps = (Capped<Vec<Region>>, Capped<Vec<Shape>>, Vec<[Point; 2]>); + /// [`live_paint`] with Gap Detection: the faces are those of `shapes` with a line across each gap /// [`find_gaps`] finds up to `max_gap`, so paint stops at the gaps, and the edges are those of /// `shapes` alone (the lines add none). Also returns the gaps. pub fn live_paint_with_gaps(shapes: &[Shape], max_gap: f64) -> (Vec<Region>, Vec<Shape>, Vec<[Point; 2]>) { + let (faces, edges, gaps) = faces_and_edges_with_gaps(shapes, max_gap); + (faces.unwrap_or_default(), edges.unwrap_or_default(), gaps) +} + +/// [`live_paint_with_gaps`], or [`TooManyPieces`] when the sweep cuts the paths, or the paths with +/// the lines across their gaps, into more than [`SHAPE_BUILDER_MAX_MAP_EDGES`] pieces, or either +/// set of paths exceeds the sweep's work budget. +pub fn try_live_paint_with_gaps(shapes: &[Shape], max_gap: f64) -> Result<WithGaps, TooManyPieces> { let gaps = find_gaps(shapes, max_gap); + let Some(closed) = with_gap_lines(shapes, &gaps) else { + let (faces, edges) = try_live_paint(shapes)?; + return Ok((faces, edges, gaps)); + }; + let (faces, _) = try_live_paint(&closed)?; + let (_, edges) = try_live_paint(shapes)?; + Ok((faces, edges, gaps)) +} + +/// The faces and the edges of [`live_paint_with_gaps`], each built on its own, and the gaps. +fn faces_and_edges_with_gaps(shapes: &[Shape], max_gap: f64) -> CappedWithGaps { + let gaps = find_gaps(shapes, max_gap); + let Some(closed) = with_gap_lines(shapes, &gaps) else { + return match try_live_paint(shapes) { + Ok((faces, edges)) => (Ok(faces), Ok(edges), gaps), + Err(e) => (Err(e), Err(e), gaps), + }; + }; + let faces = try_live_paint(&closed).map(|(faces, _)| faces); + let edges = try_live_paint(shapes).map(|(_, edges)| edges); + (faces, edges, gaps) +} + +/// `shapes` with a line across each of `gaps`, or `None` when there are none. +fn with_gap_lines(shapes: &[Shape], gaps: &[[Point; 2]]) -> Option<Vec<Shape>> { if gaps.is_empty() { - let (faces, edges) = live_paint(shapes); - return (faces, edges, gaps); + return None; } let mut closed = shapes.to_vec(); let lines = PathData::new(gaps.iter().map(|g| SubPath::polyline(g, false)).collect()); closed.push(Shape::new(lines, FillRule::NonZero, u64::MAX)); - let (faces, _) = live_paint(&closed); - let (_, edges) = live_paint(shapes); - (faces, edges, gaps) + Some(closed) } /// How many times longer than a gap the way between its two ends along the paths must be for it to diff --git a/crates/pathops/src/planar/map.rs b/crates/pathops/src/planar/map.rs index 051a341e1a..f2114a6ceb 100644 --- a/crates/pathops/src/planar/map.rs +++ b/crates/pathops/src/planar/map.rs @@ -42,11 +42,18 @@ pub(crate) fn map(shapes: &[Shape], cover: bool) -> Option<Map> { /// [`map`] whose faces and pieces are refit to `precision`, and whose slivers thinner than it are dropped. pub(super) fn map_with(shapes: &[Shape], cover: bool, precision: f64) -> Option<Map> { - map_within(shapes, cover, precision, usize::MAX) + map_within(shapes, cover, precision, usize::MAX).ok().flatten() } -/// [`map_with`], or `None` when the sweep cuts the paths into more than `max_edges` pieces. -pub(super) fn map_within(shapes: &[Shape], cover: bool, precision: f64, max_edges: usize) -> Option<Map> { +/// [`map_with`], or [`TooManyPieces`] when the sweep cuts the paths into more than `max_edges` pieces +/// or the inputs exceed the sweep's work budget. +pub(super) fn map_within(shapes: &[Shape], cover: bool, precision: f64, max_edges: usize) -> Result<Option<Map>, TooManyPieces> { + let mut capped = false; + let map = map_capped(shapes, cover, precision, max_edges, &mut capped); + if capped { Err(TooManyPieces) } else { Ok(map) } +} + +fn map_capped(shapes: &[Shape], cover: bool, precision: f64, max_edges: usize, capped: &mut bool) -> Option<Map> { let mut inputs: Vec<(BezPath, usize)> = Vec::new(); for (i, s) in shapes.iter().enumerate() { let mut bp = BezPath::new(); @@ -71,10 +78,11 @@ pub(super) fn map_within(shapes: &[Shape], cover: bool, precision: f64, max_edge snap_horizontals(&mut inputs.iter_mut().map(|p| &mut p.0).collect::<Vec<_>>(), eps); // Counted on the snapped geometry, which is what the sweep sees: snapping can bring boxes into contact. if !crate::budget::sweep_fits(inputs.iter().map(|p| &p.0)) { + *capped = true; return None; } let tidy = Tidy::keeping(precision, inputs.iter().map(|p| &p.0)); - let (points, edges) = sweep_graph(&inputs, eps, precision, max_edges)?; + let (points, edges) = sweep_graph(&inputs, eps, precision, max_edges, capped)?; let nv = points.len(); // Half-edges leaving each vertex, sorted by direction; walking a face, the next half-edge is @@ -193,7 +201,7 @@ pub(super) fn map_within(shapes: &[Shape], cover: bool, precision: f64, max_edge Some(Map { edges, around, slot_of, faces, face_index, slivers, holes, face_holes, tidy, anchors, snap }) } -fn sweep_graph(inputs: &[(BezPath, usize)], eps: f64, precision: f64, max_edges: usize) -> Option<(Vec<Point>, Vec<Edge>)> { +fn sweep_graph(inputs: &[(BezPath, usize)], eps: f64, precision: f64, max_edges: usize, capped: &mut bool) -> Option<(Vec<Point>, Vec<Edge>)> { // The sweep can panic on rare near-degenerate input; that must never take the app down. let sweep = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| Topology::<Crossings>::from_paths(inputs.iter().map(|(p, i)| (p, *i)), eps))); @@ -202,6 +210,7 @@ fn sweep_graph(inputs: &[(BezPath, usize)], eps: f64, precision: f64, max_edges: // the paths into, and paths that cross many times are cut into far more pieces than they have // segments. if top.segment_indices().nth(max_edges).is_some() { + *capped = true; return None; } // The planar graph: vertices are the sweep's points, edges its segments. Points closer than @@ -437,10 +446,17 @@ impl Map { /// Faces and edges of `shapes`, and the pieces of the open paths (those with no closed subpath) /// that lie under another path in front of them, whose edges are that path's: under a closed /// path's outline, or along an open path in front. -/// `None` when the sweep cuts the paths into more than [`SHAPE_BUILDER_MAX_MAP_EDGES`] pieces. -pub(super) fn build(shapes: &[Shape], precision: f64) -> Option<(Vec<Region>, Vec<Shape>, Vec<Shape>)> { - let m = map_within(shapes, false, precision, SHAPE_BUILDER_MAX_MAP_EDGES)?; - let Map { edges, around, faces, holes, face_holes, tidy, anchors, snap, .. } = &m; +/// This returns [`TooManyPieces`] when the sweep cuts the paths into more than +/// [`SHAPE_BUILDER_MAX_MAP_EDGES`] pieces or the inputs exceed the sweep's work budget. +pub(super) fn build(shapes: &[Shape], precision: f64) -> Result<Option<Built>, TooManyPieces> { + Ok(map_within(shapes, false, precision, SHAPE_BUILDER_MAX_MAP_EDGES)?.and_then(|m| build_from(&m, shapes, precision))) +} + +/// Faces, edges and the open paths' pieces under another path, as [`build`] gives them. +pub(super) type Built = (Vec<Region>, Vec<Shape>, Vec<Shape>); + +fn build_from(m: &Map, shapes: &[Shape], precision: f64) -> Option<Built> { + let Map { edges, around, faces, holes, face_holes, tidy, anchors, snap, .. } = m; let snap = *snap; let fills: Vec<Fill> = shapes.iter().map(Fill::new).collect(); let subpath = |cycle: &[usize]| { diff --git a/crates/pathops/src/planar/shape_builder.rs b/crates/pathops/src/planar/shape_builder.rs index 4ddd10495a..86a2fc5f36 100644 --- a/crates/pathops/src/planar/shape_builder.rs +++ b/crates/pathops/src/planar/shape_builder.rs @@ -19,6 +19,20 @@ pub const SHAPE_BUILDER_MAX_SEGMENTS: usize = 65_536; /// from them still has its region. pub const SHAPE_BUILDER_MAX_MAP_EDGES: usize = 2 * SHAPE_BUILDER_MAX_SEGMENTS; +/// The paths have more than [`SHAPE_BUILDER_MAX_SEGMENTS`] segments, or the sweep cut them into +/// more than [`SHAPE_BUILDER_MAX_MAP_EDGES`] pieces, or they exceed the sweep's work budget. +/// Their planar map was not built. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct TooManyPieces; + +impl std::fmt::Display for TooManyPieces { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("the paths have too many segments or pieces") + } +} + +impl std::error::Error for TooManyPieces {} + /// The Shape Builder's arrangement: see [`shape_builder`]. #[derive(Clone, Debug, Default, PartialEq)] pub struct BuilderArrangement { @@ -86,23 +100,43 @@ pub fn shape_builder_with_gap(shapes: &[Shape], edges: bool, gap: f64) -> Builde /// [`shape_builder_with_gap`] refitting its results to `precision` (Pathfinder Options › Precision). pub(crate) fn builder(shapes: &[Shape], edges: bool, gap: f64, precision: f64) -> BuilderArrangement { + builder_capped(shapes, edges, gap, precision, true).0 +} + +/// [`builder`], and whether its full map was skipped because the paths have more than +/// [`SHAPE_BUILDER_MAX_SEGMENTS`] segments or the sweep cut them into more than +/// [`SHAPE_BUILDER_MAX_MAP_EDGES`] pieces, or the inputs exceed the sweep's work budget. +/// The regions are then the filled areas', or, without `fallback`, there are none and the filled +/// areas are not swept. +pub(crate) fn builder_capped(shapes: &[Shape], edges: bool, gap: f64, precision: f64, fallback: bool) -> (BuilderArrangement, bool) { let has_open = has_open_path(shapes); let segments: usize = shapes.iter().flat_map(|s| &s.path.subpaths).map(|sp| sp.segment_count()).sum(); + let mut capped = segments > SHAPE_BUILDER_MAX_SEGMENTS; + let mut built = |shapes: &[Shape]| match build(shapes, precision) { + Ok(b) => b.unwrap_or_default(), + Err(TooManyPieces) => { + capped = true; + Default::default() + } + }; let planar = (segments <= SHAPE_BUILDER_MAX_SEGMENTS) .then(|| { let keyed: Vec<Shape> = shapes.iter().enumerate().map(|(i, s)| Shape::new(s.path.clone(), s.rule, i as u64)).collect(); if has_open && gap.is_finite() && gap > 0.0 { - let (faces, pieces, under) = build(&gap_inputs(&keyed, gap), precision).unwrap_or_default(); + let (faces, pieces, under) = built(&gap_inputs(&keyed, gap)); // Gap targets split original outlines too, but the bridges themselves aren't art. let art = |p: &Shape| p.key < shapes.len() as u64; (faces, pieces.into_iter().filter(art).collect(), under.into_iter().filter(art).collect()) } else { - build(&keyed, precision).unwrap_or_default() + built(&keyed) } }) .filter(|(faces, pieces, _)| !faces.is_empty() || !pieces.is_empty()); let Some((faces, pieces, under)) = planar else { - return BuilderArrangement { regions: filled_regions(shapes, precision), ..Default::default() }; + if capped && !fallback { + return (BuilderArrangement::default(), true); + } + return (BuilderArrangement { regions: filled_regions(shapes, precision), ..Default::default() }, capped); }; let is_line = |i: u64| shapes.get(i as usize).is_some_and(|s| !s.path.subpaths.iter().any(|sp| sp.closed)); let (lines, outline): (Vec<Shape>, Vec<Shape>) = pieces.into_iter().partition(|e| is_line(e.key)); @@ -114,12 +148,13 @@ pub(crate) fn builder(shapes: &[Shape], edges: bool, gap: f64, precision: f64) - regions.extend(faces.into_iter().filter(|f| f.sources.is_empty())); regions }; - BuilderArrangement { + let arrangement = BuilderArrangement { regions, lines: if has_open { lines } else { Vec::new() }, edges: if edges { outline } else { Vec::new() }, lines_under: if has_open { under } else { Vec::new() }, - } + }; + (arrangement, false) } /// The regions of the shapes' filled areas. A shape that fills nothing (open paths that enclose no diff --git a/crates/pathops/src/planar/tests.rs b/crates/pathops/src/planar/tests.rs index 130d381bfa..99045828f6 100644 --- a/crates/pathops/src/planar/tests.rs +++ b/crates/pathops/src/planar/tests.rs @@ -623,13 +623,39 @@ fn bar_grid(n: usize) -> Vec<Shape> { fn a_map_past_its_edge_cap_is_not_built() { // 20 lines each way: each line is cut into 21 pieces, 840 in all. let s = line_grid(20); - assert!(map::map_within(&s, false, DEFAULT_PRECISION, 1000).is_some()); - assert!(map::map_within(&s, false, DEFAULT_PRECISION, 500).is_none()); + assert!(map::map_within(&s, false, DEFAULT_PRECISION, 1000).is_ok_and(|m| m.is_some())); + assert!(map::map_within(&s, false, DEFAULT_PRECISION, 500).is_err()); let bars = bar_grid(20); assert!(crate::pathfinder::regions_capped(&bars, DEFAULT_PRECISION, 100_000).is_some_and(|r| r.len() > 400)); assert!(crate::pathfinder::regions_capped(&bars, DEFAULT_PRECISION, 1000).is_none()); } +#[test] +fn divide_and_live_paint_report_the_edge_cap() { + // A filled square under 300 lines each way: the lines cross past the cap. + let mut s = vec![rect(100.0, 100.0, 900.0, 900.0, 7)]; + s.extend(line_grid(300).into_iter().map(|l| Shape::new(l.path, l.rule, l.key + 1))); + assert_eq!(crate::try_pathfinder_with(crate::PathfinderOp::Divide, &s, DEFAULT_PRECISION), Err(TooManyPieces)); + // Without the report, Divide gives back the square alone, uncut. + assert_eq!(crate::pathfinder_with(crate::PathfinderOp::Divide, &s, DEFAULT_PRECISION).len(), 1); + assert_eq!(try_live_paint(&s), Err(TooManyPieces)); + assert_eq!(try_live_paint_with_gaps(&s, 10.0), Err(TooManyPieces)); + // Overlapping lines exceed the sweep's work budget before any pieces are cut. + let mut overlapping = vec![rect(100.0, 100.0, 900.0, 900.0, 7)]; + overlapping.extend((0..1500).map(|i| line((0.0, 0.0), (1000.0, 1000.0), i + 8))); + assert_eq!(crate::try_pathfinder_with(crate::PathfinderOp::Divide, &overlapping, DEFAULT_PRECISION), Err(TooManyPieces)); + assert_eq!(crate::pathfinder_with(crate::PathfinderOp::Divide, &overlapping, DEFAULT_PRECISION).len(), 1); + assert_eq!(try_live_paint(&overlapping), Err(TooManyPieces)); + assert_eq!(try_live_paint_with_gaps(&overlapping, 10.0), Err(TooManyPieces)); + let (faces, edges) = live_paint(&overlapping); + assert!(faces.is_empty() && edges.is_empty()); + // Under the cap, both build as before. + let mut small = vec![rect(100.0, 100.0, 900.0, 900.0, 7)]; + small.extend(line_grid(20).into_iter().map(|l| Shape::new(l.path, l.rule, l.key + 1))); + assert!(crate::try_pathfinder_with(crate::PathfinderOp::Divide, &small, DEFAULT_PRECISION).is_ok_and(|f| f.len() > 1)); + assert!(try_live_paint(&small).is_ok_and(|(faces, _)| faces.len() > 1)); +} + #[test] fn shape_builder_builds_no_regions_past_its_edge_cap() { // 300 lines each way cross 90,000 times with 600 segments: the sweep cuts them into about diff --git a/crates/ui-egui/src/dialogs/live_paint_gaps.rs b/crates/ui-egui/src/dialogs/live_paint_gaps.rs index 388ded4a68..69e5e0ceed 100644 --- a/crates/ui-egui/src/dialogs/live_paint_gaps.rs +++ b/crates/ui-egui/src/dialogs/live_paint_gaps.rs @@ -198,7 +198,8 @@ pub(crate) fn pump(app: &mut VectorcraftApp, ctx: &egui::Context) { Some(Ok(done)) => Some(done["gaps"].clone()), Some(Err(e)) => { app.status(e); - None + // The failed preview rolled the groups back, so the gaps an earlier one found are gone too. + Some(Value::Null) } None => None, }; @@ -519,6 +520,23 @@ mod tests { assert!(!drawn(&mut app), "no preview, no gap"); } + /// A preview that fails after one that found gaps leaves no gaps drawn from the earlier one. + #[test] + fn a_failed_preview_draws_no_earlier_gaps() { + let mut app = app(); + gapped_group(&mut app); + app.run("ui.livePaintGapOptions", json!({})).unwrap(); + set(&app, "detect", json!(true)).unwrap(); + set(&app, "preview", json!(true)).unwrap(); + pump_all(&mut app); + assert_eq!(overlays(&app).len(), 1, "the gap is previewed"); + // A custom size past 72 pt is refused, and the preview with it fails. + set(&app, "size", json!("custom")).unwrap(); + set(&app, "custom", json!(100.0)).unwrap(); + pump_all(&mut app); + assert!(overlays(&app).is_empty(), "{:?}", overlays(&app)); + } + /// With Preview on, a Gap Preview Color with an alpha part is not previewed: the group keeps /// its own color, the gaps draw in black, OK refuses the color and Cancel rolls the preview back. #[test] diff --git a/crates/ui-egui/src/menus/ui_commands.rs b/crates/ui-egui/src/menus/ui_commands.rs index 5681df62bf..2657f2de7b 100644 --- a/crates/ui-egui/src/menus/ui_commands.rs +++ b/crates/ui-egui/src/menus/ui_commands.rs @@ -2203,7 +2203,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "ui.livePaintGapOptions", "Gap Options…", "", - "{} open Gap Options (Object › Live Paint › Gap Options…; dialog `livePaintGapOptions`: detect, size small|medium|large|custom, custom (pt), color (#rrggbb or a layer color's name), closeGaps, preview) on the selected Live Paint groups, filled in from the first; with preview on, the options apply live and the gaps found draw on the canvas in the preview color: OK runs livePaint.gapOptions as one undo step; a color with an alpha part (#rrggbbaa or #rgba) is an error and OK changes nothing, and with preview on a #rrggbbaa color is not previewed: the groups keep their own color and the gaps draw in black", + "{} open Gap Options (Object › Live Paint › Gap Options…; dialog `livePaintGapOptions`: detect, size small|medium|large|custom, custom (pt), color (#rrggbb or a layer color's name), closeGaps, preview) on the selected Live Paint groups, filled in from the first; with preview on, the options apply live and the gaps found draw on the canvas in the preview color: OK runs livePaint.gapOptions as one undo step; a color with an alpha part (#rrggbbaa or #rgba) is an error and OK changes nothing, and with preview on a #rrggbbaa color is not previewed: the groups keep their own color and the gaps draw in black; a preview that fails shows its error in the status bar, puts the groups back as they were and stops drawing the dialog's preview of the gaps (View › Show Live Paint Gaps still draws the restored groups' own gaps)", ), ( "ui.perspectivePlane", diff --git a/docs/mcp.md b/docs/mcp.md index 9604e3da61..f75dd03691 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -6074,7 +6074,9 @@ already walks Image Trace. Short agent entry points: When `livePaint.gapOptions` or `livePaint.merge` cuts an edge into pieces, each piece takes the edge's paint, with its rows fitted to its part of the edge in the same way. A face or edge given no such row has one unpainted row. Rows that do not draw stay with the stored sources, which `livePaint.release` returns unchanged. The source's object effects and the strokes' pen pressure are not carried. - Expand keeps those face fills. + Expand keeps those face fills. Make, Merge and Gap Options stop with an error and leave the art unchanged when the + paths are too many or too complex to map. This happens when the paths have more than 131,072 pieces once cut where + they meet, or exceed the sweep's work budget, which counts pairs of segments with overlapping bounds. The paths include lines across the gaps when Gap Detection is on. `livePaint.expand` keeps each face and edge that draws, with all its fill and stroke rows: it is shown, its opacity is above 0, and a fill or stroke row is shown, has paint and an opacity above 0 (a stroke also a weight above 0), whichever row is on top. A painted lower row under an unpainted top row keeps the part; a part whose only painted @@ -6098,7 +6100,9 @@ already walks Image Trace. Short agent entry points: when another merged group has it on. When Gap Detection is off in every merged group, it stays off. The Gap Options dialog (`ui.livePaintGapOptions`) takes `color` as `#rrggbb` or a layer color's name; its OK gives an error for a `color` with an alpha part (`#rrggbbaa` or `#rgba`) and changes nothing. With Preview on, a - `#rrggbbaa` color is not previewed: the groups keep their own color, and the previewed gaps draw in black. + `#rrggbbaa` color is not previewed: the groups keep their own color, and the previewed gaps draw in black. When a + preview fails, the status bar shows the error, the groups go back to how they were, and the dialog stops drawing its preview of the gaps. View › Show Live Paint Gaps still draws the restored + groups' own gaps. `view.livePaintGaps` (View › Show Live Paint Gaps, or Hide Live Paint Gaps while it is on) turns the drawing of those gaps on or off. While it is on and edges show, the canvas draws the gaps of each selected Live Paint group in that group's Gap Preview Color. The reply is the new state (`true` when on). @@ -7675,8 +7679,10 @@ Pathfinder command (`object.pathfinder.unite` … `minusBack`) also takes `preci whatever the options are then. Unite, Minus Front, Intersect, Exclude and Minus Back close open paths, so a straight line encloses no area and does not change the result's shape. When a selected object is or holds such a path, the reply's `warning` says so and names Object › Path › Outline Stroke. When such a path leaves the result empty (Intersect, a line -at the back in Minus Front, or a line in front in Minus Back), the error says so too. - +at the back in Minus Front, or a line in front in Minus Back), the error says so too. Divide with open paths among +the objects stops with an error and leaves the art unchanged when the paths are too many or too complex to map. +This happens when the paths Divide maps, as it prepares them from the selection, have more than 65,536 segments, have more than 131,072 pieces once cut where +they meet, or exceed the sweep's work budget, which counts pairs of segments with overlapping bounds. ```json {"name":"run_command","arguments":{"command":"object.pathfinder.options","params":{"precision":0.1,"removeUnpainted":true}}} ``` diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 5f5f9644d5..1eb702f506 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1826,7 +1826,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur Outline Stroke, Expand's Stroke option and Flatten Transparency's Convert All Strokes to Outlines apply the object's visible geometry effects (Offset Path, Zig Zag and the others) to the path, and then apply each stroke's own geometry effects before outlining that stroke, as the canvas draws it. The filled outline of a stroke without a brush keeps the stroke's other effects, such as a drop shadow. Outline Stroke and Unite remove the overlaps of a long, low path with the sweep turned along it: when the estimated number of segments the sweep holds at once is under two thirds as large for the path turned a quarter turn (paths of 2,048 segments or more), the overlaps are removed on the turned path and the result is turned back, which moves no point by rounding. The lookups of the input curve that a piece of the result lies on, and of the input anchors that are kept, can search along y instead of x: once lookups with more than 64 candidates along x have counted 16 for each input curve or anchor, a lookup searches along y when it finds fewer candidates there (under a quarter as many for curves), and where that has rarely happened it measures along y in only one lookup of 32. On one open path of 200,000 anchors in rows of 1,000, Outline Stroke takes 17.3 s of processor time instead of 31.3 s and Unite 2.9 s instead of 6.5 s in a release build. A turned result has as many subpaths as the result without the turn, and the area where the two differ is no larger than the refit precision times the outline's length (`crates/pathops/src/sweep_axis.rs` tests). Offset Path turns the sweep the same way: when the estimate for its fill, the ring stroked around the fill and the outline of its open subpaths is under two thirds as large turned a quarter turn, the faces are found on the turned parts, the faces that lie within the offset distance of the path are dropped by testing their points turned back, and the result is turned back. On an open path of 10,000 anchors in rows of 1,000, offsetting by 2 pt takes 1.0 s of processor time instead of 1.8 s in a release build. The offset of a long, low path has as many subpaths as the offset of the same path stood on end, and the area where the two differ is no larger than the refit precision times the outline's length (`offset_path_sweeps_a_long_low_path_turned_with_the_result_of_the_path_on_end`). - - Divide uses open lines, bent paths and curves as cutting edges (#1307), preserving the frontmost filled face's appearance and holes. Engine tests cover implicit closure of filled open contours and unrelated objects; native automation confirms independent piece movement, one Undo/Redo, canvas/window captures and an exact saved-document read by a separate CLI process. The shared planar map keeps a segment cap (65,536 since #937, was 4,096) and its filled-area fallback; other Pathfinder operations are unchanged. + - Divide uses open lines, bent paths and curves as cutting edges (#1307), preserving the frontmost filled face's appearance and holes. Engine tests cover implicit closure of filled open contours and unrelated objects; native automation confirms independent piece movement, one Undo/Redo, canvas/window captures and an exact saved-document read by a separate CLI process. Divide with open paths stops with an error and leaves the art unchanged when the paths are too many or too complex to map. This happens when the paths it maps, as it prepares them from the selection, have more than 65,536 segments (since #937, the cap was 4,096), have more than 131,072 pieces once cut where they meet, or exceed the sweep's work budget, which counts pairs of segments with overlapping bounds. Other Pathfinder operations are unchanged. - Type that Transform effects only move and copy (no scale, rotation, reflection or Random) exports as type in each place, and PDF export writes every copy as selectable, searchable text, when its characters are in solid colors without underline or strikethrough, the type object has no fills or strokes of its own, no inline graphics and no perspective, its transform does not scale or shear stroked characters, and the copies do not overlap. When the effect is on the type itself, the type can also have transparency, an opacity mask and raster effects. When the effect is on the group or layer holding the type, the type has no transparency or effects of its own and is not in a clipping path, the group or layer has no fill, stroke or Pathfinder effect of its own, and no group between them has a fill, stroke, Pathfinder or geometry effect. Type still exports as outlines when the effect stops its copies early, or when the copies would number more than 10,000 or take more than 20,000,000 bytes of document data, and so does other type under a geometry effect. - Extrude & Bevel and Inflate treat strokes as outlined: each visible stroke builds a solid from its outline in its own paint beside the top fill's ([three-d.md](three-d.md#fills-and-strokes)). - A 3D effect on one fill or stroke ([the help page](https://helpx.adobe.com/illustrator/using/effects.html)) leaves the object's other fills and strokes drawn with the path's or compound path's fill rule, so an even-odd compound path keeps its holes in them; this holds for Extrude & Bevel, Inflate, Rotate and Revolve, and for the Classic Extrude & Bevel, Rotate and Revolve. Tests: `solids::tests::a_fill_or_stroke_without_the_effect_keeps_the_even_odd_hole`, `revolve::tests::a_fill_without_the_revolve_keeps_the_even_odd_hole`. @@ -2106,7 +2106,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur Live Paint Make preserves the front-most covering source's fill when compound paths share a curved boundary, and Expand keeps the face fills. Regression evidence: `planar::tests::coincident_curves_keep_their_source_faces` checks source order, winding, fill rules and nearby boundaries; `tests::build::live_paint_make_and_expand_keep_abutting_compound_colors` checks native compound paths, Make, Expand and Undo/Redo. This preserves VectorCraft's source-fill rule without changing arrangement precision. Object › Live Paint › Expand keeps the faces and edges that draw on the canvas, with all their fill and stroke rows, so the expanded paths look as the painted group did ([Create Live Paint groups](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/learn-painting-basics/create-live-paint-groups.html)). As VectorCraft's own rule, a face or edge draws when it is shown, its opacity is above 0, and any of its fill or stroke rows is shown, has paint and an opacity above 0 (a stroke also needs a weight above 0), whichever row is on top: a painted lower row under an unpainted top row is kept, and a part whose only painted row is hidden is removed. Merge copies the fill and stroke rows, visibility, opacity and blending mode of each face that draws by this rule, and of each edge, to the rebuilt parts, with their gradients kept at their fit on the old outline and without the strokes' pen pressure, tilt, bearing and rotation. Evidence: `tests::build::{live_paint_expand_keeps_the_faces_and_edges_that_draw, live_paint_merge_carries_the_faces_that_draw, live_paint_merge_leaves_pen_pressure_behind, live_paint_merge_keeps_the_fit_of_carried_gradients, live_paint_merge_keeps_the_visibility_opacity_and_blending_of_carried_parts}`. `livePaint.info` lists every fill and stroke row of each face and edge, bottom first, with its paint, opacity, visibility, weight for a stroke, and whether it draws by the rule above, beside the top fill, stroke and weight it already reported. Evidence: `tests::build::live_paint_info_lists_every_appearance_row`. - Live Paint Gap Options (Object › Live Paint › Gap Options…, `livePaint.gapOptions`): with Gap Detection on, paint stops at the gaps that run from a loose end of a path to the nearest path, up to Small (3 pt), Medium (6 pt), Large (12 pt) or a custom size; Close Gaps With Paths adds an unpainted path across each gap; Preview applies the options live and draws the gaps in the Gap Preview Color. The options are saved, copied and undone with the group, and Merge keeps the bottom group's options when its Gap Detection is on, or else turns Gap Detection on with Small when another merged group has it on. When Gap Detection is off in every merged group, it stays off. + Live Paint Gap Options (Object › Live Paint › Gap Options…, `livePaint.gapOptions`): with Gap Detection on, paint stops at the gaps that run from a loose end of a path to the nearest path, up to Small (3 pt), Medium (6 pt), Large (12 pt) or a custom size; Close Gaps With Paths adds an unpainted path across each gap; Preview applies the options live and draws the gaps in the Gap Preview Color, and a preview that fails puts the groups back and stops drawing the dialog's preview of the gaps. The options are saved, copied and undone with the group, and Merge keeps the bottom group's options when its Gap Detection is on, or else turns Gap Detection on with Small when another merged group has it on. When Gap Detection is off in every merged group, it stays off. View › Show Live Paint Gaps (`view.livePaintGaps`) draws the gaps of the selected Live Paint groups up to their Paint Stops At size, each in its group's Gap Preview Color, until Hide Live Paint Gaps or Hide Edges hides them ([Live Paint gaps](https://web.archive.org/web/20260105111201/https://helpx.adobe.com/illustrator/desktop/paint-and-fill/learn-painting-basics/find-and-close-gaps-in-live-paint-groups.html)). Double-clicking the Live Paint Selection tool opens its Tool Options ([Live Paint Selection tool options](https://web.archive.org/web/20250904012025/https://helpx.adobe.com/illustrator/using/selecting-objects.html)): with Select Fills off, a click selects an edge instead of a face; with Select Strokes off, Alt-click selects a face instead of an edge; Color and Width set the color and width of the highlight on the face or edge under the pointer (red and 4 px by default). The options last across tool switches and are saved with the preferences (`tool.setOption {tool: "livePaintSelection"}`). As VectorCraft's own rule, OK in Live Paint Selection Tool Options, Live Paint Bucket Options, Gap Options and Tile Edge Color gives an error for a color with an alpha part (`#rrggbbaa` or `#rgba`) and changes nothing. From 68a104ba8f2305839a3f1dd278fb3ef41152f4d5 Mon Sep 17 00:00:00 2001 From: Ruchir <113586074+ruchirguitar@users.noreply.github.com> Date: Tue, 1 Dec 2026 23:00:18 +0530 Subject: [PATCH 052/112] Add item context menus to resource library panels --- crates/ui-egui/src/panels/library_panel.rs | 14 ++++++-- .../ui-egui/src/panels/library_panel/tests.rs | 36 +++++++++++++++++++ docs/ui-parity.md | 1 + 3 files changed, 48 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/panels/library_panel.rs b/crates/ui-egui/src/panels/library_panel.rs index e9fc506ec0..1cd5502a2b 100644 --- a/crates/ui-egui/src/panels/library_panel.rs +++ b/crates/ui-egui/src/panels/library_panel.rs @@ -22,7 +22,7 @@ use std::collections::HashMap; use craft::behavior::{IconId, Selection, SelectionModel}; use craft::host::PickRequest; use craft::theme::variant::Tone; -use craft::ui::contract::{Bind, MemoKey, MemoProps, SelectMode, Show as _, ShowContainer as _, Trigger}; +use craft::ui::contract::{Bind, Entry, MemoKey, MemoProps, SelectMode, Show as _, ShowContainer as _, Trigger}; use craft::ui::menu::{Menu, MenuItem, PanelRow}; use craft::ui::notices::{Notice, NoticeAction, NoticeLayout}; use craft::ui::patterns::presets::{ @@ -675,7 +675,8 @@ fn body<K: LibraryKind>(app: &mut VectorcraftApp, ui: &mut Ui, id: &str) { let title = library_name(id, &name).to_string(); // The footer stays under the browser, which scrolls in the room left above it. let footer_out = RefCell::new(None); - let any = !selection.items.is_empty() && can_add(app, K::KIND); + let can_add = can_add(app, K::KIND); + let any = !selection.items.is_empty() && can_add; let mut shown = Panel::new(title.clone()) .collection_body() .footer(|ui, _| *footer_out.borrow_mut() = Some(footer_bar::<K>(any).show_footer(ui))) @@ -686,7 +687,9 @@ fn body<K: LibraryKind>(app: &mut VectorcraftApp, ui: &mut Ui, id: &str) { .select(SelectMode::Multi) .selection(Bind::given(selection.clone())) .empty(tl!("This library is empty.")) - .row_menu(PresetRowMenu::Off) + .row_menu(PresetRowMenu::Host) + .row_items(move |_: &LibraryKey| vec![Entry::new("ui.libraryPanel.add".to_owned(), K::ADD).enabled(can_add)]) + .host_version(u64::from(can_add)) .drags(K::drags()) .show(ui) }); @@ -696,6 +699,11 @@ fn body<K: LibraryKind>(app: &mut VectorcraftApp, ui: &mut Ui, id: &str) { for event in events { match event { PresetEvent::Selection(change) => chosen.apply(change), + PresetEvent::Menu { target, command, .. } if command == "ui.libraryPanel.add" && can_add => { + let names = + if chosen.items.contains(&target) { chosen.items.iter().map(|key| key.name.clone()).collect() } else { vec![target.name] }; + K::add(app, id, names); + } // A plain click on an item also adds and applies it; folders and modifier clicks only select. PresetEvent::Select { key, mods, .. } if !key.folder && !mods.shift && !mods.cmd => clicked = Some(key.name), _ => {} diff --git a/crates/ui-egui/src/panels/library_panel/tests.rs b/crates/ui-egui/src/panels/library_panel/tests.rs index a08ea664f8..58b0effd84 100644 --- a/crates/ui-egui/src/panels/library_panel/tests.rs +++ b/crates/ui-egui/src/panels/library_panel/tests.rs @@ -182,6 +182,42 @@ fn modifier_clicks_select_and_add_to_swatches_adds_the_selection() { assert!(selected_names(&app, "library:swatches:brights").is_empty()); } +#[test] +fn library_item_menu_adds_the_target_or_its_selection_without_applying_paint() { + for view in ["smallList", "smallThumb"] { + for target in ["Clay 1", "Clay 3"] { + let mut app = app(); + let ctx = context(); + app.run("window.swatchLibrary", json!({"library": "earth-tones"})).unwrap(); + let panel = shown(&app); + app.run("ui.libraryPanel", json!({"panel": panel, "view": view})).unwrap(); + click(&mut app, &ctx, "Clay 1", Modifiers::COMMAND, 0.0); + click(&mut app, &ctx, "Clay 2", Modifiers::COMMAND, 1.0); + let paint = app.session.paint.fill.clone(); + let undo = undo_len(&app); + let draw = |app: &mut VectorcraftApp, ui: &mut Ui| show(app, ui, &panel); + let (_, at) = control(&mut app, &ctx, &draw, target); + let button = |pressed| Event::PointerButton { pos: at, button: PointerButton::Secondary, pressed, modifiers: Modifiers::NONE }; + draw_frame(&mut app, &ctx, &draw, vec![Event::PointerMoved(at)]); + draw_frame(&mut app, &ctx, &draw, vec![button(true)]); + draw_frame(&mut app, &ctx, &draw, vec![button(false)]); + draw_frame(&mut app, &ctx, &draw, vec![]); + let out = draw_frame(&mut app, &ctx, &draw, vec![]); + let nodes = &out.platform_output.accesskit_update.as_ref().unwrap().nodes; + let (_, row) = nodes.iter().find(|(_, n)| n.role() == egui::accesskit::Role::MenuItem && n.label() == Some("Add to Swatches")).unwrap(); + let bounds = row.bounds().unwrap(); + assert_eq!(undo_len(&app), undo, "opening the item menu must not edit the drawing"); + let expected = if target == "Clay 1" { vec!["Clay 1", "Clay 2"] } else { vec!["Clay 3"] }; + assert_eq!(selected_names(&app, &panel), expected); + click_at(&mut app, &ctx, &draw, Pos2::new((bounds.x0 + bounds.x1) as f32 * 0.5, (bounds.y0 + bounds.y1) as f32 * 0.5)); + for name in ["Clay 1", "Clay 2", "Clay 3"] { + assert_eq!(app.session.doc().unwrap().doc.swatch(name).is_some(), expected.contains(&name), "{view}: {target}: {name}"); + } + assert_eq!(app.session.paint.fill, paint); + } + } +} + #[test] fn adding_selected_library_items_requires_an_open_drawing() { let mut app = app(); diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 8bb6c7b87a..775f91c648 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -526,6 +526,7 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po | Make Compound Path on a group (such as outlined type) keeps its backmost path's paint; compound paths joined into one keep their holes | done | #1537 | | Symbol libraries: Window › Symbol Libraries (Basic Shapes, UI Frames, Map Markers, Inventory Icons, Skill Icons, User Defined, Other Library…, Save Symbols…) and the Symbols panel's Symbol Libraries Menu button and its menu's Open Symbol Library / Save Symbol Library…; a click on a library symbol adds it to the document's Symbols (one undo step, it becomes the current symbol), Shift/Cmd-clicks select for Add to Symbols, and a symbol dragged onto the canvas is added and placed where it is dropped | done | [public source](https://helpx.adobe.com/illustrator/desktop/manage-objects/traces-mockups-symbols/create-or-import-symbol-libraries.html), [Symbols panel options](https://helpx.adobe.com/illustrator/desktop/manage-objects/traces-mockups-symbols/symbols-panel-options.html), [placing from a library](https://helpx.adobe.com/illustrator/desktop/manage-objects/traces-mockups-symbols/create-and-place-symbols.html); `window.symbolLibrary`, `window.symbolLibrary.other`, `ui.saveSymbolLibrary` (dialog `saveSymbolLibrary`), `window.userSymbolLibrary1`…`10`; `panels::tests_symbol_libraries`; five built-in libraries (Basic Shapes, UI Frames with default 9-slice, Map Markers, Inventory Icons, Skill Icons; original, generated in code) | | Brush libraries: Window › Brush Libraries (Art Ribbons, Ink and Wash, Calligraphic Nibs, Pressure Sensitive, Bristle Brushes, Pattern Borders, Decorative, Scatter Shapes, Stipple, Game Trails, Energy Beams, Dry Media, Tech Circuit, Engraving, Arrows, User Defined, Other Library…, Save Brushes…) and the Brushes panel's Brush Libraries Menu button and its menu's Open Brush Library / Save Brush Library…; a click on a library brush adds it to the document's Brushes (one undo step, it becomes the current brush, and selected paths take it in the same step), Shift/Cmd-clicks select for Add to Brushes, a brush dragged onto a path is added and applied to it and one dragged onto the Brushes panel is added; thumbnails render with the library's patterns and symbols | done | [public source](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/create-new-brush-libraries.html), [import brushes](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/import-brushes-from-brush-libraries-or-other-files.html), [Brushes panel overview](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/brushes-panel-overview.html); `window.brushLibrary`, `window.brushLibrary.other`, `ui.saveBrushLibrary` (dialog `saveBrushLibrary`), `window.userBrushLibrary1`…`10`; `panels::tests_brush_libraries`; fifteen built-in libraries (original, generated in code) | +| Swatch, Brush, Symbol and Graphic Style Library item menus | done | In list and thumbnail views, the item menu offers the same Add to action as the footer. It adds the current selection when the target is selected or the target alone otherwise. The action requires an open drawing. | | Brushes panel menu › Options of Selected Object…: changes the selected brushed paths' brush settings on those paths only, leaving the brush and its other strokes as they are; the brush type's options dialog opens without the Name row (and without an art brush's scale and direction options or a pattern brush's tiles), and OK sends only the values changed in it | done | [Modify brushes](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/modify-brushes.html), [Brushes panel overview](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/brushes-panel-overview.html); `brush.objectOptions`, `ui.brushObjectOptions`; which fields a path can set is VectorCraft's own choice (calligraphic, scatter, art and pattern brushes; not bristle); `options_of_selected_object_*` tests in `crates/engine/src/tests/brushsym.rs` and `crates/ui-egui/src/dialogs/brush_options/tests.rs`, brush tests in `crates/brush/src/tests.rs` | | Symbols panel: New Symbol opens Symbol Options (Name) before making the symbol; Alt-click skips it | partial | #1560 (#1566); Registration 9-point grid in Symbol Options (`symbol.new` / `symbol.place`); Export Type (Graphic / Movie Clip) and Enable Guides for 9-Slice Scaling (scaled instances keep their corners; in symbol editing mode the guides are drawn over the art and the Selection tool drags them); Symbol Type (Dynamic Symbol / Static Symbol, new symbols dynamic; #4938); Align to Pixel Grid (`alignToPixelGrid` on `symbol.new` / `symbol.options`: the art snaps at the symbol's natural size and instances at that size stay on whole points; [Aligning symbols to pixel grid](https://web.archive.org/web/20220911143322/https://helpx.adobe.com/pdf/cs6/illustrator_reference.pdf#page=28)) | | Dynamic symbols: an instance changes the fill, stroke, opacity and blend of objects in its symbol's art and stays linked; Reset in the Properties panel's Quick Actions and the Symbols panel menu (Reset Symbol Instance) | partial | #4938; `symbol.instance.setAppearance` (by child-index path) and `symbol.instance.reset`; redefining keeps the changes, Break Link bakes them; Direct Selection of a path, compound path or type object inside an instance, with the Fill/Stroke controls setting its fill or stroke (solid, gradient or pattern) and the Transparency panel setting its opacity and blend, is on canvas (#6308); `.ai` editing data keeps dynamic symbols and their instance changes when VectorCraft writes and reads it (#8747); on-canvas editing beyond fill, stroke, opacity and blend, and reading other apps' dynamic symbol records, remain | From c2cf867f1da26aa5c7849ab3feaf4012fc2116f3 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 09:46:40 -0800 Subject: [PATCH 053/112] Type: Make Numbers Sequence leaves locked type and masks alone and replaces signed numbers Locked or hidden type inside a selected group is no longer numbered or deleted, and removeUnused keeps a type object that masks a clipping group or layer and keeps the selection instead of selecting the numbered objects. In Numbers mode a minus sign that does not follow a letter is part of the number, and a number or placeholder that already reads the new number keeps its text and style. Rows and columns are found among the objects that get a number, with the true median for an even count. A run that would replace more than 10,000 numbers or placeholders is refused before any text is built, and a seed that is not a whole number is refused even with shuffle off. ui.menuDialog lists the dialog, and the progress doc has its line. --- crates/engine/src/cmd/addons/typetools.rs | 2 +- .../src/cmd/addons/typetools/numbers.rs | 73 ++++++++++---- .../src/cmd/addons/typetools/numbers/tests.rs | 98 +++++++++++++++++++ crates/mcp/src/ui_catalog.rs | 2 +- crates/ui-egui/src/menus/ui_commands.rs | 2 +- docs/mcp.md | 15 ++- docs/target-app-parity.md | 4 + 7 files changed, 167 insertions(+), 29 deletions(-) diff --git a/crates/engine/src/cmd/addons/typetools.rs b/crates/engine/src/cmd/addons/typetools.rs index 30ad06f8b0..e8e512a448 100644 --- a/crates/engine/src/cmd/addons/typetools.rs +++ b/crates/engine/src/cmd/addons/typetools.rs @@ -71,7 +71,7 @@ pub fn specs() -> Vec<CommandSpec> { "Make Numbers Sequence…", ["Object", "Plug-ins", "Type Tools"], None, - "{start?: number (1), step?: number (1; its sign is set to run toward `end`; 0: every object gets `start`), end?: number (omitted: the numbers run to the last type object; given: they stop past `end`, and the objects after the last number keep their text), order?: \"stacking\" (stacking order, from the back) | \"rows\" (top to bottom, each row left to right) | \"columns\" (left to right, each column top to bottom) (\"stacking\"; rows and columns group objects whose centers are within half the median height or width), replace?: \"all\" (the whole text) | \"numbers\" (every number in the text: digits, with any `.` or `,` between digits) | \"placeholder\" (every {%n}, in any case) (\"all\"; with numbers or placeholder, objects that hold none are skipped and get no number), shuffle?: false (true: the numbers go to the objects in random order, and order is not used), seed?: whole number (0; the same seed gives the same order), leadingZeros?: true (non-negative numbers are padded with zeros to the whole digits of the widest of start and end, or of the last number), digits?: 1..30 (with leadingZeros, at least this many whole digits), trailingZeros?: false (true: every number gets as many decimal places as the one with the most), removeUnused?: false (true, with end: the objects left without a number are deleted), ids?: [id…], id? (instead of ids; neither: the selection)} number the type objects among the objects (inside groups too), as one undo step. A frame of threaded type among them is an error. Values are -1e12..1e12, rounded to the most decimal places among start, step and end (at most 6). Replaced text takes the style of the text it replaces. Objects that already read so are left as they are, and when nothing changes no undo step is made → {count (objects changed), ids (numbered, in order), removed}", + "{start?: number (1), step?: number (1; its sign is set to run toward `end`; 0: every object gets `start`), end?: number (omitted: the numbers run to the last type object; given: they stop past `end`, and the objects after the last number keep their text), order?: \"stacking\" (stacking order, from the back) | \"rows\" (top to bottom, each row left to right) | \"columns\" (left to right, each column top to bottom) (\"stacking\"; rows and columns group objects whose centers are within half the median height or width), replace?: \"all\" (the whole text) | \"numbers\" (every number in the text: digits, with any `.` or `,` between digits and a `-` before them that does not follow a letter or digit) | \"placeholder\" (every {%n}, in any case) (\"all\"; with numbers or placeholder, objects that hold none are skipped, get no number and order leaves them out; the remaining objects are ordered before end limits the sequence, so objects past end still count for rows and columns; at most 10000 numbers or placeholders are replaced in one run (matches that already read their number do not count); more is an error), shuffle?: false (true: the numbers go to the objects in random order, and order is not used), seed?: whole number (0; the same seed gives the same order; checked even with shuffle off), leadingZeros?: true (non-negative numbers are padded with zeros to the whole digits of the widest of start and end, or of the last number), digits?: 1..30 (with leadingZeros, at least this many whole digits), trailingZeros?: false (true: every number gets as many decimal places as the one with the most), removeUnused?: false (true, with end: the objects left without a number are deleted, except a clipping mask), ids?: [id…], id? (instead of ids; neither: the selection)} number the type objects among the objects (inside groups too), as one undo step. Locked or hidden type is left alone. A frame of threaded type among them is an error. Values are -1e12..1e12, rounded to the most decimal places among start, step and end (at most 6). Replaced text takes the style of the text it replaces, and a match that already reads its number keeps its style. Objects that already read so are left as they are, and when nothing changes no undo step is made → {count (objects changed), ids (numbered, in order), removed}", has_selection, numbers::make_numbers ), diff --git a/crates/engine/src/cmd/addons/typetools/numbers.rs b/crates/engine/src/cmd/addons/typetools/numbers.rs index 770820f488..c83c306496 100644 --- a/crates/engine/src/cmd/addons/typetools/numbers.rs +++ b/crates/engine/src/cmd/addons/typetools/numbers.rs @@ -13,6 +13,7 @@ use vectorcraft_doc::{NodeId, NodeKind}; use vectorcraft_geom::Rect; use vectorcraft_render::effects; use vectorcraft_text::edit; +use vectorcraft_text::retype::is_combining_mark; use super::super::super::menucmds::whole_or; use super::super::super::object::choice; @@ -39,6 +40,8 @@ const MAX_DECIMALS: usize = 6; pub const MAX_DIGITS: u64 = 30; /// The most type objects one run numbers. const MAX_TEXTS: usize = 100_000; +/// The most numbers or placeholders one run replaces. +pub(crate) const MAX_MATCHES: usize = 10_000; /// What one run does, read from its params. #[derive(Debug, Clone, PartialEq)] @@ -76,7 +79,8 @@ impl Options { }; let order = pick(choice(p, C, "order", &ORDERS)?.unwrap_or("stacking"), &ORDERS); let replace = pick(choice(p, C, "replace", &REPLACES)?.unwrap_or("all"), &REPLACES); - let shuffle = if switch_or(p, "shuffle", false, C)? { Some(whole_or(p, "seed", 0, C)?) } else { None }; + let seed = whole_or(p, "seed", 0, C)?; + let shuffle = if switch_or(p, "shuffle", false, C)? { Some(seed) } else { None }; let digits = match p.get("digits") { None | Some(Value::Null) => None, Some(_) => { @@ -197,7 +201,7 @@ pub(crate) fn sequence(o: &Options, count: usize) -> Vec<String> { } /// The byte ranges of `text` a number replaces: each run of ASCII digits, with any `.` or `,` -/// followed by more digits inside it. +/// followed by more digits inside it, and a `-` before it that does not follow a letter or digit. pub(crate) fn number_spans(text: &str) -> Vec<(usize, usize)> { let b = text.as_bytes(); let mut out = vec![]; @@ -207,7 +211,8 @@ pub(crate) fn number_spans(text: &str) -> Vec<(usize, usize)> { i += 1; continue; } - let start = i; + let signed = i > 0 && b[i - 1] == b'-' && !text[..i - 1].chars().rev().find(|c| !is_combining_mark(*c)).is_some_and(char::is_alphanumeric); + let start = if signed { i - 1 } else { i }; while i < b.len() && b[i].is_ascii_digit() { i += 1; } @@ -236,7 +241,13 @@ fn by_position(ids: Vec<(NodeId, Rect)>, rows: bool) -> Vec<NodeId> { let across = |r: &Rect| if rows { r.center().x } else { r.center().y }; let mut sizes: Vec<f64> = ids.iter().map(|(_, r)| if rows { r.height() } else { r.width() }).collect(); sizes.sort_by(f64::total_cmp); - let tolerance = if ids.len() < 2 { 0.0 } else { sizes[sizes.len() / 2] / 2.0 }; + let n = sizes.len(); + let median = match n { + 0 | 1 => 0.0, + _ if n.is_multiple_of(2) => (sizes[n / 2 - 1] + sizes[n / 2]) / 2.0, + _ => sizes[n / 2], + }; + let tolerance = median / 2.0; let mut ids = ids; ids.sort_by(|a, b| along(&a.1).total_cmp(&along(&b.1))); let mut out = Vec::with_capacity(ids.len()); @@ -256,9 +267,10 @@ fn by_position(ids: Vec<(NodeId, Rect)>, rows: bool) -> Vec<NodeId> { /// One replacement in a text: its start and end bytes and the number that goes there. type Edit = (usize, usize, String); -/// Each span of `spans` replaced by `number`, as edits from the last to the first. -fn edits(spans: Vec<(usize, usize)>, number: &str) -> Vec<Edit> { - spans.into_iter().rev().map(|(a, b)| (a, b, number.to_string())).collect() +/// Each span of `spans` in `text` replaced by `number`, as edits from the last to the first. A +/// span that already reads `number` is left out, so its formatting stays. +pub(crate) fn edits(text: &str, spans: Vec<(usize, usize)>, number: &str) -> Vec<Edit> { + spans.into_iter().rev().filter(|(a, b)| text.get(*a..*b) != Some(number)).map(|(a, b)| (a, b, number.to_string())).collect() } pub(crate) fn make_numbers(s: &mut Session, p: &Value) -> Result<Value> { @@ -269,8 +281,12 @@ pub(crate) fn make_numbers(s: &mut Session, p: &Value) -> Result<Value> { if let Some(id) = named.iter().find(|id| d.node(**id).is_none()) { return Err(EngineError::NoNode(*id)); } - // Type objects, groups' included, in stacking order from the back. + // Type objects, groups' included, in stacking order from the back; locked or hidden ones stay. let mut texts = text_ids(d, &named); + { + let editable = d.editable(); + texts.retain(|id| editable(*id)); + } let paths = d.index_paths(texts.iter().copied()); texts.sort_by(|a, b| paths.get(a).cmp(&paths.get(b))); if texts.len() > MAX_TEXTS { @@ -284,14 +300,7 @@ pub(crate) fn make_numbers(s: &mut Session, p: &Value) -> Result<Value> { Some(NodeKind::Text(t)) => t.plain_text(), _ => String::new(), }; - if o.order != "stacking" && o.shuffle.is_none() { - let placed: Vec<(NodeId, Rect)> = texts - .iter() - .map(|id| (*id, effects::preview::bounds_of(d, &[*id], false).unwrap_or(Rect::new(f64::MAX, f64::MAX, f64::MAX, f64::MAX)))) - .collect(); - texts = by_position(placed, o.order == "rows"); - } - // Only objects that hold a number or the placeholder count. + // Only objects that hold a number or the placeholder count, for the order too. let mut texts: Vec<(NodeId, String)> = texts .into_iter() .map(|id| (id, plain(id))) @@ -301,6 +310,14 @@ pub(crate) fn make_numbers(s: &mut Session, p: &Value) -> Result<Value> { _ => true, }) .collect(); + if o.order != "stacking" && o.shuffle.is_none() { + let placed: Vec<(NodeId, Rect)> = texts + .iter() + .map(|(id, _)| (*id, effects::preview::bounds_of(d, &[*id], false).unwrap_or(Rect::new(f64::MAX, f64::MAX, f64::MAX, f64::MAX)))) + .collect(); + let mut by_id: std::collections::HashMap<NodeId, String> = texts.into_iter().collect(); + texts = by_position(placed, o.order == "rows").into_iter().filter_map(|id| by_id.remove(&id).map(|t| (id, t))).collect(); + } // The objects are shuffled, not the numbers, so an end limit can number any of them. if let Some(seed) = o.shuffle { let mut rng = Rng::new(seed); @@ -311,10 +328,20 @@ pub(crate) fn make_numbers(s: &mut Session, p: &Value) -> Result<Value> { } let numbers = sequence(&o, texts.len()); let mut plans: Vec<(NodeId, Vec<Edit>)> = vec![]; + let mut matches = 0; for ((id, text), number) in texts.iter().zip(&numbers) { + let spans = match o.replace { + "numbers" => number_spans(text), + "placeholder" => placeholder_spans(text), + _ => vec![], + }; + // Checked before any replacement text is made. + matches += spans.iter().filter(|(a, b)| text.get(*a..*b) != Some(number.as_str())).count(); + if matches > MAX_MATCHES { + return Err(bad(C, format!("too many numbers or placeholders to replace: at most {MAX_MATCHES}"))); + } let changes = match o.replace { - "numbers" => edits(number_spans(text), number), - "placeholder" => edits(placeholder_spans(text), number), + "numbers" | "placeholder" => edits(text, spans, number), _ => vec![(0, text.len(), number.clone())], }; // The text it would have, to leave out objects that already read so. @@ -327,12 +354,16 @@ pub(crate) fn make_numbers(s: &mut Session, p: &Value) -> Result<Value> { } } let numbered: Vec<u64> = texts.iter().take(numbers.len()).map(|(id, _)| id.0).collect(); - let removed: Vec<NodeId> = if o.remove_unused { texts.iter().skip(numbers.len()).map(|(id, _)| *id).collect() } else { vec![] }; + // A clipping group's or layer's mask is its first child; removing it would make the next child the mask. + let mask = |id: NodeId| { + d.parent_of(id).and_then(|g| d.node(g)).is_some_and(|g| g.clips() && g.children().and_then(|c| c.first()).is_some_and(|c| c.id == id)) + }; + let removed: Vec<NodeId> = + if o.remove_unused { texts.iter().skip(numbers.len()).map(|(id, _)| *id).filter(|id| !mask(*id)).collect() } else { vec![] }; if plans.is_empty() && removed.is_empty() { return Ok(json!({ "count": 0, "ids": numbered, "removed": [] })); } let count = plans.len(); - let kept: Vec<NodeId> = numbered.iter().map(|n| NodeId(*n)).collect(); s.edit("Make Numbers Sequence", |d, sel| { for (id, changes) in &plans { let t = text_mut(d, *id).ok_or(EngineError::NoNode(*id))?; @@ -345,7 +376,7 @@ pub(crate) fn make_numbers(s: &mut Session, p: &Value) -> Result<Value> { } d.remove_many(&removed)?; if !removed.is_empty() { - sel.set(kept.iter().copied()); + sel.remove_all(removed.iter().copied()); } Ok(()) })?; diff --git a/crates/engine/src/cmd/addons/typetools/numbers/tests.rs b/crates/engine/src/cmd/addons/typetools/numbers/tests.rs index 9dcc095170..148ce58423 100644 --- a/crates/engine/src/cmd/addons/typetools/numbers/tests.rs +++ b/crates/engine/src/cmd/addons/typetools/numbers/tests.rs @@ -201,6 +201,103 @@ fn shuffle_with_an_end_can_number_any_object() { assert_eq!(numbered, [true; 6], "every object is numbered for some seed"); } +fn group_of(s: &mut Session, ids: &[NodeId]) -> NodeId { + s.execute("select.set", &json!({"ids": ids.iter().map(|id| id.0).collect::<Vec<_>>()})).unwrap(); + s.execute("object.group", &json!({})).unwrap(); + s.doc().unwrap().doc.parent_of(ids[0]).unwrap() +} + +#[test] +fn a_negative_number_in_the_text_is_replaced_with_its_sign() { + assert_eq!(number_spans("Seat -4, A-4"), [(5, 7), (11, 12)], "a hyphen after a letter is not a sign"); + assert_eq!(number_spans("É-4"), [(3, 4)], "nor after a letter outside ASCII"); + assert_eq!(number_spans("E\u{301}-4"), [(4, 5)], "nor after a letter with a combining mark"); + assert_eq!(number_spans("क्-4"), [(7, 8)], "nor after a letter with a virama"); + let mut s = session(); + let a = text_at(&mut s, 40.0, 100.0, "Seat -4"); + let b = text_at(&mut s, 40.0, 140.0, "Seat 9"); + s.execute(C, &json!({"ids": [a.0, b.0], "replace": "numbers", "start": 2, "step": -3})).unwrap(); + assert_eq!([plain(&s, a), plain(&s, b)], ["Seat 2", "Seat -1"]); +} + +#[test] +fn a_match_that_already_reads_the_number_is_not_edited() { + let text = "5 and 4"; + assert_eq!(super::edits(text, number_spans(text), "5"), [(6, 7, "5".to_string())]); +} + +#[test] +fn too_many_matches_in_one_run_are_refused() { + let mut unchanged = session(); + let text = vec!["1"; super::MAX_MATCHES + 1].join(" "); + let id = text_at(&mut unchanged, 40.0, 100.0, &text); + let before = steps(&unchanged); + let out = unchanged.execute(C, &json!({"ids": [id.0], "start": 1, "replace": "numbers"})).unwrap(); + assert_eq!(out["count"], 0); + assert_eq!(plain(&unchanged, id), text); + assert_eq!(steps(&unchanged), before); + + let mut s = session(); + let a = text_at(&mut s, 40.0, 100.0, &"{%n}".repeat(super::MAX_MATCHES + 1)); + let n = steps(&s); + assert!(s.execute(C, &json!({"ids": [a.0], "replace": "placeholder"})).is_err()); + assert_eq!(steps(&s), n); + // Whole texts are not matches: the object limit covers them. + s.execute("edit.undo", &json!({})).unwrap(); + text_at(&mut s, 40.0, 140.0, "x"); + // Each duplicate of the whole selection doubles it: 2^14 objects in 14 steps. + for _ in 0..14 { + s.execute("edit.duplicate", &json!({})).unwrap(); + s.execute("select.all", &json!({})).unwrap(); + } + let count = s.doc().unwrap().selection.objects.len(); + assert!(count > super::MAX_MATCHES, "{count} objects"); + let out = s.execute(C, &json!({"step": 0})); + assert!(out.is_ok()); + let out = out.unwrap(); + assert!(out["count"].as_u64().unwrap() > super::MAX_MATCHES as u64); +} + +#[test] +fn locked_and_hidden_type_in_a_group_is_left_alone() { + let mut s = session(); + let ids: Vec<NodeId> = (0..3).map(|i| text_at(&mut s, 40.0, 100.0 + 40.0 * f64::from(i), "x")).collect(); + let group = group_of(&mut s, &ids); + s.execute("object.setProps", &json!({"ids": [ids[1].0], "locked": true})).unwrap(); + s.execute("object.setProps", &json!({"ids": [ids[2].0], "visible": false})).unwrap(); + let out = s.execute(C, &json!({"ids": [group.0], "end": 1, "removeUnused": true})).unwrap(); + assert_eq!(out["removed"], json!([])); + assert_eq!(ids.iter().map(|id| plain(&s, *id)).collect::<Vec<_>>(), ["1", "x", "x"]); +} + +#[test] +fn removing_unused_type_keeps_a_clipping_mask_and_the_selection() { + let mut s = session(); + let a = text_at(&mut s, 40.0, 100.0, "x"); + let b = text_at(&mut s, 40.0, 140.0, "x"); + // The top object becomes the mask; it sits lowest on the page, so rows number it last. + let mask = text_at(&mut s, 40.0, 300.0, "x"); + s.execute("select.set", &json!({"ids": [a.0, b.0, mask.0]})).unwrap(); + s.execute("object.clippingMask.make", &json!({})).unwrap(); + let group = s.doc().unwrap().doc.parent_of(mask).unwrap(); + s.execute("select.set", &json!({"ids": [group.0]})).unwrap(); + let out = s.execute(C, &json!({"order": "rows", "end": 1, "removeUnused": true})).unwrap(); + assert_eq!(out["removed"], json!([b.0]), "the mask stays"); + assert!(s.doc().unwrap().doc.node(mask).is_some()); + assert_eq!(s.doc().unwrap().selection.objects, [group], "the group stays selected"); +} + +#[test] +fn rows_are_found_among_the_type_that_gets_numbers() { + let mut s = session(); + let upper = text_at(&mut s, 300.0, 100.0, "1"); + let lower = text_at(&mut s, 40.0, 135.0, "1"); + let h1 = NodeId(s.execute("text.create", &json!({"x": 40, "y": 400, "text": "Title", "size": 200})).unwrap()["id"].as_u64().unwrap()); + let h2 = NodeId(s.execute("text.create", &json!({"x": 40, "y": 700, "text": "Title", "size": 200})).unwrap()["id"].as_u64().unwrap()); + s.execute(C, &json!({"ids": [upper.0, lower.0, h1.0, h2.0], "replace": "numbers", "order": "rows", "start": 1, "leadingZeros": false})).unwrap(); + assert_eq!([plain(&s, upper), plain(&s, lower)], ["1", "2"], "headings without numbers do not merge the rows"); +} + #[test] fn a_run_that_changes_nothing_makes_no_step_and_bad_params_fail() { let mut s = session(); @@ -215,6 +312,7 @@ fn a_run_that_changes_nothing_makes_no_step_and_bad_params_fail() { json!({"ids": [a.0], "digits": 0}), json!({"ids": [a.0], "removeUnused": true}), json!({"ids": [a.0], "shuffle": "yes"}), + json!({"ids": [a.0], "seed": "x"}), ] { assert!(s.execute(C, &p).is_err(), "{p} fails"); } diff --git a/crates/mcp/src/ui_catalog.rs b/crates/mcp/src/ui_catalog.rs index b29f22395c..cc3278f30e 100644 --- a/crates/mcp/src/ui_catalog.rs +++ b/crates/mcp/src/ui_catalog.rs @@ -1531,7 +1531,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "ui.menuDialog", "Menu Dialog", "", - "{command: object.move|object.rotate|object.scale|object.reflect|object.shear|object.transformEach|path.average|path.averageJoin|object.path.offsetPath|object.path.simplify|object.path.smooth|object.path.splitIntoGrid|object.vectorHalftone|object.stepAndRepeat|artboard.rearrange|artboard.rename|object.envelope.makeWithWarp|object.envelope.resetWithWarp|object.envelope.makeWithMesh|object.envelope.resetWithMesh|object.envelope.options|addon.arrange.grid|addon.arrange.offset|addon.arrange.replace|addon.arrange.size|addon.arrange.match|addon.arrange.groupRows|addon.packaging.setFoldAngle|addon.pathtools.cornerSet|addon.pathtools.divideDashes|addon.pathtools.bridge|addon.pathtools.tangentCircle|addon.type.textTweaker|addon.color.swatchLegend|addon.arrange.randomizeOpacity|addon.arrange.sort|addon.arrange.markBounds|addon.color.applyNearestSwatch|addon.color.randomFill|addon.select.byArtboards|addon.select.editPointsOnly|type.smartPunctuation|variable.define|variable.rename|variable.bind|dataset.new|dataset.set|dataset.rename|dataset.select} open the dialog that command's menu item opens (its `key` in ui.inspect is the command id, except `transformEach` for object.transformEach, `envelopeWarp` for object.envelope.makeWithWarp and object.envelope.resetWithWarp, `envelopeMesh` for object.envelope.makeWithMesh and object.envelope.resetWithMesh, `variables` for variable.define and variable.rename and variable.bind and dataset.new and dataset.set and dataset.rename and dataset.select, `envelopeOptions` for object.envelope.options, `smoothSlider` for object.path.smooth, and `simplifySlider` for object.path.simplify; the dialogs of addon.color.applyNearestSwatch and addon.select.byArtboards have no `key`; smoothSlider and simplifySlider are the sliders over the canvas, with field `level`, and object.path.simplify opens its dialog `object.path.simplify` instead once OK in that dialog keeps the settings (`retain`); Set Fold Angle's `angle` is the selected fold lines' angle, and it is refused while the selection has no fold line it can change; Scale and Transform Each have `corners` and `strokes`, from the preferences, which OK updates; Transform Each opens on the values it was last confirmed with (not `copy`), and its Copy button confirms with `copy: true`; the envelope dialogs start from the selected envelope, Make opens as Reset (`reset: true`) while one is selected; variable.rename opens only while the document has a variable, and dataset.set and dataset.rename only while it has a data set, and otherwise the status bar says why; ui.dialog.set, ui.dialog.confirm and ui.dialog.cancel take the dialog's `id` from ui.inspect, or `top`, not its `key`)", + "{command: object.move|object.rotate|object.scale|object.reflect|object.shear|object.transformEach|path.average|path.averageJoin|object.path.offsetPath|object.path.simplify|object.path.smooth|object.path.splitIntoGrid|object.vectorHalftone|object.stepAndRepeat|artboard.rearrange|artboard.rename|object.envelope.makeWithWarp|object.envelope.resetWithWarp|object.envelope.makeWithMesh|object.envelope.resetWithMesh|object.envelope.options|addon.arrange.grid|addon.arrange.offset|addon.arrange.replace|addon.arrange.size|addon.arrange.match|addon.arrange.groupRows|addon.packaging.setFoldAngle|addon.pathtools.cornerSet|addon.pathtools.divideDashes|addon.pathtools.bridge|addon.pathtools.tangentCircle|addon.type.textTweaker|addon.type.numbers|addon.color.swatchLegend|addon.arrange.randomizeOpacity|addon.arrange.sort|addon.arrange.markBounds|addon.color.applyNearestSwatch|addon.color.randomFill|addon.select.byArtboards|addon.select.editPointsOnly|type.smartPunctuation|variable.define|variable.rename|variable.bind|dataset.new|dataset.set|dataset.rename|dataset.select} open the dialog that command's menu item opens (its `key` in ui.inspect is the command id, except `transformEach` for object.transformEach, `envelopeWarp` for object.envelope.makeWithWarp and object.envelope.resetWithWarp, `envelopeMesh` for object.envelope.makeWithMesh and object.envelope.resetWithMesh, `variables` for variable.define and variable.rename and variable.bind and dataset.new and dataset.set and dataset.rename and dataset.select, `envelopeOptions` for object.envelope.options, `smoothSlider` for object.path.smooth, and `simplifySlider` for object.path.simplify; the dialogs of addon.color.applyNearestSwatch and addon.select.byArtboards have no `key`; smoothSlider and simplifySlider are the sliders over the canvas, with field `level`, and object.path.simplify opens its dialog `object.path.simplify` instead once OK in that dialog keeps the settings (`retain`); Set Fold Angle's `angle` is the selected fold lines' angle, and it is refused while the selection has no fold line it can change; Scale and Transform Each have `corners` and `strokes`, from the preferences, which OK updates; Transform Each opens on the values it was last confirmed with (not `copy`), and its Copy button confirms with `copy: true`; the envelope dialogs start from the selected envelope, Make opens as Reset (`reset: true`) while one is selected; variable.rename opens only while the document has a variable, and dataset.set and dataset.rename only while it has a data set, and otherwise the status bar says why; ui.dialog.set, ui.dialog.confirm and ui.dialog.cancel take the dialog's `id` from ui.inspect, or `top`, not its `key`)", ), ( "ui.widthPointEdit", diff --git a/crates/ui-egui/src/menus/ui_commands.rs b/crates/ui-egui/src/menus/ui_commands.rs index 671ebcec8f..4f8b3da82e 100644 --- a/crates/ui-egui/src/menus/ui_commands.rs +++ b/crates/ui-egui/src/menus/ui_commands.rs @@ -1532,7 +1532,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "ui.menuDialog", "Menu Dialog", "", - "{command: object.move|object.rotate|object.scale|object.reflect|object.shear|object.transformEach|path.average|path.averageJoin|object.path.offsetPath|object.path.simplify|object.path.smooth|object.path.splitIntoGrid|object.vectorHalftone|object.stepAndRepeat|artboard.rearrange|artboard.rename|object.envelope.makeWithWarp|object.envelope.resetWithWarp|object.envelope.makeWithMesh|object.envelope.resetWithMesh|object.envelope.options|addon.arrange.grid|addon.arrange.offset|addon.arrange.replace|addon.arrange.size|addon.arrange.match|addon.arrange.groupRows|addon.packaging.setFoldAngle|addon.pathtools.cornerSet|addon.pathtools.divideDashes|addon.pathtools.bridge|addon.pathtools.tangentCircle|addon.type.textTweaker|addon.color.swatchLegend|addon.arrange.randomizeOpacity|addon.arrange.sort|addon.arrange.markBounds|addon.color.applyNearestSwatch|addon.color.randomFill|addon.select.byArtboards|addon.select.editPointsOnly|type.smartPunctuation|variable.define|variable.rename|variable.bind|dataset.new|dataset.set|dataset.rename|dataset.select} open the dialog that command's menu item opens (its `key` in ui.inspect is the command id, except `transformEach` for object.transformEach, `envelopeWarp` for object.envelope.makeWithWarp and object.envelope.resetWithWarp, `envelopeMesh` for object.envelope.makeWithMesh and object.envelope.resetWithMesh, `variables` for variable.define and variable.rename and variable.bind and dataset.new and dataset.set and dataset.rename and dataset.select, `envelopeOptions` for object.envelope.options, `smoothSlider` for object.path.smooth, and `simplifySlider` for object.path.simplify; the dialogs of addon.color.applyNearestSwatch and addon.select.byArtboards have no `key`; smoothSlider and simplifySlider are the sliders over the canvas, with field `level`, and object.path.simplify opens its dialog `object.path.simplify` instead once OK in that dialog keeps the settings (`retain`); Set Fold Angle's `angle` is the selected fold lines' angle, and it is refused while the selection has no fold line it can change; Scale and Transform Each have `corners` and `strokes`, from the preferences, which OK updates; Transform Each opens on the values it was last confirmed with (not `copy`), and its Copy button confirms with `copy: true`; the envelope dialogs start from the selected envelope, Make opens as Reset (`reset: true`) while one is selected; variable.rename opens only while the document has a variable, and dataset.set and dataset.rename only while it has a data set, and otherwise the status bar says why; ui.dialog.set, ui.dialog.confirm and ui.dialog.cancel take the dialog's `id` from ui.inspect, or `top`, not its `key`)", + "{command: object.move|object.rotate|object.scale|object.reflect|object.shear|object.transformEach|path.average|path.averageJoin|object.path.offsetPath|object.path.simplify|object.path.smooth|object.path.splitIntoGrid|object.vectorHalftone|object.stepAndRepeat|artboard.rearrange|artboard.rename|object.envelope.makeWithWarp|object.envelope.resetWithWarp|object.envelope.makeWithMesh|object.envelope.resetWithMesh|object.envelope.options|addon.arrange.grid|addon.arrange.offset|addon.arrange.replace|addon.arrange.size|addon.arrange.match|addon.arrange.groupRows|addon.packaging.setFoldAngle|addon.pathtools.cornerSet|addon.pathtools.divideDashes|addon.pathtools.bridge|addon.pathtools.tangentCircle|addon.type.textTweaker|addon.type.numbers|addon.color.swatchLegend|addon.arrange.randomizeOpacity|addon.arrange.sort|addon.arrange.markBounds|addon.color.applyNearestSwatch|addon.color.randomFill|addon.select.byArtboards|addon.select.editPointsOnly|type.smartPunctuation|variable.define|variable.rename|variable.bind|dataset.new|dataset.set|dataset.rename|dataset.select} open the dialog that command's menu item opens (its `key` in ui.inspect is the command id, except `transformEach` for object.transformEach, `envelopeWarp` for object.envelope.makeWithWarp and object.envelope.resetWithWarp, `envelopeMesh` for object.envelope.makeWithMesh and object.envelope.resetWithMesh, `variables` for variable.define and variable.rename and variable.bind and dataset.new and dataset.set and dataset.rename and dataset.select, `envelopeOptions` for object.envelope.options, `smoothSlider` for object.path.smooth, and `simplifySlider` for object.path.simplify; the dialogs of addon.color.applyNearestSwatch and addon.select.byArtboards have no `key`; smoothSlider and simplifySlider are the sliders over the canvas, with field `level`, and object.path.simplify opens its dialog `object.path.simplify` instead once OK in that dialog keeps the settings (`retain`); Set Fold Angle's `angle` is the selected fold lines' angle, and it is refused while the selection has no fold line it can change; Scale and Transform Each have `corners` and `strokes`, from the preferences, which OK updates; Transform Each opens on the values it was last confirmed with (not `copy`), and its Copy button confirms with `copy: true`; the envelope dialogs start from the selected envelope, Make opens as Reset (`reset: true`) while one is selected; variable.rename opens only while the document has a variable, and dataset.set and dataset.rename only while it has a data set, and otherwise the status bar says why; ui.dialog.set, ui.dialog.confirm and ui.dialog.cancel take the dialog's `id` from ui.inspect, or `top`, not its `key`)", ), ( "ui.widthPointEdit", diff --git a/docs/mcp.md b/docs/mcp.md index b6a24ff643..9126281fdf 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -18243,10 +18243,15 @@ placeholder in it. It is based on Sergey Osokin's MIT-licensed script. - With `end` omitted the numbers run to the last object. With `end`, they stop past it and the objects after the last - number keep their text, or are deleted with `removeUnused`. The sign of `step` is set to run toward `end`. -- With `replace` `numbers` or `placeholder`, objects that hold no number or placeholder are skipped and get no number. - A number is a run of digits with any `.` or `,` between digits. Replaced text takes the style of the text it - replaces. + number keep their text, or are deleted with `removeUnused`. A type object that is the mask of a clipping group or layer + is not deleted. The sign of `step` is set to run toward `end`. +- Locked or hidden type, also inside a selected group, is not numbered or deleted. +- With `replace` `numbers` or `placeholder`, objects that hold no number or placeholder are skipped and get no number, + and `order` leaves them out. The remaining objects are ordered before `end` limits the sequence, so objects past + `end` still count for rows and columns. A number is a run of digits with any `.` or `,` between digits, + and a `-` before it that does not follow a letter or digit. Replaced text takes the style of the text it replaces; + a number or placeholder that already reads the new number keeps its text and style. With `numbers` or + `placeholder`, one run replaces at most 10,000 numbers or placeholders; more is an error, and nothing changes. - Values are rounded to the most decimal places among `start`, `step` and `end` (at most 6), so 0.1 by 0.1 gives 0.1, 0.2, 0.3. - Objects that already read so are left as they are; when nothing changes no undo step is made. @@ -18258,7 +18263,7 @@ script. | `end` | number −1e12…1e12 (omitted: to the last object) | | `order` | `stacking` (from the back), `rows` (top to bottom, each row left to right), `columns` (left to right, each column top to bottom) (`stacking`). Objects whose centers are within half the median height (width for columns) of a row's first object share its row | | `replace` | `all`, `numbers`, `placeholder` (`all`) | -| `shuffle`, `seed` | false; true: the numbers go to the objects in random order, the same `seed` (0) giving the same order, and `order` is not used | +| `shuffle`, `seed` | false; true: the numbers go to the objects in random order, the same `seed` (a whole number, 0) giving the same order, and `order` is not used. A `seed` that is not a whole number is an error even with `shuffle` off | | `leadingZeros` | true: non-negative numbers are padded with zeros to the whole digits of the wider of `start` and `end` (or the last number) | | `digits` | 1…30: with `leadingZeros`, at least this many whole digits | | `trailingZeros` | false; true: every number gets as many decimal places as the one with the most | diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 1cda4bba80..6a7901d435 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -3184,6 +3184,10 @@ A VectorCraft addition, not a feature of the reference app, so no area score mov A VectorCraft addition, not a feature of the reference app (it has no command for this), so no area score moves. Object › Plug-ins › Type Tools › Release Type on a Path… splits each selected type on a path into point type holding the same text and the plain path it was set on, or keeps only one of them (#5532). The path keeps its exact shape (open or closed, anchors and handles, the object's transform), layer and place in the stacking order, with no fill and no stroke since type paths carry no paint of their own. The text keeps its runs, character and paragraph attributes and becomes point type on one straight line whose baseline starts where the first character sat on the path; Type on a Path Options don't apply to point type and are dropped. Keep Original leaves the type on a path and adds the released objects above it. Other objects are left alone and a selection with no type on a path makes no undo step; otherwise the run is one undo step, the released objects are selected, and the dialog's Preview works as Type on a Path Options' does (#5360). Tests: `cmd::addons::typetools::tests::release` in `vectorcraft-engine` (each mode, Keep Original, mixed and empty selections, closed, open, curved and flipped paths, transformed and grouped type, multi-style and unicode text with a centred paragraph, empty type, undo and redo, preview, cancel and commit, bad params refused), `release_type_on_a_path_previews_cancels_and_runs_on_ok` in `vectorcraft-ui-egui` and `command_sweep`. Commands: `docs/mcp.md` › Type Tools add-on › Release Type on a Path. +## Type Tools add-on: Make Numbers Sequence (2026-12-01) + +A VectorCraft addition, so no area score moves. Object › Plug-ins › Type Tools › Make Numbers Sequence… numbers the selected type objects from a start value by a step, optionally stopping at an end value, and each number replaces the whole text, every number in it, or every `{%n}` placeholder (#10448). The objects are taken in stacking order, by rows or by columns, or in a seeded random order, with optional leading and trailing zeros, and the objects past the end can be deleted. Locked and hidden type is left alone, a clipping mask is not deleted, threaded type and bad parameters are refused, and the run is one undo step from a dialog with Preview. It is based on Sergey Osokin's MIT-licensed MakeNumbersSequence script. Tests: `cmd::addons::typetools::numbers::tests` in `vectorcraft-engine`, `addons::typetools::numbers::tests` in `vectorcraft-ui-egui` and `command_sweep`. Commands: `docs/mcp.md` › Type Tools add-on. + ## Unit Converter add-on (2026-11-14) A VectorCraft addition, so no area score moves. Object › Plug-ins › Unit Converter opens a panel with one number field per unit of Preferences › Units › East Asian Type (pt, picas, in, mm, cm, px, ft & in, m, yd, ft, Q, Ha), as proposed in #5528. A length typed in any field, with units and arithmetic as every number field reads them, updates the others as it is typed; text that does not read leaves them as they were. From Selection reads the selection's width and height as the Transform panel measures them, Width or Height picks which one the fields show, and Apply sets that side of the selection through `object.setBounds` as the Transform panel's W or H field does (its reference point, Constrain Width and Height Proportions and its Transform Object Only, Pattern Only or Both choice) as one undo step, with no step when the size is already that length. Each field's copy button copies its value, with its unit when Copy with Units is on. Agents use `addon.units.convert` and `addon.units.selectionSize`, which change nothing in the document (`docs/mcp.md`). Tests: `cmd::addons::units::tests` in `vectorcraft-engine` (every unit, number-field syntax, preview bounds and selected anchors, bad params and unknown keys refused), `addons::units::tests` in `vectorcraft-ui-egui` (typing, From Selection and a changed selection, Apply with the Transform panel's reference point, proportions, pattern choice and a symbol's registration point, copy, screen-reader names) and `command_sweep`. From 8ff9f4cba2ff5d99f4585f249fe8658dc7cecc83 Mon Sep 17 00:00:00 2001 From: ruchirguitar <info@jeevantirth.org> Date: Tue, 1 Dec 2026 23:33:48 +0530 Subject: [PATCH 054/112] .ai import: a visibility variable on hidden styled type binds the group that hides it Since #9228 hidden styled type whose look has its own transparency comes in as a group of the look and the type, and the group holds the hidden and locked state. A visibility variable bound to the type's XML id still bound the type, so showing it left the type hidden. The reader now records the text slot each such group wraps, and a visibility binding on that slot binds the group; text bindings stay on the type. --- crates/eps/src/import/ai/read.rs | 10 ++++--- crates/eps/src/import/ai/read/document.rs | 1 + crates/eps/src/import/ai/read/ops.rs | 6 ++--- crates/eps/src/import/native/build.rs | 17 +++++++++--- crates/eps/src/import/tests_native.rs | 32 +++++++++++++++++++++++ 5 files changed, 56 insertions(+), 10 deletions(-) diff --git a/crates/eps/src/import/ai/read.rs b/crates/eps/src/import/ai/read.rs index 17d9896ab9..8a29eec63e 100644 --- a/crates/eps/src/import/ai/read.rs +++ b/crates/eps/src/import/ai/read.rs @@ -248,6 +248,9 @@ pub struct Structure { /// The objects by their XML id (`AI10_ArtUID`), a text object by its slot's id: `None` for an /// id two objects have. pub xml_ids: HashMap<String, Option<NodeId>>, + /// The group of a styled text object and its look, by the text object's slot id. The group, + /// not the type in it, is hidden or locked where the text object was. + pub text_looks: HashMap<NodeId, NodeId>, /// The objects the variable library binds to its variables, by their XML ids: the importer /// binds those it keeps. pub bindings: Vec<BindingRef>, @@ -664,8 +667,9 @@ struct Reader<'a> { ruler_guides: HashMap<NodeId, (Point, Point)>, /// Legacy compound member groups, even when followed by the generic `9 () XW` marker. compound_groups: HashSet<NodeId>, - /// Groups of a text object and its look (see [`Self::style_marker`]), which aren't a look. - text_looks: HashSet<NodeId>, + /// Groups of a text object and its look (see [`Self::style_marker`]), which aren't a look, each + /// with the text object's slot id. + text_looks: HashMap<NodeId, NodeId>, /// Objects followed by samples of the pen (`(…) Xt n XD`), which aren't read: such an object /// whose style has a Calligraphic brush that varies with the pen keeps its drawn look (see /// [`Self::style_marker`]). @@ -911,7 +915,7 @@ impl<'a> Reader<'a> { looks: HashSet::new(), ruler_guides: HashMap::new(), compound_groups: HashSet::new(), - text_looks: HashSet::new(), + text_looks: HashMap::new(), pen_samples: HashSet::new(), group_ended: false, mesh_ended: false, diff --git a/crates/eps/src/import/ai/read/document.rs b/crates/eps/src/import/ai/read/document.rs index 20102b29c4..ec14b864d9 100644 --- a/crates/eps/src/import/ai/read/document.rs +++ b/crates/eps/src/import/ai/read/document.rs @@ -1485,6 +1485,7 @@ impl<'a> Reader<'a> { canvas_scale: self.canvas_scale, symbols_own_size: self.symbols_own_size, xml_ids: self.xml_ids, + text_looks: self.text_looks.into_iter().map(|(group, slot)| (slot, group)).collect(), bindings, bindings_skipped, warnings, diff --git a/crates/eps/src/import/ai/read/ops.rs b/crates/eps/src/import/ai/read/ops.rs index bb5343e4f4..1b9d6aa20b 100644 --- a/crates/eps/src/import/ai/read/ops.rs +++ b/crates/eps/src/import/ai/read/ops.rs @@ -822,7 +822,7 @@ impl<'a> Reader<'a> { // The look is a group of paths, or one image where an effect (a blur, a shadow) rasterizes it. if !self.hidden_ids.contains(&object.id) || self.hidden_ids.contains(&look.id) != hidden - || self.text_looks.contains(&look.id) + || self.text_looks.contains_key(&look.id) || !matches!(look.kind, NodeKind::Group { clip: false, .. } | NodeKind::Image(_)) { return; @@ -978,7 +978,7 @@ impl<'a> Reader<'a> { let Some(mut look) = f.children.pop() else { return }; let state = (look.opacity, look.blend, look.isolate, look.knockout, look.knockout_shape); (look.opacity, look.blend, look.isolate, look.knockout, look.knockout_shape) = (1.0, BlendMode::Normal, false, Knockout::Neutral, false); - let (visible, locked) = (object.visible, object.locked); + let (visible, locked, slot) = (object.visible, object.locked, object.id); (object.opacity, object.blend, object.isolate, object.knockout_shape) = (1.0, BlendMode::Normal, false, false); object.visible = true; object.locked = false; @@ -986,7 +986,7 @@ impl<'a> Reader<'a> { (group.opacity, group.blend, group.isolate, group.knockout, group.knockout_shape) = state; group.visible = visible; group.locked = locked; - self.text_looks.insert(group.id); + self.text_looks.insert(group.id, slot); if let Some(f) = self.frames.last_mut() { f.children.push(group); } diff --git a/crates/eps/src/import/native/build.rs b/crates/eps/src/import/native/build.rs index 0637e8e079..9daa57bfd8 100644 --- a/crates/eps/src/import/native/build.rs +++ b/crates/eps/src/import/native/build.rs @@ -350,6 +350,7 @@ pub(super) fn build_weighing( canvas_scale, symbols_own_size, xml_ids, + text_looks, bindings, bindings_skipped, warped_type, @@ -653,7 +654,7 @@ pub(super) fn build_weighing( None => unmark(&mut doc.layers, true, true, &mut vec![]), } doc.limit_depth_noting(&mut notes); - bind_variables(&mut doc, &bindings, bindings_skipped, &xml_ids, &filled, &mut notes); + bind_variables(&mut doc, &bindings, bindings_skipped, &xml_ids, &filled, &text_looks, &mut notes); if placed_documents(&mut doc, &placed_pages, &placed_eps) && !notes.iter().any(|n| n == ai::LINKED_PREVIEWS) { notes.push(ai::LINKED_PREVIEWS.to_string()); } @@ -731,7 +732,9 @@ fn to_placed_documents( /// Bind the objects of `doc` to the variables of its library that `bindings` binds them to, each /// object named by its XML id (`ids`: the object read with that id, or what `filled` made of a text /// object's slot: for a visibility variable every object that took the slot's place, for a text -/// variable the one text object among them). An object is bound when it is of the variable's kind: +/// variable the one text object among them). A visibility variable binds a styled text object's +/// group with its look (`text_looks`, by slot) in place of the type: the group is what is hidden or +/// shown. An object is bound when it is of the variable's kind: /// type for a text variable, a linked image for an image variable, any object for a visibility /// variable. Locked and hidden objects, objects in locked or hidden layers and groups, and objects /// on locked artboards keep their bindings. Graph variables and @@ -743,6 +746,7 @@ fn bind_variables( skipped: usize, ids: &std::collections::HashMap<String, Option<NodeId>>, filled: &std::collections::HashMap<NodeId, Filled>, + text_looks: &std::collections::HashMap<NodeId, NodeId>, notes: &mut Vec<String>, ) { let mut skipped = skipped; @@ -753,7 +757,12 @@ fn bind_variables( let mut bound = vec![]; for b in bindings { let kind = doc.variables.variable(&b.variable).map(|v| v.kind); - let targets = match (b.target.as_ref().and_then(|t| ids.get(t).copied().flatten()), kind) { + let target = b.target.as_ref().and_then(|t| ids.get(t).copied().flatten()); + let target = match kind { + Some(VariableKind::Visibility) => target.map(|id| text_looks.get(&id).copied().unwrap_or(id)), + _ => target, + }; + let targets = match (target, kind) { (Some(id), Some(kind)) => match filled.get(&id) { Some(f) if kind == VariableKind::Visibility => f.objects.clone(), Some(f) => match f.text.as_slice() { @@ -2819,7 +2828,7 @@ mod candidate_tests { bind("v_graph", "path"), ]; let mut notes = vec![]; - bind_variables(&mut doc, &refs, 3, &ids, &filled, &mut notes); + bind_variables(&mut doc, &refs, 3, &ids, &filled, &Default::default(), &mut notes); let sorted = |mut v: Vec<NodeId>| { v.sort(); v diff --git a/crates/eps/src/import/tests_native.rs b/crates/eps/src/import/tests_native.rs index c5b6b61d58..d51573877a 100644 --- a/crates/eps/src/import/tests_native.rs +++ b/crates/eps/src/import/tests_native.rs @@ -2240,6 +2240,38 @@ fn ai_variable_bindings_bind_the_objects_they_name() { assert!(!r.warnings.iter().any(|w| w.contains("variable library")), "{:?}", r.warnings); } +/// Hidden, locked type whose style comes in as a group of its drawn look and the type (the look has +/// its own transparency) is hidden and locked on that group. A visibility variable bound to the +/// type binds the group, so showing it shows the type; a text variable still binds the type. +#[test] +fn a_visibility_variable_on_hidden_styled_type_binds_the_group_that_hides_it() { + use vectorcraft_testkit::ai::{XmlValue, named, variable_library_data, xml_element, xml_node}; + let declare = |name: &str, t: &str| { + let uid = "/XMLUIDREF : (type_x5F_1) ;"; + let attributes = [("trait", XmlValue::Str(t)), ("varName", XmlValue::Unicode(name)), ("docRef", XmlValue::Raw(uid))]; + xml_node(1, "variable", XmlValue::Str(""), &attributes, &[]) + }; + let declared = vec![declare("v_shown", "visibility"), declare("v_text", "textcontent")]; + let set = xml_element("variableSet", &[("locked", "none")], &[xml_element("variables", &[], &declared)]); + let library = variable_library_data(&xml_element("variableSets", &[], &[set])); + let doc = text_document(&[("Bang\r", 0, (8200.0, 8180.0), (0.0, 0.0), 0.0)]); + let drawing = "0 0 1 0 k\n54 56 m\n100 56 L\n100 80 L\n54 80 L\nf"; + // The look at half opacity; the type hidden (`1 Xw`) and locked (`1 A`), with its XML id. + let look = format!("0 Ae\nu\n/AI11Text :\n1 /FreeUndo ,\n0 /FrameIndex ,\n0 /StoryIndex ,\n;\n{drawing}\nU\n0 0.5 0 0 0 Xy\n0 0 Xd\n6 () XW\n"); + let own: String = text_object(0).lines().map(|l| format!("%_{l}\n")).collect(); + let styled = format!("{look}1 Xw\n1 A\n{own}{}1 (Unlisted) XW\n0 Xw\n0 A\n", named("type_x5F_1")); + let art = native_with_text(&(library + &layer("Art", true, &styled)), &doc); + let (d, notes) = crate::ai_alone(&private(&art)).unwrap(); + let a = d.layers[0].children().unwrap(); + let [group] = a.as_slice() else { panic!("one group of the look and the type: {a:#?} {notes:?}") }; + assert!(matches!(group.kind, NodeKind::Group { .. }) && !group.visible && group.locked, "{group:#?}"); + let type_id = group.children().unwrap().iter().find(|n| matches!(n.kind, NodeKind::Text(_))).map(|n| n.id); + assert!(type_id.is_some(), "{group:#?}"); + let vars = &d.variables; + assert_eq!(vars.objects_of("v_shown"), [group.id], "the hidden group, not the type in it: {notes:?}"); + assert_eq!(vars.objects_of("v_text").first().copied(), type_id, "{notes:?}"); +} + /// An EPS whose editing data can't be used, a palette with no layers among others, comes in as its /// page with the swatches and color groups of that palette in place of the defaults. #[test] From 82cb6ef291580f4a897998b8eabf7ed14e5d0aa5 Mon Sep 17 00:00:00 2001 From: ruchirguitar <info@jeevantirth.org> Date: Tue, 1 Dec 2026 23:46:40 +0530 Subject: [PATCH 055/112] .ai import: hold the page type's word searches to their own budget #9228 let a file with many text objects whose type is made be weighed by where its pieces of type lie, up to four times the comparisons word matching may make. The page's type lying where made type draws was still searched word by word in every made text object there, and in the lines of hidden made type, so those searches could run to the larger limit. They are now counted on their own, up to MAX_PAIRS. Past it, type where made type that shows draws is taken as that type, type over hidden made type only stays on the page, and the page's type is noted as unchecked. The letters of hidden made type's lines are worked out once. --- crates/eps/src/import/native/plan.rs | 183 +++++++++++++++++++++++---- 1 file changed, 160 insertions(+), 23 deletions(-) diff --git a/crates/eps/src/import/native/plan.rs b/crates/eps/src/import/native/plan.rs index a23e8ea324..a15c272222 100644 --- a/crates/eps/src/import/native/plan.rs +++ b/crates/eps/src/import/native/plan.rs @@ -154,8 +154,19 @@ pub(super) fn made_only( if looks && infos.len().saturating_mul(shown.len()) <= MAX_PAIRS { let spelled: Vec<String> = content.iter().map(|c| if let Content::Made(node, ..) = c { spelling(&plain_text(node)) } else { String::new() }).collect(); - let made_type = |o: &[Arc<Node>]| covered(o, &content, |_| true) && has_made_words(o, &content, &spelled); + // Past the word searches, type where made type draws is taken to be that type. + let (mut checks, mut unchecked) = (WordChecks::new(), false); + let mut made_type = |o: &[Arc<Node>]| { + covered(o, &content, |_| true) + && has_made_words(o, &content, &spelled, &mut checks).unwrap_or_else(|| { + unchecked = true; + true + }) + }; let mut spare: Vec<Vec<Arc<Node>>> = shown.iter().filter(|o| !made_type(o)).cloned().collect(); + if unchecked { + note_unchecked(warn); + } fill_look_slots(infos, &mut content, &mut spare); for c in &content { if let Content::Page(parts) = c { @@ -173,7 +184,7 @@ pub(super) fn made_only( match see_page_type(&mut content, untaken) { Some(0) => {} Some(_) => warn.push(PAGE_TYPE_LEFT_OUT.into()), - None => warn.push(PAGE_TYPE_UNCHECKED.into()), + None => note_unchecked(warn), } drop_look_slots(infos, &mut content); fill_hidden(infos, stories, &mut content, hidden); @@ -274,17 +285,64 @@ fn fill_look_slots(infos: &[SlotInfo], content: &mut [Content], spare: &mut Vec< drop_look_slots(infos, content); } +/// How many more times a word of the page's type may be looked for in a text object's type. The +/// page's type is weighed against where every text object lies up to `MAX_PLACE_PAIRS` pairs, a box +/// against a box, but each text object a piece of it lies on can be searched for each of its words: +/// those searches are held to `MAX_PAIRS` of their own. +struct WordChecks(usize); + +impl WordChecks { + fn new() -> Self { + WordChecks(MAX_PAIRS) + } + + /// One more search, if any are left. + fn spend(&mut self) -> Option<()> { + self.0 = self.0.checked_sub(1)?; + Some(()) + } + + /// Are no searches left? + fn spent(&self) -> bool { + self.0 == 0 + } +} + /// Has made type that shows and draws where the page's text object `object` lies every word of it -/// ([`spelling`], each slot's in `spelled`), in any order? -fn has_made_words(object: &[Arc<Node>], content: &[Content], spelled: &[String]) -> bool { - let Some(r) = extent(object) else { return true }; +/// ([`spelling`], each slot's in `spelled`), in any order? `None` once `checks` runs out before +/// that is known. +fn has_made_words(object: &[Arc<Node>], content: &[Content], spelled: &[String], checks: &mut WordChecks) -> Option<bool> { + let Some(r) = extent(object) else { return Some(true) }; + if checks.spent() { + return None; + } let near: Vec<&String> = content .iter() .zip(spelled) .filter(|(c, _)| matches!(c, Content::Made(_, Some(region), _) if !region.intersect(r).is_zero_area())) .map(|(_, s)| s) .collect(); - object_words(object).iter().all(|w| near.iter().any(|s| s.contains(w.as_str()))) + for w in object_words(object) { + let mut found = false; + for s in &near { + checks.spend()?; + if s.contains(w.as_str()) { + found = true; + break; + } + } + if !found { + return Some(false); + } + } + Some(true) +} + +/// Note once in `warn` that some of the page's type wasn't checked against the text objects. +fn note_unchecked(warn: &mut Vec<String>) { + if !warn.iter().any(|w| w == PAGE_TYPE_UNCHECKED) { + warn.push(PAGE_TYPE_UNCHECKED.into()); + } } /// The text slots for type that a look draws and that have nothing have no type of their own to hold @@ -438,9 +496,16 @@ pub(super) fn plan( let made_stories: std::collections::BTreeSet<u32> = infos.iter().zip(&made).filter(|(_, m)| m.is_some()).filter_map(|(i, _)| i.story).collect(); let open: Vec<bool> = infos.iter().zip(&made).map(|(i, m)| m.is_none() && i.story.is_none_or(|s| !made_stories.contains(&s))).collect(); let owner = match_page_objects(infos, &lines, &open, shown); - // Where the made type that doesn't show lies, by slot. - let hidden_at: Vec<(usize, Rect)> = - infos.iter().zip(&made).enumerate().filter_map(|(k, (info, m))| Some((k, m.as_ref().filter(|_| !info.shown)?.1?))).collect(); + // Where the made type that doesn't show lies, and the letters of its lines (it has lines). + let hidden_at: Vec<(Rect, Vec<String>)> = infos + .iter() + .zip(&made) + .enumerate() + .filter_map(|(k, (info, m))| { + let place = m.as_ref().filter(|_| !info.shown)?.1?; + Some((place, lines.get(k)?.as_ref()?.iter().map(|(text, _)| letters(text)).collect())) + }) + .collect(); // Type the text document makes, shown or not: the page's pieces of it aren't needed. Its box // stays that of type without a layout here: with text objects whose type isn't made stacked on // made type that has their words (the copies of an outlined heading), the page's pieces in the @@ -448,17 +513,34 @@ pub(super) fn plan( let mut content = made_content(infos, made, false); // Is `object` the type of a text object that doesn't show, as the page draws it: in its frame, // with its words? (A copied object's lines are where its original's are, so they don't say.) - let hidden_type = |object: &[Arc<Node>]| { - let Some(r) = extent(object) else { return false }; + // `None` once `checks` runs out before that is known. + let hidden_type = |object: &[Arc<Node>], checks: &mut WordChecks| -> Option<bool> { + let Some(r) = extent(object) else { return Some(false) }; let texts: Vec<Vec<String>> = object.iter().filter_map(|n| if let NodeKind::Text(t) = &n.kind { Some(words(&t.plain_text())) } else { None }).collect(); - hidden_at.iter().any(|(k, place)| { - place.intersect(r).area() >= 0.5 * r.area().max(1e-9) - && lines.get(*k).and_then(Option::as_ref).is_some_and(|l| { - !texts.is_empty() - && texts.iter().all(|ws| !ws.is_empty() && ws.iter().all(|w| l.iter().any(|(text, _)| letters(text).contains(w.as_str())))) - }) - }) + if texts.is_empty() || texts.iter().any(Vec::is_empty) { + return Some(false); + } + for (place, l) in &hidden_at { + if place.intersect(r).area() < 0.5 * r.area().max(1e-9) { + continue; + } + let mut all = true; + 'words: for w in texts.iter().flatten() { + for text in l { + checks.spend()?; + if text.contains(w.as_str()) { + continue 'words; + } + } + all = false; + break; + } + if all { + return Some(true); + } + } + Some(false) }; // The letters and digits of each slot's made type that shows, in any script, in lower case. let spelled: Vec<String> = content @@ -472,6 +554,10 @@ pub(super) fn plan( }) .collect(); let mut spare: Vec<Vec<Arc<Node>>> = vec![]; + // The word searches below are held to their own budget: past it, type where made type that shows + // draws is taken to be that type (made type is there either way), and type where only made type + // that doesn't show lies stays on the page (it would not show otherwise). + let (mut checks, mut unchecked) = (WordChecks::new(), false); for (j, object) in shown.iter().enumerate() { match owner.get(j).copied().flatten() { Some(k) => match content.get_mut(k) { @@ -479,13 +565,28 @@ pub(super) fn plan( Some(c) => *c = Content::Page(object.clone()), None => {} }, - // What lies where made type draws, with its words, is that type as the page draws it (in - // another font, maybe, and in any script). - None if covered(object, &content, |_| true) && has_made_words(object, &content, &spelled) => {} - None if hidden_type(object) => {} - None => spare.push(object.clone()), + None => { + // What lies where made type draws, with its words, is that type as the page draws it + // (in another font, maybe, and in any script). + let theirs = covered(object, &content, |_| true) + && has_made_words(object, &content, &spelled, &mut checks).unwrap_or_else(|| { + unchecked = true; + true + }); + let hidden = !theirs + && hidden_type(object, &mut checks).unwrap_or_else(|| { + unchecked = true; + false + }); + if !theirs && !hidden { + spare.push(object.clone()); + } + } } } + if unchecked { + note_unchecked(warn); + } // The page's type that no made type takes is the spare type below. let _ = see_page_type(&mut content, shown); for (k, c) in content.iter_mut().enumerate() { @@ -600,3 +701,39 @@ fn fill_hidden(infos: &[SlotInfo], stories: &[Option<Arc<Story>>], content: &mut } } } + +#[cfg(test)] +mod tests { + use super::*; + use vectorcraft_doc::{CharStyle, TextObject}; + + fn text(id: u64, s: &str) -> Node { + let style = CharStyle { size: 12.0, ..CharStyle::default() }; + Node::new(NodeId(id), NodeKind::Text(Box::new(TextObject::point(Point::new(100.0, 100.0), s, style)))) + } + + /// The page's type is searched for in every made text object that draws where it lies, word by + /// word: those searches stop when their budget runs out, saying they didn't finish, however many + /// made text objects lie there. A word is searched for only until a text object has it. + #[test] + fn word_searches_of_the_page_s_type_stop_when_their_budget_runs_out() { + let everywhere = Rect::new(-1e4, -1e4, 1e4, 1e4); + let slots = 50; + let content: Vec<Content> = (0..slots).map(|k| Content::Made(Box::new(text(k, "Other type")), Some(everywhere), false)).collect(); + let spelled: Vec<String> = + content.iter().map(|c| if let Content::Made(n, ..) = c { spelling(&plain_text(n)) } else { String::new() }).collect(); + // A word no made type has is searched for in each of them. + let missing = vec![Arc::new(text(1000, "Alpha beta"))]; + let one_word_everywhere = slots as usize; + let mut short = WordChecks(one_word_everywhere - 1); + assert_eq!(has_made_words(&missing, &content, &spelled, &mut short), None, "past the budget the answer isn't known"); + assert!(short.spent()); + let mut enough = WordChecks(one_word_everywhere); + assert_eq!(has_made_words(&missing, &content, &spelled, &mut enough), Some(false)); + // Words that the first made type has are found there, without searching the others. + let present = vec![Arc::new(text(1001, "other TYPE"))]; + let mut few = WordChecks(one_word_everywhere); + assert_eq!(has_made_words(&present, &content, &spelled, &mut few), Some(true)); + assert!(one_word_everywhere - few.0 < one_word_everywhere / 2, "{} searches", one_word_everywhere - few.0); + } +} From 6f684e6da97ea173ff3612064ee81b3b37941ad0 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 11:16:00 -0800 Subject: [PATCH 056/112] Path Precision Tools: Common Tangents and Smooth Bridge are one dialog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Common Tangents… now also does what Smooth Bridge… did (#10465). - Connect tangents joins the two tangents of each kind into one closed shape, along the chords between where they touch each path (a point's two lines make a triangle). `connect` on `addon.pathtools.commonTangents`. - With External, the dialog shows Straight and Curved. Straight keeps the tangent lines; Curved joins the circles along concave arcs, as Smooth Bridge did, with Radius, Constant Gap, Reach and Keep Originals, which take input only with Curved. `curved`, `radius`, `gap`, `reach` and `keepOriginals` on the command; options of the other mode are an error. - The Smooth Bridge… menu item is gone. `addon.pathtools.bridge` still runs for scripts and actions, opens the merged dialog with External and Curved, and is left out of the command palette and Keyboard Shortcuts. A palette search for "metaball" or "smooth bridge" finds Common Tangents. Docs: docs/mcp.md, docs/ui-parity.md, ROADMAP. --- ROADMAP.md | 1 + crates/engine/src/cmd.rs | 3 +- .../engine/src/cmd/addons/pathtools/bridge.rs | 6 +- .../src/cmd/addons/pathtools/tangents.rs | 65 ++++- .../cmd/addons/pathtools/tangents/tests.rs | 107 ++++++++ crates/engine/src/cmd/params.rs | 1 + crates/mcp/src/ui_catalog.rs | 2 +- crates/ui-egui/src/addons/cutting/tests.rs | 33 --- crates/ui-egui/src/addons/dialogs.rs | 3 +- crates/ui-egui/src/addons/dialogs/tests.rs | 4 +- crates/ui-egui/src/addons/pathtools.rs | 9 +- crates/ui-egui/src/addons/pathtools/bridge.rs | 254 ------------------ .../ui-egui/src/addons/pathtools/tangents.rs | 150 +++++++++++ .../src/addons/pathtools/tangents/tests.rs | 244 +++++++++++++++++ crates/ui-egui/src/dialogs/command.rs | 6 +- crates/ui-egui/src/menus/ui_commands.rs | 2 +- crates/ui-egui/src/palette.rs | 13 + docs/mcp.md | 29 +- docs/ui-parity.md | 2 +- 19 files changed, 613 insertions(+), 321 deletions(-) delete mode 100644 crates/ui-egui/src/addons/pathtools/bridge.rs create mode 100644 crates/ui-egui/src/addons/pathtools/tangents.rs create mode 100644 crates/ui-egui/src/addons/pathtools/tangents/tests.rs diff --git a/ROADMAP.md b/ROADMAP.md index 894065391d..b04a110d6c 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -182,6 +182,7 @@ Ranked; detail in [docs/roadmap.md](docs/roadmap.md) and [docs/gaps.md](docs/gap - 2026-11-28: The Three-Point Arc tool joins an arc to the open paths whose ends its ends are placed on, with Join to Open Path Ends (Tool Options, or J while drawing; `shape.threePointArc` `join`), and in direction mode snaps the third point to where the arc carries an open path on, the same way or turned back (Snap Where the Arc Continues a Path, on by default). Headline numbers unchanged. - 2026-11-15: Smooth Bridge joins the Path Precision Tools add-on (Object › Plug-ins › Path Precision Tools): two selected circles become one closed outline joined by two concave arcs that touch both circles, so every anchor is smooth; the arcs' radius is a percentage of the smaller circle's radius (1 to 1000%, 100% by default), and Keep Originals adds the outline above the circles instead of replacing them. A dialog with Preview, one undo step (`addon.pathtools.bridge`). A VectorCraft addition: headline numbers unchanged. - 2026-11-18: Smooth Bridge also joins three or more circles: every two whose outlines are within Reach (10 pt by default) are joined, the bridges that connect become one shape each, and a circle bridged to no other stays as it is (at most 2000 circles); with Constant Gap the arcs' radius is the smaller circle's radius plus a gap (#8030). A VectorCraft addition: headline numbers unchanged. +- 2026-12-01: Common Tangents and Smooth Bridge are one dialog, Common Tangents… (#10465): Connect tangents joins the two tangents of each kind into one closed shape, and with External, Straight or Curved picks between the tangent lines and Smooth Bridge's curved outline, with Radius, Constant Gap, Reach and Keep Originals; the Smooth Bridge… menu item is gone, and `addon.pathtools.bridge` still runs and opens the dialog with External and Curved (`connect` and `curved` on `addon.pathtools.commonTangents`). A VectorCraft addition: headline numbers unchanged. - 2026-11-03: Text Tweaker, the first tool of the Type Tools add-on (Object › Plug-ins › Type Tools): one character attribute (size, baseline shift, rotation, horizontal or vertical scale, tracking, leading or stroke weight) goes letter by letter from a start value to an end value along a straight ramp, an ease, a bow, a spike or at random with a seed, set as the Character panel sets it, while the text stays live; a dialog with Preview, one undo step (`addon.type.textTweaker`, #4924). A VectorCraft addition: headline numbers unchanged. - 2026-11-01: Group Overlapping Objects joins the Arrange Tools add-on (Object › Plug-ins › Arrange Tools): the selected objects whose visual bounds overlap or touch, chains included, go into one group each, within their own layer or group, at the stacking place of their frontmost member; objects that overlap nothing stay as they are. One undo step, a sweep along x so thousands of loose pieces group quickly (at most 20000 objects). A VectorCraft addition: headline numbers unchanged. - 2026-10-31: Export for Screens works as the reference app's dialog: Artboards and Assets tabs with a grid or list of thumbnails, Clear Selection and Prefix, Create Sub-folders by Scale or Format (on by default), Export PDFs As Single File (the chosen artboards as one PDF's pages, `pdfs: "single"`) or Multiple Files, iOS and Android rows, format presets in a ☰ menu, and a count of the files the export writes (#4895). About 55 community PRs and fixes landed the same day: Find Font, Replace Font, Outline Stroke and Expand leave hidden and locked art alone (with a warning); DXF export writes LINE and ELLIPSE entities and outlines only the strokes a CAD line can't draw; Blob Brush Angle and Roundness; Shift-constrained Perspective Selection; Grid Repeat Options Preview; a gradient mesh from a file budgeted at about a million quads; width-profile strokes keep their shape zoomed out; `.ai`/EPS import fidelity (area type, envelopes, transparency in dictionaries, character styles); PDF import finds hyphenated and CMap-suffixed font names; Windows renders follow the process's core affinity; Enter or Escape in a floating panel's field no longer reaches the canvas (#4803); Properties shows Blend Options for any selected blend (#4817); Artwork Cleanup finds doubled type (#4835) and joins stacked lines into one object (Join Point Text, #4826). Headline numbers unchanged. diff --git a/crates/engine/src/cmd.rs b/crates/engine/src/cmd.rs index 8e8d96ea66..d2dc185222 100644 --- a/crates/engine/src/cmd.rs +++ b/crates/engine/src/cmd.rs @@ -1002,7 +1002,8 @@ pub use variablecmds::{VariableSort, VariableSortKey, variable_order}; /// Command ids kept only so older scripts keep working: `(alias, the command it duplicates)`. /// They run as before but the command palette leaves them out (it lists the command once). -pub const ALIASES: &[(&str, &str)] = &[("object.convertDocumentColorMode", "file.documentColorMode")]; +pub const ALIASES: &[(&str, &str)] = + &[("object.convertDocumentColorMode", "file.documentColorMode"), ("addon.pathtools.bridge", "addon.pathtools.commonTangents")]; /// Is `id` an [`ALIASES`] entry? pub fn is_alias(id: &str) -> bool { diff --git a/crates/engine/src/cmd/addons/pathtools/bridge.rs b/crates/engine/src/cmd/addons/pathtools/bridge.rs index 2f56079b18..6e02292917 100644 --- a/crates/engine/src/cmd/addons/pathtools/bridge.rs +++ b/crates/engine/src/cmd/addons/pathtools/bridge.rs @@ -32,15 +32,15 @@ pub(super) fn specs() -> Vec<CommandSpec> { vec![cmd!( "addon.pathtools.bridge", "Smooth Bridge", - ["Object", "Plug-ins", "Path Precision Tools"], + [], None, - "{radius?: % 1..1000 (100; the radius of each bridge's two arcs as a percentage of the smaller circle's radius: larger makes a wider, gentler bridge), gap?: pt 0..1000 (instead of radius: the arcs' radius is the smaller circle's radius plus this gap, so each arc stays this gap away from a circle of the smaller circle's size about the arc's center; for equal circles this gap apart that is where a third circle this gap from both sits, as in a triangular grid, so the channels around an empty place in such a grid are one width; giving both is an error), reach?: pt 0..10000 (10; with three or more circles: how far apart two circles' outlines may be for a bridge between them, overlapping ones included; two circles are bridged at any distance), keepOriginals?: bool (false: each outline replaces its circles, painted as the topmost of them, and a group or compound path the other circles leave empty goes; true: it goes directly above that circle and the circles stay), ids?: [id] (default: the selection; a group, other than a clipping group, gives the objects inside it)} join circles (paths whose outline is a circle, not hidden or locked) into metaball (aka meatball) shapes. Two circles become one closed outline: around each circle on its side away from the other, and along two concave arcs, one on each side, that touch both circles so the outline runs on smoothly into them. With three or more, every two circles within reach are bridged the same way, and the bridges that connect are united into one shape each (holes smaller than 1% of the smallest circle's area are filled); a pair within reach but too far apart for the radius gets no bridge, and so does one whose neck would be thinner than the precision its shape is united at, and a circle bridged to no other is left as it is. Overlapping and touching circles are joined too. An object that is not a circle is an error that says why (an ellipse whose width and height differ, a compound path, a hidden or locked object, or another object). One circle inside another (among three or more, any such pair within reach) is an error; so are two circles too far apart for the radius (the arcs would not reach both, or would cross), or three or more with no pair the arcs can join, which suggests a larger radius or gap when the largest one would bridge them; so are no two circles within reach, more than 2000 circles and more than 8000 bridges. One undo step; the outlines (and the circles left as they are) are selected → {ids, alone}, with {id} too for two circles", + "{radius?: % 1..1000 (100; the radius of each bridge's two arcs as a percentage of the smaller circle's radius: larger makes a wider, gentler bridge), gap?: pt 0..1000 (instead of radius: the arcs' radius is the smaller circle's radius plus this gap, so each arc stays this gap away from a circle of the smaller circle's size about the arc's center; for equal circles this gap apart that is where a third circle this gap from both sits, as in a triangular grid, so the channels around an empty place in such a grid are one width; giving both is an error), reach?: pt 0..10000 (10; with three or more circles: how far apart two circles' outlines may be for a bridge between them, overlapping ones included; two circles are bridged at any distance), keepOriginals?: bool (false: each outline replaces its circles, painted as the topmost of them, and a group or compound path the other circles leave empty goes; true: it goes directly above that circle and the circles stay), ids?: [id] (default: the selection; a group, other than a clipping group, gives the objects inside it)} join circles (paths whose outline is a circle, not hidden or locked) into metaball (aka meatball) shapes. Two circles become one closed outline: around each circle on its side away from the other, and along two concave arcs, one on each side, that touch both circles so the outline runs on smoothly into them. With three or more, every two circles within reach are bridged the same way, and the bridges that connect are united into one shape each (holes smaller than 1% of the smallest circle's area are filled); a pair within reach but too far apart for the radius gets no bridge, and so does one whose neck would be thinner than the precision its shape is united at, and a circle bridged to no other is left as it is. Overlapping and touching circles are joined too. An object that is not a circle is an error that says why (an ellipse whose width and height differ, a compound path, a hidden or locked object, or another object). One circle inside another (among three or more, any such pair within reach) is an error; so are two circles too far apart for the radius (the arcs would not reach both, or would cross), or three or more with no pair the arcs can join, which suggests a larger radius or gap when the largest one would bridge them; so are no two circles within reach, more than 2000 circles and more than 8000 bridges. One undo step; the outlines (and the circles left as they are) are selected → {ids, alone}, with {id} too for two circles (kept for older scripts: Common Tangents makes the same outline with `curved`, and the command palette leaves this command out)", has_selection, bridge )] } -fn bridge(s: &mut Session, p: &Value) -> Result<Value> { +pub(super) fn bridge(s: &mut Session, p: &Value) -> Result<Value> { let percent = given(p, "radius", Some(RADII), C)?; let gap = given(p, "gap", Some(GAPS), C)?; let reach = given(p, "reach", Some(REACHES), C)?.unwrap_or(REACH); diff --git a/crates/engine/src/cmd/addons/pathtools/tangents.rs b/crates/engine/src/cmd/addons/pathtools/tangents.rs index e47c009062..372ceb6e12 100644 --- a/crates/engine/src/cmd/addons/pathtools/tangents.rs +++ b/crates/engine/src/cmd/addons/pathtools/tangents.rs @@ -31,7 +31,7 @@ pub(super) fn specs() -> Vec<CommandSpec> { "Common Tangents", ["Object", "Plug-ins", "Path Precision Tools"], None, - "{tangents?: \"external\" (both paths on the same side of each line) | \"internal\" (the lines that run between them) | \"all\" (\"all\"), centerline?: bool (false: true also adds the line joining the two centers, an ellipse's center or a path's center of area), ids?: [id, id] (default: the selection)} add the common tangent lines of two convex closed paths as separate open paths, each from where it touches the first path to where it touches the second (the whole stretch where a straight side lies along it), stroked with the current stroke color and weight (black when the stroke is None) and unfilled, directly above the upper of the two, as one undo step; the new lines are selected. An ellipse drawn with the Ellipse tool, turned or scaled, is measured as an exact ellipse; any other path must be closed, have one outline, bend the same way all around and have at most 10000 segments. Separate paths have two external and two internal tangents; overlapping paths only external ones; one path inside the other has none. Paths that touch, from outside or from inside, share one tangent there instead: a line centered on the point where they touch and as long as the narrower path is wide along it; paths that meet at a corner or along a shared stretch of outline get one such line, at the middle of the directions that touch both. Paths count as touching when the gap between them is at most a billionth of the larger of their sizes and the distance between their centers. One of the two may be a point (a path of one anchor): the lines then run from the point to where they touch the path, two when the point lies outside it (one that lies along a straight side covers the whole side), one when the point lies on its outline, that is, at most the touching tolerance from it, with the point's distance from the path's center in place of the distance between centers (centered on the point and as long as the path is wide along it, or the whole straight side the point lies on), none when it lies inside; every `tangents` value gives the same lines, counted as internal when `tangents` is \"internal\" and as external otherwise, and the centerline runs from the point to the path's center; two points are refused. When there is no tangent of the kind asked for, nothing changes and the result has a `warning` → {ids, external, internal, centerline (its id or null), warning?}", + "{tangents?: \"external\" (both paths on the same side of each line) | \"internal\" (the lines that run between them) | \"all\" (\"all\"), centerline?: bool (false: true also adds the line joining the two centers, an ellipse's center or a path's center of area), connect?: bool (false: true joins the two tangents of each kind into one closed path, along the chords between where they touch each path; a kind with one tangent stays a line), curved?: bool (false: true joins the selected circles into one outline along concave arcs that touch both, as `addon.pathtools.bridge` does, in place of the external tangents; `tangents` other than \"external\", `centerline` and `connect: false` are then an error), radius?: % 1..1000 (100; with curved, as for `addon.pathtools.bridge`), gap?: pt 0..1000 (with curved, instead of radius), reach?: pt 0..10000 (10; with curved, for three or more circles), keepOriginals?: bool (false; with curved), ids?: [id, id] (default: the selection; with curved, two or more circles)} add the common tangent lines of two convex closed paths (with curved, join circles with a smooth bridge into metaball, aka meatball, shapes instead) as separate open paths, each from where it touches the first path to where it touches the second (the whole stretch where a straight side lies along it), stroked with the current stroke color and weight (black when the stroke is None) and unfilled, directly above the upper of the two, as one undo step; the new lines are selected. An ellipse drawn with the Ellipse tool, turned or scaled, is measured as an exact ellipse; any other path must be closed, have one outline, bend the same way all around and have at most 10000 segments. Separate paths have two external and two internal tangents; overlapping paths only external ones; one path inside the other has none. Paths that touch, from outside or from inside, share one tangent there instead: a line centered on the point where they touch and as long as the narrower path is wide along it; paths that meet at a corner or along a shared stretch of outline get one such line, at the middle of the directions that touch both. Paths count as touching when the gap between them is at most a billionth of the larger of their sizes and the distance between their centers. One of the two may be a point (a path of one anchor): the lines then run from the point to where they touch the path, two when the point lies outside it (one that lies along a straight side covers the whole side), one when the point lies on its outline, that is, at most the touching tolerance from it, with the point's distance from the path's center in place of the distance between centers (centered on the point and as long as the path is wide along it, or the whole straight side the point lies on), none when it lies inside; every `tangents` value gives the same lines, counted as internal when `tangents` is \"internal\" and as external otherwise, and the centerline runs from the point to the path's center; two points are refused. When there is no tangent of the kind asked for, nothing changes and the result has a `warning` → {ids, external, internal, centerline (its id or null), warning?}, or with curved `addon.pathtools.bridge`'s {ids, alone, id?}", has_selection, common_tangents )] @@ -71,9 +71,36 @@ fn refusal(e: pt::OutlineError) -> EngineError { ) } +/// The parameters that shape a curved bridge. +const CURVED_KEYS: [&str; 4] = ["radius", "gap", "reach", "keepOriginals"]; + fn common_tangents(s: &mut Session, p: &Value) -> Result<Value> { const C: &str = COMMON_TANGENTS; - let kinds = choice(p, C, "tangents", &KINDS)?.unwrap_or("all"); + let given = |key: &str| p.get(key).is_some_and(|v| !v.is_null()); + let kinds = choice(p, C, "tangents", &KINDS)?; + let connect = if given("connect") { Some(switch_or(p, "connect", false, C)?) } else { None }; + if switch_or(p, "curved", false, C)? { + if kinds.is_some_and(|k| k != "external") { + return Err(bad(C, "`curved` joins the circles along their external tangents: give `tangents` \"external\" or leave it out")); + } + if given("centerline") { + return Err(bad(C, "`centerline` applies to the tangent lines: leave it out with `curved`")); + } + if connect == Some(false) { + return Err(bad(C, "a curved bridge is always connected: leave `connect` out or set it true")); + } + // The outline is Smooth Bridge's. + let mut bridged = serde_json::Map::new(); + for key in CURVED_KEYS.iter().chain(&["ids"]).filter(|k| given(k)) { + bridged.insert((*key).to_owned(), p[*key].clone()); + } + return super::bridge::bridge(s, &Value::Object(bridged)); + } + if let Some(key) = CURVED_KEYS.iter().find(|k| given(k)) { + return Err(bad(C, format!("`{key}` applies to a curved bridge: give `curved` with it"))); + } + let kinds = kinds.unwrap_or("all"); + let connect = connect.unwrap_or(false); let centerline = switch_or(p, "centerline", false, C)?; let roots = checked_ids_or_selection(s, p, C)?; let d = &s.doc()?.doc; @@ -105,6 +132,33 @@ fn common_tangents(s: &mut Session, p: &Value) -> Result<Value> { _ => (count(pt::TangentKind::External), count(pt::TangentKind::Internal)), }; let lines: Vec<(Point, Point)> = kept.iter().map(|t| (t.from, t.to)).collect(); + // With `connect`, the two tangents of each kind and the chords between their ends on each path make one closed + // shape; a kind with one tangent (paths that touch) keeps it as a line. A point's lines are all one kind. + let shapes: Vec<(Vec<Point>, bool)> = if connect { + let mut out = vec![]; + for kind in [pt::TangentKind::External, pt::TangentKind::Internal] { + let of: Vec<&pt::Tangent> = kept.iter().copied().filter(|t| point || t.kind == kind).collect(); + match of.as_slice() { + [l, m] => { + // A point's two lines share the point, which then closes the ring once. + let same = |q: Point, p: Point| (q - p).hypot() <= 1e-9 * a.size().max(b.size()); + let mut ring = vec![l.from, l.to, m.to, m.from]; + ring.dedup_by(|q, p| same(*q, *p)); + if ring.len() > 2 && same(ring[0], ring[ring.len() - 1]) { + ring.pop(); + } + out.push((ring, true)); + } + _ => out.extend(of.iter().map(|t| (vec![t.from, t.to], false))), + } + if point { + break; + } + } + out + } else { + lines.iter().map(|&(from, to)| (vec![from, to], false)).collect() + }; if lines.is_empty() && point { // Written as `EngineError::Other` so that the i18n message scan finds it. let warning = EngineError::Other("The point lies inside the path, so it has no tangents".into()); @@ -133,13 +187,14 @@ fn common_tangents(s: &mut Session, p: &Value) -> Result<Value> { let (parent, idx, _) = d.position(top).ok_or(EngineError::NoNode(top))?; let mut ids = vec![]; let mut center_id = None; - for (k, (from, to)) in lines.iter().copied().chain(center).enumerate() { + let center = center.map(|(from, to)| (vec![from, to], false)); + for (k, (points, closed)) in shapes.iter().cloned().chain(center).enumerate() { let id = d.alloc_id(); - let path = PathData::single(SubPath::polyline(&[from, to], false)); + let path = PathData::single(SubPath::polyline(&points, closed)); let mut n = Node::new(id, NodeKind::Path { path, rule: FillRule::NonZero, live: None, clipping: false, guide: false }); look.apply(d, &mut n); d.insert(parent, idx + 1 + k, n)?; - if k == lines.len() { + if k == shapes.len() { center_id = Some(id); } ids.push(id); diff --git a/crates/engine/src/cmd/addons/pathtools/tangents/tests.rs b/crates/engine/src/cmd/addons/pathtools/tangents/tests.rs index 7ab6b32838..032ef5f377 100644 --- a/crates/engine/src/cmd/addons/pathtools/tangents/tests.rs +++ b/crates/engine/src/cmd/addons/pathtools/tangents/tests.rs @@ -354,3 +354,110 @@ fn bad_selections_and_params_are_refused() { let g = group_of(&mut s, &[b]); assert!(err(&mut s, json!({"ids": [a.0, g.0]})).contains("select two closed paths")); } + +/// The one closed outline of path `id`. +fn outline(s: &Session, id: NodeId) -> vectorcraft_geom::SubPath { + let n = s.doc().unwrap().doc.node(id).unwrap(); + let NodeKind::Path { path, .. } = &n.kind else { panic!("not a path") }; + let [sp] = path.subpaths.as_slice() else { panic!("{} subpaths", path.subpaths.len()) }; + assert!(sp.closed); + sp.clone() +} + +/// The anchors of path `id`'s one closed outline. +fn corners(s: &Session, id: NodeId) -> Vec<Point> { + outline(s, id).anchors.iter().map(|a| a.p).collect() +} + +#[test] +fn connect_joins_the_external_tangents_and_the_chords_into_one_closed_shape_in_one_step() { + let mut s = session(); + let (a, b) = (circle(&mut s, 100.0, 100.0, 20.0), circle(&mut s, 200.0, 100.0, 20.0)); + let (before, count) = (steps(&s), s.doc().unwrap().doc.node_count()); + let r = s.execute(C, &json!({"tangents": "external", "connect": true, "ids": [a.0, b.0]})).unwrap(); + assert_eq!(steps(&s), before + 1, "one undo step"); + let ids = r["ids"].as_array().unwrap(); + assert_eq!(ids.len(), 1, "one shape in place of two lines"); + assert_eq!(s.doc().unwrap().doc.node_count(), count + 1, "the circles stay"); + let found = corners(&s, NodeId(ids[0].as_u64().unwrap())); + assert_eq!(found.len(), 4); + // The tangents above and below both circles, joined by each circle's vertical diameter. + for p in [Point::new(100.0, 80.0), Point::new(200.0, 80.0), Point::new(200.0, 120.0), Point::new(100.0, 120.0)] { + assert!(found.iter().any(|&q| near(p, q)), "{p:?} in {found:?}"); + } + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(s.doc().unwrap().doc.node_count(), count); +} + +#[test] +fn connect_with_all_makes_one_shape_of_each_kind_and_a_point_makes_a_triangle() { + let mut s = session(); + let (ca, cb) = ((Point::new(100.0, 100.0), 20.0), (Point::new(220.0, 140.0), 40.0)); + let (a, b) = (circle(&mut s, ca.0.x, ca.0.y, ca.1), circle(&mut s, cb.0.x, cb.0.y, cb.1)); + let r = s.execute(C, &json!({"connect": true, "centerline": true, "ids": [a.0, b.0]})).unwrap(); + let ids: Vec<NodeId> = r["ids"].as_array().unwrap().iter().map(|v| NodeId(v.as_u64().unwrap())).collect(); + assert_eq!(ids.len(), 3, "an external shape, an internal shape and the centerline"); + for &id in &ids[..2] { + let found = corners(&s, id); + assert_eq!(found.len(), 4); + let on = |(c, r): (Point, f64)| found.iter().filter(|p| ((**p - c).hypot() - r).abs() < 1e-6).count(); + assert_eq!((on(ca), on(cb)), (2, 2), "two corners where the tangents touch each circle: {found:?}"); + } + assert_ne!(corners(&s, ids[0]), corners(&s, ids[1])); + assert_eq!(r["centerline"], json!(ids[2].0)); + + let mut s = session(); + let (p, c) = (point(&mut s, 0.0, 100.0), circle(&mut s, 100.0, 100.0, 20.0)); + let r = s.execute(C, &json!({"connect": true, "ids": [p.0, c.0]})).unwrap(); + let ids = r["ids"].as_array().unwrap(); + assert_eq!(ids.len(), 1); + let found = corners(&s, NodeId(ids[0].as_u64().unwrap())); + assert_eq!(found.len(), 3, "the point and where its two lines touch the circle: {found:?}"); + assert!(found.iter().any(|&q| near(q, Point::new(0.0, 100.0)))); +} + +#[test] +fn curved_makes_the_bridge_the_smooth_bridge_command_makes() { + let build = || { + let mut s = session(); + let ids = [circle(&mut s, 100.0, 100.0, 20.0), circle(&mut s, 150.0, 100.0, 20.0), circle(&mut s, 125.0, 140.0, 20.0)]; + select(&mut s, &ids); + s + }; + for (merged, old) in [ + (json!({"curved": true}), json!({})), + ( + json!({"tangents": "external", "connect": true, "curved": true, "gap": 5, "reach": 30, "keepOriginals": true}), + json!({"gap": 5, "reach": 30, "keepOriginals": true}), + ), + ] { + let (mut s, mut t) = (build(), build()); + let r = s.execute(C, &merged).unwrap(); + let q = t.execute("addon.pathtools.bridge", &old).unwrap(); + assert_eq!(r, q, "{merged}"); + let kinds = |s: &Session| s.doc().unwrap().doc.layers[0].children().unwrap().iter().map(|n| n.kind.clone()).collect::<Vec<_>>(); + assert_eq!(kinds(&s), kinds(&t), "{merged}"); + } +} + +#[test] +fn options_of_the_other_mode_are_refused() { + let mut s = session(); + let (a, b) = (circle(&mut s, 100.0, 100.0, 20.0), circle(&mut s, 200.0, 100.0, 20.0)); + select(&mut s, &[a, b]); + let before = (steps(&s), s.doc().unwrap().doc.node_count()); + let err = |s: &mut Session, p: Value| s.execute(C, &p).unwrap_err().to_string(); + for (p, says) in [ + (json!({"connect": "yes"}), "connect"), + (json!({"curved": true, "tangents": "all"}), "external"), + (json!({"curved": true, "centerline": true}), "centerline"), + (json!({"curved": true, "connect": false}), "connected"), + (json!({"radius": 50}), "curved"), + (json!({"connect": true, "keepOriginals": true}), "curved"), + (json!({"curved": true, "radius": 50, "gap": 2}), "not both"), + (json!({"curved": true, "radius": 0}), "radius"), + ] { + assert!(err(&mut s, p.clone()).contains(says), "{p}: {}", err(&mut s, p.clone())); + } + assert_eq!((steps(&s), s.doc().unwrap().doc.node_count()), before, "nothing changes"); +} diff --git a/crates/engine/src/cmd/params.rs b/crates/engine/src/cmd/params.rs index 9b498f1ca8..0bfbe7c304 100644 --- a/crates/engine/src/cmd/params.rs +++ b/crates/engine/src/cmd/params.rs @@ -388,6 +388,7 @@ const EXCLUSIVE_KEYS: &[(&str, &str, &str)] = &[ ("addon.pathtools.cornerSet", "items", "ids"), ("addon.pathtools.cornerRemove", "items", "ids"), ("addon.pathtools.bridge", "radius", "gap"), + ("addon.pathtools.commonTangents", "radius", "gap"), ("links.unembed", "id", "ids"), ("links.unembed", "path", "folder"), ]; diff --git a/crates/mcp/src/ui_catalog.rs b/crates/mcp/src/ui_catalog.rs index b29f22395c..1f4ade798a 100644 --- a/crates/mcp/src/ui_catalog.rs +++ b/crates/mcp/src/ui_catalog.rs @@ -1531,7 +1531,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "ui.menuDialog", "Menu Dialog", "", - "{command: object.move|object.rotate|object.scale|object.reflect|object.shear|object.transformEach|path.average|path.averageJoin|object.path.offsetPath|object.path.simplify|object.path.smooth|object.path.splitIntoGrid|object.vectorHalftone|object.stepAndRepeat|artboard.rearrange|artboard.rename|object.envelope.makeWithWarp|object.envelope.resetWithWarp|object.envelope.makeWithMesh|object.envelope.resetWithMesh|object.envelope.options|addon.arrange.grid|addon.arrange.offset|addon.arrange.replace|addon.arrange.size|addon.arrange.match|addon.arrange.groupRows|addon.packaging.setFoldAngle|addon.pathtools.cornerSet|addon.pathtools.divideDashes|addon.pathtools.bridge|addon.pathtools.tangentCircle|addon.type.textTweaker|addon.color.swatchLegend|addon.arrange.randomizeOpacity|addon.arrange.sort|addon.arrange.markBounds|addon.color.applyNearestSwatch|addon.color.randomFill|addon.select.byArtboards|addon.select.editPointsOnly|type.smartPunctuation|variable.define|variable.rename|variable.bind|dataset.new|dataset.set|dataset.rename|dataset.select} open the dialog that command's menu item opens (its `key` in ui.inspect is the command id, except `transformEach` for object.transformEach, `envelopeWarp` for object.envelope.makeWithWarp and object.envelope.resetWithWarp, `envelopeMesh` for object.envelope.makeWithMesh and object.envelope.resetWithMesh, `variables` for variable.define and variable.rename and variable.bind and dataset.new and dataset.set and dataset.rename and dataset.select, `envelopeOptions` for object.envelope.options, `smoothSlider` for object.path.smooth, and `simplifySlider` for object.path.simplify; the dialogs of addon.color.applyNearestSwatch and addon.select.byArtboards have no `key`; smoothSlider and simplifySlider are the sliders over the canvas, with field `level`, and object.path.simplify opens its dialog `object.path.simplify` instead once OK in that dialog keeps the settings (`retain`); Set Fold Angle's `angle` is the selected fold lines' angle, and it is refused while the selection has no fold line it can change; Scale and Transform Each have `corners` and `strokes`, from the preferences, which OK updates; Transform Each opens on the values it was last confirmed with (not `copy`), and its Copy button confirms with `copy: true`; the envelope dialogs start from the selected envelope, Make opens as Reset (`reset: true`) while one is selected; variable.rename opens only while the document has a variable, and dataset.set and dataset.rename only while it has a data set, and otherwise the status bar says why; ui.dialog.set, ui.dialog.confirm and ui.dialog.cancel take the dialog's `id` from ui.inspect, or `top`, not its `key`)", + "{command: object.move|object.rotate|object.scale|object.reflect|object.shear|object.transformEach|path.average|path.averageJoin|object.path.offsetPath|object.path.simplify|object.path.smooth|object.path.splitIntoGrid|object.vectorHalftone|object.stepAndRepeat|artboard.rearrange|artboard.rename|object.envelope.makeWithWarp|object.envelope.resetWithWarp|object.envelope.makeWithMesh|object.envelope.resetWithMesh|object.envelope.options|addon.arrange.grid|addon.arrange.offset|addon.arrange.replace|addon.arrange.size|addon.arrange.match|addon.arrange.groupRows|addon.packaging.setFoldAngle|addon.pathtools.cornerSet|addon.pathtools.divideDashes|addon.pathtools.bridge|addon.pathtools.commonTangents|addon.pathtools.tangentCircle|addon.type.textTweaker|addon.color.swatchLegend|addon.arrange.randomizeOpacity|addon.arrange.sort|addon.arrange.markBounds|addon.color.applyNearestSwatch|addon.color.randomFill|addon.select.byArtboards|addon.select.editPointsOnly|type.smartPunctuation|variable.define|variable.rename|variable.bind|dataset.new|dataset.set|dataset.rename|dataset.select} open the dialog that command's menu item opens (its `key` in ui.inspect is the command id, except `transformEach` for object.transformEach, `envelopeWarp` for object.envelope.makeWithWarp and object.envelope.resetWithWarp, `envelopeMesh` for object.envelope.makeWithMesh and object.envelope.resetWithMesh, `variables` for variable.define and variable.rename and variable.bind and dataset.new and dataset.set and dataset.rename and dataset.select, `envelopeOptions` for object.envelope.options, `addon.pathtools.commonTangents` for addon.pathtools.bridge, `smoothSlider` for object.path.smooth, and `simplifySlider` for object.path.simplify; the dialogs of addon.color.applyNearestSwatch and addon.select.byArtboards have no `key`; smoothSlider and simplifySlider are the sliders over the canvas, with field `level`, and object.path.simplify opens its dialog `object.path.simplify` instead once OK in that dialog keeps the settings (`retain`); Set Fold Angle's `angle` is the selected fold lines' angle, and it is refused while the selection has no fold line it can change; Scale and Transform Each have `corners` and `strokes`, from the preferences, which OK updates; Transform Each opens on the values it was last confirmed with (not `copy`), and its Copy button confirms with `copy: true`; the envelope dialogs start from the selected envelope, Make opens as Reset (`reset: true`) while one is selected; variable.rename opens only while the document has a variable, and dataset.set and dataset.rename only while it has a data set, and otherwise the status bar says why; ui.dialog.set, ui.dialog.confirm and ui.dialog.cancel take the dialog's `id` from ui.inspect, or `top`, not its `key`)", ), ( "ui.widthPointEdit", diff --git a/crates/ui-egui/src/addons/cutting/tests.rs b/crates/ui-egui/src/addons/cutting/tests.rs index b177f72604..a22e907c04 100644 --- a/crates/ui-egui/src/addons/cutting/tests.rs +++ b/crates/ui-egui/src/addons/cutting/tests.rs @@ -35,10 +35,6 @@ fn rect(app: &mut VectorcraftApp, x: f64, y: f64, width: f64, height: f64) -> u6 id_of(app.run("shape.rectangle", json!({"x": x, "y": y, "width": width, "height": height})).unwrap()) } -fn circle(app: &mut VectorcraftApp, cx: f64, cy: f64, r: f64) -> u64 { - id_of(app.run("shape.ellipse", json!({"x": cx - r, "y": cy - r, "width": 2.0 * r, "height": 2.0 * r})).unwrap()) -} - fn select(app: &mut VectorcraftApp, ids: &[u64]) { app.run("select.set", json!({ "ids": ids })).unwrap(); } @@ -224,35 +220,6 @@ fn each_addon_dialog_opens_on_its_items_values_and_runs_its_command() { assert!(b > a, "the second object lies right of the first: {a}, {b}"); }, }, - Row { - name: "common tangents", - menu: "Path Precision Tools", - label: "Common Tangents…", - command: crate::addons::pathtools::COMMON_TANGENTS, - setup: |app| { - let (a, b) = (circle(app, 60.0, 150.0, 20.0), circle(app, 220.0, 150.0, 40.0)); - select(app, &[a, b]); - }, - opens: || json!({"tangents": "all", "centerline": false}), - set: || json!({}), - check: |app, start| { - assert_eq!(nodes(app), start.node_count() + 4, "four tangent lines"); - // Each kind the list offers is one the command takes. - for (_, kind) in crate::addons::pathtools::TANGENT_KINDS { - let params = json!({"tangents": kind}); - assert!(vectorcraft_engine::check_params(crate::addons::pathtools::COMMON_TANGENTS, ¶ms).is_ok(), "{kind}"); - } - // A circle inside another: nothing changes, and a message says why. - let ids = children(start); - let inner = circle(app, 220.0, 150.0, 10.0); - select(app, &[ids[1], inner]); - let (n, count) = (steps(app), nodes(app)); - open_item(app, "Path Precision Tools", "Common Tangents…"); - answer(app, true); - assert_eq!((steps(app), nodes(app)), (n, count)); - assert!(app.ui.status.contains("inside the other"), "{}", app.ui.status); - }, - }, Row { name: "add bounding rectangle", menu: "Path Precision Tools", diff --git a/crates/ui-egui/src/addons/dialogs.rs b/crates/ui-egui/src/addons/dialogs.rs index 4abd73e430..a607911e16 100644 --- a/crates/ui-egui/src/addons/dialogs.rs +++ b/crates/ui-egui/src/addons/dialogs.rs @@ -104,7 +104,8 @@ pub(crate) fn open_from_menu(app: &mut VectorcraftApp, id: &str) -> Option<Resul let open: fn(&mut VectorcraftApp) -> Result<Value, String> = match id { pathtools::set_corners::COMMAND => pathtools::set_corners::open, pathtools::dashes::COMMAND => pathtools::dashes::open, - pathtools::bridge::COMMAND => pathtools::bridge::open, + pathtools::COMMON_TANGENTS => pathtools::tangents::open, + pathtools::tangents::BRIDGE => pathtools::tangents::open_connected, pathtools::tangent_circle::COMMAND => pathtools::tangent_circle::open, typetools::COMMAND => typetools::open, color::legend::COMMAND => color::legend::open, diff --git a/crates/ui-egui/src/addons/dialogs/tests.rs b/crates/ui-egui/src/addons/dialogs/tests.rs index c0d1c572f2..dc2372552e 100644 --- a/crates/ui-egui/src/addons/dialogs/tests.rs +++ b/crates/ui-egui/src/addons/dialogs/tests.rs @@ -183,10 +183,10 @@ fn rows() -> Vec<Row> { }, Row { group: "Path Precision Tools", - label: "Smooth Bridge…", + label: "Common Tangents…", setup: two_circles, refused: Vec::new, - values: || vec![("keepOriginals", json!(true))], + values: || vec![("tangents", json!("external")), ("sides", json!("curved")), ("keepOriginals", json!(true))], check: |app| assert_eq!(count(app), 3, "the circles and the outline above them"), }, Row { diff --git a/crates/ui-egui/src/addons/pathtools.rs b/crates/ui-egui/src/addons/pathtools.rs index 324f907615..2cb01c3e29 100644 --- a/crates/ui-egui/src/addons/pathtools.rs +++ b/crates/ui-egui/src/addons/pathtools.rs @@ -1,6 +1,6 @@ //! Path Precision Tools in the interface: its submenu (Object › Plug-ins › Path Precision Tools), //! which selects its tools, opens its panels and runs Split / Add Points at Crossings, Set Corners… ([`set_corners`]), Divide into -//! Dashes ([`dashes`]), Expand Dashes into Paths, Smooth Bridge ([`bridge`]), Convert to Parametric Shape, Tangent Circle… ([`tangent_circle`]), Add Bounding Rectangle…, Add Bounding Circle… and Add Inscribed Circle; the Anchor Inspector panel (the selected +//! Dashes ([`dashes`]), Expand Dashes into Paths, Convert to Parametric Shape, Tangent Circle… ([`tangent_circle`]), Common Tangents… (the tangent lines, or circles connected along them, [`tangents`]), Add Bounding Rectangle…, Add Bounding Circle… and Add Inscribed Circle; the Anchor Inspector panel (the selected //! anchor's position and handles as numbers, the add-on's anchor edits, the Corner Tool's values, //! [`corner`], and the Shared Edge Merge Tool's, [`shared_edge`]); the Parametric Shape panel //! ([`shape`]); its tools' options dialog (a double-click on the tool); and the Tangent Circle Tool's radius dialog @@ -8,7 +8,6 @@ //! dialog draws its circle with `shape.circleThroughPoints`. Canceling an Anchor Inspector field edit restores its //! opening value: an anchor edit is one undo step that the cancel takes back. -pub mod bridge; pub mod corner; pub mod dashes; pub mod set_corners; @@ -16,6 +15,7 @@ pub mod shape; pub mod shared_edge; pub mod tangent_circle; pub mod tangent_circle_radius; +pub mod tangents; use craft::behavior::{ColumnWidth, EditEvents}; use craft::menu::Node; @@ -45,7 +45,7 @@ use crate::{VectorcraftApp, fields}; pub const ID: &str = "anchorInspector"; /// The tools' options dialog. pub const KIND: &str = "pathToolOptions"; -/// Common Tangents' command, whose menu item opens the command dialog with a Preview. +/// Common Tangents' command, whose menu item opens its dialog ([`tangents`]). pub const COMMON_TANGENTS: &str = "addon.pathtools.commonTangents"; /// The kinds of tangent Common Tangents' `tangents` picks, and their labels. pub const TANGENT_KINDS: &[(&str, &str)] = &[("All", "all"), ("External", "external"), ("Internal", "internal")]; @@ -143,10 +143,9 @@ pub fn menu() -> Vec<Node> { cp("Split at Crossings", "addon.pathtools.crossings", json!({ "cut": true })), c("Divide into Dashes…", dashes::COMMAND), cp("Expand Dashes into Paths", "addon.pathtools.expandDashes", json!({})), - c("Smooth Bridge…", bridge::COMMAND), cp("Convert to Parametric Shape", "addon.pathtools.shape.convert", json!({})), c("Tangent Circle…", tangent_circle::COMMAND), - cp("Common Tangents…", COMMON_TANGENTS, json!({ "tangents": "all", "centerline": false })), + c("Common Tangents…", COMMON_TANGENTS), cp("Add Bounding Rectangle…", BOUNDING_RECTANGLE, json!({ "offset": 0, "each": false })), cp("Add Bounding Circle…", BOUNDING_CIRCLE, json!({ "offset": 0, "each": false })), cp("Add Inscribed Circle", INSCRIBED_CIRCLE, json!({})), diff --git a/crates/ui-egui/src/addons/pathtools/bridge.rs b/crates/ui-egui/src/addons/pathtools/bridge.rs deleted file mode 100644 index 5ddeee621b..0000000000 --- a/crates/ui-egui/src/addons/pathtools/bridge.rs +++ /dev/null @@ -1,254 +0,0 @@ -//! Smooth Bridge in the interface: its dialog (the arcs' radius as a percentage of the smaller -//! circle's radius, or with Constant Gap that radius plus a gap; the reach, unavailable with two -//! circles selected; Keep Originals), which previews on the canvas and runs -//! `addon.pathtools.bridge` on OK. - -use craft::ui::contract::Bind; -use craft::ui::patterns::form_dialogs::{DialogFields, FieldValue, Param, ParamDialog, ParamKind}; -use craft::ui::runtime::env::UnitKind; -use serde_json::{Value, json}; - -use crate::VectorcraftApp; -use crate::addons::dialogs::{self, Spec}; -use crate::canvas::rulers::general_lengths; - -/// The command. -pub const COMMAND: &str = "addon.pathtools.bridge"; -/// The radius the command takes (%), and its default. -const RADII: std::ops::RangeInclusive<f64> = 1.0..=1000.0; -const RADIUS: f64 = 100.0; -/// The gap the command takes (pt), and the dialog's first one. -const GAPS: std::ops::RangeInclusive<f64> = 0.0..=1000.0; -const GAP: f64 = 4.0; -/// The reach the command takes (pt), and its default. -const REACHES: std::ops::RangeInclusive<f64> = 0.0..=10000.0; -const REACH: f64 = 10.0; - -/// How the dialog's values reach the command. -pub(crate) static SPEC: Spec = Spec { command: COMMAND, params, found: None }; - -/// The command's parameters from the dialog's fields: the radius, or with Constant Gap the gap. -fn params(fields: &DialogFields) -> Value { - let (reach, keep) = (fields.number("reach").unwrap_or(REACH), fields.bool("keepOriginals").unwrap_or(false)); - if fields.bool("constantGap").unwrap_or(false) { - json!({ "gap": fields.number("gap").unwrap_or(GAP), "reach": reach, "keepOriginals": keep }) - } else { - json!({ "radius": fields.number("radius").unwrap_or(RADIUS), "reach": reach, "keepOriginals": keep }) - } -} - -/// Opens Smooth Bridge's dialog on the command's defaults. -pub(crate) fn open(app: &mut VectorcraftApp) -> Result<Value, String> { - // The reach applies to three or more circles; two are bridged at any distance. Counted once, before a preview - // replaces the selection with its result, with a selected group counting the objects inside it. - let many = app.session.doc().map(|doc| members(&doc.doc, &doc.selection.objects) > 2).unwrap_or(true); - let fields = DialogFields::from_pairs([ - ("radius", FieldValue::Number(RADIUS)), - ("constantGap", FieldValue::Bool(false)), - ("gap", FieldValue::Number(GAP)), - ("reach", FieldValue::Number(REACH)), - ("keepOriginals", FieldValue::Bool(false)), - ("many", FieldValue::Bool(many)), - ]); - let lengths = general_lengths(app); - dialogs::open(app, &SPEC, fields, move |fields| { - let rows = vec![ - Param::new("constantGap", tl!("Constant Gap"), ParamKind::bool(false)), - Param::number("gap", tl!("Gap:"), GAP, 1.0, 2) - .length(lengths) - .bounds(Some(*GAPS.start()), Some(*GAPS.end())) - .visible_when("constantGap", FieldValue::Bool(true)), - Param::number("radius", tl!("Radius:"), RADIUS, 1.0, 0) - .unit(UnitKind::Percent) - .bounds(Some(*RADII.start()), Some(*RADII.end())) - .visible_when("constantGap", FieldValue::Bool(false)), - Param::number("reach", tl!("Reach:"), REACH, 1.0, 2) - .length(lengths) - .bounds(Some(*REACHES.start()), Some(*REACHES.end())) - .enabled_when("many", FieldValue::Bool(true)), - Param::new("keepOriginals", tl!("Keep Originals"), ParamKind::bool(false)), - ]; - ParamDialog::new(COMMAND, tl!("Smooth Bridge"), rows).previews(true).values(Bind::bound(fields)) - }) -} - -/// How many objects the command bridges for objects `ids`: each one, or for a group (a clipping group excepted) the -/// objects inside it, at any depth; an object given twice, or with its group, counts once. -fn members(doc: &vectorcraft_doc::Document, ids: &[vectorcraft_doc::NodeId]) -> usize { - fn visit(n: &vectorcraft_doc::Node, out: &mut std::collections::BTreeSet<vectorcraft_doc::NodeId>) { - match &n.kind { - vectorcraft_doc::NodeKind::Group { children, clip: false } => children.iter().for_each(|c| visit(c, out)), - _ => { - out.insert(n.id); - } - } - } - let mut out = std::collections::BTreeSet::new(); - for n in ids.iter().filter_map(|&id| doc.node(id)) { - visit(n, &mut out); - } - out.len() -} - -#[cfg(test)] -mod tests { - use serde_json::{Value, json}; - use vectorcraft_engine::Session; - - use crate::addons::dialogs::tests::{confirm, dialog_id, frame, read, set}; - use crate::{VectorcraftApp, menus}; - - fn circle(app: &mut VectorcraftApp, x: f64, r: f64) -> u64 { - app.run("shape.ellipse", json!({"x": x - r, "y": 100.0 - r, "width": 2.0 * r, "height": 2.0 * r})).unwrap()["id"].as_u64().unwrap() - } - - fn bridge_app(xs: &[f64]) -> VectorcraftApp { - let mut app = crate::testing::windowed(VectorcraftApp::new(Session::new(), Default::default())); - app.run("file.new", json!({"width": 400, "height": 300})).unwrap(); - let ids: Vec<u64> = xs.iter().map(|&x| circle(&mut app, x, 10.0)).collect(); - app.run("select.set", json!({"ids": ids})).unwrap(); - app - } - - fn geometry(app: &VectorcraftApp) -> Vec<vectorcraft_doc::NodeKind> { - app.session.doc().unwrap().doc.layers[0].children().unwrap().iter().map(|node| node.kind.clone()).collect() - } - - fn type_number(panel: &mut crate::tests::panel_harness::Panel, label: &str, text: &str) { - panel.click(label); - panel.key(egui::Key::A, egui::Modifiers::COMMAND); - panel.type_text(text); - panel.key(egui::Key::Tab, egui::Modifiers::NONE); - panel.frame(); - } - - #[test] - fn real_bridge_controls_change_the_preview_and_confirmed_geometry() { - use crate::tests::panel_harness::Panel; - - let mut panel = Panel::new(bridge_app(&[100.0, 124.0]), crate::tests::picks::dialogs); - let before = panel.app().session.doc().unwrap().history.undo.len(); - menus::invoke(&mut panel.app(), super::COMMAND, Value::Null); - panel.frame(); - assert!(!panel.enabled("Reach"), "two circles can be bridged at any distance"); - panel.click("Keep Originals"); - type_number(&mut panel, "Radius", "150"); - let id = dialog_id(&panel.app()); - assert_eq!(read(&panel.app(), id, |f| f.number("radius")), Some(150.0)); - let mut expected = bridge_app(&[100.0, 124.0]); - expected.session.execute(super::COMMAND, &json!({"radius": 150, "keepOriginals": true})).unwrap(); - assert_eq!(geometry(&panel.app()), geometry(&expected)); - assert_eq!(geometry(&panel.app()).len(), 3, "both circles stay beside the bridge"); - - panel.click("Constant Gap"); - type_number(&mut panel, "Gap", "6"); - let params = read(&panel.app(), id, super::params); - assert_eq!(params, json!({"gap": 6.0, "reach": 10.0, "keepOriginals": true})); - let mut expected = bridge_app(&[100.0, 124.0]); - expected.session.execute(super::COMMAND, ¶ms).unwrap(); - let preview = geometry(&panel.app()); - assert_eq!(preview, geometry(&expected)); - panel.click("OK"); - panel.frame(); - assert_eq!(geometry(&panel.app()), preview); - assert_eq!(panel.app().session.doc().unwrap().history.undo.len(), before + 1); - assert!(!panel.app().any_dialog_open()); - } - - #[test] - fn real_bridge_reach_edit_reaches_the_command_and_cancel_restores_the_originals() { - use crate::tests::panel_harness::Panel; - - let mut panel = Panel::new(bridge_app(&[100.0, 124.0, 148.0, 300.0]), crate::tests::picks::dialogs); - let original = geometry(&panel.app()); - menus::invoke(&mut panel.app(), super::COMMAND, Value::Null); - panel.frame(); - assert!(panel.enabled("Reach")); - type_number(&mut panel, "Reach", "5"); - let id = dialog_id(&panel.app()); - let params = read(&panel.app(), id, super::params); - assert_eq!(params["reach"], 5.0); - let mut expected = bridge_app(&[100.0, 124.0, 148.0, 300.0]); - expected.session.execute(super::COMMAND, ¶ms).unwrap(); - assert_eq!(geometry(&panel.app()), geometry(&expected)); - panel.click("Cancel"); - panel.frame(); - assert_eq!(geometry(&panel.app()), original); - } - - #[test] - fn reach_counts_the_circles_inside_a_selected_group() { - use crate::tests::panel_harness::Panel; - - for (xs, many) in [(&[100.0, 124.0][..], false), (&[100.0, 124.0, 148.0][..], true)] { - let mut app = bridge_app(xs); - let ids: Vec<u64> = app.session.doc().unwrap().selection.objects.iter().map(|id| id.0).collect(); - let group = app.run("object.group", json!({ "ids": ids })).unwrap()["id"].as_u64().unwrap(); - app.run("select.set", json!({"ids": [group]})).unwrap(); - let mut panel = Panel::new(app, crate::tests::picks::dialogs); - menus::invoke(&mut panel.app(), super::COMMAND, Value::Null); - panel.frame(); - assert_eq!(panel.enabled("Reach"), many, "{} circles in the group", xs.len()); - panel.click("OK"); - panel.frame(); - let inside = panel.app().session.doc().unwrap().doc.node(vectorcraft_doc::NodeId(group)).unwrap().children().unwrap().len(); - assert_eq!(inside, 1, "the circles in the group became one shape"); - } - // A group of two circles selected together with one of them: still two circles. - let mut app = bridge_app(&[100.0, 124.0]); - let ids: Vec<u64> = app.session.doc().unwrap().selection.objects.iter().map(|id| id.0).collect(); - let group = app.run("object.group", json!({ "ids": ids })).unwrap()["id"].as_u64().unwrap(); - app.run("select.set", json!({"ids": [group, ids[0]]})).unwrap(); - assert_eq!(app.session.doc().unwrap().selection.objects.len(), 2); - let mut panel = Panel::new(app, crate::tests::picks::dialogs); - menus::invoke(&mut panel.app(), super::COMMAND, Value::Null); - panel.frame(); - assert!(!panel.enabled("Reach"), "a circle selected with its group counts once"); - } - - #[test] - fn constant_gap_shows_the_gap_and_bridges_many_circles_within_reach() { - let mut app = crate::testing::windowed(VectorcraftApp::new(Session::new(), Default::default())); - app.run("file.new", json!({"width": 400, "height": 300})).unwrap(); - // Three circles 4 apart in a row and one far off. - let ids: Vec<u64> = [100.0, 124.0, 148.0, 300.0].iter().map(|&x| circle(&mut app, x, 10.0)).collect(); - app.run("select.set", json!({ "ids": ids })).unwrap(); - menus::invoke(&mut app, super::COMMAND, Value::Null); - let dialog = dialog_id(&app); - set(&app, dialog, "constantGap", json!(true)); - // A preview leaves two objects selected (one shape and the far circle); Reach stays available for the - // four circles the command still bridges. - frame(&mut app); - assert_eq!(app.session.doc().unwrap().selection.objects.len(), 2, "previewed"); - let (many, params) = read(&app, dialog, |fields| (fields.bool("many"), (super::SPEC.params)(fields))); - assert_eq!(many, Some(true), "Reach available for four circles"); - assert_eq!(params, json!({"gap": 4.0, "reach": 10.0, "keepOriginals": false}), "the gap, not the radius"); - assert!(confirm(&app, dialog), "OK is on"); - frame(&mut app); - let top: Vec<u64> = app.session.doc().unwrap().doc.layers[0].children().unwrap().iter().map(|n| n.id.0).collect(); - assert_eq!(top, [ids[2], ids[3]], "one shape in the topmost joined circle's place, and the far circle"); - } - - #[test] - fn the_status_line_says_why_an_ellipse_is_refused() { - use crate::tests::panel_harness::Panel; - - let mut app = crate::testing::windowed(VectorcraftApp::new(Session::new(), Default::default())); - app.run("file.new", json!({"width": 400, "height": 300})).unwrap(); - let a = circle(&mut app, 100.0, 10.0); - let oval = app.run("shape.ellipse", json!({"x": 130, "y": 90, "width": 20, "height": 21})).unwrap()["id"].as_u64().unwrap(); - app.run("select.set", json!({"ids": [a, oval]})).unwrap(); - let original = geometry(&app); - let mut panel = Panel::new(app, crate::tests::picks::dialogs); - let before = panel.app().session.doc().unwrap().history.undo.len(); - menus::invoke(&mut panel.app(), super::COMMAND, Value::Null); - panel.frame(); - let why = "an ellipse whose width and height differ is not a circle"; - assert!(panel.app().ui.status.contains(why), "the preview's refusal: {}", panel.app().ui.status); - panel.click("OK"); - panel.frame(); - assert!(panel.app().ui.status.contains(why), "OK's refusal: {}", panel.app().ui.status); - assert_eq!(geometry(&panel.app()), original); - assert_eq!(panel.app().session.doc().unwrap().history.undo.len(), before, "no undo step"); - } -} diff --git a/crates/ui-egui/src/addons/pathtools/tangents.rs b/crates/ui-egui/src/addons/pathtools/tangents.rs new file mode 100644 index 0000000000..1c1587a0d5 --- /dev/null +++ b/crates/ui-egui/src/addons/pathtools/tangents.rs @@ -0,0 +1,150 @@ +//! Common Tangents in the interface: one dialog for the tangent lines of two shapes and for circles joined by a smooth +//! bridge. It picks the kind of tangent, the centerline and Connect tangents (the two tangents of each kind joined into +//! one closed shape). With External, Straight keeps the tangent lines and Curved joins the circles along concave arcs +//! instead (the arcs' radius as a percentage of the smaller circle's radius, or with Constant Gap that radius plus a +//! gap; the reach, unavailable with two circles selected; Keep Originals), as `addon.pathtools.bridge` does. It +//! previews on the canvas and runs `addon.pathtools.commonTangents` on OK. Smooth Bridge's command id opens the same +//! dialog with External and Curved on. + +use craft::ui::contract::Bind; +use craft::ui::patterns::form_dialogs::{DialogFields, FieldValue, Param, ParamDialog, ParamKind}; +use craft::ui::runtime::env::UnitKind; +use serde_json::{Value, json}; + +use crate::VectorcraftApp; +use crate::addons::dialogs::{self, Spec}; +use crate::canvas::rulers::general_lengths; + +use super::{COMMON_TANGENTS, TANGENT_KINDS}; + +/// Smooth Bridge's command, which opens this dialog with External and Curved on. +pub const BRIDGE: &str = "addon.pathtools.bridge"; +/// The kind of tangent the dialog opens with. +const TANGENTS: &str = "all"; +/// The tangents that Curved replaces with arcs. +const EXTERNAL: &str = "external"; +/// What joins the circles with External, and its labels; the first is the default. +const SIDES: [(&str, &str); 2] = [("straight", "Straight"), ("curved", "Curved")]; +/// The radius the command takes (%), and its default. +const RADII: std::ops::RangeInclusive<f64> = 1.0..=1000.0; +const RADIUS: f64 = 100.0; +/// The gap the command takes (pt), and the dialog's first one. +const GAPS: std::ops::RangeInclusive<f64> = 0.0..=1000.0; +const GAP: f64 = 4.0; +/// The reach the command takes (pt), and its default. +const REACHES: std::ops::RangeInclusive<f64> = 0.0..=10000.0; +const REACH: f64 = 10.0; + +/// How the dialog's values reach the command. +pub(crate) static SPEC: Spec = Spec { command: COMMON_TANGENTS, params, found: None }; + +/// Whether the fields ask for a curved bridge: External with Curved. +fn curved(fields: &DialogFields) -> bool { + fields.text("tangents") == Some(EXTERNAL) && fields.text("sides") == Some("curved") +} + +/// The command's parameters from the dialog's fields: the tangent lines' kind, centerline and Connect tangents, or for +/// a curved bridge the radius (or with Constant Gap the gap), the reach and Keep Originals. +fn params(fields: &DialogFields) -> Value { + if !curved(fields) { + return json!({ + "tangents": fields.text("tangents").unwrap_or(TANGENTS), + "centerline": fields.bool("centerline").unwrap_or(false), + "connect": fields.bool("connect").unwrap_or(false), + }); + } + let (reach, keep) = (fields.number("reach").unwrap_or(REACH), fields.bool("keepOriginals").unwrap_or(false)); + if fields.bool("constantGap").unwrap_or(false) { + json!({ "tangents": EXTERNAL, "curved": true, "gap": fields.number("gap").unwrap_or(GAP), "reach": reach, "keepOriginals": keep }) + } else { + json!({ "tangents": EXTERNAL, "curved": true, "radius": fields.number("radius").unwrap_or(RADIUS), "reach": reach, "keepOriginals": keep }) + } +} + +/// Opens Common Tangents' dialog for the tangent lines. +pub(crate) fn open(app: &mut VectorcraftApp) -> Result<Value, String> { + open_with(app, false) +} + +/// Opens Common Tangents' dialog with External and Curved on, for Smooth Bridge's command. +pub(crate) fn open_connected(app: &mut VectorcraftApp) -> Result<Value, String> { + open_with(app, true) +} + +fn open_with(app: &mut VectorcraftApp, bridge: bool) -> Result<Value, String> { + // The reach applies to three or more circles; two are bridged at any distance. Counted once, before a preview + // replaces the selection with its result, with a selected group counting the objects inside it. + let many = app.session.doc().map(|doc| members(&doc.doc, &doc.selection.objects) > 2).unwrap_or(true); + let fields = DialogFields::from_pairs([ + ("tangents", FieldValue::from(if bridge { EXTERNAL } else { TANGENTS })), + ("centerline", FieldValue::Bool(false)), + ("connect", FieldValue::Bool(bridge)), + ("sides", FieldValue::from(if bridge { "curved" } else { "straight" })), + ("constantGap", FieldValue::Bool(false)), + ("radius", FieldValue::Number(RADIUS)), + ("gap", FieldValue::Number(GAP)), + ("reach", FieldValue::Number(REACH)), + ("keepOriginals", FieldValue::Bool(false)), + ("many", FieldValue::Bool(many)), + ]); + let lengths = general_lengths(app); + dialogs::open(app, &SPEC, fields, move |fields| { + let kinds = TANGENT_KINDS.iter().map(|(label, id)| ((*id).to_owned(), tl!(label).into())).collect(); + let sides = SIDES.iter().map(|(id, label)| ((*id).to_owned(), tl!(label).into())).collect(); + let curved = || ["curved"]; + // Picking another kind of tangent goes back to Straight, so Curved only holds while External does. + let rows = vec![ + Param::new("tangents", tl!("Tangents:"), ParamKind::choice(kinds, Some(TANGENTS.to_owned()))).resets(["sides"]), + Param::new("centerline", tl!("Centerline"), ParamKind::bool(false)).enabled_when("sides", "straight"), + // A curved bridge is always connected. + Param::new("connect", tl!("Connect tangents"), ParamKind::bool(false)).enabled_when("sides", "straight").disabled_value(true), + Param::new("sides", tl!("Sides"), ParamKind::radio(sides, Some(SIDES[0].0.to_owned()))).visible_when("tangents", EXTERNAL), + Param::new("constantGap", tl!("Constant Gap"), ParamKind::bool(false)) + .visible_when("tangents", EXTERNAL) + .enabled_when_in("sides", curved()), + Param::number("gap", tl!("Gap:"), GAP, 1.0, 2) + .length(lengths) + .bounds(Some(*GAPS.start()), Some(*GAPS.end())) + .visible_when("tangents", EXTERNAL) + .visible_when_in("constantGap", [true]) + .enabled_when_in("sides", curved()), + Param::number("radius", tl!("Radius:"), RADIUS, 1.0, 0) + .unit(UnitKind::Percent) + .bounds(Some(*RADII.start()), Some(*RADII.end())) + .visible_when("tangents", EXTERNAL) + .visible_when_in("constantGap", [false]) + .enabled_when_in("sides", curved()), + Param::number("reach", tl!("Reach:"), REACH, 1.0, 2) + .length(lengths) + .bounds(Some(*REACHES.start()), Some(*REACHES.end())) + .visible_when("tangents", EXTERNAL) + .enabled_when_in("sides", curved()) + .and_enabled_when_in("many", [true]), + Param::new("keepOriginals", tl!("Keep Originals"), ParamKind::bool(false)) + .visible_when("tangents", EXTERNAL) + .enabled_when_in("sides", curved()), + ]; + ParamDialog::new(COMMON_TANGENTS, tl!("Common Tangents"), rows).previews(true).values(Bind::bound(fields)) + }) +} + +/// How many objects the command bridges for objects `ids`: each one, or for a group (a clipping group excepted) the +/// objects inside it, at any depth; an object given twice, or with its group, counts once. +fn members(doc: &vectorcraft_doc::Document, ids: &[vectorcraft_doc::NodeId]) -> usize { + fn visit(n: &vectorcraft_doc::Node, out: &mut std::collections::BTreeSet<vectorcraft_doc::NodeId>) { + match &n.kind { + vectorcraft_doc::NodeKind::Group { children, clip: false } => children.iter().for_each(|c| visit(c, out)), + _ => { + out.insert(n.id); + } + } + } + let mut out = std::collections::BTreeSet::new(); + for n in ids.iter().filter_map(|&id| doc.node(id)) { + visit(n, &mut out); + } + out.len() +} + +#[cfg(test)] +mod tests; diff --git a/crates/ui-egui/src/addons/pathtools/tangents/tests.rs b/crates/ui-egui/src/addons/pathtools/tangents/tests.rs new file mode 100644 index 0000000000..c3f1b84163 --- /dev/null +++ b/crates/ui-egui/src/addons/pathtools/tangents/tests.rs @@ -0,0 +1,244 @@ +//! Common Tangents' dialog: the tangent lines, Connect tangents, External's Straight or Curved bridge, Smooth +//! Bridge's command opening it curved, the reach's availability, Cancel and the refusals on the status line. + +use serde_json::{Value, json}; +use vectorcraft_engine::Session; + +use super::{BRIDGE, COMMON_TANGENTS}; +use crate::addons::dialogs::tests::{confirm, dialog_id, frame, read, set}; +use crate::tests::panel_harness::Panel; +use crate::{VectorcraftApp, menus}; + +fn circle(app: &mut VectorcraftApp, x: f64, r: f64) -> u64 { + app.run("shape.ellipse", json!({"x": x - r, "y": 100.0 - r, "width": 2.0 * r, "height": 2.0 * r})).unwrap()["id"].as_u64().unwrap() +} + +fn circles_app(xs: &[f64]) -> VectorcraftApp { + let mut app = crate::testing::windowed(VectorcraftApp::new(Session::new(), Default::default())); + app.run("file.new", json!({"width": 400, "height": 300})).unwrap(); + let ids: Vec<u64> = xs.iter().map(|&x| circle(&mut app, x, 10.0)).collect(); + app.run("select.set", json!({"ids": ids})).unwrap(); + app +} + +fn geometry(app: &VectorcraftApp) -> Vec<vectorcraft_doc::NodeKind> { + app.session.doc().unwrap().doc.layers[0].children().unwrap().iter().map(|node| node.kind.clone()).collect() +} + +fn steps(app: &VectorcraftApp) -> usize { + app.session.doc().unwrap().history.undo.len() +} + +fn type_number(panel: &mut Panel, label: &str, text: &str) { + panel.click(label); + panel.key(egui::Key::A, egui::Modifiers::COMMAND); + panel.type_text(text); + panel.key(egui::Key::Tab, egui::Modifiers::NONE); + panel.frame(); +} + +/// The geometry the command makes on `xs`'s circles with `params`. +fn expected(xs: &[f64], params: &Value) -> Vec<vectorcraft_doc::NodeKind> { + let mut app = circles_app(xs); + app.session.execute(COMMON_TANGENTS, params).unwrap(); + geometry(&app) +} + +#[test] +fn the_menu_item_adds_the_tangent_lines_and_only_their_options_take_input() { + let xs = [100.0, 200.0]; + let mut panel = Panel::new(circles_app(&xs), crate::tests::picks::dialogs); + let before = steps(&panel.app()); + menus::invoke(&mut panel.app(), COMMON_TANGENTS, Value::Null); + panel.frame(); + assert!(panel.enabled("Centerline") && panel.enabled("Tangents") && panel.enabled("Connect tangents")); + assert!(!panel.shows("Radius") && !panel.shows("Straight"), "the bridge's options wait for External"); + panel.click("Centerline"); + panel.frame(); + let id = dialog_id(&panel.app()); + let params = read(&panel.app(), id, super::params); + assert_eq!(params, json!({"tangents": "all", "centerline": true, "connect": false})); + assert_eq!(geometry(&panel.app()), expected(&xs, ¶ms), "the preview"); + assert_eq!(geometry(&panel.app()).len(), 2 + 5, "four tangents and the centerline beside the circles"); + panel.click("OK"); + panel.frame(); + assert_eq!(steps(&panel.app()), before + 1); + assert!(!panel.app().any_dialog_open()); +} + +#[test] +fn external_shows_straight_or_curved_and_curved_takes_the_bridge_options() { + let xs = [100.0, 124.0]; + let mut panel = Panel::new(circles_app(&xs), crate::tests::picks::dialogs); + let before = steps(&panel.app()); + menus::invoke(&mut panel.app(), COMMON_TANGENTS, Value::Null); + panel.frame(); + let id = dialog_id(&panel.app()); + set(&panel.app(), id, "tangents", json!("external")); + panel.frame(); + assert!(panel.shows("Straight") && panel.shows("Radius"), "External shows the bridge's options"); + assert!(!panel.enabled("Radius") && !panel.enabled("Keep Originals"), "Straight keeps them unavailable"); + panel.click("Connect tangents"); + panel.frame(); + let straight = read(&panel.app(), id, super::params); + assert_eq!(straight, json!({"tangents": "external", "centerline": false, "connect": true})); + assert_eq!(geometry(&panel.app()), expected(&xs, &straight)); + assert_eq!(geometry(&panel.app()).len(), 3, "the circles and one closed shape"); + + panel.click("Curved"); + panel.frame(); + assert!(panel.enabled("Radius") && panel.enabled("Keep Originals") && !panel.enabled("Centerline")); + let curved = read(&panel.app(), id, super::params); + assert_eq!(curved, json!({"tangents": "external", "curved": true, "radius": 100.0, "reach": 10.0, "keepOriginals": false})); + let preview = geometry(&panel.app()); + assert_eq!(preview, expected(&xs, &curved)); + assert_eq!(preview.len(), 1, "the bridge replaces the circles"); + + // Another kind of tangent goes back to Straight and the lines' options. + set(&panel.app(), id, "tangents", json!("internal")); + panel.frame(); + assert!(panel.enabled("Centerline") && !panel.shows("Curved")); + assert_eq!(read(&panel.app(), id, super::params)["tangents"], "internal"); + set(&panel.app(), id, "tangents", json!("external")); + panel.frame(); + panel.click("Curved"); + panel.frame(); + panel.click("OK"); + panel.frame(); + assert_eq!(geometry(&panel.app()), preview); + assert_eq!(steps(&panel.app()), before + 1, "one undo step"); +} + +#[test] +fn the_bridge_command_opens_the_dialog_connected_and_its_controls_reach_the_command() { + let xs = [100.0, 124.0]; + let mut panel = Panel::new(circles_app(&xs), crate::tests::picks::dialogs); + let before = steps(&panel.app()); + menus::invoke(&mut panel.app(), BRIDGE, Value::Null); + panel.frame(); + assert!(panel.enabled("Radius"), "External and Curved are on"); + assert!(!panel.enabled("Reach"), "two circles can be bridged at any distance"); + panel.click("Keep Originals"); + type_number(&mut panel, "Radius", "150"); + let id = dialog_id(&panel.app()); + assert_eq!(read(&panel.app(), id, |f| f.number("radius")), Some(150.0)); + let mut old = circles_app(&xs); + old.session.execute(BRIDGE, &json!({"radius": 150, "keepOriginals": true})).unwrap(); + assert_eq!(geometry(&panel.app()), geometry(&old), "the same outline Smooth Bridge makes"); + assert_eq!(geometry(&panel.app()).len(), 3, "both circles stay beside the bridge"); + + panel.click("Constant Gap"); + type_number(&mut panel, "Gap", "6"); + let params = read(&panel.app(), id, super::params); + assert_eq!(params, json!({"tangents": "external", "curved": true, "gap": 6.0, "reach": 10.0, "keepOriginals": true})); + let preview = geometry(&panel.app()); + assert_eq!(preview, expected(&xs, ¶ms)); + panel.click("OK"); + panel.frame(); + assert_eq!(geometry(&panel.app()), preview); + assert_eq!(steps(&panel.app()), before + 1); + assert!(!panel.app().any_dialog_open()); +} + +#[test] +fn a_reach_edit_reaches_the_command_and_cancel_restores_the_originals() { + let xs = [100.0, 124.0, 148.0, 300.0]; + let mut panel = Panel::new(circles_app(&xs), crate::tests::picks::dialogs); + let original = geometry(&panel.app()); + menus::invoke(&mut panel.app(), BRIDGE, Value::Null); + panel.frame(); + assert!(panel.enabled("Reach")); + type_number(&mut panel, "Reach", "5"); + let id = dialog_id(&panel.app()); + let params = read(&panel.app(), id, super::params); + assert_eq!(params["reach"], 5.0); + assert_eq!(geometry(&panel.app()), expected(&xs, ¶ms)); + panel.click("Cancel"); + panel.frame(); + assert_eq!(geometry(&panel.app()), original); +} + +#[test] +fn reach_counts_the_circles_inside_a_selected_group() { + for (xs, many) in [(&[100.0, 124.0][..], false), (&[100.0, 124.0, 148.0][..], true)] { + let mut app = circles_app(xs); + let ids: Vec<u64> = app.session.doc().unwrap().selection.objects.iter().map(|id| id.0).collect(); + let group = app.run("object.group", json!({ "ids": ids })).unwrap()["id"].as_u64().unwrap(); + app.run("select.set", json!({"ids": [group]})).unwrap(); + let mut panel = Panel::new(app, crate::tests::picks::dialogs); + menus::invoke(&mut panel.app(), BRIDGE, Value::Null); + panel.frame(); + assert_eq!(panel.enabled("Reach"), many, "{} circles in the group", xs.len()); + panel.click("OK"); + panel.frame(); + let inside = panel.app().session.doc().unwrap().doc.node(vectorcraft_doc::NodeId(group)).unwrap().children().unwrap().len(); + assert_eq!(inside, 1, "the circles in the group became one shape"); + } + // A group of two circles selected together with one of them: still two circles. + let mut app = circles_app(&[100.0, 124.0]); + let ids: Vec<u64> = app.session.doc().unwrap().selection.objects.iter().map(|id| id.0).collect(); + let group = app.run("object.group", json!({ "ids": ids })).unwrap()["id"].as_u64().unwrap(); + app.run("select.set", json!({"ids": [group, ids[0]]})).unwrap(); + let mut panel = Panel::new(app, crate::tests::picks::dialogs); + menus::invoke(&mut panel.app(), BRIDGE, Value::Null); + panel.frame(); + assert!(!panel.enabled("Reach"), "a circle selected with its group counts once"); +} + +#[test] +fn constant_gap_bridges_many_circles_within_reach() { + let mut app = circles_app(&[100.0, 124.0, 148.0, 300.0]); + let ids: Vec<u64> = app.session.doc().unwrap().selection.objects.iter().map(|id| id.0).collect(); + menus::invoke(&mut app, BRIDGE, Value::Null); + let dialog = dialog_id(&app); + set(&app, dialog, "constantGap", json!(true)); + // A preview leaves two objects selected (one shape and the far circle); Reach stays available for the four + // circles the command still bridges. + frame(&mut app); + assert_eq!(app.session.doc().unwrap().selection.objects.len(), 2, "previewed"); + let (many, params) = read(&app, dialog, |fields| (fields.bool("many"), (super::SPEC.params)(fields))); + assert_eq!(many, Some(true), "Reach available for four circles"); + assert_eq!(params, json!({"tangents": "external", "curved": true, "gap": 4.0, "reach": 10.0, "keepOriginals": false}), "the gap, not the radius"); + assert!(confirm(&app, dialog), "OK is on"); + frame(&mut app); + let top: Vec<u64> = app.session.doc().unwrap().doc.layers[0].children().unwrap().iter().map(|n| n.id.0).collect(); + assert_eq!(top, [ids[2], ids[3]], "one shape in the topmost joined circle's place, and the far circle"); +} + +#[test] +fn the_status_line_says_why_a_selection_is_refused() { + // Connected: an ellipse is not a circle. + let mut app = crate::testing::windowed(VectorcraftApp::new(Session::new(), Default::default())); + app.run("file.new", json!({"width": 400, "height": 300})).unwrap(); + let a = circle(&mut app, 100.0, 10.0); + let oval = app.run("shape.ellipse", json!({"x": 130, "y": 90, "width": 20, "height": 21})).unwrap()["id"].as_u64().unwrap(); + app.run("select.set", json!({"ids": [a, oval]})).unwrap(); + let original = geometry(&app); + let mut panel = Panel::new(app, crate::tests::picks::dialogs); + let before = steps(&panel.app()); + menus::invoke(&mut panel.app(), BRIDGE, Value::Null); + panel.frame(); + let why = "an ellipse whose width and height differ is not a circle"; + assert!(panel.app().ui.status.contains(why), "the preview's refusal: {}", panel.app().ui.status); + panel.click("OK"); + panel.frame(); + assert!(panel.app().ui.status.contains(why), "OK's refusal: {}", panel.app().ui.status); + assert_eq!(geometry(&panel.app()), original); + assert_eq!(steps(&panel.app()), before, "no undo step"); + + // The lines: a circle inside another has none, and the warning says so. + let mut app = circles_app(&[150.0]); + let outer = app.run("shape.ellipse", json!({"x": 100, "y": 50, "width": 100, "height": 100})).unwrap()["id"].as_u64().unwrap(); + let inner = app.session.doc().unwrap().doc.layers[0].children().unwrap()[0].id.0; + app.run("select.set", json!({"ids": [inner, outer]})).unwrap(); + let mut panel = Panel::new(app, crate::tests::picks::dialogs); + let before = steps(&panel.app()); + let count = geometry(&panel.app()).len(); + menus::invoke(&mut panel.app(), COMMON_TANGENTS, Value::Null); + panel.frame(); + panel.click("OK"); + panel.frame(); + assert_eq!(steps(&panel.app()), before); + assert_eq!(geometry(&panel.app()).len(), count); + assert!(panel.app().ui.status.contains("inside the other"), "{}", panel.app().ui.status); +} diff --git a/crates/ui-egui/src/dialogs/command.rs b/crates/ui-egui/src/dialogs/command.rs index 6d8741d342..6be16732f6 100644 --- a/crates/ui-egui/src/dialogs/command.rs +++ b/crates/ui-egui/src/dialogs/command.rs @@ -349,8 +349,7 @@ fn heading_in(lang: crate::i18n::Lang, label: &str) -> String { /// too (#5360), as public tutorials of the dialog show, and Type Tools › Release Type on a Path /// works the same way (#5532), and so do Image Tools › Remove Background and Color Mask and /// Cutting Tools › Weed Box and Lines, Banner Hems and Grommets and Nest Shapes, and Path -/// Precision Tools › Common Tangents and the bounding shapes (Add Bounding Rectangle… and Add -/// Bounding Circle…). (Cancel rolls a preview back whichever dialog started it.) +/// Precision Tools' bounding shapes (Add Bounding Rectangle… and Add Bounding Circle…). (Cancel rolls a preview back whichever dialog started it.) fn previews(command: &str, opening: &Map<String, Value>) -> bool { match command { "object.repeat.options" => opening.contains_key("gridType"), @@ -361,7 +360,6 @@ fn previews(command: &str, opening: &Map<String, Value>) -> bool { | crate::addons::cutting::WEED | crate::addons::cutting::BANNER | crate::addons::cutting::NEST - | crate::addons::pathtools::COMMON_TANGENTS | crate::addons::pathtools::BOUNDING_RECTANGLE | crate::addons::pathtools::BOUNDING_CIRCLE => true, _ => false, @@ -465,7 +463,6 @@ fn order(command: &str) -> &'static [&'static str] { } crate::addons::cutting::BRIDGES => &["width", "count", "direction", "keepOriginal"], crate::addons::packaging::SET_ROLE_SWATCH => &["role", "swatch"], - crate::addons::pathtools::COMMON_TANGENTS => &["tangents", "centerline"], crate::addons::pathtools::BOUNDING_RECTANGLE | crate::addons::pathtools::BOUNDING_CIRCLE => &["offset", "each"], "object.path.cleanUp" => &["strayPoints", "unpaintedObjects", "emptyTextPaths", "hairlineSlivers", "sliverWidth"], _ => &[], @@ -484,7 +481,6 @@ fn choices(command: &str, key: &str) -> Option<form::Choices> { ("text.areaOptions", "firstBaseline") => Some(FIRST_BASELINE), ("text.areaOptions", "verticalAlign") => Some(VERTICAL_ALIGN), (crate::addons::cutting::WEED, "direction") => Some(crate::addons::cutting::WEED_DIRECTIONS), - (crate::addons::pathtools::COMMON_TANGENTS, "tangents") => Some(crate::addons::pathtools::TANGENT_KINDS), (crate::addons::image::REMOVE_BACKGROUND | crate::addons::image::COLOR_MASK, "background") => Some(crate::addons::image::BACKGROUNDS), (crate::addons::image::REMOVE_BACKGROUND | crate::addons::image::COLOR_MASK, "match") => Some(crate::addons::image::MATCHES), ("object.rasterize", "antiAlias") => Some(RASTERIZE_ANTI_ALIAS), diff --git a/crates/ui-egui/src/menus/ui_commands.rs b/crates/ui-egui/src/menus/ui_commands.rs index 671ebcec8f..0be68e7a2b 100644 --- a/crates/ui-egui/src/menus/ui_commands.rs +++ b/crates/ui-egui/src/menus/ui_commands.rs @@ -1532,7 +1532,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "ui.menuDialog", "Menu Dialog", "", - "{command: object.move|object.rotate|object.scale|object.reflect|object.shear|object.transformEach|path.average|path.averageJoin|object.path.offsetPath|object.path.simplify|object.path.smooth|object.path.splitIntoGrid|object.vectorHalftone|object.stepAndRepeat|artboard.rearrange|artboard.rename|object.envelope.makeWithWarp|object.envelope.resetWithWarp|object.envelope.makeWithMesh|object.envelope.resetWithMesh|object.envelope.options|addon.arrange.grid|addon.arrange.offset|addon.arrange.replace|addon.arrange.size|addon.arrange.match|addon.arrange.groupRows|addon.packaging.setFoldAngle|addon.pathtools.cornerSet|addon.pathtools.divideDashes|addon.pathtools.bridge|addon.pathtools.tangentCircle|addon.type.textTweaker|addon.color.swatchLegend|addon.arrange.randomizeOpacity|addon.arrange.sort|addon.arrange.markBounds|addon.color.applyNearestSwatch|addon.color.randomFill|addon.select.byArtboards|addon.select.editPointsOnly|type.smartPunctuation|variable.define|variable.rename|variable.bind|dataset.new|dataset.set|dataset.rename|dataset.select} open the dialog that command's menu item opens (its `key` in ui.inspect is the command id, except `transformEach` for object.transformEach, `envelopeWarp` for object.envelope.makeWithWarp and object.envelope.resetWithWarp, `envelopeMesh` for object.envelope.makeWithMesh and object.envelope.resetWithMesh, `variables` for variable.define and variable.rename and variable.bind and dataset.new and dataset.set and dataset.rename and dataset.select, `envelopeOptions` for object.envelope.options, `smoothSlider` for object.path.smooth, and `simplifySlider` for object.path.simplify; the dialogs of addon.color.applyNearestSwatch and addon.select.byArtboards have no `key`; smoothSlider and simplifySlider are the sliders over the canvas, with field `level`, and object.path.simplify opens its dialog `object.path.simplify` instead once OK in that dialog keeps the settings (`retain`); Set Fold Angle's `angle` is the selected fold lines' angle, and it is refused while the selection has no fold line it can change; Scale and Transform Each have `corners` and `strokes`, from the preferences, which OK updates; Transform Each opens on the values it was last confirmed with (not `copy`), and its Copy button confirms with `copy: true`; the envelope dialogs start from the selected envelope, Make opens as Reset (`reset: true`) while one is selected; variable.rename opens only while the document has a variable, and dataset.set and dataset.rename only while it has a data set, and otherwise the status bar says why; ui.dialog.set, ui.dialog.confirm and ui.dialog.cancel take the dialog's `id` from ui.inspect, or `top`, not its `key`)", + "{command: object.move|object.rotate|object.scale|object.reflect|object.shear|object.transformEach|path.average|path.averageJoin|object.path.offsetPath|object.path.simplify|object.path.smooth|object.path.splitIntoGrid|object.vectorHalftone|object.stepAndRepeat|artboard.rearrange|artboard.rename|object.envelope.makeWithWarp|object.envelope.resetWithWarp|object.envelope.makeWithMesh|object.envelope.resetWithMesh|object.envelope.options|addon.arrange.grid|addon.arrange.offset|addon.arrange.replace|addon.arrange.size|addon.arrange.match|addon.arrange.groupRows|addon.packaging.setFoldAngle|addon.pathtools.cornerSet|addon.pathtools.divideDashes|addon.pathtools.bridge|addon.pathtools.commonTangents|addon.pathtools.tangentCircle|addon.type.textTweaker|addon.color.swatchLegend|addon.arrange.randomizeOpacity|addon.arrange.sort|addon.arrange.markBounds|addon.color.applyNearestSwatch|addon.color.randomFill|addon.select.byArtboards|addon.select.editPointsOnly|type.smartPunctuation|variable.define|variable.rename|variable.bind|dataset.new|dataset.set|dataset.rename|dataset.select} open the dialog that command's menu item opens (its `key` in ui.inspect is the command id, except `transformEach` for object.transformEach, `envelopeWarp` for object.envelope.makeWithWarp and object.envelope.resetWithWarp, `envelopeMesh` for object.envelope.makeWithMesh and object.envelope.resetWithMesh, `variables` for variable.define and variable.rename and variable.bind and dataset.new and dataset.set and dataset.rename and dataset.select, `envelopeOptions` for object.envelope.options, `addon.pathtools.commonTangents` for addon.pathtools.bridge, `smoothSlider` for object.path.smooth, and `simplifySlider` for object.path.simplify; the dialogs of addon.color.applyNearestSwatch and addon.select.byArtboards have no `key`; smoothSlider and simplifySlider are the sliders over the canvas, with field `level`, and object.path.simplify opens its dialog `object.path.simplify` instead once OK in that dialog keeps the settings (`retain`); Set Fold Angle's `angle` is the selected fold lines' angle, and it is refused while the selection has no fold line it can change; Scale and Transform Each have `corners` and `strokes`, from the preferences, which OK updates; Transform Each opens on the values it was last confirmed with (not `copy`), and its Copy button confirms with `copy: true`; the envelope dialogs start from the selected envelope, Make opens as Reset (`reset: true`) while one is selected; variable.rename opens only while the document has a variable, and dataset.set and dataset.rename only while it has a data set, and otherwise the status bar says why; ui.dialog.set, ui.dialog.confirm and ui.dialog.cancel take the dialog's `id` from ui.inspect, or `top`, not its `key`)", ), ( "ui.widthPointEdit", diff --git a/crates/ui-egui/src/palette.rs b/crates/ui-egui/src/palette.rs index 017486e7ad..98f7ac967d 100644 --- a/crates/ui-egui/src/palette.rs +++ b/crates/ui-egui/src/palette.rs @@ -2786,4 +2786,17 @@ mod tests { } } } + + /// Smooth Bridge is part of Common Tangents (#10465): the palette lists Common Tangents once, a search for + /// "metaball" or "smooth bridge" finds it, and Smooth Bridge's own command is no result. + #[test] + fn a_search_for_metaball_finds_common_tangents_and_not_smooth_bridge() { + let app = app_on(Session::new()); + let built = built_for(&app); + assert!(built.entries.iter().all(|e| !e.ids().iter().any(|id| id == "addon.pathtools.bridge")), "Smooth Bridge is no result"); + for query in ["metaball", "smooth bridge"] { + let found = ranked(&built, query); + assert_eq!(found.first().map(String::as_str), Some(crate::addons::pathtools::COMMON_TANGENTS), "{query}: {found:?}"); + } + } } diff --git a/docs/mcp.md b/docs/mcp.md index 5a32fe1e32..ad7c424552 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -16981,7 +16981,7 @@ Commands: - `addon.pathtools.bridge {radius?, gap?, reach?, keepOriginals?, ids?}` joins circles (`ids`, default: the selection, with a group other than a clipping group giving the objects inside it at any depth, which must all be circles; paths whose outline is a circle, not hidden or locked) into metaball (aka meatball) shapes, as one undo step (Object › - Plug-ins › Path Precision Tools › Smooth Bridge…). Two circles become one closed outline that goes around each circle + Plug-ins › Path Precision Tools › Common Tangents… with External and Curved). Two circles become one closed outline that goes around each circle on its side away from the other and along two concave arcs, one on each side of the line through the centers, each touching both circles from outside, so every anchor is smooth. `radius` is the arcs' radius as a percentage of the smaller circle's radius (1 to 1,000, 100 by default): a larger radius makes a wider, gentler bridge. `gap` (0 to 1,000 @@ -17011,10 +17011,11 @@ Commands: other stays as it is. The shapes and the circles left as they are are selected. It is an error when any pair within reach has one circle inside the other, when no pair within reach can be bridged (suggesting a larger radius or gap only when the largest would bridge a pair of them under these rules), when no two circles are within reach, and above 2,000 circles or 8,000 bridges. → `{ids, alone}`: - the shapes and the circles left as they are, with `id` as well for two circles. Smooth Bridge… opens a dialog - (`ui.menuDialog {command}`, key `addon.pathtools.bridge`) with Constant Gap (a Gap field in place of the Radius field in - percent), Reach (unavailable when the selection, a selected group's objects counted, holds two objects), Keep Originals - and Preview. + the shapes and the circles left as they are, with `id` as well for two circles. Opening `addon.pathtools.bridge` + from the menu dialog (`ui.menuDialog {command}`) opens Common Tangents' dialog (key + `addon.pathtools.commonTangents`) with External and Curved on, described under + `addon.pathtools.commonTangents`. No menu item runs `addon.pathtools.bridge`, and the command palette and Keyboard + Shortcuts leave it out; scripts and actions still run it. - `addon.pathtools.tangentCircle {ids?, radius?, circle?}` draws the circles that touch two paths or compound paths and have `radius` (0.01 to 1,000,000 pt, needed with two), or that touch three (which set the radius themselves, so `radius` is then an error), as one undo step (Object › Plug-ins › Path Precision Tools › Tangent Circle…). `ids` @@ -17115,7 +17116,7 @@ Commands: - `addon.pathtools.shape.convert {ids?}` makes the selected plain closed paths that are rectangles, ellipses or polygons with equal sides and corners (stretched along their own axes at most) parametric shapes with the same outline. → `{ids}` (those converted). -- `addon.pathtools.commonTangents {tangents?, centerline?, ids?}` adds the common tangent lines of two convex closed +- `addon.pathtools.commonTangents {tangents?, centerline?, connect?, curved?, radius?, gap?, reach?, keepOriginals?, ids?}` adds the common tangent lines of two convex closed paths (`ids`, or the two selected objects) as separate open paths: lines that touch both paths without crossing into either. `tangents`: `external` (both paths on the same side of the line), `internal` (lines that run between them) or `all` (default). With `centerline: true` it also adds the line joining the two centers: an ellipse's center, or @@ -17140,9 +17141,19 @@ Commands: runs from the point to the path's center. Two points are refused with "select two closed paths". The lines are stroked with the current stroke color and weight (black when the stroke is None), have no fill, go directly above the upper of the two paths and are selected; one undo step. When there is no tangent of the kind asked for, - nothing changes, and the result's `warning` says why. Common Tangents… opens a dialog (Tangents, Centerline) with - Preview; with a point selected, every Tangents choice gives the same lines. → `{ids, external, internal, - centerline, warning?}` (`centerline`: the centerline's id, or null). + nothing changes, and the result's `warning` says why. → `{ids, external, internal, centerline, warning?}` + (`centerline`: the centerline's id, or null). With `connect: true` the two tangents of each kind become one closed + path instead of two lines, joined by the chords between where they touch each path (two internal tangents make a + crossed shape, and a point's two lines make a triangle); a kind with one tangent stays a line, and the centerline + stays a line. With `curved: true` it joins the selected circles into one outline along concave arcs instead, as + `addon.pathtools.bridge` does, taking that command's `radius` or `gap`, `reach`, `keepOriginals` and `ids`, and + the result is that command's. `tangents` other than `external`, `centerline` and `connect: false` with `curved` are + an error, and so are `radius`, `gap`, `reach` and `keepOriginals` without it. Common Tangents… opens a dialog with + Tangents, Centerline and Connect tangents; with External it also shows Straight and Curved (Straight by default) and + the bridge's options: Constant Gap (a Gap field in place of the Radius field in percent), Reach (unavailable when the + selection, a selected group's objects counted, holds two objects) and Keep Originals, which take input only with + Curved. With Curved, Centerline is unavailable and Connect tangents shows on. Choosing another kind of tangent goes + back to Straight. With a point selected, every Tangents choice gives the same lines. - `addon.pathtools.boundingRectangle {each?, offset?}` draws a live rectangle on the geometric bounding box of the selected objects, strokes and effects left out (Object › Plug-ins › Path Precision Tools › Add Bounding Rectangle…, #6966). `addon.pathtools.boundingCircle {each?, offset?}` draws the smallest live circle that holds the outlines of diff --git a/docs/ui-parity.md b/docs/ui-parity.md index fa75b28fb4..2f94f51885 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -592,7 +592,7 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po | Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools › Trim at Crossings Tool (also in the Scissors tool's group in both shipped toolbars, after the Knife, and listed there in the All Tools drawer; a toolbar edited before keeps its saved layout until Reset Toolbar; no shortcut until one is set in Edit › Keyboard Shortcuts › Tools; the Knife's cursor, drawn as a knife with the blade's point on the hotspot) removes stretches of paths between the places where they are crossed, on any editable path, selected or not: a click removes the stretch under the pointer, a drag removes every stretch its rectangle touches, and an Alt-drag removes every stretch its freehand line crosses; one undo step each; Escape during a drag removes nothing; hovering shows in red the stretch a click would remove, and a drag that reaches few paths shows what its release would remove | done | `addon.pathtools.trim` (in `crates/engine/src/cmd/addons/pathtools/trim.rs`), `crates/tools/src/addons/trim.rs` and their tests; not a feature of the reference app, so it is not scored | | Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools › Tangent Circle Tool (also in the All Tools drawer): a click on a path segment, then on another, draws the circle tangent to the first at the point clicked that touches the second or a segment beside it; Shift uses the tool's radius (36 pt to start, set in its options) and a drag from the second segment sets the radius (Shift in round steps, Cmd/Ctrl slowly), the circle then touching the first segment anywhere along it; the circle shows with its center and radii first, or a note when there is none (its options show or hide the center cross and the radii, set their color, and set how near a segment is picked with Smart Guides on or off); Add Points to Existing Paths (in its options; Alt at the release turns it the other way, a dot beside the pointer while it is in effect) also adds an anchor point where the circle touches each segment; one undo step | done | tool `tangentCircle` (in `crates/tools/src/addons/tangent_circle.rs`, geometry in `crates/pathops/src/addons/pathtools/tangent_circle/on_segments.rs`) and its tests; a VectorCraft addition, so it is not scored | | Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools › Expand Dashes into Paths turns each selected path's dashed stroke into separate open paths, one per dash, laid out as the stroke draws them (pattern, offset, Align Dashes to Corners and Path Ends), each keeping the stroke with the dashes off; one undo step | done | #4922; `addon.pathtools.expandDashes` (in `crates/engine/src/cmd/addons/pathtools.rs`, using the renderer's dash layout) and its tests; not a feature of the reference app, so it is not scored | -| Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools › Smooth Bridge… (Radius as a percentage of the smaller circle's radius, or with Constant Gap that radius plus a gap; Reach; Keep Originals; Preview) joins two selected circles into one outline with two concave arcs that touch both circles, or three or more each to the others within reach, united where the bridges connect, in place of the circles or above them (a pair within reach gets no bridge when its arcs would not reach both circles or would cross, or when its neck would be thinner than the precision its shape is united at; a circle bridged to no other stays as it is); one undo step | done | `addon.pathtools.bridge`, `crates/pathops/src/addons/pathtools/bridge.rs`, `crates/ui-egui/src/addons/pathtools/bridge.rs` and their tests; a VectorCraft addition, so it is not scored | +| Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools › Common Tangents… with External and Curved (Radius as a percentage of the smaller circle's radius, or with Constant Gap that radius plus a gap; Reach; Keep Originals; Preview) joins two selected circles into one outline with two concave arcs that touch both circles, or three or more each to the others within reach, united where the bridges connect, in place of the circles or above them (a pair within reach gets no bridge when its arcs would not reach both circles or would cross, or when its neck would be thinner than the precision its shape is united at; a circle bridged to no other stays as it is); one undo step | done | `addon.pathtools.bridge`, `crates/pathops/src/addons/pathtools/bridge.rs`, `crates/ui-egui/src/addons/pathtools/tangents.rs` and their tests; a VectorCraft addition, so it is not scored | | Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools › Tangent Circle… draws the circles that touch two selected paths or compound paths at a radius, or three of them, each touching the outlines without crossing them; Radius (two shapes), a Circle menu (All or one by number) and Preview; one undo step | done | `addon.pathtools.tangentCircle` (in `crates/engine/src/cmd/addons/pathtools/tangent_circle.rs`, geometry in `crates/pathops/src/addons/pathtools/tangent_circle.rs`) and its tests; a VectorCraft addition, so it is not scored | | Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools › Add Bounding Rectangle… and Add Bounding Circle… draw a live rectangle on the selection's geometric bounding box, or the smallest live circle that holds its outlines, from a dialog with Offset, One per Object (a shape around each object instead of one around the whole selection) and Preview; one undo step | done | `addon.pathtools.boundingRectangle` and `addon.pathtools.boundingCircle` (in `crates/engine/src/cmd/addons/pathtools/bounding.rs`, the circle in `crates/geom/src/shapes.rs`, `enclosing_circle`; the dialog is the command dialog, `crates/ui-egui/src/dialogs/command.rs`) and their tests, with the menu items' test `add_bounding_rectangle_and_circle_open_a_dialog_with_offset_and_one_per_object` in `crates/ui-egui/src/addons/pathtools/tests.rs`; a VectorCraft addition, so it is not scored | | Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools › Add Inscribed Circle draws the largest live circle inside each selected closed path or compound path, in the area it fills under its fill rule; one undo step | done | `addon.pathtools.inscribedCircle` (in `crates/engine/src/cmd/addons/pathtools/inscribed.rs`, geometry in `crates/pathops/src/addons/pathtools/inscribed.rs`) and its tests, with the menu item's test `add_inscribed_circle_draws_its_circles_without_a_dialog` in `crates/ui-egui/src/addons/pathtools/tests.rs`; a VectorCraft addition, so it is not scored | From 186e6db9bae18223917fe6cbb24dccbaaa68f864 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 13:34:08 -0800 Subject: [PATCH 057/112] xtask: test-lint reads renames, cfg_attr paths, casts and arm bindings - changed mode diffs with --no-renames, so an exact rename lists the old path as deleted and the new path as added, and both seed the route walk. - census reads a cast of the loop binding (k as usize) as the entry, and no longer reads a field or path segment named like it (config.k, m::k). - reads-source takes the file name from the final .join(...) component; a final component that is not a literal is an unknown file. - mirror keeps whitespace inside string literals when it compares lookup keys, so "A B" and "AB" are different entries. - fixture-only resolves a name bound by a match arm's pattern to that arm, not to an outer let; a guard still reads the outer binding. - never-run follows #[cfg_attr(<cond>, path = "...")] overrides: the selected path is loaded where the condition holds, and the default path elsewhere. - never-run treats tests/<dir>/mod.rs as loaded by the test targets beside it, like a crate root. - exact-pixel no longer reports two rects compared by their difference (a.width() - b.width()). --- xtask/src/test_lint.rs | 266 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 245 insertions(+), 21 deletions(-) diff --git a/xtask/src/test_lint.rs b/xtask/src/test_lint.rs index 0c7d793c0f..0e3baa802e 100644 --- a/xtask/src/test_lint.rs +++ b/xtask/src/test_lint.rs @@ -343,9 +343,9 @@ pub fn run(root: &Path, args: &[&str]) -> Result<(), String> { let base_off: RefCell<HashMap<String, HashSet<(String, usize)>>> = RefCell::new(HashMap::new()); let newly_off = |path: &str, src: &str, hit: &Hit| { let mut cache = base_off.borrow_mut(); - let off = cache.entry(path.to_owned()).or_insert_with(|| { - lint_file(path, src, &base_ctx).into_iter().filter(|h| h.rule == Rule::NeverRun).map(|h| (h.test, h.line)).collect() - }); + let off = cache + .entry(path.to_owned()) + .or_insert_with(|| lint_file(path, src, &base_ctx).into_iter().filter(|h| h.rule == Rule::NeverRun).map(|h| (h.test, h.line)).collect()); !off.contains(&(hit.test.clone(), hit.line)) }; let (mut counted, mut older) = (vec![], 0usize); @@ -560,6 +560,8 @@ fn changed_lines(root: &Path, base: &str) -> Result<BTreeMap<String, Option<BTre "--inter-hunk-context=0", "--no-color", "--no-ext-diff", + // A rename shows as a deletion and an addition, so both paths count as changed. + "--no-renames", "--src-prefix=a/", "--dst-prefix=b/", base, @@ -1782,13 +1784,20 @@ fn round_trip_call(op: &str, var: &str) -> bool { }) } -/// Whether `s` contains the identifier `var` as a whole word. +/// Whether the (whitespace-free) `s` reads the binding `var`: a whole word that is not a field or +/// path segment (`config.k`, `m::k`), alone or cast to a primitive (`k as usize` reads `kasusize`). fn reads_ident(s: &str, var: &str) -> bool { + const PRIMITIVES: &[&str] = + &["usize", "isize", "u128", "i128", "u64", "i64", "u32", "i32", "u16", "i16", "u8", "i8", "f64", "f32", "char", "bool"]; let b = s.as_bytes(); + let ends = |rest: &str| !rest.bytes().next().is_some_and(is_ident); !var.is_empty() && s.match_indices(var).any(|(at, _)| { let end = at + var.len(); - !(at > 0 && is_ident(b[at - 1])) && !b.get(end).copied().is_some_and(is_ident) + let field = at > 0 && b[at - 1] == b'.' && !(at > 1 && b[at - 2] == b'.'); + let path = at > 1 && &b[at - 2..at] == b"::"; + let cast = s[end..].strip_prefix("as").is_some_and(|r| PRIMITIVES.iter().any(|t| r.strip_prefix(t).is_some_and(ends))); + !(at > 0 && is_ident(b[at - 1])) && !field && !path && (ends(&s[end..]) || cast) }) } @@ -3084,8 +3093,12 @@ fn reads_source_hits(file: &File) -> Vec<Hit> { let rs = match word { b"ends_with" => literal == "\".rs\"", // The last path literal in the argument names the file read: `root.join("src/lib.rs")`, - // `concat!(…, "/x.rs")`, but not `root.join("fixtures.rs").join("data.json")`. - b"read_to_string" => last_literal(&arg).is_some_and(|l| l.ends_with(".rs\"")), + // `concat!(…, "/x.rs")`, but not `root.join("fixtures.rs").join("data.json")`. A final + // component that is not a literal (`.join(name)`) names an unknown file. + b"read_to_string" => { + let last = arg.rfind(".join(").and_then(|at| matching(arg.as_bytes(), at + 5).map(|close| &arg[at + 6..close])); + last_literal(last.unwrap_or(&arg)).is_some_and(|l| l.ends_with(".rs\"")) + } _ => arg.trim_end_matches('#').ends_with(".rs\""), }; if rs { @@ -3191,7 +3204,35 @@ fn first_arithmetic(op: &str) -> Option<usize> { fn head_args(f: &File, code: &[u8], (from, to): (usize, usize)) -> Option<Vec<String>> { let open = from + f.m.get(from..to)?.iter().position(|&c| c == b'(')?; let close = matching(&f.m, open)?; - Some(split_args(&f.m, open + 1, close).into_iter().map(|(a, b)| norm(code.get(a..b).unwrap_or(&f.src[a..b]))).collect()) + Some(split_args(&f.m, open + 1, close).into_iter().map(|(a, b)| norm_outside_literals(code.get(a..b).unwrap_or(&f.src[a..b]))).collect()) +} + +/// [`norm`] that keeps whitespace inside string literals: `"A B"` and `"AB"` are different keys. +fn norm_outside_literals(b: &[u8]) -> String { + let mut out = Vec::with_capacity(b.len()); + let mut in_str = false; + let mut i = 0; + while i < b.len() { + let c = b[i]; + if in_str { + out.push(c); + if c == b'\\' { + if let Some(&n) = b.get(i + 1) { + out.push(n); + i += 1; + } + } else if c == b'"' { + in_str = false; + } + } else if c == b'"' && !(i > 0 && b[i - 1] == b'\'' && b.get(i + 1) == Some(&b'\'')) { + in_str = true; + out.push(c); + } else if !c.is_ascii_whitespace() { + out.push(c); + } + i += 1; + } + String::from_utf8_lossy(&out).into_owned() } /// An argument that names an entry rather than a quantity: a string or integer literal, or a local, @@ -3321,13 +3362,67 @@ fn reaching_init(body: &[u8], name: &str, before: usize) -> Option<Option<(Strin let pattern = norm(pattern.as_bytes()); open < before && before < close && !words(pattern.as_bytes(), name.as_bytes(), 0, pattern.len()).is_empty() }); - match (loop_at, &found) { + // A match arm's pattern binds its names inside that arm only. + let inner = loop_at.max(arm_binding(body, name, before)); + match (inner, &found) { (Some(l), Some((_, at))) if *at > l => found.map(|(init, _)| init), (Some(_), _) => Some(None), (None, _) => found.map(|(init, _)| init), } } +/// The offset of the `=>` of the innermost match arm whose pattern binds `name` and whose body +/// holds `before`: `Some(n) => assert_eq!(n, 1)` binds `n`, `None => …` does not. +fn arm_binding(body: &[u8], name: &str, before: usize) -> Option<usize> { + let mut found = None; + for arrow in (0..before.min(body.len().saturating_sub(1))).filter(|&i| &body[i..i + 2] == b"=>") { + // The pattern runs back to the `{` or `,` that opens the arm. + let mut depth = 0usize; + let mut start = arrow; + while start > 0 { + match body[start - 1] { + b')' | b']' | b'}' => depth += 1, + b'(' | b'[' | b'{' if depth == 0 => break, + b'(' | b'[' | b'{' => depth -= 1, + b',' if depth == 0 => break, + _ => {} + } + start -= 1; + } + // A guard (`Some(x) if x == n`) reads names; it does not bind them. + let guard = words(body, b"if", start, arrow).first().copied().unwrap_or(arrow); + let pattern = norm(&body[start..guard]); + if words(pattern.as_bytes(), name.as_bytes(), 0, pattern.len()).is_empty() { + continue; + } + // The arm's body: a block, or an expression up to the `,` or brace that ends the arm. + let from = skip_ws(body, arrow + 2); + let end = match body.get(from) { + Some(b'{') => matching(body, from), + _ => { + let mut depth = 0usize; + (from..body.len()).find(|&i| match body[i] { + b'(' | b'[' | b'{' => { + depth += 1; + false + } + b')' | b']' | b'}' if depth == 0 => true, + b')' | b']' | b'}' => { + depth -= 1; + false + } + b',' => depth == 0, + _ => false, + }) + } + }; + if end.is_some_and(|end| before < end) { + found = Some(arrow); + } + } + found +} + /// [`reaching_init`] over `let` bindings alone, with the position of the binding that decides it. fn let_init(body: &[u8], name: &str, before: usize) -> Option<(Option<(String, usize)>, usize)> { let mut found = None; @@ -3644,13 +3739,20 @@ fn cfgs_over(m: &[u8], src: &[u8], pos: usize) -> Vec<(String, usize, usize)> { /// The module name a file declares and the files that may declare it with `mod <name>;`, or `None` /// for a crate root (`lib.rs`, `main.rs`, `build.rs`, a file directly in `tests`, `benches` or -/// `examples` beside a crate's `src`, or a file directly in `src/bin`). A `tests` directory under +/// `examples` beside a crate's `src`, or a file directly in `src/bin`), and for a `mod.rs` one +/// directory below those, which their roots load (`tests/common/mod.rs`). A `tests` directory under /// `src` holds modules, not test targets. fn module_parent(path: &str) -> Option<(&str, Vec<String>)> { let (dir, file) = path.rsplit_once('/')?; - let outside_src = |d: &str| dir.strip_suffix(d).is_some_and(|crate_dir| !crate_dir.split('/').any(|s| s == "src")); - let root_dir = ["/tests", "/benches", "/examples"].iter().any(|d| outside_src(d)) || dir.ends_with("/src/bin"); - if ["lib.rs", "main.rs", "build.rs"].contains(&file) || (root_dir && file != "mod.rs") { + let is_root_dir = |dir: &str| { + let outside_src = |d: &str| dir.strip_suffix(d).is_some_and(|crate_dir| !crate_dir.split('/').any(|s| s == "src")); + ["/tests", "/benches", "/examples"].iter().any(|d| outside_src(d)) || dir.ends_with("/src/bin") + }; + let root_dir = is_root_dir(dir); + // `tests/common/mod.rs` is loaded by the target roots beside it (`tests/smoke.rs` with + // `mod common;`), which are not listed here, so it counts as reached like a root. + let beside_roots = file == "mod.rs" && dir.rsplit_once('/').is_some_and(|(up, _)| is_root_dir(up)); + if ["lib.rs", "main.rs", "build.rs"].contains(&file) || (root_dir && file != "mod.rs") || beside_roots { return None; } let (name, parent) = if file == "mod.rs" { dir.rsplit_once('/').map(|(p, n)| (n, p))? } else { (file.strip_suffix(".rs")?, dir) }; @@ -3689,22 +3791,38 @@ fn declared_cfgs(src: &str, parent: &str, want: &Loaded) -> Option<(Vec<String>, continue; } let item = m[..at].iter().rposition(|&c| matches!(c, b';' | b'{' | b'}')).map_or(0, |p| p + 1); - let loads = match path_attr(&m, src.as_bytes(), item, at) { - Some(rel) => override_path(dir, file, mod_rs, want.chain, &rel) == want.path, + // A `cfg_attr` override loads its path where its condition holds, and the default (or a + // plain `#[path]`) elsewhere. + let conditional = cfg_attr_paths(&m, src.as_bytes(), item, at); + let overrides_here = |rel: &str| override_path(dir, file, mod_rs, want.chain, rel) == want.path; + let fallback = match path_attr(&m, src.as_bytes(), item, at) { + Some(rel) => overrides_here(&rel), None => { &m[start..end] == want.name.as_bytes() && [format!("{}.rs", want.name), format!("{}/mod.rs", want.name)].iter().any(|rel| join_path(&default_dir, rel) == want.path) } }; - if !loads { - continue; - } + let selected: Vec<&str> = conditional.iter().filter(|(_, rel)| overrides_here(rel)).map(|(c, _)| c.as_str()).collect(); + let route = match (fallback, selected.is_empty(), conditional.is_empty()) { + (true, _, true) => None, + (true, true, false) => Some(format!("not(any({}))", conditional.iter().map(|(c, _)| c.as_str()).collect::<Vec<_>>().join(","))), + (true, false, false) => { + let others: Vec<&str> = conditional.iter().filter(|(_, rel)| !overrides_here(rel)).map(|(c, _)| c.as_str()).collect(); + (!others.is_empty()).then(|| format!("not(any({}))", others.join(","))) + } + (false, true, _) => continue, + (false, false, _) => Some(format!("any({})", selected.join(","))), + }; // Inner attributes cover the file, and [`cfgs_over`] reads them. let attrs: Vec<CfgAttr> = cfg_attrs(&m, src.as_bytes(), item, at).into_iter().filter(|a| !a.inner).collect(); at_lines.push(lines.of(at)); // Every line of a multiline attribute counts: an edit inside its predicate changes it. at_lines.extend(attrs.iter().flat_map(|a| lines.of(a.at)..=lines.of(a.end))); let mut preds: Vec<String> = attrs.into_iter().map(|a| a.pred).collect(); + if let Some(route) = route { + preds.push(route); + at_lines.extend(lines.of(skip_ws(&m, item))..=lines.of(at)); + } for (p, a, e) in cfgs_over(&m, src.as_bytes(), at) { preds.push(p); at_lines.extend(lines.of(a)..=lines.of(e)); @@ -3747,7 +3865,9 @@ fn path_children(src: &str, parent: &str) -> Vec<(String, Vec<String>)> { continue; } let item = m[..at].iter().rposition(|&c| matches!(c, b';' | b'{' | b'}')).map_or(0, |p| p + 1); - if let Some(rel) = path_attr(&m, src.as_bytes(), item, at) { + let rels = + path_attr(&m, src.as_bytes(), item, at).into_iter().chain(cfg_attr_paths(&m, src.as_bytes(), item, at).into_iter().map(|(_, r)| r)); + for rel in rels { let chain = inline_mods(&m, src.as_bytes(), at); out.push((override_path(dir, file, mod_rs, &chain, &rel), chain)); } @@ -3819,6 +3939,31 @@ fn path_attr(m: &[u8], src: &[u8], from: usize, to: usize) -> Option<String> { }) } +/// The `#[cfg_attr(<condition>, path = "…")]` overrides in `m[from..to]`, each as its condition and +/// path. +fn cfg_attr_paths(m: &[u8], src: &[u8], from: usize, to: usize) -> Vec<(String, String)> { + let mut out = vec![]; + for at in words(m, b"cfg_attr", from, to) { + if !m[..at].trim_ascii_end().strip_suffix(b"[").is_some_and(|b| b.trim_ascii_end().ends_with(b"#")) { + continue; + } + let open = skip_ws(m, at + "cfg_attr".len()); + let Some(close) = (m.get(open) == Some(&b'(')).then(|| matching(m, open)).flatten() else { continue }; + let text = pred_text(&src[open + 1..close]); + let cuts = top_level_at(&text, ","); + let Some(&first) = cuts.first() else { continue }; + let mut start = first + 1; + for cut in cuts[1..].iter().copied().chain([text.len()]) { + let arg = text.get(start..cut).unwrap_or(""); + if let Some(rel) = arg.strip_prefix("path=\"").and_then(|r| r.strip_suffix('"')) { + out.push((text[..first].to_owned(), rel.to_owned())); + } + start = cut + 1; + } + } + out +} + /// `rel` joined to the directory `base`, with `.` and `..` resolved. fn join_path(base: &str, rel: &str) -> String { let mut parts: Vec<&str> = base.split('/').filter(|s| !s.is_empty()).collect(); @@ -4028,8 +4173,14 @@ fn names_rect(op: &str) -> bool { if b.get(after) == Some(&b'(') { after = matching(b, after).map_or(b.len(), |c| c + 1); } - let rest = &op[after..]; - if rest.is_empty() || RECT_PARTS.iter().any(|p| rest.starts_with(p)) { + // The rect and its parts make up the whole operand: `a.width() - b.width()` compares two + // rects, not one with a number. + let mut rest = &op[after..]; + while let Some(r) = RECT_PARTS.iter().chain(&[".x", ".y"]).find_map(|p| rest.strip_prefix(p)) { + rest = r; + } + let lead = op[..i].trim_start_matches(['&', '*', '(']); + if rest.trim_start_matches(')').is_empty() && !lead.contains(['+', '-', '*', '/', '%', ',']) { return true; } } @@ -4112,6 +4263,13 @@ mod tests { let census = |src: &str| hits(src).into_iter().filter(|h| h.1 == "census").collect::<Vec<_>>(); let fixed = "#[test]\nfn t() {\n for expected in CASES {\n assert_eq!(lookup(\"baseline\"), expected);\n }\n}\n"; assert_eq!(census(fixed), [], "a lookup of a fixed key is not a round trip of the entry"); + let cast = "#[test]\nfn t() {\n for k in KEYS {\n assert_eq!(lookup(k as usize), k);\n }\n}\n"; + assert_eq!(census(cast), [(2, "census")], "a cast of the entry is still the entry"); + let fixed_cast = "#[test]\nfn t() {\n for k in KEYS {\n assert_eq!(lookup(FIXED as usize), k);\n }\n}\n"; + assert_eq!(census(fixed_cast), [], "a cast of a fixed key"); + let field = + "#[test]\nfn t() {\n for k in KEYS {\n assert_eq!(lookup(config.k), k);\n assert_eq!(lookup(keys::k), k);\n }\n}\n"; + assert_eq!(census(field), [], "a field or path named like the binding is a fixed key"); let derived = "#[test]\nfn t() {\n for k in Kind::ALL {\n assert_eq!(Kind::from_id(k.id()), Some(k));\n }\n}\n"; assert_eq!(census(derived), [(2, "census")]); let successor = "#[test]\nfn t() {\n for k in KEYS {\n assert_eq!(1 + lookup(k), k);\n }\n}\n"; @@ -5660,6 +5818,10 @@ mod tests { assert_eq!(only("mirror", order), [], "positions of two entries in one list"); let commented = "#[test]\nfn t() {\n assert_eq!(at(\"B\" /* later entry */), at(\"A\") + 1);\n}\n"; assert_eq!(only("mirror", commented), [], "a comment beside a key"); + let spaced = "#[test]\nfn t() {\n assert_eq!(at(\"A B\"), at(\"AB\") + 1);\n}\n"; + assert_eq!(only("mirror", spaced), [], "a space inside a key makes a different entry"); + let same_key = "#[test]\nfn t() {\n assert_eq!(at(\"A B\"), at( \"A B\" ) + 1);\n}\n"; + assert_eq!(only("mirror", same_key), [(3, "mirror")], "spaces between tokens do not"); let offset = "#[test]\nfn t() {\n assert_eq!(bounds(&s, copies[0]), bounds(&s, id) + dv);\n assert_eq!(board(&s, 3), board(&s, 2) + step);\n}\n"; assert_eq!(only("mirror", offset), [], "two objects of one document, one moved from the other"); @@ -5678,6 +5840,10 @@ mod tests { assert_eq!(only("fixture-only", fixture), [(2, "fixture-only")]); let result = "#[test]\nfn t() {\n let input = vec![1, 2, 3];\n let out = process(&input);\n assert_eq!(out.len(), 3);\n}\n"; assert_eq!(only("fixture-only", result), [], "the result of the code under test"); + let arm = "#[test]\nfn t() {\n let n = 0;\n match compute() {\n Some(n) => assert_eq!(n, 1),\n None => assert_eq!(n, 0),\n }\n}\n"; + assert_eq!(only("fixture-only", arm), [], "a match arm binds its own n"); + let outer = "#[test]\nfn t() {\n let n = 0;\n match compute() {\n Some(m) if m == n => assert_eq!(n, 0),\n _ => assert_eq!(n, 0),\n }\n}\n"; + assert_eq!(only("fixture-only", outer), [(2, "fixture-only")], "a guard reads the outer n"); let changed = "#[test]\nfn t() {\n let mut input = vec![1, 2, 3];\n process(&mut input);\n assert_eq!(input.len(), 3);\n}\n"; assert_eq!(only("fixture-only", changed), [], "a mutable local the code changes"); let borrowed = "#[test]\nfn t() {\n let input = &mut [3, 1];\n sort(input);\n assert_eq!(*input, [1, 3]);\n}\n"; @@ -5921,6 +6087,18 @@ mod tests { let test = "#[test]\nfn t() {\n assert_eq!(f(), 1);\n}\n"; assert_eq!(hits_in(&child, test, &ctx), [(2, "never-run")], "src/tests holds modules, not test targets"); assert_eq!(module_parent("crates/x/tests/fonts.rs"), None, "a test target beside src"); + let files: HashMap<&str, &str> = [ + ("crates/x/src/lib.rs", "#[cfg(target_os = \"macos\")]\n#[path = \"../tests/common/mod.rs\"]\nmod common;\n"), + ("crates/x/tests/smoke.rs", "mod common;\n"), + ("crates/x/tests/common/mod.rs", ""), + ] + .into_iter() + .collect(); + let read = |p: &str| files.get(p).map(|s| (*s).to_owned()); + let overrides = path_overrides(files.iter().map(|(p, s)| (*p, *s))); + let shared = "crates/x/tests/common/mod.rs".to_owned(); + let shared_ctx = Ctx { module_cfgs: module_cfgs(std::slice::from_ref(&shared), &read, &overrides), ..self::ctx() }; + assert_eq!(hits_in(&shared, test, &shared_ctx), [], "a test target beside it loads the shared module on every target"); } #[test] @@ -5955,6 +6133,45 @@ mod tests { std::fs::remove_dir_all(root).unwrap(); } + #[test] + fn never_run_follows_a_path_selected_by_cfg_attr() { + let files: HashMap<&str, &str> = [ + ("crates/x/src/lib.rs", "#[cfg_attr(unix, path = \"live.rs\")]\nmod platform;\n#[cfg(target_os = \"macos\")]\nmod live;\n"), + ("crates/x/src/live.rs", ""), + ("crates/x/src/platform.rs", ""), + ] + .into_iter() + .collect(); + let read = |p: &str| files.get(p).map(|s| (*s).to_owned()); + let overrides = path_overrides(files.iter().map(|(p, s)| (*p, *s))); + let test = "#[test]\nfn t() {\n assert_eq!(f(), 1);\n}\n"; + let live = "crates/x/src/live.rs".to_owned(); + let ctx = Ctx { module_cfgs: module_cfgs(std::slice::from_ref(&live), &read, &overrides), ..ctx() }; + assert_eq!(hits_in(&live, test, &ctx), [], "Linux loads live.rs through the cfg_attr path"); + let platform = "crates/x/src/platform.rs".to_owned(); + let gates = module_gates(std::slice::from_ref(&platform), &read, &overrides); + assert_eq!(gates.get(&platform).map(|g| g.preds.clone()), Some(vec!["not(any(unix))".to_owned()]), "the default path elsewhere"); + } + + #[test] + fn changed_lines_lists_both_paths_of_an_exact_rename() { + let unique = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap().as_nanos(); + let root = std::env::temp_dir().join(format!("test-lint-rename-{}-{unique}", std::process::id())); + std::fs::create_dir_all(root.join("crates/x/src/bin")).unwrap(); + git(&root, &["init", "--quiet"]).unwrap(); + let src = "#[path = \"../shared.rs\"]\nmod shared;\nfn main() {}\n"; + std::fs::write(root.join("crates/x/src/bin/tool.rs"), src).unwrap(); + git(&root, &["add", "."]).unwrap(); + let base = git(&root, &["write-tree"]).unwrap(); + std::fs::create_dir_all(root.join("crates/x/src/disabled")).unwrap(); + std::fs::rename(root.join("crates/x/src/bin/tool.rs"), root.join("crates/x/src/disabled/tool.rs")).unwrap(); + git(&root, &["add", "-A"]).unwrap(); + let changed = changed_lines(&root, &base).unwrap(); + assert_eq!(changed.get("crates/x/src/bin/tool.rs"), Some(&None), "the old path counts as deleted"); + assert_eq!(changed.get("crates/x/src/disabled/tool.rs"), Some(&None), "the new path counts as added"); + std::fs::remove_dir_all(root).unwrap(); + } + #[test] fn never_run_joins_inline_and_override_routes() { for (lib, child) in [ @@ -6208,6 +6425,8 @@ mod tests { assert_eq!(px("assert!(rect.width() == 120.0);"), [(4, "exact-pixel")]); assert_eq!(px("assert!(panel_rect.contains_rect(button_rect));"), [], "a relationship"); assert_eq!(px("assert!(rect.width() >= SPACING);"), []); + assert_eq!(px("assert_eq!(left_rect.width() - right_rect.width(), 0.0);"), [], "two rects compared by their difference"); + assert_eq!(px("assert_eq!(left_rect.width(), 120.0);"), [(4, "exact-pixel")]); assert_eq!(px("assert_eq!(rects.len(), 3);"), [], "a count"); assert_eq!(px("assert_eq!(correct, 3);"), [], "a word that only contains rect"); assert_eq!(px("assert_eq!(tabs_rect(&app).min.y, 0.0);"), [(4, "exact-pixel")], "a call that returns a rect"); @@ -6229,6 +6448,11 @@ mod tests { assert_eq!(only("reads-source", comment), [], "a Rust path only in a comment"); let dir = "#[test]\nfn t() {\n let s = fs::read_to_string(root.join(\"fixtures.rs\").join(\"data.json\")).unwrap();\n assert!(s.contains(\"x\"));\n}\n"; assert_eq!(only("reads-source", dir), [], "a directory named like a Rust file"); + let unknown = "#[test]\nfn t() {\n let name = \"data.json\";\n let s = fs::read_to_string(root.join(\"fixtures.rs\").join(name)).unwrap();\n assert!(s.contains(\"x\"));\n}\n"; + assert_eq!(only("reads-source", unknown), [], "a final component that is not a literal"); + let joined = + "#[test]\nfn t() {\n let s = fs::read_to_string(root.join(\"src\").join(\"lib.rs\")).unwrap();\n assert!(s.contains(\"x\"));\n}\n"; + assert_eq!(only("reads-source", joined), [(3, "reads-source")], "a final join that names a .rs file"); let formatted = "#[test]\nfn t() {\n let s = fs::read_to_string(format!(\"fixtures/{}.txt\", \"lib.rs\")).unwrap();\n assert!(s.contains(\"x\"));\n}\n"; assert_eq!(only("reads-source", formatted), [], "a format argument is not the file read"); let format_rs = From 4ce98e803263933233d22e6b55ca97e3fc19e2f5 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 13:45:26 -0800 Subject: [PATCH 058/112] MCP: regenerate the UI catalog for the Gap Options preview text The params text of ui.livePaintGapOptions in crates/ui-egui/src/menus/ui_commands.rs gained the failed-preview sentence, but crates/mcp/src/ui_catalog.rs was not regenerated, so `cargo xtask ui-commands --check` failed in CI. This is the output of `cargo xtask ui-commands`. --- crates/mcp/src/ui_catalog.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/mcp/src/ui_catalog.rs b/crates/mcp/src/ui_catalog.rs index f2ef87651c..baffcb9634 100644 --- a/crates/mcp/src/ui_catalog.rs +++ b/crates/mcp/src/ui_catalog.rs @@ -2202,7 +2202,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "ui.livePaintGapOptions", "Gap Options…", "", - "{} open Gap Options (Object › Live Paint › Gap Options…; dialog `livePaintGapOptions`: detect, size small|medium|large|custom, custom (pt), color (#rrggbb or a layer color's name), closeGaps, preview) on the selected Live Paint groups, filled in from the first; with preview on, the options apply live and the gaps found draw on the canvas in the preview color: OK runs livePaint.gapOptions as one undo step; a color with an alpha part (#rrggbbaa or #rgba) is an error and OK changes nothing, and with preview on a #rrggbbaa color is not previewed: the groups keep their own color and the gaps draw in black", + "{} open Gap Options (Object › Live Paint › Gap Options…; dialog `livePaintGapOptions`: detect, size small|medium|large|custom, custom (pt), color (#rrggbb or a layer color's name), closeGaps, preview) on the selected Live Paint groups, filled in from the first; with preview on, the options apply live and the gaps found draw on the canvas in the preview color: OK runs livePaint.gapOptions as one undo step; a color with an alpha part (#rrggbbaa or #rgba) is an error and OK changes nothing, and with preview on a #rrggbbaa color is not previewed: the groups keep their own color and the gaps draw in black; a preview that fails shows its error in the status bar, puts the groups back as they were and stops drawing the dialog's preview of the gaps (View › Show Live Paint Gaps still draws the restored groups' own gaps)", ), ( "ui.perspectivePlane", From 7183a91544853c274f1b94a1cff760881c931885 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 13:52:58 -0800 Subject: [PATCH 059/112] Preferences: Reset All Warning Dialogs turns dismissed warnings back on General gets a Reset All Warning Dialogs button after the Show External Script Warning row. It turns every warning that a Don't Show Again box turned off back on in the Preferences window, and OK or Apply saves it. The button is dimmed while every warning is on, so a click then changes nothing. The warnings with a Don't Show Again box are listed in one place (`WARNING_DIALOGS`), so a later dialog with the box joins the reset by adding its preference there. --- crates/ui-egui/src/prefs_dialog/model.rs | 29 ++++++++++++- crates/ui-egui/src/prefs_dialog/tests.rs | 53 ++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/prefs_dialog/model.rs b/crates/ui-egui/src/prefs_dialog/model.rs index 3a951fb6cb..847610adb4 100644 --- a/crates/ui-egui/src/prefs_dialog/model.rs +++ b/crates/ui-egui/src/prefs_dialog/model.rs @@ -8,7 +8,7 @@ use std::sync::{Mutex, PoisonError}; use craft::host::{PickKind, PickRequest}; use craft::theme::Rgba; use craft::ui::buttons::Button; -use craft::ui::contract::{Bind, Entry, Show as _, ShowContainer as _}; +use craft::ui::contract::{Bind, Entry, Props as _, Show as _, ShowContainer as _}; use craft::ui::form::{SliderField, SliderFieldLayout}; use craft::ui::layout_components::Row; use craft::ui::patterns::preferences::{GroupSpec, PageSpec, PathSetting, PrefValue, PreferencesDraft, PreferencesModel, RowKind, RowSpec}; @@ -26,6 +26,21 @@ use craft::ui::dialog::{DialogResult, PromptChoice, StandardPrompt}; /// The pixel size every point-stored length field of this port uses. const PIXELS_PER_INCH: f64 = 72.0; +/// The preferences that a dialog's Don't Show Again box turns off, one per dialog; General › Reset All Warning +/// Dialogs turns each of them back on. The button follows the last one's row. +pub(super) const WARNING_DIALOGS: &[&str] = &["showExternalScriptWarning"]; + +/// The row key of the Reset All Warning Dialogs button. +const RESET_WARNINGS_KEY: &str = "resetWarningDialogs"; + +/// Turns the warning preferences `keys` back on in the draft, as Reset All Warning Dialogs does; OK or Apply writes +/// them. +pub(super) fn reset_warning_dialogs(w: &mut PrefsWindow, keys: &[&str]) { + for key in keys { + w.set_row(key, &json!(true)); + } +} + /// The model of the open window: the app, and the window taken out of it for the pass. pub(super) struct Live<'a> { pub(super) app: &'a mut VectorcraftApp, @@ -264,6 +279,10 @@ impl Live<'_> { let english = "Script File Access revoke read write file folder"; groups.add(sp.section, self.row(script_access::KEY, tl!("Script File Access"), english, RowKind::CustomRows)); } + if WARNING_DIALOGS.last() == Some(&sp.key) { + let english = "Reset All Warning Dialogs don't show again"; + groups.add(sp.section, self.row(RESET_WARNINGS_KEY, "", english, RowKind::Custom)); + } } if cat == PREF_CATEGORIES[0] { let tools = self.row("prefsFile", "", "export import reset preferences", RowKind::Custom); @@ -370,6 +389,14 @@ impl PreferencesModel for Live<'_> { script_access::show(self.app, &mut self.w.script_access, ui); false } + RESET_WARNINGS_KEY => { + let turned_off: Vec<&str> = WARNING_DIALOGS.iter().copied().filter(|k| !self.bool_of(k)).collect(); + if Button::new(tl!("Reset All Warning Dialogs")).enabled(!turned_off.is_empty()).show(ui).clicked() { + reset_warning_dialogs(self.w, &turned_off); + return true; + } + false + } "prefsFile" => { let (mut export, mut import, mut reset) = (false, false, false); let web = crate::io::is_web(self.app); diff --git a/crates/ui-egui/src/prefs_dialog/tests.rs b/crates/ui-egui/src/prefs_dialog/tests.rs index fc61192b84..5b15a52f69 100644 --- a/crates/ui-egui/src/prefs_dialog/tests.rs +++ b/crates/ui-egui/src/prefs_dialog/tests.rs @@ -1536,3 +1536,56 @@ fn script_file_access_revoke_names_the_whole_path() { } let _ = std::fs::remove_dir_all(store.parent().unwrap()); } + +/// One frame of the Reset All Warning Dialogs row in the window's context with `events` → the texts it drew, each +/// with its place. +fn reset_warnings_frame(a: &mut VectorcraftApp, events: Vec<egui::Event>) -> Vec<(String, egui::Rect)> { + let ctx = a.ui_ctx.clone().expect("a window context"); + let raw = + egui::RawInput { screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(900.0, 700.0))), events, ..Default::default() }; + let out = crate::testing::part_frame(a, &ctx, raw, |a, ui| { + let Some(mut w) = a.prefs.take() else { return }; + let _ = model::Live { app: &mut *a, w: &mut w }.custom_row(ui, "resetWarningDialogs"); + a.prefs = Some(w); + }); + crate::tests_removeanchors::shapes_text(&crate::tests_labels::flat_painted_shapes(&out.shapes)) +} + +/// Clicks Reset All Warning Dialogs with the pointer. +fn click_reset_warnings(a: &mut VectorcraftApp) { + reset_warnings_frame(a, vec![]); + let texts = reset_warnings_frame(a, vec![]); + let label = "Reset All Warning Dialogs"; + let at = texts.iter().find(|(t, _)| t == label).map(|(_, r)| r.center()).unwrap_or_else(|| panic!("no `{label}` in {texts:?}")); + let press = |pressed| egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: Default::default() }; + reset_warnings_frame(a, vec![egui::Event::PointerMoved(at)]); + reset_warnings_frame(a, vec![press(true)]); + reset_warnings_frame(a, vec![press(false)]); +} + +/// General shows Reset All Warning Dialogs beside the warning a Don't Show Again box turned off. With the warning +/// off, the button turns it back on in the window and OK saves it; with every warning on, the button is dimmed and +/// a click leaves the row untouched. +#[test] +fn reset_all_warning_dialogs_turns_a_dismissed_warning_back_on() { + let mut a = app(); + a.run("prefs.set", json!({"key": "showExternalScriptWarning", "value": false})).unwrap(); + open(&mut a, Some("General")); + let rows: Vec<(String, String)> = with_pages(&mut a, |pages| { + let general = pages.iter().find(|p| p.id == "General").expect("a General page"); + general.groups.iter().flat_map(|g| g.rows.iter().map(|r| (g.title.unwrap_or_default().to_string(), r.key.to_string()))).collect() + }); + let at = |key: &str| rows.iter().position(|(_, k)| k == key).unwrap_or_else(|| panic!("no {key} in {rows:?}")); + let (warning, reset) = (at("showExternalScriptWarning"), at("resetWarningDialogs")); + assert!(warning < reset && rows[warning].0 == rows[reset].0, "the button follows the warning's row in its section: {rows:?}"); + + click_reset_warnings(&mut a); + assert_eq!(field(&a, "showExternalScriptWarning"), json!(true), "the window shows the warning on"); + assert!(!a.session.prefs.show_external_script_warning, "nothing is saved before OK"); + confirm(&mut a).unwrap(); + assert!(a.session.prefs.show_external_script_warning, "OK saves the warning on"); + + open(&mut a, Some("General")); + click_reset_warnings(&mut a); + assert!(!a.prefs.as_ref().unwrap().touched.contains("showExternalScriptWarning"), "a dimmed button changes nothing"); +} From 829a090cd8c694f81a36df05fa47a007234fb2e8 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 13:59:05 -0800 Subject: [PATCH 060/112] xtask: test-lint sleep rule leaves out condition polls and fallback releases The `sleep` rule reported every `thread::sleep` in test code, so 24 of the 30 hits across the workspace were the pause of a loop that waits for a condition (a search's progress, a flag's `load`, a tool's `poll`) with a long deadline, or a spawned thread that opens a gate after 10 s in case the test never does. None of those make a test pass or fail on time. The rule now leaves out: - a sleep in a `while` or `loop` whose condition or body calls a function or method other than one that reads or converts a time, also when the sleep sits under an `if` or `match` inside that loop; - a sleep in a closure passed to `spawn` when the call is a whole statement, so the test drops the thread's handle. A loop that only waits for the clock (`elapsed`, `as_millis` and other `Duration` reads), a counted loop, a `for` loop, a sleep under an `if` outside a loop, and a spawned thread whose handle is kept, returned, passed on or joined are still reported. Macros such as `println!` in a loop do not count as a condition. The loop's head is read as a whole statement, so braces inside it, as in `json!({})`, do not cut it short. `cargo xtask test-lint --all` now lists 6 sleep hits instead of 30; each of the 6 delays a gate or a poll that the test's result depends on. --- xtask/src/test_lint.rs | 165 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 162 insertions(+), 3 deletions(-) diff --git a/xtask/src/test_lint.rs b/xtask/src/test_lint.rs index 5cc0a180aa..21f18cfa86 100644 --- a/xtask/src/test_lint.rs +++ b/xtask/src/test_lint.rs @@ -36,7 +36,10 @@ //! file's code sets `NAME`; workflow mapping keys and `NAME=` assignments count, but comments, //! string literals, `echo` or `printf` output that is not written to `$GITHUB_ENV`, and variable //! reads do not; -//! * `sleep`: `thread::sleep` in test code, or a bare `sleep(…)` in a file that imports it; +//! * `sleep`: `thread::sleep` in test code, or a bare `sleep(…)` in a file that imports it. Left +//! out: the pause of a `while` or `loop` that checks a condition (its condition or body calls a +//! function or method besides reading the clock), also under an `if` or `match` inside that +//! loop, and the delay inside a closure passed to `spawn` whose thread handle the test drops; //! * `reads-source`: test code that reads Rust source (`include_str!` of a `.rs` file, or a walk //! that keeps files ending in `.rs`), outside the source audits in [`SOURCE_AUDITS`]; //! * `census`: a test that loops over a whole table (a `SCREAMING_CASE` constant, `Type::ALL`, @@ -2875,15 +2878,139 @@ fn sleep_hits(file: &File) -> Vec<Hit> { } let before = m[..at].trim_ascii_end(); let path = before.strip_suffix(b"::").map(<[u8]>::trim_ascii_end); - match path { + let thread_sleep = match path { Some(p) => p.ends_with(b"thread") && !p.ends_with(b"_thread"), None => imported && !before.ends_with(b".") && !before.ends_with(b"fn"), - } + }; + thread_sleep && !polls_or_releases(m, at) }) .map(|at| file.hit(at, Rule::Sleep, file.test_at(at), "sleeps in test code".into())) .collect() } +/// Calls that only read or build a time, which a wait on the clock alone makes. +const TIME_CALLS: &[&str] = &[ + "sleep", + "now", + "elapsed", + "duration_since", + "saturating_duration_since", + "checked_sub", + "checked_add", + "from_millis", + "from_secs", + "from_micros", + "from_nanos", + "from_secs_f32", + "from_secs_f64", + "as_secs", + "as_millis", + "as_micros", + "as_nanos", + "as_secs_f32", + "as_secs_f64", + "subsec_millis", + "subsec_micros", + "subsec_nanos", + "mul_f32", + "mul_f64", +]; + +/// The enclosing block's opening brace and the start of the statement that opens it. +fn enclosing_block(m: &[u8], at: usize) -> Option<(usize, usize)> { + let mut depth = 0usize; + let open = (0..at).rev().find(|&j| match m[j] { + b'}' => { + depth += 1; + false + } + b'{' if depth == 0 => true, + b'{' => { + depth -= 1; + false + } + _ => false, + })?; + // The statement that opens the block starts after the last `;`, `{` or `}` outside brackets, so + // a condition such as `json!({}) != 1` stays whole. + let mut nest = 0usize; + let start = (0..open) + .rev() + .find(|&j| match m[j] { + b')' | b']' => { + nest += 1; + false + } + b'}' if nest > 0 => { + nest += 1; + false + } + b'(' | b'[' => { + nest = nest.saturating_sub(1); + false + } + b'{' if nest > 0 => { + nest -= 1; + false + } + b';' | b'{' | b'}' => true, + _ => false, + }) + .map_or(0, |j| j + 1); + Some((open, start)) +} + +/// Whether the sleep at `at` is the pause of a loop that checks a condition, or the delay of a +/// spawned thread's fallback release. A `while` or `loop` around it polls when its condition or +/// body calls a function or method other than [`TIME_CALLS`] (a flag's `load`, a `poll`, a +/// progress read); a macro such as `println!` does not count. A +/// closure passed to a `spawn` call whose handle is dropped runs beside the test, which does not +/// wait for it. +fn polls_or_releases(m: &[u8], at: usize) -> bool { + let mut at = at; + let (open, start) = loop { + let Some((open, start)) = enclosing_block(m, at) else { return false }; + let head = m[start..open].trim_ascii(); + let keyword = |w: &[u8]| head.starts_with(w) && !head.get(w.len()).copied().is_some_and(is_ident); + if keyword(b"while") || keyword(b"loop") || head.ends_with(b"||") { + break (open, start); + } + if !head.is_empty() && !keyword(b"if") && !keyword(b"else") && !keyword(b"match") && !head.ends_with(b"=>") { + return false; + } + at = open; + }; + let head = m[start..open].trim_ascii(); + if head.ends_with(b"||") { + // The thread's handle is dropped only when the `spawn` call is the whole statement: a + // path before it and a `;` after it. A `let`, an assignment, an argument or a chained + // `.join()` keeps the handle, and a test that joins it waits for the sleep. + let head_at = start + (m[start..open].len() - m[start..open].trim_ascii_start().len()); + let dropped = |s: usize| { + let path = &head[..s]; + let mut i = 0; + while i < path.len() { + if !is_ident(path[i]) || path[i].is_ascii_digit() { + return false; + } + while i < path.len() && is_ident(path[i]) { + i += 1; + } + i = skip_ws(path, i); + if path.get(i..i + 2) != Some(&b"::"[..]) { + return false; + } + i = skip_ws(path, i + 2); + } + let paren = skip_ws(m, head_at + s + "spawn".len()); + matching(m, paren).is_some_and(|close| m.get(skip_ws(m, close + 1)) == Some(&b';')) + }; + return words(head, b"spawn", 0, head.len()).into_iter().any(|s| head.get(skip_ws(head, s + "spawn".len())) == Some(&b'(') && dropped(s)); + } + let close = matching(m, open).unwrap_or(m.len()); + calls(m, start, close).iter().any(|(name, _)| !name.ends_with('!') && !TIME_CALLS.contains(&name.as_str())) +} + fn reads_source_hits(file: &File) -> Vec<Hit> { if SOURCE_AUDITS.contains(&file.path) { return vec![]; @@ -4358,6 +4485,38 @@ mod tests { assert!(touches(&found[0], Some(&[4].into_iter().collect())), "a change to the name alone"); } + #[test] + fn sleep_in_a_condition_poll_or_a_spawned_release_is_not_reported() { + let polls = [ + "fn wait(r: &R, back_off: bool) {\n while !r.load(SeqCst) {\n if back_off {\n thread::sleep(D);\n }\n }\n}\n", + "fn wait(r: &R) {\n loop {\n match r.state() {\n S::Done => break,\n _ => {\n thread::sleep(D);\n }\n }\n }\n}\n", + "fn wait(s: &S) -> P {\n loop {\n let p = s.progress();\n if p.done || Instant::now() > until {\n return p;\n }\n thread::sleep(D);\n }\n}\n", + "fn wait(g: &G) {\n while !g.0.load(SeqCst) {\n std::thread::sleep(Duration::from_millis(1));\n }\n}\n", + "fn wait(t: &mut T) {\n while t.waiting() {\n thread::sleep(D);\n t.poll();\n }\n}\n", + "fn wait(s: &S) {\n while s.execute(\"a\", &json!({})).unwrap()[\"n\"] != 1 && Instant::now() < until {\n thread::sleep(D);\n }\n}\n", + "#[test]\nfn t() {\n std::thread::spawn(move || {\n std::thread::sleep(Duration::from_secs(10));\n gate.open();\n });\n assert_eq!(f(), 1);\n}\n", + ]; + for src in polls { + assert_eq!(hits(src), [], "{src}"); + } + let timed = [ + "fn wait() {\n for _ in 0..3 {\n if ready() {\n thread::sleep(D);\n }\n }\n}\n", + "fn start() -> JoinHandle<()> {\n return std::thread::spawn(move || {\n std::thread::sleep(D);\n });\n}\n", + "fn wait() {\n let t0 = Instant::now();\n while t0.elapsed() < Duration::from_millis(50) {\n thread::sleep(Duration::from_millis(5));\n }\n}\n", + "fn wait() {\n let t0 = Instant::now();\n while t0.elapsed().as_millis() < 50 {\n thread::sleep(D);\n }\n}\n", + "fn wait() {\n let mut n = 0;\n loop {\n thread::sleep(D);\n n += 1;\n if n == 3 {\n break;\n }\n }\n}\n", + "fn wait(g: &G) {\n if g.ready() {\n thread::sleep(D);\n }\n}\n", + "fn wait() {\n let t0 = Instant::now();\n loop {\n thread::sleep(D);\n println!(\"{:?}\", t0.elapsed());\n if t0.elapsed() > D {\n break;\n }\n }\n}\n", + "#[test]\nfn t() {\n let h = run(move || {\n thread::sleep(D);\n });\n assert_eq!(h, 1);\n}\n", + "#[test]\nfn t() {\n std::thread::spawn(move || {\n std::thread::sleep(D);\n })\n .join()\n .unwrap();\n assert_eq!(f(), 1);\n}\n", + "#[test]\nfn t() {\n handles.push(std::thread::spawn(move || {\n std::thread::sleep(D);\n }));\n assert_eq!(f(), 1);\n}\n", + "#[test]\nfn t() {\n let release = std::thread::spawn(move || {\n std::thread::sleep(D);\n gate.open();\n });\n assert_eq!(f(), 1);\n release.join().unwrap();\n}\n", + ]; + for src in timed { + assert_eq!(hits(src).iter().filter(|h| h.1 == "sleep").count(), 1, "{src}"); + } + } + #[test] fn sleep_needs_the_thread_function() { let local = "fn sleep() -> u8 { 42 }\n#[test]\nfn t() {\n assert_eq!(sleep(), 42);\n}\n"; From 827f4fc87ebfe78ddbe31024ee3f63d24676539c Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 14:10:14 -0800 Subject: [PATCH 061/112] Tests: make isolation change the contrast answer for the grouped Difference square The white square behind the Difference square was opaque, so the art behind the group never reached the blend and the test gave the same answer with isolation off. That square is now 50 % opaque. The test checks that the isolating group gives one answer and that the same group without isolation reports that the art behind the selection is not one color. --- crates/engine/src/tests/colorcontrast.rs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/tests/colorcontrast.rs b/crates/engine/src/tests/colorcontrast.rs index 152e48a837..2ac70f800d 100644 --- a/crates/engine/src/tests/colorcontrast.rs +++ b/crates/engine/src/tests/colorcontrast.rs @@ -1160,9 +1160,10 @@ fn a_blend_mode_over_art_of_several_colors_has_no_one_answer() { assert!((ratio(&r) - 21.0).abs() < 1e-3, "white minus white is black: {r}"); } -/// A Difference square over a white square in a 50 % group that isolates its blending, over the -/// edge between black and white art: the square blends only with the white inside the group, so +/// A Difference square over a 50 % white square in a 50 % group that isolates its blending, over +/// the edge between black and white art: the square blends only with the white inside the group, so /// the art of two colors outside it, which the group draws over in Normal mode, leaves one answer. +/// Without isolation the blend also reaches that art, and there is no one answer. #[test] fn a_blend_mode_inside_an_isolating_group_answers_over_art_of_several_colors() { let mut s = session(); @@ -1177,17 +1178,29 @@ fn a_blend_mode_inside_an_isolating_group_answers_over_art_of_several_colors() { let back = id(s.execute("shape.rectangle", &json!({"x": 60, "y": 60, "width": 80, "height": 80})).unwrap()); s.execute("paint.setFill", &json!({"color": "#ffffff"})).unwrap(); s.execute("paint.setStroke", &json!({"none": true})).unwrap(); + // Translucent, so that a blend that is not isolated also reaches the art behind the group. + s.execute("transparency.set", &json!({"opacity": 50})).unwrap(); let square = id(s.execute("shape.rectangle", &json!({"x": 70, "y": 70, "width": 60, "height": 60})).unwrap()); s.execute("paint.setStroke", &json!({"none": true})).unwrap(); s.execute("paint.setFill", &json!({"color": "#ffffff"})).unwrap(); s.execute("transparency.set", &json!({"blend": "difference"})).unwrap(); - s.execute("object.group", &json!({"ids": [back, square]})).unwrap(); + let group = id(s.execute("object.group", &json!({"ids": [back, square]})).unwrap()); s.execute("transparency.set", &json!({"opacity": 50, "isolate": true})).unwrap(); s.execute("select.set", &json!({"ids": [square]})).unwrap(); let r = s.execute("color.contrast", &json!({})).unwrap(); let isolated = ratio(&r); assert!(isolated > 1.0, "{r}"); assert!(r["against"].as_str().is_some_and(|h| vectorcraft_color::Color::from_hex(h).is_some()), "{r}"); + // Without isolation the square also blends with the black and white art, so there is no one answer. + let set_isolate = |s: &mut Session, on: bool| { + s.execute("select.set", &json!({"ids": [group]})).unwrap(); + s.execute("transparency.set", &json!({"isolate": on})).unwrap(); + s.execute("select.set", &json!({"ids": [square]})).unwrap(); + }; + set_isolate(&mut s, false); + let e = s.execute("color.contrast", &json!({})).unwrap_err().to_string(); + assert!(e.contains("is not one color where it is read"), "{e}"); + set_isolate(&mut s, true); // The Difference mode is applied: in Normal mode the same square gives another answer. s.execute("transparency.set", &json!({"blend": "normal"})).unwrap(); let normal = ratio(&s.execute("color.contrast", &json!({})).unwrap()); From 5d494db4d99dd45ab9657fc9a5a1168c2cd8173f Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 14:16:38 -0800 Subject: [PATCH 062/112] Tests: Connect tangents' external shape does not cross itself The test checked only which corners the shape has, so corners joined in the wrong order passed. It now also checks the shape's area. --- crates/engine/src/cmd/addons/pathtools/tangents/tests.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/engine/src/cmd/addons/pathtools/tangents/tests.rs b/crates/engine/src/cmd/addons/pathtools/tangents/tests.rs index 032ef5f377..1653089520 100644 --- a/crates/engine/src/cmd/addons/pathtools/tangents/tests.rs +++ b/crates/engine/src/cmd/addons/pathtools/tangents/tests.rs @@ -385,6 +385,9 @@ fn connect_joins_the_external_tangents_and_the_chords_into_one_closed_shape_in_o for p in [Point::new(100.0, 80.0), Point::new(200.0, 80.0), Point::new(200.0, 120.0), Point::new(100.0, 120.0)] { assert!(found.iter().any(|&q| near(p, q)), "{p:?} in {found:?}"); } + // In order around the band, not crossing itself: the area is the 100 by 40 rectangle's. + let area = found.iter().zip(found.iter().cycle().skip(1)).map(|(p, q)| p.x * q.y - q.x * p.y).sum::<f64>() / 2.0; + assert!((area.abs() - 4000.0).abs() < 1e-6, "area {area} of {found:?}"); s.execute("edit.undo", &json!({})).unwrap(); assert_eq!(s.doc().unwrap().doc.node_count(), count); } From 7e7826c6e9c05cfc221d5cfa1a489b81747e79ed Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 14:25:21 -0800 Subject: [PATCH 063/112] Gradient: the stop popover's CMYK sliders keep the stop's own values The Color tab of the gradient stop popover gave its Color panel only the stop's sRGB, so every frame the rows worked their values out again from that sRGB. On a CMYK stop, typing a value or dragging one slider rewrote the other channels: typing Cyan 40 on C10 M20 Y30 K5 gave M17.3 Y24.7 K0. The popover now passes the stop's values in its own model, as the Color panel does, so a typed value stays as typed and a drag changes only the dragged channel. The new test types Cyan, sets Magenta and drags Yellow on a CMYK stop and checks the exact channel values after each edit. --- crates/ui-egui/src/dialogs/gradient_stop.rs | 94 +++++++++++++++++++-- 1 file changed, 86 insertions(+), 8 deletions(-) diff --git a/crates/ui-egui/src/dialogs/gradient_stop.rs b/crates/ui-egui/src/dialogs/gradient_stop.rs index 5b2ee66107..e9e05185b5 100644 --- a/crates/ui-egui/src/dialogs/gradient_stop.rs +++ b/crates/ui-egui/src/dialogs/gradient_stop.rs @@ -17,7 +17,8 @@ use std::sync::Arc; use craft::behavior::IconId; use craft::color_ui::ui::{ - ColorPanel, ColorPanelLayout, ColorPanelMode, ColorPanelOutput, ColorPanelShown, ColorPanelState, ColorPanelWords, DropperButton, SwatchPalette, + ColorPanel, ColorPanelLayout, ColorPanelMode, ColorPanelOutput, ColorPanelShown, ColorPanelState, ColorPanelWords, DropperButton, PickedColor, + SwatchPalette, }; use craft::theme::Srgba; use craft::theme::variant::Tone; @@ -43,6 +44,7 @@ use vectorcraft_geom::{Point, Rect}; use vectorcraft_tools::params::color_json; use crate::VectorcraftApp; +use crate::panels::color::model_values; use crate::panels::gradient::{edit_point, edits_points, set_stops, set_stops_keeping_models, shown_points}; use crate::panels::{Live, active_paint, c32}; @@ -470,6 +472,9 @@ fn body(ui: &mut Ui, feed: &Feed, tab: &mut Tab, panel: &mut ColorPanelState, fi filed.panels.push( ColorPanel::new(Bind::bound(&mut *panel), [feed.current; 2]) .layout(ColorPanelLayout::FillStroke) + // The rows show and edit the stop's own values (CMYK %, working RGB), not values + // derived again from its sRGB on every frame. + .edited(Some(PickedColor::in_model(feed.current, model_values(&feed.color)))) .shown(feed.shown.clone()) .show(ui), ); @@ -575,13 +580,11 @@ fn place(app: &VectorcraftApp, ctx: &egui::Context, anchor: Anchor) -> Pos2 { } } -/// Pushes `target`'s values, the swatches, what the Color panel shows and the place into the open popover `id`. -fn refresh(app: &VectorcraftApp, ctx: &egui::Context, id: DialogId, target: &Target) { - let Some(dialogs) = app.dialogs() else { return }; - let Some(anchor) = dialogs.with(|host| host.get_by_id::<GradientStopPopover>(id).map(|popover| popover.anchor)) else { return }; +/// `target`'s values, the document's swatches and what the Color panel shows, for the popover's body. +fn feed(app: &VectorcraftApp, target: &Target) -> Feed { let shown = crate::panels::color::shown(app, &crate::panels::color::target_now(app)); let swatches = swatch_colors(app); - let feed = Feed { + Feed { point: matches!(target, Target::Point(..)), color: target.color(), current: Srgba::from(c32(&target.color())), @@ -590,7 +593,14 @@ fn refresh(app: &VectorcraftApp, ctx: &egui::Context, id: DialogId, target: &Tar tiles: swatches.iter().map(|(name, c)| (Label::from(name.clone()), Srgba::from(c32(c)))).collect(), swatches, shown, - }; + } +} + +/// Pushes `target`'s values, the swatches, what the Color panel shows and the place into the open popover `id`. +fn refresh(app: &VectorcraftApp, ctx: &egui::Context, id: DialogId, target: &Target) { + let Some(dialogs) = app.dialogs() else { return }; + let Some(anchor) = dialogs.with(|host| host.get_by_id::<GradientStopPopover>(id).map(|popover| popover.anchor)) else { return }; + let feed = feed(app, target); let at = place(app, ctx, anchor); dialogs.with(|host| { if let Some(popover) = host.get_mut_by_id::<GradientStopPopover>(id) { @@ -776,7 +786,14 @@ fn apply(app: &mut VectorcraftApp, target: &Target, f: &PopoverFields) { #[cfg(test)] mod tests { use craft::behavior::{EditEvent, GestureId, Mixed}; - use craft::color_ui::ui::{PanelTarget, PickedColor}; + use std::cell::RefCell; + use std::rc::Rc; + + use craft::color_ui::ui::PanelTarget; + use craft::ui::runtime::access::Role; + use craft::ui::testing::Fixture; + use craft::ui::testing::focus::AccessActionKind; + use egui::{Key, Modifiers}; use vectorcraft_engine::Session; use super::*; @@ -1203,4 +1220,65 @@ mod tests { host::pump(&mut app, &ctx); assert!(!is_open(&app)); } + + /// The popover's body over `app`'s selected stop in `mode`, drawn headless; each frame's Color panel output is + /// applied to the stop as `pump` applies it. + fn panel_body(app: Rc<RefCell<VectorcraftApp>>, mode: ColorPanelMode) -> Fixture { + let mut tab = Tab::Color; + let mut panel = ColorPanelState::default(); + panel.mode = mode; + app.borrow_mut().ui.color_panel.mode = mode; + let mut fx = Fixture::new(move |ui| { + let mut app = app.borrow_mut(); + let Some(target) = selected(&app) else { return }; + let feed = feed(&app, &target); + let mut filed = Filed::default(); + body(ui, &feed, &mut tab, &mut panel, &mut filed); + for output in &filed.panels { + crate::panels::color::apply_output(&mut app, output); + } + }); + fx.room(vec2(320.0, 640.0)).settle(); + fx + } + + fn stop_cmyk(app: &VectorcraftApp) -> [f32; 4] { + let Color::Cmyk { c, m, y, k } = stops(app)[1].color else { panic!("a CMYK stop: {:?}", stops(app)[1].color) }; + [c, m, y, k] + } + + /// A CMYK value typed or set on one row of the popover changes only that channel: the others keep their + /// exact values instead of being worked out again from the stop's RGB. + #[test] + fn a_cmyk_stop_keeps_its_other_channels_when_one_is_typed_or_dragged() { + let mut app = app(); + app.run("file.documentColorMode", json!({"mode": "cmyk"})).unwrap(); + let stops_json = json!([{"offset": 0, "color": "#ffffff"}, {"offset": 0.5, "color": {"c": 10, "m": 20, "y": 30, "k": 5}}, {"offset": 1, "color": "#000000"}]); + app.run("paint.setFill", json!({"gradient": {"stops": stops_json, "start": [100, 150], "end": [200, 150]}, "keepModel": true})).unwrap(); + app.run("gradient.selectStop", json!({"index": 1})).unwrap(); + let close = |a: [f32; 4], b: [f32; 4]| a.iter().zip(b).all(|(x, y)| (x - y).abs() < 1e-4); + assert!(close(stop_cmyk(&app), [0.10, 0.20, 0.30, 0.05]), "{:?}", stop_cmyk(&app)); + let app = Rc::new(RefCell::new(app)); + let mut fx = panel_body(app.clone(), ColorPanelMode::CmykSliders); + let row = |fx: &Fixture, name: &str| { + fx.by_role(Role::SLIDER).into_iter().find(|t| fx.tree().name_of(t.node) == Some(name)).unwrap_or_else(|| panic!("the {name} slider")) + }; + // Typed: the Cyan field gets 40. + let field = fx.by_role(Role::SPIN_BUTTON).into_iter().find(|t| fx.tree().name_of(t.node) == Some("Cyan")).expect("the Cyan field"); + fx.click(&field).key(Key::A, Modifiers::COMMAND).type_text("40").key(Key::Enter, Modifiers::NONE).settle(); + let typed = stop_cmyk(&app.borrow()); + assert!(close(typed, [0.40, 0.20, 0.30, 0.05]), "typed Cyan: {typed:?}"); + // Set as a screen reader sets it: the Magenta slider goes to 60. + let magenta = row(&fx, "Magenta"); + fx.access(AccessActionKind::SetValue(60.0), &magenta).idle(2); + let set = stop_cmyk(&app.borrow()); + assert!(close(set, [0.40, 0.60, 0.30, 0.05]), "Magenta set to 60: {set:?}"); + // Dragged with the pointer: the Yellow slider's thumb goes from a tenth to most of the way across. + let yellow = row(&fx, "Yellow"); + let along = |f: f32| egui::pos2(yellow.rect.left() + f * yellow.rect.width(), yellow.rect.center().y); + fx.drag_at(along(0.1), along(0.8) - along(0.1)).idle(2); + let [c, m, y, k] = stop_cmyk(&app.borrow()); + assert!(close([c, m, k, 0.0], [0.40, 0.60, 0.05, 0.0]), "dragged Yellow kept the other channels: {:?}", [c, m, y, k]); + assert!(y > 0.5, "the drag moved Yellow: {y}"); + } } From 8662e69da8d4d7a0e1c32a7cc62112d8ef17ad7e Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 14:33:08 -0800 Subject: [PATCH 064/112] xtask: test-lint sleep rule treats Duration::new as a clock call A wait such as `while start.elapsed() < Duration::new(1, 0)` checks only the clock, but the poll check counted its `new` call as a condition and left the sleep unreported. `new` now counts as a time call when every `new` in the loop is `Duration::new`, and the clock-only wait cases include it. --- xtask/src/test_lint.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/xtask/src/test_lint.rs b/xtask/src/test_lint.rs index 3dfae5c582..4ef9627229 100644 --- a/xtask/src/test_lint.rs +++ b/xtask/src/test_lint.rs @@ -3102,7 +3102,14 @@ fn polls_or_releases(m: &[u8], at: usize) -> bool { return words(head, b"spawn", 0, head.len()).into_iter().any(|s| head.get(skip_ws(head, s + "spawn".len())) == Some(&b'(') && dropped(s)); } let close = matching(m, open).unwrap_or(m.len()); - calls(m, start, close).iter().any(|(name, _)| !name.ends_with('!') && !TIME_CALLS.contains(&name.as_str())) + // `new` builds a time only as `Duration::new`; any other `new` call counts as a condition. + let span = &m[start..close]; + let only_duration_new = words(span, b"new", 0, span.len()) + .into_iter() + .all(|s| span[..s].trim_ascii_end().strip_suffix(b"::").is_some_and(|p| p.trim_ascii_end().ends_with(b"Duration"))); + calls(m, start, close) + .iter() + .any(|(name, _)| !name.ends_with('!') && !TIME_CALLS.contains(&name.as_str()) && !(name == "new" && only_duration_new)) } /// The contents of the last string literal in `s`, without its quotes. @@ -5327,6 +5334,7 @@ mod tests { "fn start() -> JoinHandle<()> {\n return std::thread::spawn(move || {\n std::thread::sleep(D);\n });\n}\n", "fn wait() {\n let t0 = Instant::now();\n while t0.elapsed() < Duration::from_millis(50) {\n thread::sleep(Duration::from_millis(5));\n }\n}\n", "fn wait() {\n let t0 = Instant::now();\n while t0.elapsed().as_millis() < 50 {\n thread::sleep(D);\n }\n}\n", + "fn wait() {\n let t0 = Instant::now();\n while t0.elapsed() < Duration::new(1, 0) {\n thread::sleep(D);\n }\n}\n", "fn wait() {\n let mut n = 0;\n loop {\n thread::sleep(D);\n n += 1;\n if n == 3 {\n break;\n }\n }\n}\n", "fn wait(g: &G) {\n if g.ready() {\n thread::sleep(D);\n }\n}\n", "fn wait() {\n let t0 = Instant::now();\n loop {\n thread::sleep(D);\n println!(\"{:?}\", t0.elapsed());\n if t0.elapsed() > D {\n break;\n }\n }\n}\n", From 86a5efd04c0ae4ddee3c50342c7b7c5732a98f91 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 14:38:27 -0800 Subject: [PATCH 065/112] Export for Screens: Include Bleed files of an artboard hold the bleed once With Include Bleed, a .vectorcraft, .ai or EPS row wrote the artboard already grown by the document's bleed and kept the document's bleed as well. Opened again, the file had the bleed outside the grown artboard, so a PDF with the document's bleed came out with it twice: a 3 mm bleed made a 6 mm one. These files now hold the grown artboard with a bleed of 0. PDF rows and Full Document files are unchanged. The params text and docs/mcp.md say so. --- crates/engine/src/cmd/fileio/commands.rs | 2 +- crates/engine/src/cmd/fileio/screens.rs | 23 ++++++++---- crates/engine/src/cmd/fileio/tests_screens.rs | 36 +++++++++++++++++++ docs/mcp.md | 3 +- 4 files changed, 55 insertions(+), 9 deletions(-) diff --git a/crates/engine/src/cmd/fileio/commands.rs b/crates/engine/src/cmd/fileio/commands.rs index a48ac3e85b..99a916a453 100644 --- a/crates/engine/src/cmd/fileio/commands.rs +++ b/crates/engine/src/cmd/fileio/commands.rs @@ -54,7 +54,7 @@ pub fn specs() -> Vec<CommandSpec> { "Export for Screens", ["File", "Export"], None, - "{folder?, zip?: false (one .zip of every file, each deflated or stored, whichever is smaller: no folder → {name, dataBase64, bytes, files: [name…]}; with a folder it is written there → {path, bytes, files}), artboard?: index | artboards?: [index…] | range?: \"1-3\" (default all), assets?: [asset id…] (instead of artboards: each asset's art alone, cropped to its bounds and named after the asset; see assets.list), layers?: [layer id…] (instead of artboards: each layer's art alone, sublayers included, named after the layer), selection?: one|each (instead of artboards: the selected art as one file, or a file per selected object, named after it), fullDocument?: false (one file per format instead: a PDF of every artboard, other formats the bounds of all visible art, named after the document), includeBleed?: false (artboards grown by the document's bleed; a PDF page keeps the artboard as its TrimBox and puts its row's bleed around it once, the document's bleed when the row sets none and its preset gives none or 0), includeArtboardFill?: true (Include Artboard Fill: each artboard's background color behind its art; false leaves it out), pdfs?: multiple|single (Export PDFs As: with several artboards, single writes them as the pages of one PDF per PDF row, named after the document; refused with assets, layers or selection: each), exportPreset?: (a preset of document.exportPresets.list: its settings, under these params), subfolders?: false (each row's files in a sub-folder: its folder, else its size for raster (1x, 2x, 100w…) or its format (SVG, PDF)), folders?: none|rows (as subfolders)|format (a folder per extension: png, svg, pdf…)|item (a folder per artboard, asset, layer or object)|itemFormat (item/extension) (default: rows with subfolders or a preset, else none), name?: (a file name pattern instead of the item's name, with <filename> for the document, <name> for the artboard, asset, layer or object, <index> from 1, #### for the counter zero-padded to the run of #, <format>, <scale>, <suffix> (else the row's suffix ends the name), YYYYMMDD, YYYY-MM-DD, YYYY, <date>, <time>, <YYYY>, <MM>, <DD>, <hh>, <mm> and <ss>; a trailing .ext is dropped, as in `COMPANY-Logo-<filename>-####-YYYYMMDD`; different files it names alike get -2, -3…), counterStart?: 1, counterPer?: item (every file of an item has its number)|file, date?: YYYY-MM-DD (the date the pattern uses; default today, UTC), preset?: mobile (PNG 1x, 2x, 3x) | density (PNG 0.75x–4x in ldpi…xxxhdpi sub-folders) instead of formats (turns subfolders on), formats?: [{format: png|png8|jpg|webp|gif|tiff|bmp|tga|psd|svg|svgz|pdf|eps|ai|vectorcraft, scale?: 1 | \"2x\" | \"100w\" | \"100h\" | \"72ppi\", width?: px | height?: px | ppi? (raster only; width, then height, then ppi win over scale), suffix?: (raster default: @2x, @100w, @100h, none at 1x; vector formats drop size suffixes), folder?: (its sub-folder), quality?: (jpg 0–100; webp 0–100 with lossless: false), …the format's options (antiAlias, background, preset (pdf)…)}], settings?: {png|png8|jpg|webp|gif|tiff|bmp|tga|psd|svg|svgz|pdf|eps|ai|vectorcraft: {…options for every row of that format}} (rows' own options win), prefix?, antiAlias?: none|art|type (raster rows without their own), openLocation?: (remembered; the app shows the files after exporting)} one file per artboard and format (a PDF holds its artboard alone; artboards with the same name, in any case, get -2, -3…; an unnamed one is Artboard-N; a row whose file would take a name another row's file has, in any case, gets -2, -3… too, and identical rows write one file; row folders that differ only in case are one folder, spelled as the first row spells it) → {files: [path…]} (into the folder of exportPreset, outside the automation read roots: no ZIP path, and files relative to that folder); no folder → {files: [{name, dataBase64}]} (names include sub-folders: 2x/Icon@2x.png); every reply has warnings: [the encoders' warnings for the files, each once: an image that couldn't be decoded, type written in the fallback font…]. eps, ai and vectorcraft rows write a document of the item alone (its one artboard). The params (but zip and assets) are remembered in the document (document.exportSettings; not an undo step). A key it doesn't take, a key no format takes in a format row or in settings, settings for a format it doesn't write, and an unknown key inside a PDF, EPS or SVG option's object, are refused; a key only another format takes in a row or in settings is not used, and warnings name it as given (formats[0].quality; a key in settings only when no row of that format reads it; not a key of an exportPreset). Under automation read roots, an svg or svgz row, and a row whose files carry the native document (vectorcraft, eps, ai but a version 7 file, a pdf with preserveEditing on that holds every artboard of the document it is written from), is refused, before the folder is made or any file is written, while the document links a JavaScript file outside them, or while the row's file would name a linked image's file outside them, as document.export refuses it", + "{folder?, zip?: false (one .zip of every file, each deflated or stored, whichever is smaller: no folder → {name, dataBase64, bytes, files: [name…]}; with a folder it is written there → {path, bytes, files}), artboard?: index | artboards?: [index…] | range?: \"1-3\" (default all), assets?: [asset id…] (instead of artboards: each asset's art alone, cropped to its bounds and named after the asset; see assets.list), layers?: [layer id…] (instead of artboards: each layer's art alone, sublayers included, named after the layer), selection?: one|each (instead of artboards: the selected art as one file, or a file per selected object, named after it), fullDocument?: false (one file per format instead: a PDF of every artboard, other formats the bounds of all visible art, named after the document), includeBleed?: false (artboards grown by the document's bleed; a PDF page keeps the artboard as its TrimBox and puts its row's bleed around it once, the document's bleed when the row sets none and its preset gives none or 0; a native, .ai or EPS file of an artboard holds the grown artboard with a bleed of 0), includeArtboardFill?: true (Include Artboard Fill: each artboard's background color behind its art; false leaves it out), pdfs?: multiple|single (Export PDFs As: with several artboards, single writes them as the pages of one PDF per PDF row, named after the document; refused with assets, layers or selection: each), exportPreset?: (a preset of document.exportPresets.list: its settings, under these params), subfolders?: false (each row's files in a sub-folder: its folder, else its size for raster (1x, 2x, 100w…) or its format (SVG, PDF)), folders?: none|rows (as subfolders)|format (a folder per extension: png, svg, pdf…)|item (a folder per artboard, asset, layer or object)|itemFormat (item/extension) (default: rows with subfolders or a preset, else none), name?: (a file name pattern instead of the item's name, with <filename> for the document, <name> for the artboard, asset, layer or object, <index> from 1, #### for the counter zero-padded to the run of #, <format>, <scale>, <suffix> (else the row's suffix ends the name), YYYYMMDD, YYYY-MM-DD, YYYY, <date>, <time>, <YYYY>, <MM>, <DD>, <hh>, <mm> and <ss>; a trailing .ext is dropped, as in `COMPANY-Logo-<filename>-####-YYYYMMDD`; different files it names alike get -2, -3…), counterStart?: 1, counterPer?: item (every file of an item has its number)|file, date?: YYYY-MM-DD (the date the pattern uses; default today, UTC), preset?: mobile (PNG 1x, 2x, 3x) | density (PNG 0.75x–4x in ldpi…xxxhdpi sub-folders) instead of formats (turns subfolders on), formats?: [{format: png|png8|jpg|webp|gif|tiff|bmp|tga|psd|svg|svgz|pdf|eps|ai|vectorcraft, scale?: 1 | \"2x\" | \"100w\" | \"100h\" | \"72ppi\", width?: px | height?: px | ppi? (raster only; width, then height, then ppi win over scale), suffix?: (raster default: @2x, @100w, @100h, none at 1x; vector formats drop size suffixes), folder?: (its sub-folder), quality?: (jpg 0–100; webp 0–100 with lossless: false), …the format's options (antiAlias, background, preset (pdf)…)}], settings?: {png|png8|jpg|webp|gif|tiff|bmp|tga|psd|svg|svgz|pdf|eps|ai|vectorcraft: {…options for every row of that format}} (rows' own options win), prefix?, antiAlias?: none|art|type (raster rows without their own), openLocation?: (remembered; the app shows the files after exporting)} one file per artboard and format (a PDF holds its artboard alone; artboards with the same name, in any case, get -2, -3…; an unnamed one is Artboard-N; a row whose file would take a name another row's file has, in any case, gets -2, -3… too, and identical rows write one file; row folders that differ only in case are one folder, spelled as the first row spells it) → {files: [path…]} (into the folder of exportPreset, outside the automation read roots: no ZIP path, and files relative to that folder); no folder → {files: [{name, dataBase64}]} (names include sub-folders: 2x/Icon@2x.png); every reply has warnings: [the encoders' warnings for the files, each once: an image that couldn't be decoded, type written in the fallback font…]. eps, ai and vectorcraft rows write a document of the item alone (its one artboard). The params (but zip and assets) are remembered in the document (document.exportSettings; not an undo step). A key it doesn't take, a key no format takes in a format row or in settings, settings for a format it doesn't write, and an unknown key inside a PDF, EPS or SVG option's object, are refused; a key only another format takes in a row or in settings is not used, and warnings name it as given (formats[0].quality; a key in settings only when no row of that format reads it; not a key of an exportPreset). Under automation read roots, an svg or svgz row, and a row whose files carry the native document (vectorcraft, eps, ai but a version 7 file, a pdf with preserveEditing on that holds every artboard of the document it is written from), is refused, before the folder is made or any file is written, while the document links a JavaScript file outside them, or while the row's file would name a linked image's file outside them, as document.export refuses it", has_doc, screens::export_for_screens ), diff --git a/crates/engine/src/cmd/fileio/screens.rs b/crates/engine/src/cmd/fileio/screens.rs index 0fb1cc0860..4cc3cad433 100644 --- a/crates/engine/src/cmd/fileio/screens.rs +++ b/crates/engine/src/cmd/fileio/screens.rs @@ -1131,23 +1131,29 @@ fn names_scripts(item: &Item, r: &Row, single: Option<&[usize]>) -> bool { /// The document the file of `item` that row `r` writes carries when it carries one /// ([`names_scripts`]): Full Document's PDF of every artboard, the item's artboard alone for a -/// native, `.ai` or EPS row ([`board_document`]), else the item's document. -fn carried_document<'a>(item: &'a Item, r: &Row, single: Option<&[usize]>) -> std::borrow::Cow<'a, Document> { +/// native, `.ai` or EPS row ([`board_document`]), else the item's document. `grown`: Include Bleed +/// grew the artboards by the document's bleed. +fn carried_document<'a>(item: &'a Item, r: &Row, single: Option<&[usize]>, grown: bool) -> std::borrow::Cow<'a, Document> { match (&item.every_artboard, r.format.id, single) { (Some(all), "pdf", None) => std::borrow::Cow::Borrowed(&**all), - _ if r.whole_document() && item.artboard.is_some() => std::borrow::Cow::Owned(board_document(item)), + _ if r.whole_document() && item.artboard.is_some() => std::borrow::Cow::Owned(board_document(item, grown)), _ => std::borrow::Cow::Borrowed(&*item.doc), } } /// The document a native, `.ai` or EPS row writes for `item`'s artboard: that artboard alone, with -/// its background color and the art on it, as Save's separateArtboards writes it (#3868). -fn board_document(item: &Item) -> Document { +/// its background color and the art on it, as Save's separateArtboards writes it (#3868). When +/// Include Bleed grew the artboard (`grown`), the artboard already holds the bleed, so the document +/// is written with a bleed of 0: opened again, its pages are not grown by the bleed a second time. +fn board_document(item: &Item, grown: bool) -> Document { let mut d = single_artboard(&item.doc, item.region, &item.name); if let (Some(a), Some(from)) = (d.artboards.first_mut(), item.doc.artboards.get(item.artboard.unwrap_or(0))) { a.color = from.color; } super::save::keep_art_on(&mut d, item.region); + if grown && item.every_artboard.is_none() { + d.setup.bleed = [0.0; 4]; + } d } @@ -1209,7 +1215,7 @@ pub(crate) fn export(s: &mut Session, p: &Value, asked: &Value) -> Result<Value> let all = item.every_artboard.is_some() && r.format.id == "pdf" && single.is_none(); let board = item.artboard.filter(|_| !all && r.whole_document()); if looked.insert((Arc::as_ptr(&item.doc) as usize, all, board)) - && crate::cmd::links::names_hidden_file(&carried_document(item, r, single.as_deref()), base) + && crate::cmd::links::names_hidden_file(&carried_document(item, r, single.as_deref(), ungrown.is_some()), base) { return Err(bad(C, super::access::IMAGE_OUTSIDE)); } @@ -1402,7 +1408,10 @@ fn encode_and_write(export: ScreenExport, writer: &mut dyn FnMut(&str, &[u8]) -> write(pdf_doc.unwrap_or(all), "pdf", &options)? } else if r.whole_document() && item.artboard.is_some() { let b = item.artboard.unwrap_or(0); - let d = board_docs.entry((Arc::as_ptr(&item.doc) as usize, b)).or_insert_with(|| Arc::new(board_document(item))).clone(); + let d = board_docs + .entry((Arc::as_ptr(&item.doc) as usize, b)) + .or_insert_with(|| Arc::new(board_document(item, pdf_doc.is_some()))) + .clone(); let mut options = r.options_for(item.region, None)?; // An EPS page is the artboard, not its art's bounds: an artboard without art still writes. if r.format.id == "eps" { diff --git a/crates/engine/src/cmd/fileio/tests_screens.rs b/crates/engine/src/cmd/fileio/tests_screens.rs index 74356b6f31..93c4d7e6b1 100644 --- a/crates/engine/src/cmd/fileio/tests_screens.rs +++ b/crates/engine/src/cmd/fileio/tests_screens.rs @@ -1512,3 +1512,39 @@ fn each_piece_writes_its_own_native_document() { assert!(name.contains(&board), "{name} holds the artboard {board}"); } } + +/// With Include Bleed, a native, `.ai` or EPS file of an artboard holds the artboard grown by the +/// bleed, and no bleed of its own: opened again, a PDF with the document's bleed has the same page +/// as the export's own PDF row, not one grown by the bleed twice. A Full Document file keeps the +/// document's bleed around its art's bounds, which Include Bleed doesn't grow. +#[test] +fn include_bleed_native_files_hold_the_bleed_once() { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 100, "height": 100})).unwrap(); + s.execute("shape.rectangle", &json!({"x": 10, "y": 10, "width": 50, "height": 50})).unwrap(); + s.execute("document.setup", &json!({"bleed": 9})).unwrap(); + let r = export(&mut s, json!({"includeBleed": true, "artboard": 0, "formats": [{"format": "pdf"}]})); + let [(_, pdf)] = &files(&r)[..] else { panic!("one PDF: {r}") }; + let [(media, bleed, ..)] = page_sizes(pdf)[..] else { panic!("one page") }; + let reopened = |name: &str, bytes: &[u8]| -> (Session, Vec<PageSizes>) { + let mut t = Session::new(); + t.execute("document.open", &json!({"name": name, "dataBase64": vectorcraft_format::base64_encode(bytes)})).unwrap(); + let r = t.execute("document.exportPdf", &json!({"bleed": {"useDocument": true}, "preserveEditing": false})).unwrap(); + let pages = page_sizes(&b64(&r)); + (t, pages) + }; + for format in ["vectorcraft", "ai", "eps"] { + let r = export(&mut s, json!({"includeBleed": true, "artboard": 0, "formats": [{"format": format}]})); + let [(name, bytes)] = &files(&r)[..] else { panic!("one {format} file: {r}") }; + let (t, pages) = reopened(name, bytes); + let [(m, b, trim, _)] = pages[..] else { panic!("{format}: one page") }; + assert_eq!((m, b), (media, bleed), "{format}: the page of the PDF row"); + assert_eq!(trim, bleed, "{format}: the artboard holds the bleed"); + assert_eq!(t.doc().unwrap().doc.setup.bleed, [0.0; 4], "{format}: no second bleed"); + } + // Full Document: the art's bounds, with the document's bleed around them. + let r = export(&mut s, json!({"includeBleed": true, "fullDocument": true, "formats": [{"format": "vectorcraft"}]})); + let [(name, bytes)] = &files(&r)[..] else { panic!("one file: {r}") }; + let (t, _) = reopened(name, bytes); + assert_eq!(t.doc().unwrap().doc.setup.bleed, [9.0; 4]); +} diff --git a/docs/mcp.md b/docs/mcp.md index 43d1223804..bd8053d754 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -12068,7 +12068,8 @@ height (`"100h"`) or a resolution (`"72ppi"`); raster rows name their files `@2x otherwise. `fullDocument` writes one file per row instead (a PDF of every artboard, other formats the bounds of all art), `includeBleed` grows each artboard by the document's bleed (a PDF row's page keeps the artboard as its TrimBox and puts the row's `bleed` around it once: the row's own values, zero included, else the document's bleed -when the row sets none and its PDF preset gives none or a bleed of 0), `includeArtboardFill: false` (Include Artboard +when the row sets none and its PDF preset gives none or a bleed of 0; a native, `.ai` or EPS file of an artboard +holds the grown artboard with a bleed of 0, so the bleed is not added again when the file is opened), `includeArtboardFill: false` (Include Artboard Fill unchecked) leaves the artboards' background colors out of the files, `pdfs: "single"` (Export PDFs As › Single file) writes the artboards a PDF row exports as the pages of one PDF named after the document (it is refused with `assets`, `layers` or `selection: "each"`, whose files each hold one item's art), `subfolders` puts each From 184978b9a6bf6a4e9efb540588d94899a06ea09a Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 14:44:03 -0800 Subject: [PATCH 066/112] Tools: Color, Gradient and None share one line in a one-column rail craft-libs #4609 measures the Fill and Stroke proxy at the width of its column, so the proxy no longer widens a one-column Tools panel. The column is then one rail button less one tight gap wide, and the three swatch chips (a third of a rail button each, a tight gap apart) took more than that: None wrapped onto a second line. The craft-libs pin moves to storytold/craft-libs#4659, which sizes a swatch chip so the three chips and their gaps fit the column. That rev also carries #4609 and the other craft-libs changes merged up to d73e274a. The one-column toolbar test now also checks that the chips stay inside the column of tools and do not overlap, and a new test checks the same at UI scale 2. --- Cargo.lock | 172 ++++++++++++++-------------- Cargo.toml | 76 ++++++------ apps/vectorcraft-web/Cargo.toml | 2 +- crates/ui-egui/src/toolbar/tests.rs | 19 +++ xtask/src/pdf_deps.rs | 2 +- 5 files changed, 145 insertions(+), 126 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a398edf733..ae1e726a80 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1231,7 +1231,7 @@ dependencies = [ [[package]] name = "craft" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "craft-automation", "craft-behavior", @@ -1272,7 +1272,7 @@ dependencies = [ [[package]] name = "craft-affinity" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "crc32fast", "flate2", @@ -1283,7 +1283,7 @@ dependencies = [ [[package]] name = "craft-appkit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "block2 0.6.2", "objc2 0.6.5", @@ -1295,7 +1295,7 @@ dependencies = [ [[package]] name = "craft-atomic" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "rustix 1.1.6", ] @@ -1303,7 +1303,7 @@ dependencies = [ [[package]] name = "craft-automation" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -1328,7 +1328,7 @@ dependencies = [ [[package]] name = "craft-behavior" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "accesskit", "bitflags 2.13.2", @@ -1346,7 +1346,7 @@ dependencies = [ [[package]] name = "craft-browse" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "craft-behavior", "craft-docpath", @@ -1364,7 +1364,7 @@ dependencies = [ [[package]] name = "craft-cdr" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "crc32fast", "flate2", @@ -1373,7 +1373,7 @@ dependencies = [ [[package]] name = "craft-cloud-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "egui", ] @@ -1381,7 +1381,7 @@ dependencies = [ [[package]] name = "craft-cms" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "md-5", "rayon", @@ -1390,12 +1390,12 @@ dependencies = [ [[package]] name = "craft-codepage" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" [[package]] name = "craft-color-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "craft-behavior", "craft-cms", @@ -1415,7 +1415,7 @@ dependencies = [ [[package]] name = "craft-control" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "craft-control-protocol", "craft-platform", @@ -1426,7 +1426,7 @@ dependencies = [ [[package]] name = "craft-control-protocol" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "getrandom 0.3.4", "serde_json", @@ -1436,7 +1436,7 @@ dependencies = [ [[package]] name = "craft-dds" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "rayon", ] @@ -1444,7 +1444,7 @@ dependencies = [ [[package]] name = "craft-dialogs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "block2 0.6.2", "craft-appkit", @@ -1470,7 +1470,7 @@ dependencies = [ [[package]] name = "craft-doc" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "blake3", "craft-ecproj-format", @@ -1486,7 +1486,7 @@ dependencies = [ [[package]] name = "craft-docpath" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "serde", ] @@ -1494,7 +1494,7 @@ dependencies = [ [[package]] name = "craft-draw" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1513,7 +1513,7 @@ dependencies = [ [[package]] name = "craft-dxf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "craft-codepage", "encoding_rs", @@ -1525,7 +1525,7 @@ dependencies = [ [[package]] name = "craft-ecproj-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "serde", "serde_json", @@ -1535,12 +1535,12 @@ dependencies = [ [[package]] name = "craft-eps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "fontique", "harfrust 0.13.3", @@ -1555,7 +1555,7 @@ dependencies = [ [[package]] name = "craft-font-manager" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -1574,7 +1574,7 @@ dependencies = [ [[package]] name = "craft-font-os-windows" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "windows-registry", "windows-sys 0.61.2", @@ -1583,7 +1583,7 @@ dependencies = [ [[package]] name = "craft-font-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "cap-primitives", "craft-atomic", @@ -1606,12 +1606,12 @@ dependencies = [ [[package]] name = "craft-fonts-build" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" [[package]] name = "craft-gif" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "gif", ] @@ -1619,7 +1619,7 @@ dependencies = [ [[package]] name = "craft-gzip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "flate2", ] @@ -1627,7 +1627,7 @@ dependencies = [ [[package]] name = "craft-host" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "bitflags 2.13.2", "craft-i18n", @@ -1640,7 +1640,7 @@ dependencies = [ [[package]] name = "craft-i18n" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "brotli 9.1.3", "brotli-decompressor 6.3.2", @@ -1670,7 +1670,7 @@ dependencies = [ [[package]] name = "craft-image-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "craft-dds", "craft-jpeg", @@ -1697,7 +1697,7 @@ dependencies = [ [[package]] name = "craft-imaging" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1715,7 +1715,7 @@ dependencies = [ [[package]] name = "craft-jpeg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "thiserror 2.0.21", ] @@ -1723,7 +1723,7 @@ dependencies = [ [[package]] name = "craft-jxl" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "brotli-decompressor 5.0.3", "jixel", @@ -1734,7 +1734,7 @@ dependencies = [ [[package]] name = "craft-keymap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "craft-host", "craft-i18n", @@ -1749,7 +1749,7 @@ dependencies = [ [[package]] name = "craft-layers" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "craft-behavior", "craft-i18n", @@ -1763,7 +1763,7 @@ dependencies = [ [[package]] name = "craft-menu" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "craft-behavior", "craft-host", @@ -1781,7 +1781,7 @@ dependencies = [ [[package]] name = "craft-metadata" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "brotli-decompressor 6.3.2", "chrono", @@ -1793,7 +1793,7 @@ dependencies = [ [[package]] name = "craft-metafile" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "encoding_rs", "image", @@ -1804,7 +1804,7 @@ dependencies = [ [[package]] name = "craft-mime" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "chrono", "craft-codepage", @@ -1814,7 +1814,7 @@ dependencies = [ [[package]] name = "craft-nightly" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "uds_windows", "winsafe", @@ -1823,7 +1823,7 @@ dependencies = [ [[package]] name = "craft-pages" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "craft-behavior", "craft-keymap", @@ -1839,7 +1839,7 @@ dependencies = [ [[package]] name = "craft-pcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "flate2", "serde", @@ -1850,7 +1850,7 @@ dependencies = [ [[package]] name = "craft-pdf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "hayro-interpret", "hayro-syntax", @@ -1862,7 +1862,7 @@ dependencies = [ [[package]] name = "craft-platform" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "async-channel", "async-io", @@ -1895,7 +1895,7 @@ dependencies = [ [[package]] name = "craft-plotter" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "kurbo 0.13.1", "thiserror 2.0.21", @@ -1904,7 +1904,7 @@ dependencies = [ [[package]] name = "craft-print" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "craft-behavior", "craft-host", @@ -1928,7 +1928,7 @@ dependencies = [ [[package]] name = "craft-proof" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "log", "miniz_oxide 0.9.1", @@ -1939,7 +1939,7 @@ dependencies = [ [[package]] name = "craft-ps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "craft-eps", "flate2", @@ -1953,7 +1953,7 @@ dependencies = [ [[package]] name = "craft-psd" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "encoding_rs", "flate2", @@ -1964,7 +1964,7 @@ dependencies = [ [[package]] name = "craft-quit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "dispatch2", "egui", @@ -1977,7 +1977,7 @@ dependencies = [ [[package]] name = "craft-review" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -1996,7 +1996,7 @@ dependencies = [ [[package]] name = "craft-settings" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "craft-atomic", "craft-host", @@ -2013,7 +2013,7 @@ dependencies = [ [[package]] name = "craft-stream-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "fax", "hayro-ccitt", @@ -2024,7 +2024,7 @@ dependencies = [ [[package]] name = "craft-svg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "craft-image-codecs", "craft-xml", @@ -2045,7 +2045,7 @@ dependencies = [ [[package]] name = "craft-table" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "craft-behavior", "craft-keymap", @@ -2057,7 +2057,7 @@ dependencies = [ [[package]] name = "craft-text" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "craft-behavior", "craft-font-manager", @@ -2082,7 +2082,7 @@ dependencies = [ [[package]] name = "craft-theme" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "bitflags 2.13.2", "craft-tracked", @@ -2097,7 +2097,7 @@ dependencies = [ [[package]] name = "craft-theme-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "craft-atomic", "craft-behavior", @@ -2112,7 +2112,7 @@ dependencies = [ [[package]] name = "craft-tiff" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "serde", "thiserror 2.0.21", @@ -2122,7 +2122,7 @@ dependencies = [ [[package]] name = "craft-time" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "serde", "thiserror 2.0.21", @@ -2131,7 +2131,7 @@ dependencies = [ [[package]] name = "craft-timeline" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "craft-behavior", "craft-keymap", @@ -2146,12 +2146,12 @@ dependencies = [ [[package]] name = "craft-tracked" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" [[package]] name = "craft-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "craft-cloud-ui", "craft-ui-canvas", @@ -2165,7 +2165,7 @@ dependencies = [ [[package]] name = "craft-ui-canvas" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -2182,7 +2182,7 @@ dependencies = [ [[package]] name = "craft-ui-contract" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "accesskit", "craft-behavior", @@ -2220,7 +2220,7 @@ dependencies = [ [[package]] name = "craft-ui-macros" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2231,7 +2231,7 @@ dependencies = [ [[package]] name = "craft-ui-panels" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "craft-behavior", "craft-host", @@ -2249,7 +2249,7 @@ dependencies = [ [[package]] name = "craft-ui-patterns" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "craft-behavior", "craft-host", @@ -2270,7 +2270,7 @@ dependencies = [ [[package]] name = "craft-ui-shell" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "craft-behavior", "craft-host", @@ -2291,7 +2291,7 @@ dependencies = [ [[package]] name = "craft-ui-widgets" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "craft-behavior", "craft-host", @@ -2310,7 +2310,7 @@ dependencies = [ [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "base64 0.22.1", "chrono", @@ -2342,7 +2342,7 @@ dependencies = [ [[package]] name = "craft-vectorcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "flate2", "serde", @@ -2353,7 +2353,7 @@ dependencies = [ [[package]] name = "craft-wayland" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "raw-window-handle", "wayland-backend", @@ -2363,7 +2363,7 @@ dependencies = [ [[package]] name = "craft-web-api" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "js-sys", "serde_json", @@ -2374,7 +2374,7 @@ dependencies = [ [[package]] name = "craft-win32" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "winsafe", ] @@ -2382,7 +2382,7 @@ dependencies = [ [[package]] name = "craft-window" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "craft-appkit", "craft-atomic", @@ -2414,7 +2414,7 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "quick-xml 0.41.0", "serde", @@ -3773,7 +3773,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a" [[package]] name = "hayro-cmap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "brotli 8.0.4", "hayro-postscript", @@ -3782,7 +3782,7 @@ dependencies = [ [[package]] name = "hayro-interpret" version = "0.7.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "bitflags 2.13.2", "hayro-cmap", @@ -3800,7 +3800,7 @@ dependencies = [ [[package]] name = "hayro-jbig2" version = "0.3.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "fearless_simd", "hayro-ccitt", @@ -3818,12 +3818,12 @@ dependencies = [ [[package]] name = "hayro-postscript" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" [[package]] name = "hayro-syntax" version = "0.7.2" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "flate2", "hayro-ccitt", @@ -4806,7 +4806,7 @@ dependencies = [ [[package]] name = "krilla" version = "0.8.2" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "base64 0.22.1", "bumpalo", @@ -4963,7 +4963,7 @@ checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" [[package]] name = "linesweeper" version = "0.5.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" dependencies = [ "arrayvec", "kurbo 0.13.1", diff --git a/Cargo.toml b/Cargo.toml index fcc2a1ad8f..71ece379bf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,51 +10,51 @@ license = "MIT OR Apache-2.0" rust-version = "1.95" [workspace.dependencies] -craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6", default-features = false, features = ["interpret", "write"] } -craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8", default-features = false, features = ["interpret", "write"] } +craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } # Language packs: the Craft apps' shared font store installs them (#4936). -craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } # The `.vectorcraft` envelope: its members, version, embedded images and the data after the JSON. -craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } # `.pcraft` documents: their manifest, full-size composite, preview, layer pixels and ICC profile. -craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6", features = ["pcraft-pixels"] } +craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8", features = ["pcraft-pixels"] } # Native Affinity documents (craft-libs#914). -craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } # Bounded CDR (v1-v27) and CMX (32-bit) reader (craft-libs#778). -craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } # SVG parsing, limits, SVGZ and writer (craft-libs#778). -craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6", features = ["tree"] } -craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8", features = ["tree"] } +craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } # EPS container, previews, ASCII85 and DSC comments (craft-libs#778). -craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } # DXF tags, reader and writer (craft-libs#778, #926, #927). -craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } # WMF, EMF and EMF+ reader (craft-libs#778). -craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6", default-features = false, features = ["read", "write"] } -craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8", default-features = false, features = ["read", "write"] } +craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } # The framework facade (`craft::ui`, `craft::settings`, `craft::platform`, ...). No default features: each crate names # the members it imports. -craft = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } # Below the egui layer, so not through the facade: the colour harmony rules and their settings (craft-color-ui # without its `ui` feature), the colour type they work in, and the craft-fonts tables the text crate's build writes. -craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } # Nightly profile isolation, launch protocol, and security fence. -craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } # internal vectorcraft-geom = { path = "crates/geom" } vectorcraft-color = { path = "crates/color" } @@ -194,13 +194,13 @@ lto = "thin" codegen-units = 1 [patch.crates-io] -hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -krilla = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +krilla = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } ecolor = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } emath = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } epaint = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } diff --git a/apps/vectorcraft-web/Cargo.toml b/apps/vectorcraft-web/Cargo.toml index 824600f90a..ba85754a00 100644 --- a/apps/vectorcraft-web/Cargo.toml +++ b/apps/vectorcraft-web/Cargo.toml @@ -28,7 +28,7 @@ egui_extras = { workspace = true } # `wgpu` pulls egui-wgpu's defaults: WebGPU plus the WebGL2 fallback. eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit"] } # The page command API (storytold/craft-libs#413): the request plumbing behind window.vectorcraft. -craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6", version = "0.1.0" } +craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8", version = "0.1.0" } wasm-bindgen = "0.2" serde_json = { workspace = true } diff --git a/crates/ui-egui/src/toolbar/tests.rs b/crates/ui-egui/src/toolbar/tests.rs index 34447647d9..91becce66b 100644 --- a/crates/ui-egui/src/toolbar/tests.rs +++ b/crates/ui-egui/src/toolbar/tests.rs @@ -318,6 +318,9 @@ fn the_controls_under_the_tools_share_a_line_under_a_rule() { let chips = ["Color (, or Shift+,)", "Gradient (. or Shift+.)", "None (/)"].map(|label| named_rect(&nodes, label)); assert!(chips.iter().all(|r| (r.top() - chips[0].top()).abs() < 0.5), "one line: {chips:?}"); let last = cells(&app, &nodes).into_iter().max_by(|a, b| a.bottom().total_cmp(&b.bottom())).expect("the rail shows tools"); + // The line fits the column of tools, and the chips do not cover each other. + assert!(chips.iter().all(|r| r.left() >= last.left() - 0.5 && r.right() <= last.right() + 0.5), "inside {last:?}: {chips:?}"); + assert!(chips.windows(2).all(|w| w[0].right() <= w[1].left() + 0.01), "apart: {chips:?}"); let proxy = named_rect(&nodes, "Fill and Stroke"); let screen_rect = Some(egui::Rect::from_min_size(Pos2::ZERO, egui::vec2(1200.0, 2000.0))); let out = crate::testing::app_frame(&mut app, &ctx, egui::RawInput { time: Some(1.0), screen_rect, ..Default::default() }); @@ -336,6 +339,22 @@ fn the_controls_under_the_tools_share_a_line_under_a_rule() { assert_eq!(rules, 1, "one rule lies between the last tool {last:?} and Fill and Stroke {proxy:?}"); } +/// At UI scale 2 the one-column rail's Color, Gradient and None chips still share one line inside the column of tools. +#[test] +fn the_color_chips_share_a_line_at_ui_scale_2() { + let mut app = app_with(200, 200); + let ctx = reader(); + app.session.prefs.ui_scaling = 2.0; + app.run("window.toolbarColumns", json!({ "double": false })).unwrap(); + let nodes = settled(&mut app, &ctx, 0.0, 2000.0); + assert_eq!(ctx.zoom_factor(), 2.0, "the frames run at UI scale 2"); + let chips = ["Color (, or Shift+,)", "Gradient (. or Shift+.)", "None (/)"].map(|label| named_rect(&nodes, label)); + assert!(chips.iter().all(|r| (r.top() - chips[0].top()).abs() < 0.5), "one line: {chips:?}"); + let last = cells(&app, &nodes).into_iter().max_by(|a, b| a.bottom().total_cmp(&b.bottom())).expect("the rail shows tools"); + assert!(chips.iter().all(|r| r.left() >= last.left() - 0.5 && r.right() <= last.right() + 0.5), "inside {last:?}: {chips:?}"); + assert!(chips.windows(2).all(|w| w[0].right() <= w[1].left() + 0.01), "apart: {chips:?}"); +} + /// A screen reader reads the drawing-mode buttons' state as the rail shows it, in every mode: in two columns the /// current mode's button reads pressed and the other two not pressed; in one column the single button is named for the /// current mode and cycles the modes, so it reads as a plain button with no pressed state. diff --git a/xtask/src/pdf_deps.rs b/xtask/src/pdf_deps.rs index 337ba6325e..4b7e8ebb2f 100644 --- a/xtask/src/pdf_deps.rs +++ b/xtask/src/pdf_deps.rs @@ -5,7 +5,7 @@ use std::process::Command; use serde_json::Value; -const REV: &str = "965c7beeb6076480e016e448bddddcce0a738ff6"; +const REV: &str = "edbf2117a322c82d672050ca813b95beb835c3e8"; const PACKAGES: &[(&str, &str, &str)] = &[ ("craft-pdf", "0.1.0", REV), ("krilla", "0.8.2", REV), From f5d227fe2390d8309fae52422c9d04ddcbde8d01 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 15:13:59 -0800 Subject: [PATCH 067/112] xtask: test-lint sleep rule reads labels, block conditions and closure return types The poll check now: - keeps a block condition (`while { r.load(SeqCst) } { ... }`) in the loop header, so the loop counts as a poll, while a `m! { ... }` macro before a loop still ends the statement before it; - strips a loop label (`'outer: while ...`) before looking for the keyword; - treats `move || -> () { ... }` as a spawned closure, like `move || {`; - does not take `return ::std::thread::spawn(...);` as a dropped handle, since a keyword is not a path segment; - does not count a nested `fn` item's name as a call in the loop. --- xtask/src/test_lint.rs | 122 +++++++++++++++++++++++++++++++---------- 1 file changed, 93 insertions(+), 29 deletions(-) diff --git a/xtask/src/test_lint.rs b/xtask/src/test_lint.rs index 4ef9627229..46abce213d 100644 --- a/xtask/src/test_lint.rs +++ b/xtask/src/test_lint.rs @@ -3026,34 +3026,78 @@ fn enclosing_block(m: &[u8], at: usize) -> Option<(usize, usize)> { _ => false, })?; // The statement that opens the block starts after the last `;`, `{` or `}` outside brackets, so - // a condition such as `json!({}) != 1` stays whole. + // a condition such as `json!({}) != 1` stays whole. A block in the condition (`while { … } {`) + // belongs to the statement too. let mut nest = 0usize; - let start = (0..open) - .rev() - .find(|&j| match m[j] { - b')' | b']' => { - nest += 1; - false - } - b'}' if nest > 0 => { - nest += 1; - false - } - b'(' | b'[' => { - nest = nest.saturating_sub(1); - false - } - b'{' if nest > 0 => { - nest -= 1; - false - } - b';' | b'{' | b'}' => true, - _ => false, - }) - .map_or(0, |j| j + 1); + let mut j = open; + let start = loop { + let Some(k) = j.checked_sub(1) else { break 0 }; + j = k; + match m[j] { + b')' | b']' => nest += 1, + b'}' if nest > 0 => nest += 1, + b'(' | b'[' => nest = nest.saturating_sub(1), + b'{' if nest > 0 => nest -= 1, + b'}' => match opening_brace(m, j).filter(|&o| condition_block(&m[..o])) { + Some(o) => j = o, + None => break j + 1, + }, + b';' | b'{' => break j + 1, + _ => {} + } + }; Some((open, start)) } +/// The `{` that the `}` at `close` closes. +fn opening_brace(m: &[u8], close: usize) -> Option<usize> { + let mut depth = 0usize; + (0..close).rev().find(|&j| match m[j] { + b'}' => { + depth += 1; + false + } + b'{' if depth == 0 => true, + b'{' => { + depth -= 1; + false + } + _ => false, + }) +} + +/// Whether a block whose `{` follows `before` is an operand in a condition: it follows `while`, +/// `if`, `match`, `&&`, `!` or a comparison. +fn condition_block(before: &[u8]) -> bool { + let before = before.trim_ascii_end(); + let keyword = |w: &[u8]| before.ends_with(w) && !before.len().checked_sub(w.len() + 1).is_some_and(|j| is_ident(before[j])); + // A `!` after a name is a macro's (`m! { … }`), not a negation. + let not = before.strip_suffix(b"!").is_some_and(|b| !b.trim_ascii_end().last().copied().is_some_and(is_ident)); + keyword(b"while") || keyword(b"if") || keyword(b"match") || before.ends_with(b"&&") || not || before.ends_with(b"=") +} + +/// `head` without a leading loop label (`'outer:`). +fn strip_label(head: &[u8]) -> &[u8] { + if head.first() == Some(&b'\'') { + let n = 1 + head[1..].iter().take_while(|&&c| is_ident(c)).count(); + if let Some(rest) = head[n..].trim_ascii_start().strip_prefix(b":") { + return rest.trim_ascii_start(); + } + } + head +} + +/// Whether `head` opens the body of a closure without parameters: `|| {`, or `|| -> T {` with a return type. +fn closure_head(head: &[u8]) -> bool { + head.ends_with(b"||") || head.windows(2).rposition(|w| w == b"||").is_some_and(|p| head[p + 2..].trim_ascii_start().starts_with(b"->")) +} + +/// Keywords that cannot be a path segment before `spawn`, such as the `return` of `return ::std::thread::spawn(…);`. +const NOT_PATH: &[&[u8]] = &[ + b"return", b"break", b"yield", b"let", b"else", b"in", b"as", b"move", b"match", b"if", b"while", b"loop", b"for", b"box", b"unsafe", b"async", + b"await", b"const", b"static", b"mut", b"ref", b"dyn", b"impl", +]; + /// Whether the sleep at `at` is the pause of a loop that checks a condition, or the delay of a /// spawned thread's fallback release. A `while` or `loop` around it polls when its condition or /// body calls a function or method other than [`TIME_CALLS`] (a flag's `load`, a `poll`, a @@ -3065,8 +3109,10 @@ fn polls_or_releases(m: &[u8], at: usize) -> bool { let (open, start) = loop { let Some((open, start)) = enclosing_block(m, at) else { return false }; let head = m[start..open].trim_ascii(); + let labeled = strip_label(head); let keyword = |w: &[u8]| head.starts_with(w) && !head.get(w.len()).copied().is_some_and(is_ident); - if keyword(b"while") || keyword(b"loop") || head.ends_with(b"||") { + let loop_keyword = |w: &[u8]| labeled.starts_with(w) && !labeled.get(w.len()).copied().is_some_and(is_ident); + if loop_keyword(b"while") || loop_keyword(b"loop") || closure_head(head) { break (open, start); } if !head.is_empty() && !keyword(b"if") && !keyword(b"else") && !keyword(b"match") && !head.ends_with(b"=>") { @@ -3075,7 +3121,7 @@ fn polls_or_releases(m: &[u8], at: usize) -> bool { at = open; }; let head = m[start..open].trim_ascii(); - if head.ends_with(b"||") { + if closure_head(head) { // The thread's handle is dropped only when the `spawn` call is the whole statement: a // path before it and a `;` after it. A `let`, an assignment, an argument or a chained // `.join()` keeps the handle, and a test that joins it waits for the sleep. @@ -3087,9 +3133,13 @@ fn polls_or_releases(m: &[u8], at: usize) -> bool { if !is_ident(path[i]) || path[i].is_ascii_digit() { return false; } + let segment = i; while i < path.len() && is_ident(path[i]) { i += 1; } + if NOT_PATH.contains(&&path[segment..i]) { + return false; + } i = skip_ws(path, i); if path.get(i..i + 2) != Some(&b"::"[..]) { return false; @@ -3107,9 +3157,17 @@ fn polls_or_releases(m: &[u8], at: usize) -> bool { let only_duration_new = words(span, b"new", 0, span.len()) .into_iter() .all(|s| span[..s].trim_ascii_end().strip_suffix(b"::").is_some_and(|p| p.trim_ascii_end().ends_with(b"Duration"))); - calls(m, start, close) - .iter() - .any(|(name, _)| !name.ends_with('!') && !TIME_CALLS.contains(&name.as_str()) && !(name == "new" && only_duration_new)) + // A nested `fn` item's name is a declaration, not a call. + let mut found = calls(m, start, close); + for f in words(span, b"fn", 0, span.len()) { + let s = skip_ws(span, f + "fn".len()); + let n = span[s..].iter().take_while(|&&c| is_ident(c)).count(); + let name = String::from_utf8_lossy(&span[s..s + n]); + if let Some(p) = found.iter().position(|(called, method)| !method && *called == name) { + found.remove(p); + } + } + found.iter().any(|(name, _)| !name.ends_with('!') && !TIME_CALLS.contains(&name.as_str()) && !(name == "new" && only_duration_new)) } /// The contents of the last string literal in `s`, without its quotes. @@ -5325,6 +5383,10 @@ mod tests { "fn wait(t: &mut T) {\n while t.waiting() {\n thread::sleep(D);\n t.poll();\n }\n}\n", "fn wait(s: &S) {\n while s.execute(\"a\", &json!({})).unwrap()[\"n\"] != 1 && Instant::now() < until {\n thread::sleep(D);\n }\n}\n", "#[test]\nfn t() {\n std::thread::spawn(move || {\n std::thread::sleep(Duration::from_secs(10));\n gate.open();\n });\n assert_eq!(f(), 1);\n}\n", + "fn wait(r: &R) {\n while { r.load(SeqCst) } {\n thread::sleep(D);\n }\n}\n", + "fn wait(r: &R) {\n m! { r }\n while !r.load(SeqCst) {\n thread::sleep(D);\n }\n}\n", + "fn wait(r: &R) {\n 'outer: while !r.load(SeqCst) {\n thread::sleep(D);\n }\n}\n", + "#[test]\nfn t() {\n std::thread::spawn(move || -> () {\n std::thread::sleep(D);\n gate.open();\n });\n assert_eq!(f(), 1);\n}\n", ]; for src in polls { assert_eq!(hits(src), [], "{src}"); @@ -5332,6 +5394,8 @@ mod tests { let timed = [ "fn wait() {\n for _ in 0..3 {\n if ready() {\n thread::sleep(D);\n }\n }\n}\n", "fn start() -> JoinHandle<()> {\n return std::thread::spawn(move || {\n std::thread::sleep(D);\n });\n}\n", + "fn start() -> JoinHandle<()> {\n return ::std::thread::spawn(move || {\n std::thread::sleep(D);\n });\n}\n", + "fn wait() {\n let t0 = Instant::now();\n while t0.elapsed() < D {\n fn unused() {}\n thread::sleep(D);\n }\n}\n", "fn wait() {\n let t0 = Instant::now();\n while t0.elapsed() < Duration::from_millis(50) {\n thread::sleep(Duration::from_millis(5));\n }\n}\n", "fn wait() {\n let t0 = Instant::now();\n while t0.elapsed().as_millis() < 50 {\n thread::sleep(D);\n }\n}\n", "fn wait() {\n let t0 = Instant::now();\n while t0.elapsed() < Duration::new(1, 0) {\n thread::sleep(D);\n }\n}\n", From a0f7ba0ed1cc90293e0e554adb58dbf5e391b4ee Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 15:40:44 -0800 Subject: [PATCH 068/112] Tests: exempt the macOS-only Quick Pen touchpad test from never-run main's CI fails at test-lint since #8808 merged: keys_held_during_a_touchpad_gesture_count_until_it_ends is compiled only on macOS, which no CI test leg runs. egui reports a touchpad gesture's phases only on macOS; on Windows and Linux it reads a touchpad's Ctrl+scroll as a pinch, so the test cannot run there. The allow comment names that reason. --- crates/ui-egui/src/tests/quickpenwheel.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/ui-egui/src/tests/quickpenwheel.rs b/crates/ui-egui/src/tests/quickpenwheel.rs index 98c3a82e13..a6a88d648d 100644 --- a/crates/ui-egui/src/tests/quickpenwheel.rs +++ b/crates/ui-egui/src/tests/quickpenwheel.rs @@ -292,6 +292,7 @@ fn a_touchpad_steps_once_per_wheel_line() { /// Ctrl+scroll as a pinch, which carries no phases. #[cfg(target_os = "macos")] #[test] +// test-lint: allow never-run egui reports touchpad gesture phases only on macOS fn keys_held_during_a_touchpad_gesture_count_until_it_ends() { let mut app = app(); on_canvas(&mut app, |rig| { From 4bbb277a86bf9c086167590f598f3e1b554ddaec Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 16:14:39 -0800 Subject: [PATCH 069/112] Properties: a drag does not measure the panel's sections on each move The Properties panel measured all of its sections before showing them whenever the document's revision changed. A Selection tool drag changes the revision on every pointer move, so each frame of the drag ran the whole panel twice. On a blank document with one rectangle, a drag frame ran 396 components where a hover frame ran 170. The revision is now kept apart from the selection, tool and isolation key. While a canvas drag or a scrubbed field is in progress, a new revision alone does not measure the sections; the edit is measured once when the drag ends. A drag frame now runs 168 components and each frame still takes one pass. --- crates/ui-egui/src/panels/properties.rs | 18 +++++-- crates/ui-egui/src/panels/properties/tests.rs | 51 +++++++++++++++++++ 2 files changed, 66 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/panels/properties.rs b/crates/ui-egui/src/panels/properties.rs index 3ee8c24ce5..6194f28085 100644 --- a/crates/ui-egui/src/panels/properties.rs +++ b/crates/ui-egui/src/panels/properties.rs @@ -29,6 +29,8 @@ pub struct PropertiesUi { quick_actions: Option<(u64, Vec<QuickAction>)>, /// The [`content_key`] the sections were last shown for. content: Option<u64>, + /// The document (uid, revision) the sections were last shown for. + revision: Option<(u64, u64)>, } /// The key of [`PropertiesUi::edited_profiled`]: (document uid, revision, active Appearance row). @@ -66,7 +68,13 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { let guides = super::transform::selected_guides(app); let header = heading(first.as_deref(), n_sel, editing_artboards, guides.is_some()); let content = content_key(app); - let changed = app.ui.properties_panel.content.replace(content) != Some(content); + let revision = app.session.active().map(|st| (st.uid, st.revision)); + let content_changed = app.ui.properties_panel.content.replace(content) != Some(content); + let edited = std::mem::replace(&mut app.ui.properties_panel.revision, revision) != revision; + // A drag on the canvas, or a scrubbed field, moves the revision on every pointer move without changing which + // sections show: the sections are measured again for an edit once the drag ends, not on each move. + let dragging = app.session.active().is_some_and(|st| st.interaction.is_some() || st.undo_group.is_some()); + let changed = content_changed || (edited && !dragging); let mut sections = |ui: &mut Ui, _: &mut BodyCx<'_>| { // The reference panel's labels end in a colon beside fields that keep their own width. Stack::new().fill_width().labels(LabelScheme::Form).show(ui, |ui, _| { @@ -87,19 +95,21 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { let mut panel = Panel::new(header).titled().strength(HeaderStrength::Quiet).labels(LabelScheme::Inspector).pad(Pad::None); panel = panel.id_salt(egui::IdSalt::new(key)); if changed { + #[cfg(test)] + SECTION_MEASURES.with(|n| n.set(n.get() + 1)); let _ = panel.measure_in(ui, Proposal::Size(ui.available_size()), &mut sections); } panel.show(ui, sections); } -/// What the sections show: the document and its revision, the selection, the tool and isolation mode. +/// What the sections show besides the document's revision: the document, the selection, the tool and isolation mode. fn content_key(app: &VectorcraftApp) -> u64 { use std::hash::{Hash, Hasher}; let mut h = std::collections::hash_map::DefaultHasher::new(); app.session.tool_id().hash(&mut h); if let Some(st) = app.session.active() { let selection = &st.selection; - (st.uid, st.revision, st.isolation, &selection.objects, selection.key, selection.target, &selection.slices).hash(&mut h); + (st.uid, st.isolation, &selection.objects, selection.key, selection.target, &selection.slices).hash(&mut h); for (id, anchors) in &selection.anchors { (id, anchors.len()).hash(&mut h); } @@ -223,6 +233,8 @@ fn quick_actions_key(app: &VectorcraftApp) -> u64 { thread_local! { /// How many times this thread has listed the Quick Actions. pub(crate) static QUICK_ACTION_LISTS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; + /// How many times this thread has measured the panel's sections before showing them. + pub(crate) static SECTION_MEASURES: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; } /// [`quick_actions`], listed again only when [`quick_actions_key`] changed. diff --git a/crates/ui-egui/src/panels/properties/tests.rs b/crates/ui-egui/src/panels/properties/tests.rs index 97c9f1e9bb..c46bcbf6e4 100644 --- a/crates/ui-egui/src/panels/properties/tests.rs +++ b/crates/ui-egui/src/panels/properties/tests.rs @@ -190,6 +190,57 @@ fn a_selection_change_draws_the_window_in_one_pass() { } } +/// Dragging the selected object with the Selection tool, with the Properties panel docked, does not measure the +/// panel's sections on each pointer move, and each frame of the drag takes one pass. The release measures them once +/// for the moved object, and so does an edit made without a drag. +#[test] +fn a_drag_does_not_measure_the_sections_on_each_move() { + let measures = || SECTION_MEASURES.with(std::cell::Cell::get); + let mut app = new_app(); + let a = rect(&mut app, 100.0, 100.0, 80.0, 80.0); + app.run("select.set", json!({"ids": [a]})).unwrap(); + app.run("window.panel", json!({"panel": "properties"})).unwrap(); + app.select_tool("selection"); + let ctx = crate::testing::ui_context(); + let mut time = 0.0; + // One frame with `events` → (the passes it took, the section measures it made). + let mut frame = |app: &mut VectorcraftApp, events: Vec<Event>| { + time += 1.0 / 60.0; + let raw = egui::RawInput { + time: Some(time), + screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1600.0, 1000.0))), + focused: true, + events, + ..Default::default() + }; + let (pass, measured) = (ctx.cumulative_pass_nr(), measures()); + let _ = crate::testing::app_frame(app, &ctx, raw); + (ctx.cumulative_pass_nr() - pass, measures() - measured) + }; + for _ in 0..4 { + frame(&mut app, vec![]); + } + let x = |app: &VectorcraftApp| { + let st = app.session.active().unwrap(); + st.selection.objects.first().and_then(|id| st.doc.node(*id)).and_then(|n| n.geometric_bounds()).unwrap().x0 + }; + let start_x = x(&app); + let start = app.canvas_view().unwrap().to_screen(craft::behavior::kurbo::Point::new(140.0, 140.0)); + let button = |pos, pressed| Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed, modifiers: Modifiers::NONE }; + frame(&mut app, vec![Event::PointerMoved(start)]); + assert_eq!(frame(&mut app, vec![button(start, true)]), (1, 0), "the press"); + let mut at = start; + for step in 1..=6 { + at = start + egui::vec2(8.0 * step as f32, 5.0 * step as f32); + assert_eq!(frame(&mut app, vec![Event::PointerMoved(at)]), (1, 0), "move {step} of the drag"); + } + assert_eq!(frame(&mut app, vec![button(at, false)]), (1, 1), "the release measures the moved object's sections once"); + assert!(x(&app) > start_x, "the drag moved the object"); + assert_eq!(frame(&mut app, vec![]).1, 0, "a settled frame"); + app.run("object.move", json!({"dx": 5, "dy": 0})).unwrap(); + assert_eq!(frame(&mut app, vec![]).1, 1, "an edit without a drag measures the sections"); +} + /// Start Global Edit in Quick Actions starts it on the one selected path, the button then reads /// Stop Global Edit, and Escape stops it. Selected type has no Start Global Edit button. #[test] From a7654fc63850be4ca7a0c42f05acbb0077e6aa2a Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 16:17:26 -0800 Subject: [PATCH 070/112] xtask: test-lint matches base tests by place and keeps route kinds apart - never-run in changed mode lints the file as it was at the base and matches a test by its name and its place among tests of that name, so a test that was already off is not counted again when lines move. - A file reached by name inherits only the gates of named declarations, and one reached through #[path] only those of #[path] declarations. - The changed-file walk also reads the base child declarations of a #[path]-loaded file, so a removed `mod child;` still reaches the child. - reads-source classifies the outer path step, not a join nested in its argument. - mirror treats complete raw string literals as keys. - A raw cfg value keeps the quotes inside it (r#""unix""# is not unix). - census keeps word boundaries, so `k as usize` reads `k` and the local `kasusize` does not. - fixture-only finds a for loop's `in` across line breaks. --- xtask/src/test_lint.rs | 243 +++++++++++++++++++++++++++++++++-------- 1 file changed, 197 insertions(+), 46 deletions(-) diff --git a/xtask/src/test_lint.rs b/xtask/src/test_lint.rs index fe0090fa33..40ac3b2f25 100644 --- a/xtask/src/test_lint.rs +++ b/xtask/src/test_lint.rs @@ -330,7 +330,7 @@ pub fn run(root: &Path, args: &[&str]) -> Result<(), String> { // Deleted files seed the walk too: a module they loaded at the base may have lost its only CI route. let seeds: Vec<String> = changed.keys().cloned().collect(); let below: Vec<String> = - descendants(&seeds, &files, &overrides, &base_overrides, &read_work).into_iter().filter(|p| !changed.contains_key(p)).collect(); + descendants(&seeds, &files, &overrides, &base_overrides, &read_work, &read_base).into_iter().filter(|p| !changed.contains_key(p)).collect(); let gated: Vec<String> = present.iter().chain(&below).cloned().collect(); let gates = module_gates(&gated, &read_work, &overrides); let module_cfgs = gates.iter().map(|(p, g)| (p.clone(), g.preds.clone())).collect(); @@ -340,14 +340,17 @@ pub fn run(root: &Path, args: &[&str]) -> Result<(), String> { let base_gates = module_gates(&gated, &read_base, &base_overrides); let base_cfgs = base_gates.iter().map(|(p, g)| (p.clone(), g.preds.clone())).collect(); let base_ctx = Ctx { helpers: ctx.helpers.clone(), ci_env: ctx.ci_env.clone(), module_cfgs: base_cfgs }; - // The base's `never-run` hits, computed once per file on its first parent-attributed hit. - let base_off: RefCell<HashMap<String, HashSet<(String, usize)>>> = RefCell::new(HashMap::new()); + // The base's `never-run` hits on the file as it was at the base (the current source when the + // file is new or moved), computed once per file on its first parent-attributed hit. + let base_off: RefCell<HashMap<String, (String, Vec<Hit>)>> = RefCell::new(HashMap::new()); let newly_off = |path: &str, src: &str, hit: &Hit| { let mut cache = base_off.borrow_mut(); - let off = cache - .entry(path.to_owned()) - .or_insert_with(|| lint_file(path, src, &base_ctx).into_iter().filter(|h| h.rule == Rule::NeverRun).map(|h| (h.test, h.line)).collect()); - !off.contains(&(hit.test.clone(), hit.line)) + let (base_src, off) = cache.entry(path.to_owned()).or_insert_with(|| { + let base_src = read_base(path).unwrap_or_else(|| src.to_owned()); + let off = lint_file(path, &base_src, &base_ctx).into_iter().filter(|h| h.rule == Rule::NeverRun).collect(); + (base_src, off) + }); + !already_off(off, base_src, src, hit) }; let (mut counted, mut older) = (vec![], 0usize); for (path, src) in read_all(root, &present)? { @@ -369,11 +372,21 @@ pub fn run(root: &Path, args: &[&str]) -> Result<(), String> { finish(&counted, older, present.len(), &base) } -/// Whether `base`, the hits of the same source under the base's gates, has a `never-run` hit for the -/// test of `hit`. Tests of one name in different inline modules are told apart by their line. -#[cfg(test)] -fn already_off(base: &[Hit], hit: &Hit) -> bool { - base.iter().any(|h| h.rule == Rule::NeverRun && h.test == hit.test && h.line == hit.line) +/// Whether `base`, the hits of `base_src` under the base's gates, has a `never-run` hit for the test +/// of `hit` in `src`. A test is matched by its name and its place among the tests of that name, so +/// lines that moved still match and tests of one name in different inline modules stay apart. +fn already_off(base: &[Hit], base_src: &str, src: &str, hit: &Hit) -> bool { + let place = test_place(src, &hit.test, hit.line); + base.iter().filter(|h| h.rule == Rule::NeverRun && h.test == hit.test).any(|h| match place { + Some(place) => test_place(base_src, &h.test, h.line) == Some(place), + None => h.line == hit.line, + }) +} + +/// The index of the test `name` whose `fn` is on `line` among the tests of that name in `src`. +fn test_place(src: &str, name: &str, line: usize) -> Option<usize> { + let lines = Lines::new(src); + tests_in(&mask(src)).iter().filter(|t| t.name == name).position(|t| lines.of(t.fn_at) == line) } /// The directory holding the modules that the file `p` declares by name: its own directory for @@ -387,13 +400,15 @@ fn module_dir(p: &str) -> String { /// The files of `files` that the files `start` load, directly or through modules in between: the /// files under their module directories and the files their current or base `#[path]` declarations load. /// A file loaded through `#[path]` also loads the modules it declares by name from its own directory -/// (`mod child;` in `impl/platform.rs` loads `impl/child.rs`), read through `read`. +/// (`mod child;` in `impl/platform.rs` loads `impl/child.rs`), read through `read` and, for the +/// declarations a change removed, through `read_base`. fn descendants( start: &[String], files: &[String], overrides: &Overrides, base_overrides: &Overrides, read: &dyn Fn(&str) -> Option<String>, + read_base: &dyn Fn(&str) -> Option<String>, ) -> Vec<String> { let mut seen: BTreeSet<String> = start.iter().cloned().collect(); let mut frontier: Vec<String> = start.to_vec(); @@ -404,7 +419,12 @@ fn descendants( return vec![]; } let dir = p.rsplit_once('/').map_or("", |(d, _)| d); - read(p).map_or(vec![], |src| declared_names(&src).into_iter().flat_map(|n| [format!("{dir}/{n}.rs"), format!("{dir}/{n}/")]).collect()) + [read(p), read_base(p)] + .into_iter() + .flatten() + .flat_map(|src| declared_names(&src)) + .flat_map(|n| [format!("{dir}/{n}.rs"), format!("{dir}/{n}/")]) + .collect() }; let dirs: Vec<String> = frontier.iter().map(|p| module_dir(p)).chain(frontier.iter().flat_map(beside)).collect(); let next: Vec<String> = files @@ -973,6 +993,25 @@ fn norm(b: &[u8]) -> String { String::from_utf8_lossy(&b.iter().copied().filter(|c| !c.is_ascii_whitespace()).collect::<Vec<u8>>()).into_owned() } +/// [`norm`], except that whitespace between two identifier characters becomes one space, so +/// `k as usize` stays three words and `kasusize` stays one. Removing the spaces gives [`norm`]. +fn norm_words(b: &[u8]) -> String { + let mut out = vec![]; + let mut gap = false; + for &c in b { + if c.is_ascii_whitespace() { + gap = true; + continue; + } + if gap && is_ident(c) && out.last().copied().is_some_and(is_ident) { + out.push(b' '); + } + gap = false; + out.push(c); + } + String::from_utf8_lossy(&out).into_owned() +} + /// Line starts, to turn byte offsets into 1-based lines. struct Lines(Vec<usize>); @@ -1545,7 +1584,7 @@ fn census(v: &View, helpers: &HashSet<String>) -> Vec<Hit> { helpers_in(from, to).is_empty() && !rejects(body) && !inside.is_empty() - && inside.iter().all(|a| weak_census_check(&a.name, &a.args.iter().map(|&(f, t)| norm(&m[f..t])).collect::<Vec<_>>(), var)) + && inside.iter().all(|a| weak_census_check(&a.name, &a.args.iter().map(|&(f, t)| norm_words(&m[f..t])).collect::<Vec<_>>(), var)) }; for at in words(m, b"for", v.t.open, v.t.close) { let Some(&kw) = words(m, b"in", at, v.t.close).first() else { continue }; @@ -1788,10 +1827,10 @@ fn weak_predicate_within(pred: &str, depth: usize) -> bool { } /// Whether an assertion in a loop over entries bound to `var` checks only presence, or compares -/// a lookup or parse with the entry itself. +/// a lookup or parse with the entry itself. `args` are written as [`norm_words`] gives them. fn weak_census_check(name: &str, args: &[String], var: &str) -> bool { match guard_arg_count(name) { - 1 => args.first().is_some_and(|a| weak_predicate(a)), + 1 => args.first().is_some_and(|a| weak_predicate(&a.replace(' ', ""))), 2 if name.ends_with("_ne") => false, 2 => match args { [a, b, ..] => (round_trip_call(a, var) && is_entry(b, var)) || (round_trip_call(b, var) && is_entry(a, var)), @@ -1801,7 +1840,7 @@ fn weak_census_check(name: &str, args: &[String], var: &str) -> bool { } } -/// Whether a (whitespace-free) operand is the result of one of [`ROUND_TRIP`], called by its whole +/// Whether an operand ([`norm_words`]) is the result of one of [`ROUND_TRIP`], called by its whole /// name with only a path or receiver before it (no arithmetic) and followed only by unwrapping (`.unwrap()`, `.ok()`, `.expect(…)`, `?` and the like), so /// the operand is the parsed or looked-up entry itself and not a value derived from it. The call's /// arguments must read the loop entry `var` (`Kind::from_id(k.id())`); a lookup of a fixed key is @@ -1826,20 +1865,16 @@ fn round_trip_call(op: &str, var: &str) -> bool { }) } -/// Whether the (whitespace-free) `s` reads the binding `var`: a whole word that is not a field or -/// path segment (`config.k`, `m::k`), alone or cast to a primitive (`k as usize` reads `kasusize`). +/// Whether `s`, written as [`norm_words`] gives it, reads the binding `var`: a whole word that is not +/// a field or path segment (`config.k`, `m::k`), alone or cast (`k as usize`). `kasusize` is one word. fn reads_ident(s: &str, var: &str) -> bool { - const PRIMITIVES: &[&str] = - &["usize", "isize", "u128", "i128", "u64", "i64", "u32", "i32", "u16", "i16", "u8", "i8", "f64", "f32", "char", "bool"]; let b = s.as_bytes(); - let ends = |rest: &str| !rest.bytes().next().is_some_and(is_ident); !var.is_empty() && s.match_indices(var).any(|(at, _)| { let end = at + var.len(); let field = at > 0 && b[at - 1] == b'.' && !(at > 1 && b[at - 2] == b'.'); let path = at > 1 && &b[at - 2..at] == b"::"; - let cast = s[end..].strip_prefix("as").is_some_and(|r| PRIMITIVES.iter().any(|t| r.strip_prefix(t).is_some_and(ends))); - !(at > 0 && is_ident(b[at - 1])) && !field && !path && (ends(&s[end..]) || cast) + !(at > 0 && is_ident(b[at - 1])) && !field && !path && !b.get(end).copied().is_some_and(is_ident) }) } @@ -3137,10 +3172,11 @@ fn reads_source_hits(file: &File) -> Vec<Hit> { // The final path step names the file read: the last literal of `root.join("src/lib.rs")` // or `concat!(…, "/x.rs")`, but not `root.join("fixtures.rs").join("data.json")`; the // extension of a final `.with_extension("json")`. A final step whose argument is not a - // literal (`.join(name)`, `.with_extension(ext)`) names an unknown file. + // literal (`.join(name)`, `.with_extension(ext)`) names an unknown file. Only steps on + // the outer path count: a `.join` inside another step's argument does not. b"read_to_string" => { let step = |s: &'static str| { - arg.rfind(s).and_then(|at| matching(arg.as_bytes(), at + s.len() - 1).map(|close| (at, s, &arg[at + s.len()..close]))) + rfind_outer(&arg, s).and_then(|at| matching(arg.as_bytes(), at + s.len() - 1).map(|close| (at, s, &arg[at + s.len()..close]))) }; match [".join(", ".with_file_name(", ".with_extension("].map(step).into_iter().flatten().max_by_key(|&(at, _, _)| at) { Some((_, ".with_extension(", ext)) => ext.trim_start_matches('r').trim_matches('#') == "\"rs\"", @@ -3161,6 +3197,35 @@ fn reads_source_hits(file: &File) -> Vec<Hit> { out } +/// The offset of the last `pat` in `expr` outside every bracket and string literal. +fn rfind_outer(expr: &str, pat: &str) -> Option<usize> { + let b = expr.as_bytes(); + let (mut depth, mut in_str, mut found) = (0usize, false, None); + let mut i = 0; + while i < b.len() { + let c = b[i]; + if in_str { + if c == b'\\' { + i += 1; + } else if c == b'"' { + in_str = false; + } + } else { + if depth == 0 && b[i..].starts_with(pat.as_bytes()) { + found = Some(i); + } + match c { + b'"' if !(i > 0 && b[i - 1] == b'\'' && b.get(i + 1) == Some(&b'\'')) => in_str = true, + b'(' | b'[' | b'{' => depth += 1, + b')' | b']' | b'}' => depth = depth.saturating_sub(1), + _ => {} + } + } + i += 1; + } + found +} + /// The last string literal in a (whitespace-free) expression, quotes included. Inside a /// `format!`-family call, an argument is not the file name, so the format string is returned /// instead: `format!("fixtures/{}.txt", "lib.rs")` names a `.txt` file. @@ -3284,12 +3349,22 @@ fn norm_outside_literals(b: &[u8]) -> String { String::from_utf8_lossy(&out).into_owned() } +/// The contents of a complete raw string literal written after its `r`: `"a"` and `#"a"#` give `a`, +/// and `#""a""#` gives `"a"`. `None` when `s` is not one whole literal. +fn raw_literal_body(s: &str) -> Option<&str> { + let hashes = s.len() - s.trim_start_matches('#').len(); + let close = format!("\"{}", "#".repeat(hashes)); + let body = s[hashes..].strip_prefix('"')?.strip_suffix(close.as_str())?; + (!body.contains(close.as_str())).then_some(body) +} + /// An argument that names an entry rather than a quantity: a string or integer literal, or a local, /// field or indexed element (`"Swatches"`, `3`, `&doc`, `front[0]`). fn key_like(arg: &str) -> bool { let arg = arg.trim_start_matches("&mut").trim_start_matches('&'); match arg.as_bytes().first() { Some(b'"') => arg.len() > 1 && arg.ends_with('"'), + Some(b'r') if arg[1..].starts_with(['"', '#']) => raw_literal_body(&arg[1..]).is_some(), Some(c) if c.is_ascii_digit() => arg.bytes().all(|c| c.is_ascii_digit() || c == b'_'), Some(_) => arg.bytes().all(|c| is_ident(c) || matches!(c, b'.' | b'[' | b']' | b':')), None => false, @@ -3406,9 +3481,9 @@ fn reaching_init(body: &[u8], name: &str, before: usize) -> Option<Option<(Strin // A `for` pattern binds its names inside the loop body only, to values the loop produces. let loop_at = words(body, b"for", 0, before).into_iter().rev().find(|&at| { let Some((open, close)) = let_body(body, at + 3) else { return false }; - let head = String::from_utf8_lossy(&body[at + 3..open]); - let Some((pattern, _)) = head.split_once(" in ") else { return false }; - let pattern = norm(pattern.as_bytes()); + // `in` is found as a word, so a line break around it still ends the pattern. + let Some(&kw) = words(body, b"in", at + 3, open).first() else { return false }; + let pattern = norm(&body[at + 3..kw]); open < before && before < close && !words(pattern.as_bytes(), name.as_bytes(), 0, pattern.len()).is_empty() }); // A match arm's pattern binds its names inside that arm only, and a closure's parameters @@ -3753,7 +3828,7 @@ fn cfg_value(p: &str, t: &Target) -> Option<bool> { // An ordinary string is compared by its decoded value (`"\x6cinux"` is `linux`); a raw string's // contents are kept as written. let (key, value) = p.split_once('=').map_or((p, String::new()), |(k, v)| match v.strip_prefix('r') { - Some(raw) => (k, raw.trim_matches('#').trim_matches('"').to_owned()), + Some(raw) => (k, raw_literal_body(raw).unwrap_or(raw).to_owned()), None => (k, unescape(v.strip_prefix('"').and_then(|v| v.strip_suffix('"')).unwrap_or(v))), }); let value = value.as_str(); @@ -3960,8 +4035,9 @@ struct Loaded<'a> { /// items, inline modules and file around them, with the 1-based lines of those declarations and /// attributes. Several declarations that load the file join into one `any(all(…), …)`. `None` /// when `src` loads no such file. `owns_dir` reads `parent` as loaded through `#[path]`, which -/// declares its modules in its own directory, as a `mod.rs` or a crate root does. -fn declared_cfgs(src: &str, parent: &str, want: &Loaded, owns_dir: bool) -> Option<(Vec<String>, Vec<usize>)> { +/// declares its modules in its own directory, as a `mod.rs` or a crate root does. `via` keeps only +/// the declarations that load `want` by name (`Named`) or through `#[path]` (`Path`). +fn declared_cfgs(src: &str, parent: &str, want: &Loaded, owns_dir: bool, via: Via) -> Option<(Vec<String>, Vec<usize>)> { let m = mask(src); let lines = Lines::new(src); let (dir, file) = parent.rsplit_once('/').unwrap_or(("", parent)); @@ -3993,13 +4069,14 @@ fn declared_cfgs(src: &str, parent: &str, want: &Loaded, owns_dir: bool) -> Opti let conditional = cfg_attr_paths(&m, src.as_bytes(), item, at); let overrides_here = |rel: &str| override_path(dir, file, mod_rs, want.chain, rel) == want.path; let fallback = match path_attr(&m, src.as_bytes(), item, at) { - Some(rel) => overrides_here(&rel), + Some(rel) => via != Via::Named && overrides_here(&rel), None => { - &m[start..end] == want.name.as_bytes() + via != Via::Path + && &m[start..end] == want.name.as_bytes() && [format!("{}.rs", want.name), format!("{}/mod.rs", want.name)].iter().any(|rel| join_path(&default_dir, rel) == want.path) } }; - let selected: Vec<&str> = conditional.iter().filter(|(_, rel)| overrides_here(rel)).map(|(c, _)| c.as_str()).collect(); + let selected: Vec<&str> = conditional.iter().filter(|(_, rel)| via != Via::Named && overrides_here(rel)).map(|(c, _)| c.as_str()).collect(); let route = match (fallback, selected.is_empty(), conditional.is_empty()) { (true, _, true) => None, (true, true, false) => Some(format!("not(any({}))", conditional.iter().map(|(c, _)| c.as_str()).collect::<Vec<_>>().join(","))), @@ -4294,7 +4371,7 @@ fn module_gate(at: &str, read: &dyn Fn(&str) -> Option<String>, overrides: &Over // can both load it): its tests are off only when every one of them leaves them out. if via != Via::Path { found.extend(candidates.iter().filter_map(|c| { - read(c).inspect(|_| parent_read = true).and_then(|s| declared_cfgs(&s, c, &want, false)).map(|f| (c.clone(), f, named(c))) + read(c).inspect(|_| parent_read = true).and_then(|s| declared_cfgs(&s, c, &want, false, via)).map(|f| (c.clone(), f, named(c))) })); } if chain.is_empty() { @@ -4305,7 +4382,7 @@ fn module_gate(at: &str, read: &dyn Fn(&str) -> Option<String>, overrides: &Over continue; } let want = Loaded { path: at, name: &name, chain: inline }; - found.extend(read(c).and_then(|s| declared_cfgs(&s, c, &want, false)).map(|f| (c.clone(), f, Via::Any))); + found.extend(read(c).and_then(|s| declared_cfgs(&s, c, &want, false, via)).map(|f| (c.clone(), f, Via::Any))); } // A file loaded through `#[path]` owns its directory like a `mod.rs`: its `mod child;` // loads the `child.rs` beside it (`impl/platform.rs` loads `impl/child.rs`). @@ -4313,7 +4390,7 @@ fn module_gate(at: &str, read: &dyn Fn(&str) -> Option<String>, overrides: &Over .keys() .filter(|k| via != Via::Path && k.as_str() != at && !owns_its_dir(k) && k.rsplit_once('/').is_some_and(|(d, _)| d == module_dir)); for owner in path_loaded { - found.extend(read(owner).and_then(|s| declared_cfgs(&s, owner, &want, true)).map(|f| (owner.clone(), f, Via::Path))); + found.extend(read(owner).and_then(|s| declared_cfgs(&s, owner, &want, true, via)).map(|f| (owner.clone(), f, Via::Path))); } } if via == Via::Path || beside_roots(at) { @@ -4519,6 +4596,8 @@ mod tests { assert_eq!(census(cast), [(2, "census")], "a cast of the entry is still the entry"); let fixed_cast = "#[test]\nfn t() {\n for k in KEYS {\n assert_eq!(lookup(FIXED as usize), k);\n }\n}\n"; assert_eq!(census(fixed_cast), [], "a cast of a fixed key"); + let one_word = "#[test]\nfn t() {\n let kasusize = 3;\n for k in KEYS {\n assert_eq!(lookup(kasusize), k);\n }\n}\n"; + assert_eq!(census(one_word), [], "a fixed local spelled like a cast of the entry"); let field = "#[test]\nfn t() {\n for k in KEYS {\n assert_eq!(lookup(config.k), k);\n assert_eq!(lookup(keys::k), k);\n }\n}\n"; assert_eq!(census(field), [], "a field or path named like the binding is a fixed key"); @@ -6084,6 +6163,8 @@ mod tests { assert_eq!(only("mirror", order), [], "positions of two entries in one list"); let commented = "#[test]\nfn t() {\n assert_eq!(at(\"B\" /* later entry */), at(\"A\") + 1);\n}\n"; assert_eq!(only("mirror", commented), [], "a comment beside a key"); + let raw = "#[test]\nfn t() {\n assert_eq!(at(r#\"B\"#), at(r#\"A\"#) + 1);\n assert_eq!(at(r\"B\"), at(r\"A\") + 1);\n}\n"; + assert_eq!(only("mirror", raw), [], "raw string keys"); let spaced = "#[test]\nfn t() {\n assert_eq!(at(\"A B\"), at(\"AB\") + 1);\n}\n"; assert_eq!(only("mirror", spaced), [], "a space inside a key makes a different entry"); let same_key = "#[test]\nfn t() {\n assert_eq!(at(\"A B\"), at( \"A B\" ) + 1);\n}\n"; @@ -6217,7 +6298,7 @@ mod tests { #[test] fn never_run_follows_the_cfg_around_the_mod_declaration() { let child = Loaded { path: "src/child.rs", name: "child", chain: &[] }; - let declared = |src: &str, want: &Loaded| declared_cfgs(src, "src/lib.rs", want, false).map(|(p, _)| p); + let declared = |src: &str, want: &Loaded| declared_cfgs(src, "src/lib.rs", want, false, Via::Any).map(|(p, _)| p); let inner = "#![cfg(target_os = \"macos\")]\nmod child;\n"; assert_eq!(declared(inner, &child), Some(vec!["target_os=\"macos\"".to_owned()])); let block = "#[cfg(windows)]\nmod platform {\n mod child;\n}\n"; @@ -6339,10 +6420,25 @@ mod tests { let base = lint_file(path, src, &ctx()); let now = lint_file(path, src, &Ctx { module_cfgs: [(path.to_owned(), vec!["target_os=\"macos\"".to_owned()])].into_iter().collect(), ..ctx() }); - let off: Vec<usize> = now.iter().filter(|h| h.rule == Rule::NeverRun && !already_off(&base, h)).map(|h| h.line).collect(); + let off: Vec<usize> = now.iter().filter(|h| h.rule == Rule::NeverRun && !already_off(&base, src, src, h)).map(|h| h.line).collect(); assert_eq!(off.len(), 1, "only the test in `b` is newly off: {off:?}"); } + #[test] + fn a_test_off_at_the_base_is_matched_in_the_base_source() { + // At the base an inline module gate turned the test off; the change removes that gate and + // gates the parent instead, which also moves the test up a line. + let path = "crates/x/src/child.rs"; + let before = "mod a {\n #[test]\n fn u() {\n assert_eq!(f(), 1);\n }\n}\n#[cfg(target_os = \"macos\")]\nmod b {\n #[test]\n fn t() {\n assert_eq!(f(), 1);\n }\n}\n"; + let after = "mod a {\n #[test]\n fn u() {\n assert_eq!(f(), 1);\n }\n}\nmod b {\n #[test]\n fn t() {\n assert_eq!(f(), 1);\n }\n}\n"; + let base = lint_file(path, before, &ctx()); + let now = + lint_file(path, after, &Ctx { module_cfgs: [(path.to_owned(), vec!["target_os=\"macos\"".to_owned()])].into_iter().collect(), ..ctx() }); + let off: Vec<&str> = + now.iter().filter(|h| h.rule == Rule::NeverRun && !already_off(&base, before, after, h)).map(|h| h.test.as_str()).collect(); + assert_eq!(off, ["u"], "`t` was already off at the base; only `u` is newly off"); + } + #[test] fn never_run_follows_a_tests_module_directory_under_src() { let files: HashMap<&str, &str> = @@ -6430,7 +6526,56 @@ mod tests { assert_eq!(hits_in(&below, test, &ctx), [], "the path-loaded file does not load impl/platform/child.rs"); let seeds = ["crates/x/src/impl/platform.rs".to_owned()]; let all: Vec<String> = files.keys().map(|p| (*p).to_owned()).collect(); - assert!(descendants(&seeds, &all, &overrides, &Overrides::new(), &read).contains(&child), "a change to platform.rs reaches child.rs"); + assert!( + descendants(&seeds, &all, &overrides, &Overrides::new(), &read, &|_| None).contains(&child), + "a change to platform.rs reaches child.rs" + ); + } + + #[test] + fn a_named_route_takes_only_the_gates_of_named_declarations() { + // `parent.rs` is loaded by name on macOS and through `#[path]` on Linux. Only the named route + // loads `parent/child.rs`; the `#[path]` route loads `child.rs` beside `parent.rs`. + let files: HashMap<&str, &str> = [ + ("crates/x/src/lib.rs", "#[cfg(target_os = \"macos\")]\nmod parent;\n#[cfg(target_os = \"linux\")]\n#[path = \"parent.rs\"]\nmod p2;\n"), + ("crates/x/src/parent.rs", "mod child;\n"), + ("crates/x/src/parent/child.rs", ""), + ("crates/x/src/child.rs", ""), + ] + .into_iter() + .collect(); + let read = |p: &str| files.get(p).map(|s| (*s).to_owned()); + let overrides = path_overrides(files.iter().map(|(p, s)| (*p, *s))); + let test = "#[test]\nfn t() {\n assert_eq!(f(), 1);\n}\n"; + for (child, expected) in [("crates/x/src/parent/child.rs", vec![(2, "never-run")]), ("crates/x/src/child.rs", vec![])] { + let ctx = Ctx { module_cfgs: module_cfgs(&[child.to_owned()], &read, &overrides), ..self::ctx() }; + assert_eq!(hits_in(child, test, &ctx), expected, "{child}"); + } + } + + #[test] + fn a_removed_child_declaration_still_reaches_the_child() { + let work: HashMap<&str, &str> = [ + ( + "crates/x/src/lib.rs", + "#[path = \"impl/platform.rs\"]\nmod platform;\n#[cfg(target_os = \"macos\")]\n#[path = \"impl/child.rs\"]\nmod child;\n", + ), + ("crates/x/src/impl/platform.rs", ""), + ("crates/x/src/impl/child.rs", ""), + ] + .into_iter() + .collect(); + let read = |p: &str| work.get(p).map(|s| (*s).to_owned()); + let read_base = |p: &str| if p == "crates/x/src/impl/platform.rs" { Some("mod child;\n".to_owned()) } else { read(p) }; + let overrides = path_overrides(work.iter().map(|(p, s)| (*p, *s))); + let seeds = ["crates/x/src/impl/platform.rs".to_owned()]; + let all: Vec<String> = work.keys().map(|p| (*p).to_owned()).collect(); + let child = "crates/x/src/impl/child.rs".to_owned(); + assert!(!descendants(&seeds, &all, &overrides, &Overrides::new(), &read, &|_| None).contains(&child)); + assert!( + descendants(&seeds, &all, &overrides, &Overrides::new(), &read, &read_base).contains(&child), + "the base `mod child;` that the change removed still leads to child.rs" + ); } #[test] @@ -6594,7 +6739,7 @@ mod tests { let base_ctx = Ctx { module_cfgs: module_cfgs(&paths, &read_base, &base_overrides), ..ctx() }; let files = work_files.iter().map(|(p, _)| (*p).to_owned()).chain(paths.iter().cloned()).collect::<Vec<_>>(); assert!( - descendants(&[a.to_owned()], &files, &overrides, &base_overrides, &|_| None).contains(&child.to_owned()), + descendants(&[a.to_owned()], &files, &overrides, &base_overrides, &|_| None, &|_| None).contains(&child.to_owned()), "the removed route still reaches the shared tests" ); for lines in [Some(BTreeSet::new()), Some([20].into_iter().collect()), None] { @@ -6602,7 +6747,7 @@ mod tests { assert!(!gate_changed(gates.get(child), &changed), "the surviving route was not edited"); let parent_changed = route_gate_changed(child, gates.get(child), base_gates.get(child), &base_overrides, &changed); assert!(parent_changed, "deletions and shifted lines still change a base route"); - assert_eq!(parent_changed && !already_off(&lint_file(child, test, &base_ctx), &hit), ran); + assert_eq!(parent_changed && !already_off(&lint_file(child, test, &base_ctx), test, test, &hit), ran); assert!( route_gate_changed(child, gates.get(child), None, &base_overrides, &changed), "a base route parent counts even without inherited predicates" @@ -6683,6 +6828,8 @@ mod tests { assert_eq!(cfg_value("target_os=\"\\u{6c}inux\"", linux), Some(true)); assert_eq!(cfg_value("target_os=r\"linux\"", linux), Some(true)); assert_eq!(cfg_value("target_os=r\"\\x6cinux\"", linux), Some(false), "a raw string is not decoded"); + assert_eq!(cfg_value("target_family=r#\"unix\"#", linux), Some(true)); + assert_eq!(cfg_value("target_family=r#\"\"unix\"\"#", linux), Some(false), "quotes inside a raw string are part of the value"); } #[test] @@ -6705,7 +6852,7 @@ mod tests { let base: Overrides = [("crates/x/src/shared.rs".to_owned(), vec![("crates/x/src/bin/tool.rs".to_owned(), vec![])])].into_iter().collect(); let seeds: Vec<String> = got.keys().cloned().collect(); let files = ["crates/x/src/shared.rs".to_owned()]; - assert_eq!(descendants(&seeds, &files, &Overrides::new(), &base, &|_| None), ["crates/x/src/shared.rs"]); + assert_eq!(descendants(&seeds, &files, &Overrides::new(), &base, &|_| None, &|_| None), ["crates/x/src/shared.rs"]); } #[test] @@ -6720,7 +6867,7 @@ mod tests { ]; let overrides = path_overrides(sources); let read = |p: &str| sources.iter().find(|(f, _)| *f == p).map(|(_, s)| (*s).to_owned()); - let found = descendants(&["src/solids/graphics.rs".to_owned()], &files, &overrides, &Overrides::new(), &read); + let found = descendants(&["src/solids/graphics.rs".to_owned()], &files, &overrides, &Overrides::new(), &read, &|_| None); assert_eq!(found, ["src/solids/map_art.rs", "src/solids/tests_map_art.rs"], "through map_art.rs, and not other.rs"); } @@ -6817,6 +6964,8 @@ mod tests { let joined = "#[test]\nfn t() {\n let s = fs::read_to_string(root.join(\"src\").join(\"lib.rs\")).unwrap();\n assert!(s.contains(\"x\"));\n}\n"; assert_eq!(only("reads-source", joined), [(3, "reads-source")], "a final join that names a .rs file"); + let nested = "#[test]\nfn t() {\n let s = fs::read_to_string(root.join(if root.join(\"config.rs\").exists() { \"a.json\" } else { \"b.json\" })).unwrap();\n assert!(s.contains(\"x\"));\n}\n"; + assert_eq!(only("reads-source", nested), [], "a join inside the outer join's argument"); let extension = "#[test]\nfn t() {\n let s = fs::read_to_string(root.join(\"sample.rs\").with_extension(\"json\")).unwrap();\n assert!(s.contains(\"x\"));\n}\n"; assert_eq!(only("reads-source", extension), [], "a final extension that is not rs"); let to_rs = "#[test]\nfn t() {\n let s = fs::read_to_string(root.join(\"lib.txt\").with_extension(\"rs\")).unwrap();\n assert!(s.contains(\"x\"));\n}\n"; @@ -6856,6 +7005,8 @@ mod tests { fn a_for_binding_shadows_the_outer_one_in_its_body() { let looped = "#[test]\nfn t() {\n let n = 0;\n for n in results() {\n assert_eq!(n, 1);\n }\n}\n"; assert_eq!(only("fixture-only", looped), []); + let broken = "#[test]\nfn t() {\n let n = 0;\n for n in\n results()\n {\n assert_eq!(n, 1);\n }\n}\n"; + assert_eq!(only("fixture-only", broken), [], "a line break after `in`"); let after = "#[test]\nfn t() {\n let n = 0;\n for n in results() {\n consume(n);\n }\n assert_eq!(n, 0);\n}\n"; assert_eq!(only("fixture-only", after), [(2, "fixture-only")], "the outer binding after the loop"); } From e19e96f810de7342f8c5bd3e6d693a9ee9a83f6e Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 17:06:07 -0800 Subject: [PATCH 071/112] xtask: test-lint reads base roots, module scopes and whole literals - Changed mode builds the base's target-root routes from the base tree, so a deleted tests/<root>.rs still counts as loading tests/common/mod.rs. - A base test is matched by its name, its inline modules and its place among same-named tests in them, so removing `mod a` does not let `a::t` hide a newly off `b::t`. - reads-source looks through grouping around the read path and names a file only from a complete literal, a format!/concat! call or Path::new/PathBuf::from; `"data.json".trim_end_matches(".rs")` no longer counts as a .rs file. - mirror keys keep a raw literal whole up to its own delimiter, and a key must be one complete string literal. - for, if let, while let, let and match patterns keep word boundaries (`mut n` binds `n`), and a struct pattern's braces are not taken as the loop or if-let body. - #[path] and cfg_attr path values accept raw string literals. --- xtask/src/test_lint.rs | 320 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 289 insertions(+), 31 deletions(-) diff --git a/xtask/src/test_lint.rs b/xtask/src/test_lint.rs index 40ac3b2f25..449885209f 100644 --- a/xtask/src/test_lint.rs +++ b/xtask/src/test_lint.rs @@ -293,6 +293,12 @@ fn read_small(root: &Path, path: &str) -> Option<String> { (std::fs::metadata(&full).ok()?.len() <= MAX_FILE).then(|| std::fs::read_to_string(full).ok()).flatten() } +/// The scanned files of the tree at `base`, or `None` when Git cannot list it. +fn base_files(root: &Path, base: &str) -> Option<Vec<String>> { + let list = git(root, &["ls-tree", "-r", "-z", "--name-only", base]).ok()?; + Some(list.split('\0').filter(|p| !p.is_empty() && is_scanned(p)).map(str::to_owned).collect()) +} + /// Cache successful and missing reads for one source tree. fn cached_read(read: impl Fn(&str) -> Option<String>) -> impl Fn(&str) -> Option<String> { let cache = RefCell::new(HashMap::<String, Option<String>>::new()); @@ -324,7 +330,10 @@ pub fn run(root: &Path, args: &[&str]) -> Result<(), String> { // instead of reading the tree, and the target roots beside a shared `tests/<dir>/mod.rs`. let overrides = with_root_routes(discover_path_overrides(root, None, &read_work), &files); let read_base = cached_read(|p| git(root, &["show", &format!("{base}:{p}")]).ok().filter(|s| s.len() as u64 <= MAX_FILE)); - let base_overrides = with_root_routes(discover_path_overrides(root, Some(&base), &read_base), &files); + // The base's target roots come from the base tree: a root the change deleted still loaded the + // shared module beside it. + let base_overrides = + with_root_routes(discover_path_overrides(root, Some(&base), &read_base), &base_files(root, &base).unwrap_or_else(|| files.clone())); // Files a changed file loads, directly or through other modules: a `cfg` added to their `mod` // declaration can turn their tests off without a change to them. // Deleted files seed the walk too: a module they loaded at the base may have lost its only CI route. @@ -373,20 +382,49 @@ pub fn run(root: &Path, args: &[&str]) -> Result<(), String> { } /// Whether `base`, the hits of `base_src` under the base's gates, has a `never-run` hit for the test -/// of `hit` in `src`. A test is matched by its name and its place among the tests of that name, so -/// lines that moved still match and tests of one name in different inline modules stay apart. +/// of `hit` in `src`. A test is matched by its name, the inline modules around it and its place +/// among the tests of that name in those modules, so lines that moved still match and tests of one +/// name in different inline modules stay apart, even when a change removes one of the modules. fn already_off(base: &[Hit], base_src: &str, src: &str, hit: &Hit) -> bool { let place = test_place(src, &hit.test, hit.line); - base.iter().filter(|h| h.rule == Rule::NeverRun && h.test == hit.test).any(|h| match place { - Some(place) => test_place(base_src, &h.test, h.line) == Some(place), + base.iter().filter(|h| h.rule == Rule::NeverRun && h.test == hit.test).any(|h| match &place { + Some(place) => test_place(base_src, &h.test, h.line).as_ref() == Some(place), None => h.line == hit.line, }) } -/// The index of the test `name` whose `fn` is on `line` among the tests of that name in `src`. -fn test_place(src: &str, name: &str, line: usize) -> Option<usize> { +/// The inline modules around the test `name` whose `fn` is on `line` in `src` (outermost first), +/// and its index among the tests of that name in the same modules. +fn test_place(src: &str, name: &str, line: usize) -> Option<(Vec<String>, usize)> { let lines = Lines::new(src); - tests_in(&mask(src)).iter().filter(|t| t.name == name).position(|t| lines.of(t.fn_at) == line) + let m = mask(src); + let named: Vec<(Vec<String>, usize)> = + tests_in(&m).iter().filter(|t| t.name == name).map(|t| (inline_modules(&m, t.fn_at), lines.of(t.fn_at))).collect(); + let (scope, _) = named.iter().find(|(_, l)| *l == line)?; + let index = named.iter().filter(|(s, _)| s == scope).position(|(_, l)| *l == line)?; + Some((scope.clone(), index)) +} + +/// The names of the inline `mod <name> { … }` blocks around `at` in the masked text `m`, outermost +/// first. +fn inline_modules(m: &[u8], at: usize) -> Vec<String> { + let mut open: Vec<Option<String>> = vec![]; + for (i, &c) in m.iter().enumerate().take(at) { + match c { + b'{' => { + let head = m[..i].trim_ascii_end(); + let name = head.iter().rev().take_while(|&&c| is_ident(c)).count(); + let before = head[..head.len() - name].trim_ascii_end(); + let keyword = name > 0 && before.ends_with(b"mod") && !before[..before.len() - 3].last().copied().is_some_and(is_ident); + open.push(keyword.then(|| String::from_utf8_lossy(&head[head.len() - name..]).into_owned())); + } + b'}' => { + open.pop(); + } + _ => {} + } + } + open.into_iter().flatten().collect() } /// The directory holding the modules that the file `p` declares by name: its own directory for @@ -3175,13 +3213,15 @@ fn reads_source_hits(file: &File) -> Vec<Hit> { // literal (`.join(name)`, `.with_extension(ext)`) names an unknown file. Only steps on // the outer path count: a `.join` inside another step's argument does not. b"read_to_string" => { + // Grouping around the whole argument hides no step: `(root.join(…))`. + let arg = ungroup(arg.strip_suffix(',').unwrap_or(&arg)); let step = |s: &'static str| { - rfind_outer(&arg, s).and_then(|at| matching(arg.as_bytes(), at + s.len() - 1).map(|close| (at, s, &arg[at + s.len()..close]))) + rfind_outer(arg, s).and_then(|at| matching(arg.as_bytes(), at + s.len() - 1).map(|close| (at, s, &arg[at + s.len()..close]))) }; match [".join(", ".with_file_name(", ".with_extension("].map(step).into_iter().flatten().max_by_key(|&(at, _, _)| at) { - Some((_, ".with_extension(", ext)) => ext.trim_start_matches('r').trim_matches('#') == "\"rs\"", - Some((_, _, last)) => last_literal(last).is_some_and(|l| l.ends_with(".rs\"")), - None => last_literal(&arg).is_some_and(|l| l.ends_with(".rs\"")), + Some((_, ".with_extension(", ext)) => file_literal(ext) == Some("\"rs\""), + Some((_, _, last)) => file_literal(last).is_some_and(|l| l.ends_with(".rs\"")), + None => file_literal(arg).is_some_and(|l| l.ends_with(".rs\"")), } } _ => arg.trim_end_matches('#').ends_with(".rs\""), @@ -3226,6 +3266,81 @@ fn rfind_outer(expr: &str, pat: &str) -> Option<usize> { found } +/// The offset of the `)` that closes the `(` at `open` in `expr`, skipping string literals. +fn outer_close(expr: &str, open: usize) -> Option<usize> { + let b = expr.as_bytes(); + let (mut depth, mut in_str) = (0usize, false); + let mut i = open; + while i < b.len() { + let c = b[i]; + if in_str { + if c == b'\\' { + i += 1; + } else if c == b'"' { + in_str = false; + } + } else { + match c { + b'"' if !(i > 0 && b[i - 1] == b'\'' && b.get(i + 1) == Some(&b'\'')) => in_str = true, + b'(' | b'[' | b'{' => depth += 1, + b')' | b']' | b'}' => { + depth = depth.saturating_sub(1); + if depth == 0 { + return Some(i); + } + } + _ => {} + } + } + i += 1; + } + None +} + +/// A whitespace-free expression without the references and parentheses around all of it: +/// `&(root.join("a"))` gives `root.join("a")`. +fn ungroup(mut expr: &str) -> &str { + loop { + let inner = expr.trim_start_matches('&'); + match inner.strip_prefix('(') { + Some(_) if outer_close(inner, 0) == Some(inner.len() - 1) => expr = &inner[1..inner.len() - 1], + _ => return inner, + } + } +} + +/// `s` when it is one complete ordinary string literal (`"a.rs"`, not `"a"+"b"`), or the body of +/// one complete raw string literal in quotes (`r#"a.rs"#` gives `"a.rs"`). +fn whole_literal(s: &str) -> Option<&str> { + if s.starts_with('"') { + return (s.len() > 1 && string_end(s.as_bytes(), 1) == s.len() && s.ends_with('"')).then_some(s); + } + let rest = s.strip_prefix('r')?; + let hashes = rest.len() - rest.trim_start_matches('#').len(); + raw_literal_body(rest).map(|_| &rest[hashes..rest.len() - hashes]) +} + +/// The literal that names the file of a whitespace-free path expression, quotes included: one +/// complete string literal, the file literal of a `format!`-family or `concat!` call +/// ([`last_literal`]), or the same inside `Path::new(…)` or `PathBuf::from(…)`. `None` for any +/// other expression: `"data.json".trim_end_matches(".rs")` names `data.json`, not its last literal. +fn file_literal(expr: &str) -> Option<&str> { + let e = ungroup(expr.strip_suffix(',').unwrap_or(expr)); + if let Some(l) = whole_literal(e) { + return Some(l); + } + let open = e.find('(')?; + if outer_close(e, open) != Some(e.len() - 1) { + return None; + } + let head = e[..open].trim_start_matches("std::").trim_start_matches("path::"); + match head { + "format!" | "format_args!" | "concat!" => last_literal(e), + "Path::new" | "PathBuf::from" => file_literal(&e[open + 1..e.len() - 1]), + _ => None, + } +} + /// The last string literal in a (whitespace-free) expression, quotes included. Inside a /// `format!`-family call, an argument is not the file name, so the format string is returned /// instead: `format!("fixtures/{}.txt", "lib.rs")` names a `.txt` file. @@ -3341,6 +3456,13 @@ fn norm_outside_literals(b: &[u8]) -> String { } else if c == b'"' && !(i > 0 && b[i - 1] == b'\'' && b.get(i + 1) == Some(&b'\'')) { in_str = true; out.push(c); + } else if c == b'r' && !(i > 0 && is_ident(b[i - 1])) && matches!(b[i + 1..].iter().find(|&&h| h != b'#'), Some(b'"')) { + // A raw literal runs to its own closing delimiter: the `"` in `r#"A" B"#` does not end it. + let mut sink = vec![]; + let end = after_ident(b, &mut sink, i, false); + out.extend_from_slice(&b[i..end]); + i = end; + continue; } else if !c.is_ascii_whitespace() { out.push(c); } @@ -3363,7 +3485,7 @@ fn raw_literal_body(s: &str) -> Option<&str> { fn key_like(arg: &str) -> bool { let arg = arg.trim_start_matches("&mut").trim_start_matches('&'); match arg.as_bytes().first() { - Some(b'"') => arg.len() > 1 && arg.ends_with('"'), + Some(b'"') => whole_literal(arg).is_some(), Some(b'r') if arg[1..].starts_with(['"', '#']) => raw_literal_body(&arg[1..]).is_some(), Some(c) if c.is_ascii_digit() => arg.bytes().all(|c| c.is_ascii_digit() || c == b'_'), Some(_) => arg.bytes().all(|c| is_ident(c) || matches!(c, b'.' | b'[' | b']' | b':')), @@ -3480,10 +3602,12 @@ fn reaching_init(body: &[u8], name: &str, before: usize) -> Option<Option<(Strin let found = let_init(body, name, before); // A `for` pattern binds its names inside the loop body only, to values the loop produces. let loop_at = words(body, b"for", 0, before).into_iter().rev().find(|&at| { - let Some((open, close)) = let_body(body, at + 3) else { return false }; - // `in` is found as a word, so a line break around it still ends the pattern. - let Some(&kw) = words(body, b"in", at + 3, open).first() else { return false }; - let pattern = norm(&body[at + 3..kw]); + // `in` is found as a word outside the pattern's brackets, so a line break around it still + // ends the pattern, and the braces of `for Row { n } in …` are not the loop body. + let Some(kw) = words(body, b"in", at + 3, before).into_iter().find(|&kw| bracket_depth(&body[at + 3..kw]) == 0) else { return false }; + let Some((open, close)) = block_after(body, kw + 2) else { return false }; + // Words stay apart, so `mut n` binds `n`. + let pattern = norm_words(&body[at + 3..kw]); open < before && before < close && !words(pattern.as_bytes(), name.as_bytes(), 0, pattern.len()).is_empty() }); // A match arm's pattern binds its names inside that arm only, and a closure's parameters @@ -3564,7 +3688,7 @@ fn arm_binding(body: &[u8], name: &str, before: usize) -> Option<usize> { } // A guard (`Some(x) if x == n`) reads names; it does not bind them. let guard = words(body, b"if", start, arrow).first().copied().unwrap_or(arrow); - let pattern = norm(&body[start..guard]); + let pattern = norm_words(&body[start..guard]); if words(pattern.as_bytes(), name.as_bytes(), 0, pattern.len()).is_empty() { continue; } @@ -3609,9 +3733,8 @@ fn let_init(body: &[u8], name: &str, before: usize) -> Option<(Option<(String, u [&b"if"[..], b"while"].into_iter().find(|k| head.ends_with(k) && !head[..head.len() - k.len()].last().copied().is_some_and(is_ident)); if keyword.is_some() { // `if let` and `while let` bind the pattern's names inside their body only. - if let Some((open, close)) = let_body(body, n0) { - let pattern = norm(&body[n0..open]); - let pattern = pattern.split_once('=').map_or(pattern.as_str(), |(p, _)| p); + if let Some((eq, open, close)) = let_body(body, n0) { + let pattern = norm_words(&body[n0..eq]); if open < before && before < close && !words(pattern.as_bytes(), name.as_bytes(), 0, pattern.len()).is_empty() { found = Some((None, at)); } @@ -3629,7 +3752,7 @@ fn let_init(body: &[u8], name: &str, before: usize) -> Option<(Option<(String, u found = Some((if is_mut { None } else { init }, at)); } else if !plain { // A pattern that binds the name (`let (a, b) = …`, `let Foo { a, .. } = …`). - let pattern = norm(&body[n0..stop]); + let pattern = norm_words(&body[n0..stop]); let pattern = pattern.split_once('=').map_or(pattern.as_str(), |(p, _)| p); if !words(pattern.as_bytes(), name.as_bytes(), 0, pattern.len()).is_empty() { found = Some((None, at)); @@ -3639,9 +3762,44 @@ fn let_init(body: &[u8], name: &str, before: usize) -> Option<(Option<(String, u found } -/// The braces of the body of an `if let` or `while let` whose pattern starts at `from`: the first -/// `{` outside parentheses and brackets, and its match. -fn let_body(body: &[u8], from: usize) -> Option<(usize, usize)> { +/// The `=` that ends the pattern of an `if let` or `while let` starting at `from`, and the braces of +/// its body after the scrutinee ([`block_after`]). The `=` sits outside every bracket, so the braces +/// of a struct pattern (`if let Row { n } = …`) are part of the pattern, and it is not part of `==`, +/// `=>`, `..=`, `<=`, `>=` or `!=`. +fn let_body(body: &[u8], from: usize) -> Option<(usize, usize, usize)> { + let mut depth = 0usize; + for (i, &c) in body.iter().enumerate().skip(from) { + match c { + b'(' | b'[' | b'{' => depth += 1, + b')' | b']' | b'}' if depth == 0 => return None, + b')' | b']' | b'}' => depth -= 1, + b';' if depth == 0 => return None, + b'=' if depth == 0 + && !matches!(body.get(i + 1), Some(b'=' | b'>')) + && !matches!(i.checked_sub(1).map(|j| body[j]), Some(b'=' | b'.' | b'<' | b'>' | b'!')) => + { + return block_after(body, i + 1).map(|(open, close)| (i, open, close)); + } + _ => {} + } + } + None +} + +/// The depth of the brackets left open at the end of `b`. +fn bracket_depth(b: &[u8]) -> isize { + b.iter() + .map(|&c| match c { + b'(' | b'[' | b'{' => 1, + b')' | b']' | b'}' => -1, + _ => 0, + }) + .sum() +} + +/// The braces of the block that follows an expression starting at `from`: the first `{` outside +/// parentheses and brackets, and its match. +fn block_after(body: &[u8], from: usize) -> Option<(usize, usize)> { let mut depth = 0usize; for (i, &c) in body.iter().enumerate().skip(from) { match c { @@ -4202,20 +4360,37 @@ fn path_overrides<'a>(sources: impl IntoIterator<Item = (&'a str, &'a str)>) -> out } -/// The string value of a `#[path = "…"]` attribute in `m[from..to]`. +/// The string value of a `#[path = "…"]` attribute in `m[from..to]`, written as an ordinary or a +/// raw string literal (`#[path = r"shared.rs"]`, `#[path = r#"shared.rs"#]`). fn path_attr(m: &[u8], src: &[u8], from: usize, to: usize) -> Option<String> { words(m, b"path", from, to).into_iter().find_map(|at| { let attr = m[..at].trim_ascii_end().strip_suffix(b"[").is_some_and(|b| b.trim_ascii_end().ends_with(b"#")); let eq = skip_ws(m, at + 4); - let q = skip_ws(m, eq + 1); - if !attr || m.get(eq) != Some(&b'=') || m.get(q) != Some(&b'"') { + let mut q = skip_ws(m, eq + 1); + if !attr || m.get(eq) != Some(&b'=') { return None; } - let close = find(m, b"\"", q + 1)?; - Some(String::from_utf8_lossy(&src[q + 1..close]).into_owned()) + let hashes = if m.get(q) == Some(&b'r') { + let h = m[q + 1..].iter().take_while(|&&c| c == b'#').count(); + q += 1 + h; + h + } else { + 0 + }; + if m.get(q) != Some(&b'"') { + return None; + } + let close: Vec<u8> = std::iter::once(b'"').chain(std::iter::repeat_n(b'#', hashes)).collect(); + let end = find(m, &close, q + 1)?; + Some(String::from_utf8_lossy(&src[q + 1..end]).into_owned()) }) } +/// The value of a whitespace-free `path=<literal>` argument, for an ordinary or a raw string literal. +fn path_arg(arg: &str) -> Option<&str> { + whole_literal(arg.strip_prefix("path=")?).map(|l| &l[1..l.len() - 1]) +} + /// The `#[cfg_attr(<condition>, path = "…")]` overrides in `m[from..to]`, each as its condition and /// path. fn cfg_attr_paths(m: &[u8], src: &[u8], from: usize, to: usize) -> Vec<(String, String)> { @@ -4232,7 +4407,7 @@ fn cfg_attr_paths(m: &[u8], src: &[u8], from: usize, to: usize) -> Vec<(String, let mut start = first + 1; for cut in cuts[1..].iter().copied().chain([text.len()]) { let arg = text.get(start..cut).unwrap_or(""); - if let Some(rel) = arg.strip_prefix("path=\"").and_then(|r| r.strip_suffix('"')) { + if let Some(rel) = path_arg(arg) { out.push((text[..first].to_owned(), rel.to_owned())); } start = cut + 1; @@ -6167,6 +6342,10 @@ mod tests { assert_eq!(only("mirror", raw), [], "raw string keys"); let spaced = "#[test]\nfn t() {\n assert_eq!(at(\"A B\"), at(\"AB\") + 1);\n}\n"; assert_eq!(only("mirror", spaced), [], "a space inside a key makes a different entry"); + let raw_quote = "#[test]\nfn t() {\n assert_eq!(at(r#\"A\" B\"#), at(r#\"A\"B\"#) + 1);\n}\n"; + assert_eq!(only("mirror", raw_quote), [], "a quote inside a raw key does not end it"); + let computed = "#[test]\nfn t() {\n assert_eq!(label(\"A\".to_owned() + \"B\"), label(\"C\") + 1);\n}\n"; + assert_eq!(only("mirror", computed), [(3, "mirror")], "a computed string is not an entry key"); let same_key = "#[test]\nfn t() {\n assert_eq!(at(\"A B\"), at( \"A B\" ) + 1);\n}\n"; assert_eq!(only("mirror", same_key), [(3, "mirror")], "spaces between tokens do not"); let offset = @@ -6211,6 +6390,13 @@ mod tests { assert_eq!(hits(later), [], "an initializer reads the binding that reaches it, not a later one"); let if_let = "#[test]\nfn t() {\n let x = 0;\n if let Some(x) = compute() {\n assert_eq!(x, 2);\n }\n}\n"; assert_eq!(only("fixture-only", if_let), [], "an `if let` binding shadows the outer one in its body"); + let struct_pattern = "#[test]\nfn t() {\n let n = 0;\n if let Row { n } = compute() {\n assert_eq!(n, 2);\n }\n}\n"; + assert_eq!(only("fixture-only", struct_pattern), [], "the braces of a struct pattern are not the body"); + let else_branch = "#[test]\nfn t() {\n let n = 0;\n if let Row { n } = compute() {\n consume(n);\n } else {\n assert_eq!(n, 0);\n }\n}\n"; + assert_eq!(only("fixture-only", else_branch), [(2, "fixture-only")], "the `else` branch sees the outer binding"); + let mut_pattern = + "#[test]\nfn t() {\n let n = 0;\n if let Some(mut n) = compute() {\n n += 1;\n assert_eq!(n, 2);\n }\n}\n"; + assert_eq!(only("fixture-only", mut_pattern), [], "`mut n` in an `if let` binds `n`"); } #[test] @@ -6439,6 +6625,20 @@ mod tests { assert_eq!(off, ["u"], "`t` was already off at the base; only `u` is newly off"); } + #[test] + fn a_removed_namesake_module_does_not_hide_a_newly_off_test() { + // `a::t` was off at the base and `b::t` ran; the change deletes `mod a` and gates the parent, + // so `b::t` is now the only `t` in the file. + let path = "crates/x/src/child.rs"; + let before = "#[cfg(target_os = \"macos\")]\nmod a {\n #[test]\n fn t() {\n assert_eq!(f(), 1);\n }\n}\nmod b {\n #[test]\n fn t() {\n assert_eq!(f(), 1);\n }\n}\n"; + let after = "mod b {\n #[test]\n fn t() {\n assert_eq!(f(), 1);\n }\n}\n"; + let base = lint_file(path, before, &ctx()); + let now = + lint_file(path, after, &Ctx { module_cfgs: [(path.to_owned(), vec!["target_os=\"macos\"".to_owned()])].into_iter().collect(), ..ctx() }); + let off: Vec<usize> = now.iter().filter(|h| h.rule == Rule::NeverRun && !already_off(&base, before, after, h)).map(|h| h.line).collect(); + assert_eq!(off, [3], "`b::t` is newly off"); + } + #[test] fn never_run_follows_a_tests_module_directory_under_src() { let files: HashMap<&str, &str> = @@ -6610,6 +6810,27 @@ mod tests { std::fs::remove_dir_all(root).unwrap(); } + #[test] + fn base_root_routes_come_from_the_base_tree() { + let unique = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap().as_nanos(); + let root = std::env::temp_dir().join(format!("test-lint-roots-{}-{unique}", std::process::id())); + std::fs::create_dir_all(root.join("crates/x/tests/common")).unwrap(); + git(&root, &["init", "--quiet"]).unwrap(); + std::fs::write(root.join("crates/x/tests/smoke.rs"), "mod common;\n").unwrap(); + std::fs::write(root.join("crates/x/tests/common/mod.rs"), "").unwrap(); + git(&root, &["add", "."]).unwrap(); + let base = git(&root, &["write-tree"]).unwrap(); + std::fs::remove_file(root.join("crates/x/tests/smoke.rs")).unwrap(); + let shared = "crates/x/tests/common/mod.rs"; + let now = vec![shared.to_owned()]; + assert!(with_root_routes(Overrides::new(), &now).get(shared).is_none_or(|r| r.is_empty()), "no root loads it now"); + let then = base_files(&root, &base).unwrap(); + let routes = with_root_routes(Overrides::new(), &then); + let parents: Vec<&str> = routes.get(shared).into_iter().flatten().map(|(p, _)| p.as_str()).collect(); + assert_eq!(parents, ["crates/x/tests/smoke.rs"], "the deleted root loaded it at the base"); + std::fs::remove_dir_all(root).unwrap(); + } + #[test] fn never_run_follows_a_path_selected_by_cfg_attr() { let files: HashMap<&str, &str> = [ @@ -6977,6 +7198,15 @@ mod tests { let format_rs = "#[test]\nfn t() {\n let s = fs::read_to_string(format!(\"{}/lib.rs\", dir)).unwrap();\n assert!(s.contains(\"x\"));\n}\n"; assert_eq!(only("reads-source", format_rs), [(3, "reads-source")], "a format string that names a .rs file"); + let grouped_ext = "#[test]\nfn t() {\n let s = fs::read_to_string((root.join(\"sample.rs\").with_extension(ext))).unwrap();\n assert!(s.contains(\"x\"));\n}\n"; + assert_eq!(only("reads-source", grouped_ext), [], "grouping around the argument hides no step"); + let grouped_rs = + "#[test]\nfn t() {\n let s = fs::read_to_string(&(root.join(\"src/lib.rs\"))).unwrap();\n assert!(s.contains(\"x\"));\n}\n"; + assert_eq!(only("reads-source", grouped_rs), [(3, "reads-source")], "a grouped join that names a .rs file"); + let computed = "#[test]\nfn t() {\n let s = fs::read_to_string(root.join(\"data.json\".trim_end_matches(\".rs\"))).unwrap();\n assert!(s.contains(\"x\"));\n}\n"; + assert_eq!(only("reads-source", computed), [], "a computed file name is not its last literal"); + let wrapped = "#[test]\nfn t() {\n let s = fs::read_to_string(Path::new(\"src/lib.rs\")).unwrap();\n assert!(s.contains(\"x\"));\n}\n"; + assert_eq!(only("reads-source", wrapped), [(3, "reads-source")], "a literal inside Path::new"); let split = "#[test]\nfn t() {\n let s = fs::read_to_string(\n \"src/lib.rs\",\n )\n .unwrap();\n assert!(s.contains(\"x\"));\n}\n"; let found = lint_file("crates/x/src/tests.rs", split, &ctx()); let hit = found.iter().find(|h| h.rule == Rule::ReadsSource).unwrap(); @@ -7009,6 +7239,12 @@ mod tests { assert_eq!(only("fixture-only", broken), [], "a line break after `in`"); let after = "#[test]\nfn t() {\n let n = 0;\n for n in results() {\n consume(n);\n }\n assert_eq!(n, 0);\n}\n"; assert_eq!(only("fixture-only", after), [(2, "fixture-only")], "the outer binding after the loop"); + let mutable = "#[test]\nfn t() {\n let n = 0;\n for mut n in results() {\n n += 1;\n assert_eq!(n, 2);\n }\n}\n"; + assert_eq!(only("fixture-only", mutable), [], "`mut n` binds `n`"); + let destructured = "#[test]\nfn t() {\n let n = 0;\n for Row { n } in rows() {\n assert_eq!(n, 2);\n }\n}\n"; + assert_eq!(only("fixture-only", destructured), [], "the braces of a struct pattern are not the loop body"); + let mut_after = "#[test]\nfn t() {\n let n = 0;\n for mut n in results() {\n consume(n);\n }\n assert_eq!(n, 0);\n}\n"; + assert_eq!(only("fixture-only", mut_after), [(2, "fixture-only")], "the outer binding after a `mut` loop"); } #[test] @@ -7033,6 +7269,28 @@ mod tests { assert_eq!(only("never-run", comma), [], "a comma inside the condition's value"); let src = "#[cfg_attr(unix, path = \"a,b.rs\")]\nmod x;\n"; assert_eq!(cfg_attr_paths(&mask(src), src.as_bytes(), 0, src.len()), [("unix".to_owned(), "a,b.rs".to_owned())]); + let raw = "#[cfg_attr(unix, path = r#\"a.rs\"#)]\nmod x;\n"; + assert_eq!(cfg_attr_paths(&mask(raw), raw.as_bytes(), 0, raw.len()), [("unix".to_owned(), "a.rs".to_owned())]); + } + + #[test] + fn path_attributes_accept_raw_strings() { + for src in ["#[path = r\"shared.rs\"]\nmod s;\n", "#[path = r#\"shared.rs\"#]\nmod s;\n", "#[path = \"shared.rs\"]\nmod s;\n"] { + assert_eq!(path_attr(&mask(src), src.as_bytes(), 0, src.len()).as_deref(), Some("shared.rs"), "{src}"); + } + let files: HashMap<&str, &str> = [ + ("crates/x/src/lib.rs", "mod a;\nmod b;\n"), + ("crates/x/src/a.rs", "#[path = r\"shared.rs\"]\nmod s;\n"), + ("crates/x/src/b.rs", "#[cfg(target_os = \"macos\")]\n#[path = \"shared.rs\"]\nmod s;\n"), + ] + .into_iter() + .collect(); + let read = |p: &str| files.get(p).map(|s| (*s).to_owned()); + let overrides = path_overrides(files.iter().map(|(p, s)| (*p, *s))); + let shared = "crates/x/src/shared.rs".to_owned(); + let ctx = Ctx { module_cfgs: module_cfgs(std::slice::from_ref(&shared), &read, &overrides), ..ctx() }; + let test = "#[test]\nfn t() {\n assert_eq!(f(), 1);\n}\n"; + assert_eq!(hits_in(&shared, test, &ctx), [], "the raw-string route runs it on Linux"); } #[test] From f91fe5bf541e4d7242badbaec0908ed5668ff4fd Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 17:09:51 -0800 Subject: [PATCH 072/112] xtask: test-lint sleep rule checks thread spawns and real polling calls - A dropped-handle spawn counts only as `thread::spawn` through a path, with or without a leading `::`, or as a bare `spawn` that a `use` brings in. A local `fn spawn` that runs the closure at once is reported. - A sleep that is the whole body of a closure without braces is judged by the call that takes the closure: a dropped `thread::spawn` is exempt, and a joined one is reported even inside a polling loop. - A `loop` used as a `let` value is checked for polling calls. - Calls inside the sleep's own argument and inside `stringify!` are not polling work, and neither are `unwrap`, `expect` and the `unwrap_or` family. - `Duration::new` is matched per call, with `Duration` as a whole path segment, so a local named `new` or `ScheduleDuration::new()` does not change the result. --- xtask/src/test_lint.rs | 205 ++++++++++++++++++++++++++++++----------- 1 file changed, 151 insertions(+), 54 deletions(-) diff --git a/xtask/src/test_lint.rs b/xtask/src/test_lint.rs index 46abce213d..c1a0682dad 100644 --- a/xtask/src/test_lint.rs +++ b/xtask/src/test_lint.rs @@ -987,6 +987,11 @@ const COMMON: &[&str] = &[ /// The names called in `m[from..to]`: functions (`name(`, also through a path), methods /// (`.name(`), including calls with turbofish arguments, and macros (`name!`). fn calls(m: &[u8], from: usize, to: usize) -> Vec<(String, bool)> { + calls_at(m, from, to).into_iter().map(|(_, name, method)| (name, method)).collect() +} + +/// [`calls`] with the index where each name starts. +fn calls_at(m: &[u8], from: usize, to: usize) -> Vec<(usize, String, bool)> { let m = &m[..to]; let mut out = vec![]; let mut i = from; @@ -1003,7 +1008,7 @@ fn calls(m: &[u8], from: usize, to: usize) -> Vec<(String, bool)> { let name = String::from_utf8_lossy(&m[i..end]).into_owned(); let method = i > 0 && m[i - 1] == b'.'; if !KEYWORDS.contains(&name.as_str()) { - out.push((if bang { format!("{name}!") } else { name }, method)); + out.push((i, if bang { format!("{name}!") } else { name }, method)); } } i = end; @@ -2959,11 +2964,8 @@ fn ignore_reason(src: &[u8]) -> Option<&[u8]> { fn sleep_hits(file: &File) -> Vec<Hit> { let m = &file.m; // A bare `sleep(…)` counts only where a `use` brings in `thread::sleep`. - let imported = words(m, b"use", 0, m.len()).into_iter().any(|u| { - let item = norm(&m[u..statement_end(m, u)]); - item.contains("thread::sleep") - || item.split_once("thread::{").is_some_and(|(_, list)| !words(list.as_bytes(), b"sleep", 0, list.len()).is_empty()) - }); + let imported = thread_import(m, "sleep"); + let spawn_imported = thread_import(m, "spawn"); words(m, b"sleep", 0, m.len()) .into_iter() .filter(|&at| { @@ -2976,12 +2978,26 @@ fn sleep_hits(file: &File) -> Vec<Hit> { Some(p) => p.ends_with(b"thread") && !p.ends_with(b"_thread"), None => imported && !before.ends_with(b".") && !before.ends_with(b"fn"), }; - thread_sleep && !polls_or_releases(m, at) + thread_sleep && !polls_or_releases(m, at, spawn_imported) }) .map(|at| file.hit(at, Rule::Sleep, file.test_at(at), "sleeps in test code".into())) .collect() } +/// Whether a `use` brings in `thread::<name>`, alone or in a `thread::{…}` list. +fn thread_import(m: &[u8], name: &str) -> bool { + let path = format!("thread::{name}"); + words(m, b"use", 0, m.len()).into_iter().any(|u| { + let item = norm(&m[u..statement_end(m, u)]); + item.contains(&path) + || item.split_once("thread::{").is_some_and(|(_, list)| !words(list.as_bytes(), name.as_bytes(), 0, list.len()).is_empty()) + }) +} + +/// Calls that pass a value through without reading any state, such as the `unwrap` of +/// `elapsed().checked_sub(D).unwrap()`. +const PASS_THROUGH_CALLS: &[&str] = &["unwrap", "expect", "unwrap_or", "unwrap_or_default", "unwrap_or_else"]; + /// Calls that only read or build a time, which a wait on the clock alone makes. const TIME_CALLS: &[&str] = &[ "sleep", @@ -3100,19 +3116,25 @@ const NOT_PATH: &[&[u8]] = &[ /// Whether the sleep at `at` is the pause of a loop that checks a condition, or the delay of a /// spawned thread's fallback release. A `while` or `loop` around it polls when its condition or -/// body calls a function or method other than [`TIME_CALLS`] (a flag's `load`, a `poll`, a -/// progress read); a macro such as `println!` does not count. A -/// closure passed to a `spawn` call whose handle is dropped runs beside the test, which does not -/// wait for it. -fn polls_or_releases(m: &[u8], at: usize) -> bool { +/// body calls a function or method other than [`TIME_CALLS`] and [`PASS_THROUGH_CALLS`] (a +/// flag's `load`, a `poll`, a progress read). A macro such as `println!`, a call inside the +/// arguments of `stringify!` or of the sleep itself, a nested `fn` name and `Duration::new` do +/// not count. A closure passed to a `thread::spawn` call whose handle is dropped runs beside the +/// test, which does not wait for it. +fn polls_or_releases(m: &[u8], at: usize, spawn_imported: bool) -> bool { + if let Some((name, end)) = expression_closure_call(m, at) { + return &m[name..end] == b"spawn" && dropped_spawn(m, name, spawn_imported); + } let mut at = at; let (open, start) = loop { let Some((open, start)) = enclosing_block(m, at) else { return false }; let head = m[start..open].trim_ascii(); let labeled = strip_label(head); let keyword = |w: &[u8]| head.starts_with(w) && !head.get(w.len()).copied().is_some_and(is_ident); - let loop_keyword = |w: &[u8]| labeled.starts_with(w) && !labeled.get(w.len()).copied().is_some_and(is_ident); - if loop_keyword(b"while") || loop_keyword(b"loop") || closure_head(head) { + let starts_while = labeled.starts_with(b"while") && !labeled.get(5).copied().is_some_and(is_ident); + // A `loop` can be the value of a `let` (`let p = loop { … };`), so it ends the head. + let ends_loop = labeled.ends_with(b"loop") && !labeled.len().checked_sub(5).is_some_and(|j| is_ident(labeled[j])); + if starts_while || ends_loop || closure_head(head) { break (open, start); } if !head.is_empty() && !keyword(b"if") && !keyword(b"else") && !keyword(b"match") && !head.ends_with(b"=>") { @@ -3122,52 +3144,115 @@ fn polls_or_releases(m: &[u8], at: usize) -> bool { }; let head = m[start..open].trim_ascii(); if closure_head(head) { - // The thread's handle is dropped only when the `spawn` call is the whole statement: a - // path before it and a `;` after it. A `let`, an assignment, an argument or a chained - // `.join()` keeps the handle, and a test that joins it waits for the sleep. let head_at = start + (m[start..open].len() - m[start..open].trim_ascii_start().len()); - let dropped = |s: usize| { - let path = &head[..s]; - let mut i = 0; - while i < path.len() { - if !is_ident(path[i]) || path[i].is_ascii_digit() { - return false; - } - let segment = i; - while i < path.len() && is_ident(path[i]) { - i += 1; - } - if NOT_PATH.contains(&&path[segment..i]) { - return false; - } - i = skip_ws(path, i); - if path.get(i..i + 2) != Some(&b"::"[..]) { - return false; - } - i = skip_ws(path, i + 2); - } - let paren = skip_ws(m, head_at + s + "spawn".len()); - matching(m, paren).is_some_and(|close| m.get(skip_ws(m, close + 1)) == Some(&b';')) - }; - return words(head, b"spawn", 0, head.len()).into_iter().any(|s| head.get(skip_ws(head, s + "spawn".len())) == Some(&b'(') && dropped(s)); + return words(head, b"spawn", 0, head.len()) + .into_iter() + .any(|s| head.get(skip_ws(head, s + "spawn".len())) == Some(&b'(') && dropped_spawn(m, head_at + s, spawn_imported)); } let close = matching(m, open).unwrap_or(m.len()); - // `new` builds a time only as `Duration::new`; any other `new` call counts as a condition. - let span = &m[start..close]; - let only_duration_new = words(span, b"new", 0, span.len()) - .into_iter() - .all(|s| span[..s].trim_ascii_end().strip_suffix(b"::").is_some_and(|p| p.trim_ascii_end().ends_with(b"Duration"))); + let found = calls_at(m, start, close); + // The arguments of `stringify!` and of a sleep are not polling work. + let skipped: Vec<(usize, usize)> = found + .iter() + .filter(|(_, name, _)| name == "stringify!" || name == "sleep") + .filter_map(|(p, name, _)| { + let o = skip_ws(m, p + name.len()); + matching(m, o).map(|c| (o, c)) + }) + .collect(); + let before = |p: usize| m[..p].trim_ascii_end(); + // `new` builds a time only as `Duration::new`, with `Duration` as a whole path segment. + let duration_new = |p: usize| { + before(p) + .strip_suffix(b"::") + .map(<[u8]>::trim_ascii_end) + .is_some_and(|q| q.ends_with(b"Duration") && !q.len().checked_sub(9).is_some_and(|j| is_ident(q[j]))) + }; // A nested `fn` item's name is a declaration, not a call. - let mut found = calls(m, start, close); - for f in words(span, b"fn", 0, span.len()) { - let s = skip_ws(span, f + "fn".len()); - let n = span[s..].iter().take_while(|&&c| is_ident(c)).count(); - let name = String::from_utf8_lossy(&span[s..s + n]); - if let Some(p) = found.iter().position(|(called, method)| !method && *called == name) { - found.remove(p); + let declared = |p: usize| { + let b = before(p); + b.ends_with(b"fn") && !b.len().checked_sub(3).is_some_and(|j| is_ident(b[j])) + }; + found.iter().any(|&(p, ref name, method)| { + !name.ends_with('!') + && !TIME_CALLS.contains(&name.as_str()) + && !PASS_THROUGH_CALLS.contains(&name.as_str()) + && !skipped.iter().any(|&(o, c)| o < p && p < c) + && !(name == "new" && !method && duration_new(p)) + && !(!method && declared(p)) + }) +} + +/// For a sleep that is the whole body of a closure without braces (`spawn(|| thread::sleep(D))`), +/// the start and end of the name of the call that takes the closure. +fn expression_closure_call(m: &[u8], at: usize) -> Option<(usize, usize)> { + // The `(` of the call, or the `,` before the argument, that starts the argument holding `at`. + let argument_start = |from: usize, comma: bool| { + let mut depth = 0usize; + let mut j = from; + loop { + j = j.checked_sub(1)?; + match m[j] { + b')' | b']' | b'}' => depth += 1, + b'(' | b'[' | b'{' if depth > 0 => depth -= 1, + b'(' if depth == 0 => return Some(j), + b',' if depth == 0 && comma => return Some(j), + b'[' | b'{' | b';' if depth == 0 => return None, + _ => {} + } } + }; + let stop = argument_start(at, true)?; + let arg = m[stop + 1..at].trim_ascii(); + let arg = match arg.strip_prefix(b"move") { + Some(rest) if !rest.first().copied().is_some_and(is_ident) => rest.trim_ascii_start(), + _ => arg, + }; + let params = arg.strip_prefix(b"|")?; + let body = ¶ms[params.iter().position(|&c| c == b'|')? + 1..]; + if !body.iter().all(|&c| is_ident(c) || c == b':' || c.is_ascii_whitespace()) { + return None; } - found.iter().any(|(name, _)| !name.ends_with('!') && !TIME_CALLS.contains(&name.as_str()) && !(name == "new" && only_duration_new)) + let paren = if m[stop] == b'(' { stop } else { argument_start(stop, false)? }; + let end = m[..paren].trim_ascii_end().len(); + let name = m[..end].iter().rposition(|&c| !is_ident(c)).map_or(0, |j| j + 1); + (name < end).then_some((name, end)) +} + +/// Whether the `spawn(…)` call whose name starts at `at` starts a thread and drops its handle. +/// The call is the whole statement: a path ending in `thread::` (or none, where a `use` brings in +/// `thread::spawn`) before it and a `;` after it. A `let`, an assignment, an argument or a chained +/// `.join()` keeps the handle, and a test that joins it waits for the sleep. +fn dropped_spawn(m: &[u8], at: usize, spawn_imported: bool) -> bool { + let from = m[..at].iter().rposition(|&c| !(is_ident(c) || c == b':' || c.is_ascii_whitespace())).map_or(0, |j| j + 1); + if !matches!(m[..from].last().copied(), None | Some(b';' | b'{' | b'}')) { + return false; + } + let path = m[from..at].trim_ascii(); + let path = path.strip_prefix(b"::").map_or(path, <[u8]>::trim_ascii_start); + let mut last: &[u8] = b""; + let mut i = 0; + while i < path.len() { + if !is_ident(path[i]) || path[i].is_ascii_digit() { + return false; + } + let segment = i; + while i < path.len() && is_ident(path[i]) { + i += 1; + } + last = &path[segment..i]; + if NOT_PATH.contains(&last) { + return false; + } + i = skip_ws(path, i); + if path.get(i..i + 2) != Some(&b"::"[..]) { + return false; + } + i = skip_ws(path, i + 2); + } + let thread = if path.is_empty() { spawn_imported } else { last == b"thread" }; + let paren = skip_ws(m, at + "spawn".len()); + thread && matching(m, paren).is_some_and(|close| m.get(skip_ws(m, close + 1)) == Some(&b';')) } /// The contents of the last string literal in `s`, without its quotes. @@ -5387,6 +5472,11 @@ mod tests { "fn wait(r: &R) {\n m! { r }\n while !r.load(SeqCst) {\n thread::sleep(D);\n }\n}\n", "fn wait(r: &R) {\n 'outer: while !r.load(SeqCst) {\n thread::sleep(D);\n }\n}\n", "#[test]\nfn t() {\n std::thread::spawn(move || -> () {\n std::thread::sleep(D);\n gate.open();\n });\n assert_eq!(f(), 1);\n}\n", + "fn wait() -> P {\n let p = loop {\n let p = progress();\n if p.done {\n break p;\n }\n std::thread::sleep(D);\n };\n p\n}\n", + "#[test]\nfn t() {\n ::std::thread::spawn(move || {\n std::thread::sleep(D);\n release();\n });\n assert_eq!(f(), 1);\n}\n", + "fn wait() {\n while ScheduleDuration::new().pending {\n thread::sleep(D);\n }\n}\n", + "#[test]\nfn t() {\n std::thread::spawn(|| std::thread::sleep(D));\n assert_eq!(f(), 1);\n}\n", + "use std::thread::{self, spawn};\n#[test]\nfn t() {\n spawn(|| {\n thread::sleep(D);\n });\n assert_eq!(f(), 1);\n}\n", ]; for src in polls { assert_eq!(hits(src), [], "{src}"); @@ -5406,6 +5496,13 @@ mod tests { "#[test]\nfn t() {\n std::thread::spawn(move || {\n std::thread::sleep(D);\n })\n .join()\n .unwrap();\n assert_eq!(f(), 1);\n}\n", "#[test]\nfn t() {\n handles.push(std::thread::spawn(move || {\n std::thread::sleep(D);\n }));\n assert_eq!(f(), 1);\n}\n", "#[test]\nfn t() {\n let release = std::thread::spawn(move || {\n std::thread::sleep(D);\n gate.open();\n });\n assert_eq!(f(), 1);\n release.join().unwrap();\n}\n", + "fn spawn(f: impl FnOnce()) {\n f();\n}\n#[test]\nfn t() {\n spawn(|| {\n thread::sleep(D);\n });\n assert_eq!(f(), 1);\n}\n", + "fn wait(t0: Instant) {\n while t0.elapsed() < Duration::new(1, 0) {\n let new = t0.elapsed();\n thread::sleep(D);\n }\n}\n", + "fn wait() {\n let mut n = 0;\n while n < 3 {\n thread::sleep(delay());\n n += 1;\n }\n}\n", + "fn wait(t0: Instant) {\n while t0.elapsed().checked_sub(Duration::ZERO).unwrap() < D {\n thread::sleep(D);\n }\n}\n", + "fn wait(t0: Instant) {\n while t0.elapsed() < D {\n let _ = stringify!(probe());\n std::thread::sleep(D);\n }\n}\n", + "#[test]\nfn t() {\n while !ready() {\n std::thread::spawn(|| std::thread::sleep(D)).join().unwrap();\n }\n assert_eq!(f(), 1);\n}\n", + "fn wait() -> u8 {\n let mut n = 0;\n let r = loop {\n n += 1;\n if n == 3 {\n break n;\n }\n thread::sleep(D);\n };\n r\n}\n", ]; for src in timed { assert_eq!(hits(src).iter().filter(|h| h.1 == "sleep").count(), 1, "{src}"); From 21f9323fcf2ee91c7637f6ccb3d09014e1adde13 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 17:22:04 -0800 Subject: [PATCH 073/112] Tests: import_fuzz's two regression tests check that their input reaches the export svg_type_shifted_two_billion_points_exports_to_pdf now checks that the SVG import keeps the type's shift of more than 2,000,000,000 pt, and that the exported PDF leaves the type out, read back with the PDF importer. Before, it checked only that the export returned Ok, so an import that dropped or clamped the shift made it pass without reaching the bound. a_long_thin_shape_with_a_shadow_renders_and_exports now checks that the Affinity import gives exactly one shape with a drop shadow, more than 3,000,000 pt wide, before it renders and exports it. Before, an import that dropped the shadow made it pass without drawing one. The other 66 test-lint hits in import_fuzz.rs are property tests whose claim is that hostile input loads, renders and exports without a panic. Their helpers (survive, survive_library and the others) fail the case through TestCaseError, which the no-assertion rule does not count. --- crates/engine/tests/import_fuzz.rs | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/crates/engine/tests/import_fuzz.rs b/crates/engine/tests/import_fuzz.rs index 9ff294a878..c6f02b9240 100644 --- a/crates/engine/tests/import_fuzz.rs +++ b/crates/engine/tests/import_fuzz.rs @@ -929,7 +929,20 @@ fn mutate_text(src: &str, cut: usize, edits: &[(usize, char)]) -> String { fn svg_type_shifted_two_billion_points_exports_to_pdf() { let svg = r#"<svg xmlns="http://www.w3.org/2000/svg"><text baseline-shift="-2147483649">f</text></svg>"#; let d = vectorcraft_svg::import(svg).unwrap(); - assert!(vectorcraft_engine::export_pdf(&d, &vectorcraft_pdf::PdfOptions::default()).is_ok()); + // The type opens with its shift, so the export below meets a glyph that far out. + let mut shifts = Vec::new(); + d.walk(|n| { + if let vectorcraft_doc::NodeKind::Text(t) = &n.kind { + shifts.extend(t.runs.iter().map(|r| r.style.baseline_shift)); + } + }); + assert!(shifts.iter().any(|&s| s.abs() > 2e9), "baseline shifts read: {shifts:?}"); + let pdf = vectorcraft_engine::export_pdf(&d, &vectorcraft_pdf::PdfOptions::default()).unwrap(); + // The PDF leaves the type out: reading it back finds no type. + let back = vectorcraft_pdf::import(&pdf).unwrap(); + let mut text = 0; + back.walk(|n| text += usize::from(matches!(n.kind, vectorcraft_doc::NodeKind::Text(_)))); + assert_eq!(text, 0, "type left out of the page"); } proptest! { @@ -8630,6 +8643,16 @@ fn a_long_thin_shape_with_a_shadow_renders_and_exports() { let stream = canvas_stream(vec![with_effects(rectangle(10, (0.0, 0.0), (3_276_800.0, 50.0)), vec![shadow()])]); let bytes = affinity_sample_file(&stream, None); let doc = vectorcraft_engine::cmd::fileio::load("long.af", &bytes).unwrap().doc; + // The shape opens whole, with its shadow, so the exports below draw the shadow that far out. + let mut shadowed = Vec::new(); + doc.walk(|n| { + if n.appearance.effects.iter().any(|e| e.id == "stylize.dropShadow") { + shadowed.push(n.id); + } + }); + assert_eq!(shadowed.len(), 1, "one shape with a drop shadow"); + let width = doc.bounds_of(&shadowed, false).map(|r| r.width()); + assert!(width.is_some_and(|w| w > 3_000_000.0), "the shape is {width:?} pt wide"); survive("long shape", || Some(doc)).unwrap(); } From c58415b30725a45b778783b00d9577090c35b33f Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 17:24:39 -0800 Subject: [PATCH 074/112] Tests: color and effects tests check behavior, not their own tables Parse tests in the color crate looped over every id or label and parsed it back. Blend modes, policies, harmony rules, recolor methods and WCAG categories parse by looking the text up in that same table, so those loops could not fail. They now parse representative ids, labels and spellings, and the edge cases: "Color" next to "Color Burn", empty text, and a label where only ids parse. - default_swatches_parse read swatch.rs as text. It now checks the built swatches: no two solid swatches share a color (a bad hex literal falls back to black), and the Sunset and Ocean stops equal the swatches their literals name. - loads_system_cmyk_icc ran only on macOS and returned early without the system profile. loads_icc_files_and_refuses_bad_ones runs on every native target: a missing file is an I/O error naming the path, a file that is not a profile is refused, and a built-in profile's bytes are refused for their name. - the_other_libraries_keep_classic_mixing_and_centered_midpoints is removed: those libraries are built with Gradient::new's defaults. - pixel_timings and bench_catalog_lookup are removed. They were ignored and only printed timings. - Checks over lists that can be empty now also check the count: reverse and move keep every stop, a conic draws its 4 wedges, each harmony gives at least two colors, the fit leaves patches out, the wireframe draws edges, a flat warp keeps its anchors, a gradient stroke has slices, and fitted dashes on a curve are drawn. - the_effects_are_colour_adjustments_in_their_own_menu checks one add-on effect and one effect outside it instead of every entry. --- crates/color/src/blend.rs | 8 +-- crates/color/src/cms/tests.rs | 51 ++++++++++-------- crates/color/src/cms/tests_icc.rs | 2 +- crates/color/src/cms/tests_measured.rs | 1 + crates/color/src/gradient/tests.rs | 5 +- crates/color/src/harmony.rs | 15 +++--- crates/color/src/libraries.rs | 12 ----- crates/color/src/recolor.rs | 8 +-- crates/color/src/swatch.rs | 23 ++++++--- crates/color/src/wcag.rs | 7 +-- crates/effects/src/addons/color.rs | 7 ++- crates/effects/src/pixel/tests.rs | 54 -------------------- crates/effects/src/solids/wireframe/tests.rs | 6 ++- crates/effects/src/stroke/tests_fit.rs | 1 + crates/effects/src/stroke/tests_gradient.rs | 4 +- crates/effects/src/tests.rs | 25 +++------ 16 files changed, 91 insertions(+), 138 deletions(-) diff --git a/crates/color/src/blend.rs b/crates/color/src/blend.rs index c4338c289e..d622332c32 100644 --- a/crates/color/src/blend.rs +++ b/crates/color/src/blend.rs @@ -313,8 +313,10 @@ mod tests { assert_eq!(BlendMode::parse("ColorBurn"), Some(BlendMode::ColorBurn)); assert_eq!(BlendMode::parse("soft_light"), Some(BlendMode::SoftLight)); assert_eq!(BlendMode::parse("nope"), None); - for m in BlendMode::ALL { - assert_eq!(BlendMode::parse(m.label()), Some(m)); - } + assert_eq!(BlendMode::parse(""), None); + // A label that starts another one names its own mode. + assert_eq!(BlendMode::parse("Color"), Some(BlendMode::Color)); + assert_eq!(BlendMode::parse("Color Dodge"), Some(BlendMode::ColorDodge)); + assert_eq!(BlendMode::parse("HARD-LIGHT"), Some(BlendMode::HardLight)); } } diff --git a/crates/color/src/cms/tests.rs b/crates/color/src/cms/tests.rs index 761a121191..47131dc678 100644 --- a/crates/color/src/cms/tests.rs +++ b/crates/color/src/cms/tests.rs @@ -15,11 +15,14 @@ fn de(a: [f32; 3], b: [f32; 3]) -> f32 { #[test] fn intents_parse_and_name() { - for i in Intent::ALL { - assert_eq!(Intent::parse(i.id()), Some(i)); - assert_eq!(Intent::parse(i.label()), Some(i)); - } + // The id settings save and the label the menu shows both read back, in any case and spacing. + assert_eq!(Intent::RelativeColorimetric.id(), "relative"); + assert_eq!(Intent::parse("relative"), Some(Intent::RelativeColorimetric)); + assert_eq!(Intent::parse("Relative Colorimetric"), Some(Intent::RelativeColorimetric)); + assert_eq!(Intent::parse("absolute_colorimetric"), Some(Intent::AbsoluteColorimetric)); + assert_eq!(Intent::parse("PERCEPTUAL"), Some(Intent::Perceptual)); assert_eq!(Intent::parse("bogus"), None); + assert_eq!(Intent::parse(""), None); } #[test] @@ -322,21 +325,29 @@ fn bad_icc_rejected() { assert!(matches!(register_icc(b"not a profile", None), Err(CmsError::BadProfile(_)))); } -#[cfg(target_os = "macos")] +/// A profile file is read and registered as its bytes are: a missing file is an I/O error naming +/// the path, a file that is not a profile is refused as one, and a file holding a built-in +/// profile is refused for its name. +#[cfg(not(target_arch = "wasm32"))] #[test] -fn loads_system_cmyk_icc() { - let path = std::path::Path::new("/System/Library/ColorSync/Profiles/Generic CMYK Profile.icc"); - if !path.exists() { - return; +fn loads_icc_files_and_refuses_bad_ones() { + let dir = std::env::temp_dir().join(format!("vectorcraft-color-icc-{}", std::process::id())); + std::fs::create_dir_all(&dir).unwrap(); + let missing = dir.join("missing.icc"); + match load_icc_file(&missing) { + Err(CmsError::Io(e)) => assert!(e.contains("missing.icc"), "{e}"), + other => panic!("{other:?}"), } - let info = load_icc_file(path).unwrap(); - assert_eq!(info.kind, ProfileKind::Cmyk); - assert!(profiles().iter().any(|p| p.name == info.name && !p.builtin)); - let c = Cms::new(&ColorSettings { cmyk: info.name.clone(), ..Default::default() }).unwrap(); - let rgb = [0.7, 0.5, 0.4]; - let back = c.cmyk_to_srgb(c.srgb_to_cmyk(rgb, Intent::RelativeColorimetric), false); - assert!(de(rgb, back) < 5.0, "{back:?}"); - assert_eq!(c.cmyk_to_srgb([0.0; 4], false).map(|v| (v * 255.0).round() as u8), [255, 255, 255]); + let junk = dir.join("junk.icc"); + std::fs::write(&junk, b"not a profile").unwrap(); + assert!(matches!(load_icc_file(&junk), Err(CmsError::BadProfile(_)))); + let builtin = dir.join("generic.icc"); + std::fs::write(&builtin, &*icc_bytes(GENERIC_CMYK).unwrap()).unwrap(); + match load_icc_file(&builtin) { + Err(CmsError::Unsupported(e)) => assert!(e.contains("built-in"), "{e}"), + other => panic!("{other:?}"), + } + std::fs::remove_dir_all(&dir).unwrap(); } /// With black-point compensation, sRGB black separates to the press's black point and that black @@ -568,10 +579,10 @@ fn a_document_gets_the_same_context_for_the_same_profiles() { /// settings saved before the policies existed read with the default policy. #[test] fn policies_parse_and_default_in_saved_settings() { - for p in Policy::CMYK { - assert_eq!(Policy::parse(p.id()), Some(p)); - } + assert_eq!(Policy::parse("preserveNumbers"), Some(Policy::PreserveNumbers)); + assert_eq!(Policy::parse("convert"), Some(Policy::Convert)); assert_eq!(Policy::parse("bogus"), None); + assert_eq!(Policy::parse("Preserve Numbers"), None, "only ids parse"); assert!(!Policy::RGB.contains(&Policy::PreserveNumbers)); let old: ColorSettings = serde_json::from_str(r#"{"rgb": "sRGB IEC61966-2.1", "cmyk": "Device CMYK (uncalibrated)", "intent": "perceptual", "bpc": false}"#).unwrap(); diff --git a/crates/color/src/cms/tests_icc.rs b/crates/color/src/cms/tests_icc.rs index 3506bcb856..8cefd7cfe5 100644 --- a/crates/color/src/cms/tests_icc.rs +++ b/crates/color/src/cms/tests_icc.rs @@ -395,5 +395,5 @@ fn cmyk_to_cmyk_compensates_the_black_point() { assert_ne!(convert(true), convert(false)); // White is untouched. let white = generic.to_same_model_of(&device, &[0.0; 4], rel, true).unwrap(); - assert!(white.iter().all(|v| *v < 0.01), "{white:?}"); + assert!(white.len() == 4 && white.iter().all(|v| *v < 0.01), "{white:?}"); } diff --git a/crates/color/src/cms/tests_measured.rs b/crates/color/src/cms/tests_measured.rs index 7bf5735c7a..cd2e06a70e 100644 --- a/crates/color/src/cms/tests_measured.rs +++ b/crates/color/src/cms/tests_measured.rs @@ -108,6 +108,7 @@ fn the_fit_predicts_patches_it_left_out() { let corner = |p: &measured::Patch| p.cmyk.iter().all(|v| *v == 0.0 || *v == 1.0); let first = |p: &measured::Patch| patches.iter().position(|q| q.cmyk == p.cmyk).unwrap_or(0); let (kept, left): (Vec<&measured::Patch>, Vec<_>) = patches.iter().partition(|p| first(p) % 4 != 3 || corner(p)); + assert!(!left.is_empty(), "{}: nothing left out", c.reference); assert!(left.iter().all(|l| kept.iter().all(|k| k.cmyk != l.cmyk)), "{}", c.reference); let kept: Vec<measured::Patch> = kept.into_iter().copied().collect(); let left: Vec<measured::Patch> = left.into_iter().copied().collect(); diff --git a/crates/color/src/gradient/tests.rs b/crates/color/src/gradient/tests.rs index 4d5c84c01f..fd39d0b94e 100644 --- a/crates/color/src/gradient/tests.rs +++ b/crates/color/src/gradient/tests.rs @@ -184,6 +184,7 @@ fn reverse_mirrors_midpoints() { r.reverse(); let mids: Vec<f32> = r.stops.iter().map(|s| s.midpoint).collect(); let want: Vec<f32> = g.stops.iter().rev().skip(1).map(|s| 1.0 - s.midpoint).chain([0.5]).collect(); + assert_eq!(mids.len(), g.stops.len(), "reversing keeps every stop"); assert!(mids.iter().zip(&want).all(|(a, b)| (a - b).abs() < 1e-6), "{mids:?} {want:?}"); for i in 0..=20 { let t = i as f32 / 20.0; @@ -291,6 +292,7 @@ fn remove_keeps_two() { fn move_reorders_and_tracks_index() { let g = g3(); let (v, i) = move_stop(&g.stops, 0, 0.8); + assert_eq!(v.len(), g.stops.len(), "moving keeps every stop"); assert_eq!(i, 1); assert_eq!(v[1].color.to_hex(), "#ffffff"); assert!(v.windows(2).all(|w| w[0].offset <= w[1].offset)); @@ -1176,7 +1178,8 @@ fn a_conic_with_no_extent_or_bad_numbers_still_sweeps() { assert!(t(90.0, 50.0).abs() < 1e-12, "{g:?}"); assert!((t(50.0, 90.0) - 0.25).abs() < 1e-12, "{g:?}"); let wedges = g.conic_wedges(Rect::new(0.0, 0.0, 100.0, 100.0), 4, false); - assert!(wedges.iter().flat_map(|(pts, _)| pts).all(|p| p.is_finite()), "{g:?}"); + assert_eq!(wedges.len(), 4, "{g:?}"); + assert!(wedges.iter().all(|(pts, _)| pts.len() >= 3 && pts.iter().all(|p| p.is_finite())), "{g:?}: {wedges:?}"); } // A flat extent keeps the vector's direction and the sign of its aspect. let down = GradientGeom { end: Point::new(50.0, 80.0), ..conic_at(c, 30.0, 0.0) }; diff --git a/crates/color/src/harmony.rs b/crates/color/src/harmony.rs index 58fcd886ee..75a5fdc2a5 100644 --- a/crates/color/src/harmony.rs +++ b/crates/color/src/harmony.rs @@ -177,20 +177,23 @@ mod tests { fn harmonies_keep_the_base_model() { let base = Color::cmyk(0.0, 1.0, 1.0, 0.0); for h in Harmony::ALL { - assert!(apply(h, base).iter().all(|c| matches!(c, Color::Cmyk { .. })), "{}", label(h)); + let colors = apply(h, base); + assert!(colors.len() >= 2 && colors.iter().all(|c| matches!(c, Color::Cmyk { .. })), "{}: {colors:?}", label(h)); } let Color::Cmyk { c, m, y, .. } = apply(Harmony::Complementary, base)[1] else { panic!("a CMYK complement") }; assert!(c > m && c > y, "the complement of red is a cyan: {c} {m} {y}"); let g = Guide::new(Color::gray(0.4), Harmony::Triad, &GuideOptions::default()); - assert!(g.grid.iter().flatten().all(|c| matches!(c, Color::Gray { .. }))); + let cells: Vec<&Color> = g.grid.iter().flatten().collect(); + assert!(!cells.is_empty() && cells.iter().all(|c| matches!(c, Color::Gray { .. })), "{cells:?}"); } #[test] fn rules_parse_by_id_and_label() { - for h in Harmony::ALL { - assert_eq!(parse(h.id()), Some(h)); - assert_eq!(parse(label(h)), Some(h)); - } + // A label reads back as its rule, its spaces and case ignored, and so does an id. + assert_eq!(parse("Split Complementary"), Some(Harmony::SplitComplementary)); + assert_eq!(parse("high contrast 3"), Some(Harmony::HighContrast3)); + assert_eq!(parse("tetrad2"), Some(Harmony::Tetrad2)); + assert_eq!(parse(""), None); assert_eq!(Harmony::SplitComplementary.id(), "splitComplementary"); assert_eq!(Harmony::HighContrast3.id(), "highContrast3"); assert_eq!(parse("square"), None); diff --git a/crates/color/src/libraries.rs b/crates/color/src/libraries.rs index b4197ca0ef..f7e482e567 100644 --- a/crates/color/src/libraries.rs +++ b/crates/color/src/libraries.rs @@ -825,16 +825,4 @@ mod tests { let [l, ..] = to_oklab(&stop("Violet Edge", 4)); assert!(l < 0.5 && to_oklab(&stop("Prism Veil", 2))[0] > 0.95, "{l}"); } - - #[test] - fn the_other_libraries_keep_classic_mixing_and_centered_midpoints() { - for b in builtins().filter(|b| !["organic-fades", "holographic"].contains(&b.id)) { - for s in builtin_library(b.id).unwrap().iter() { - if let Paint::Gradient(g) = &s.paint { - assert_eq!(g.gradient.method, GradientMethod::Classic, "{}", s.name); - assert!(g.gradient.stops.iter().all(|st| st.midpoint == 0.5), "{}", s.name); - } - } - } - } } diff --git a/crates/color/src/recolor.rs b/crates/color/src/recolor.rs index 05c386e405..c90257b9f1 100644 --- a/crates/color/src/recolor.rs +++ b/crates/color/src/recolor.rs @@ -796,12 +796,12 @@ mod tests { #[test] fn methods_parse_by_id_and_label() { - for m in Method::ALL { - assert_eq!(Method::parse(m.id()), Some(m)); - assert_eq!(Method::parse(m.label()), Some(m)); - } + assert_eq!(Method::parse("preserveTints"), Some(Method::PreserveTints)); + assert_eq!(Method::parse("Hue Shift"), Some(Method::HueShift)); + assert_eq!(Method::parse("Tints and Shades"), Some(Method::TintsShades)); assert_eq!(Method::parse("tints & shades"), Some(Method::TintsShades)); assert_eq!(Method::parse("nope"), None); + assert_eq!(Method::parse(""), None); } #[test] diff --git a/crates/color/src/swatch.rs b/crates/color/src/swatch.rs index 12ae31220a..b9ce45b1df 100644 --- a/crates/color/src/swatch.rs +++ b/crates/color/src/swatch.rs @@ -186,13 +186,20 @@ mod tests { #[test] fn default_swatches_parse() { - // `solid`/`grad` fall back to black or white on a bad literal instead of panicking; make sure - // none falls back. - let src = include_str!("swatch.rs"); - let hexes: Vec<&str> = src.split('"').filter(|t| t.starts_with('#') && t.len() == 7).collect(); - assert!(hexes.len() > 30); - for h in hexes { - assert!(Color::from_hex(h).is_some(), "{h}"); - } + // `solid` and `grad` fall back to black or white on a bad hex literal. A fallback gives a + // solid the color of Black or White, and a gradient a stop that differs from the swatch + // its hex literal names. + let (s, g) = default_swatches(Model::Rgb); + let solids: Vec<Color> = s.iter().chain(g.iter().flat_map(|g| &g.swatches)).filter_map(|w| w.paint.color()).collect(); + assert!(solids.len() > 40, "{}", solids.len()); + let repeated: Vec<&Color> = solids.iter().enumerate().filter(|(i, c)| solids[..*i].contains(c)).map(|(_, c)| c).collect(); + assert_eq!(repeated, Vec::<&Color>::new(), "colors of more than one default swatch"); + let color = |name: &str| s.iter().find(|w| w.name == name).and_then(|w| w.paint.color()); + let stops = |name: &str| match s.iter().find(|w| w.name == name).map(|w| &w.paint) { + Some(Paint::Gradient(gp)) => gp.gradient.stops.iter().map(|st| Some(st.color)).collect::<Vec<_>>(), + other => panic!("{name}: {other:?}"), + }; + assert_eq!(stops("Sunset"), [color("Amber"), color("Rose")]); + assert_eq!(stops("Ocean"), [color("Cyan"), color("Blue")]); } } diff --git a/crates/color/src/wcag.rs b/crates/color/src/wcag.rs index ba5bb3b974..9abb0d80ea 100644 --- a/crates/color/src/wcag.rs +++ b/crates/color/src/wcag.rs @@ -208,10 +208,11 @@ mod tests { #[test] fn category_ids_parse_back() { - for c in Category::ALL { - assert_eq!(Category::parse(c.id()), Some(c)); - } + // Commands and saved settings name a category by its id, exactly. + assert_eq!(Category::parse("largeText"), Some(Category::LargeText)); + assert_eq!(Category::parse("graphics"), Some(Category::Graphics)); assert_eq!(Category::parse("NormalText"), None); + assert_eq!(Category::parse("Large Text"), None, "a label is not an id"); } fn hue(srgb: [f32; 3]) -> f64 { diff --git a/crates/effects/src/addons/color.rs b/crates/effects/src/addons/color.rs index d6edf5f576..3cb72f60d4 100644 --- a/crates/effects/src/addons/color.rs +++ b/crates/effects/src/addons/color.rs @@ -109,10 +109,9 @@ mod tests { #[test] fn the_effects_are_colour_adjustments_in_their_own_menu() { - for id in EFFECTS { - assert!(crate::is_adjustment(id), "{id}"); - assert_eq!(crate::effect_info(id).unwrap().menu, ["Effect", "Color Effects"]); - } + assert!(crate::is_adjustment(DUOTONE)); + assert_eq!(crate::effect_info(DUOTONE).unwrap().menu, ["Effect", "Color Effects"]); + assert!(!crate::is_adjustment("stylize.dropShadow"), "an effect outside the add-on is not one"); } #[test] diff --git a/crates/effects/src/pixel/tests.rs b/crates/effects/src/pixel/tests.rs index b0c5332c29..f389c399e7 100644 --- a/crates/effects/src/pixel/tests.rs +++ b/crates/effects/src/pixel/tests.rs @@ -1065,60 +1065,6 @@ fn linear_light_blur_mixes_light_not_values() { } } -/// Timings on a 2000 × 2000 raster (`cargo test -p vectorcraft-effects --release -- --ignored -/// --nocapture pixel_timings`). -#[test] -#[ignore] -fn pixel_timings() { - let (w, h) = (2000, 2000); - let src = image(w, h, |x, y| [(x % 256) as u8, (y % 256) as u8, ((x ^ y) % 256) as u8, 255]); - let s = PixelSpace { - to_doc: Affine::IDENTITY, - px: 1.0, - center: Point::new(1000.0, 1000.0), - size: vectorcraft_geom::Vec2::new(2000.0, 2000.0), - channels: Channels::Rgb, - line: 1.0, - extent: 0.0, - }; - let cases = [ - ("blur.radial", json!({"quality": "draft"})), - ("blur.radial", json!({"quality": "good"})), - ("blur.radial", json!({"quality": "best", "method": "zoom"})), - ("blur.smart", json!({"quality": "low"})), - ("blur.smart", json!({"quality": "high", "radius": 30})), - ("sharpen.unsharpMask", json!({"radius": 20})), - ("brushStrokes.accentedEdges", json!({"edgeWidth": 14})), - ("brushStrokes.angledStrokes", json!({"strokeLength": 50})), - ("brushStrokes.crosshatch", json!({"strokeLength": 50, "strength": 3})), - ("brushStrokes.darkStrokes", json!({})), - ("brushStrokes.inkOutlines", json!({"strokeLength": 50})), - ("brushStrokes.spatter", json!({"sprayRadius": 25})), - ("brushStrokes.sprayedStrokes", json!({"strokeLength": 20, "sprayRadius": 25})), - ("brushStrokes.sumiE", json!({"strokeWidth": 15})), - ("pixelate.colorHalftone", json!({"maxRadius": 4})), - ("pixelate.crystallize", json!({"cellSize": 3})), - ("pixelate.crystallize", json!({"cellSize": 300})), - ("pixelate.mezzotint", json!({"type": "grainyDots"})), - ("pixelate.pointillize", json!({"cellSize": 3})), - ("pixelate.pointillize", json!({"cellSize": 300})), - ("texture.craquelure", json!({"crackSpacing": 2})), - ("texture.craquelure", json!({"crackSpacing": 100})), - ("texture.grain", json!({"grainType": "clumped"})), - ("texture.mosaicTiles", json!({"tileSize": 2})), - ("texture.patchwork", json!({"squareSize": 0})), - ("texture.stainedGlass", json!({"cellSize": 2})), - ("texture.texturizer", json!({"texture": "sandstone", "scaling": 50})), - ("texture.texturizer", json!({"texture": "burlap"})), - ]; - for (id, p) in cases { - let mut d = src.clone(); - let t = std::time::Instant::now(); - fx(id, p.clone()).apply(&mut d, w, h, &s); - println!("{id} {p}: {:?}", t.elapsed()); - } -} - #[test] fn pixelate_params_take_defaults_and_stay_in_range() { assert_eq!(fx("pixelate.colorHalftone", json!({})), PixelFx::ColorHalftone { max_radius: 8.0, angles: [108.0, 162.0, 90.0, 45.0] }); diff --git a/crates/effects/src/solids/wireframe/tests.rs b/crates/effects/src/solids/wireframe/tests.rs index cb92d59e72..b20d0fedf0 100644 --- a/crates/effects/src/solids/wireframe/tests.rs +++ b/crates/effects/src/solids/wireframe/tests.rs @@ -466,14 +466,16 @@ fn wireframe_mode_is_checked_against_the_edges_it_draws() { assert!(refused.contains("simplify the gradient"), "{refused}"); assert_eq!(crate::validate_revolve(&n, &wire), Ok(())); n.appearance.effects.push(crate::new_effect(crate::REVOLVE, &wire).unwrap()); - assert!(leaves(&drawn(&n)).iter().all(|(_, filled, stroke)| !filled && stroke.is_some())); + let edges = leaves(&drawn(&n)); + assert!(!edges.is_empty() && edges.iter().all(|(_, filled, stroke)| !filled && stroke.is_some()), "{} pieces", edges.len()); // On the fill. let fx = n.appearance.effects.remove(0); let at = n.appearance.items.iter().position(|i| matches!(i, AppearanceItem::Fill(_))).unwrap(); assert!(crate::revolve::validate_item_revolve(&n, &shaded, at, 0).is_err()); assert_eq!(crate::revolve::validate_item_revolve(&n, &wire, at, 0), Ok(())); n.appearance.items[at].effects_mut().push(fx); - assert!(leaves(&drawn(&n)).iter().all(|(_, filled, stroke)| !filled && stroke.is_some())); + let edges = leaves(&drawn(&n)); + assert!(!edges.is_empty() && edges.iter().all(|(_, filled, stroke)| !filled && stroke.is_some()), "{} pieces", edges.len()); } /// A 3D (Classic) effect ignores a `render` it does not take in a loaded file: it draws as before. diff --git a/crates/effects/src/stroke/tests_fit.rs b/crates/effects/src/stroke/tests_fit.rs index f7fecb9abc..343ef29c50 100644 --- a/crates/effects/src/stroke/tests_fit.rs +++ b/crates/effects/src/stroke/tests_fit.rs @@ -155,6 +155,7 @@ fn fitted_dashes_on_curves_and_degenerate_paths_stay_finite() { s.profile = profile.clone(); }); let o = line_outline(&mixed, &st, 4.0, 0.01); + assert!(!o.elements().is_empty(), "{pat:?}: the curve's dashes are drawn"); assert!(o.elements().iter().filter_map(|e| e.end_point()).all(|p| p.x.is_finite() && p.y.is_finite()), "{pat:?}"); } } diff --git a/crates/effects/src/stroke/tests_gradient.rs b/crates/effects/src/stroke/tests_gradient.rs index 55aeda8d7f..42a6723597 100644 --- a/crates/effects/src/stroke/tests_gradient.rs +++ b/crates/effects/src/stroke/tests_gradient.rs @@ -301,7 +301,9 @@ fn a_spread_gradient_runs_its_stops_along_the_stroke_that_many_times() { let mut st = stroke(10.0, mode); let g = Gradient { spread, repeats: 3, ..Gradient::default() }; st.paint = Paint::Gradient(Box::new(GradientPaint::new(g.clone()))); - for s in slices(&bp, &st) { + let pieces = slices(&bp, &st); + assert!(!pieces.is_empty(), "{mode:?} {spread:?}: the stroke is painted in slices"); + for s in pieces { let Paint::Gradient(p) = s.paint(&g.unrolled()) else { panic!("a gradient slice") }; let geom = p.geom.unwrap(); for u in [0.1, 0.5, 0.9] { diff --git a/crates/effects/src/tests.rs b/crates/effects/src/tests.rs index aa77e45b2f..dadbd35ae8 100644 --- a/crates/effects/src/tests.rs +++ b/crates/effects/src/tests.rs @@ -247,15 +247,14 @@ fn a_warp_draws_with_the_map_its_version_names() { fn a_warp_bends_a_flat_box_as_the_middle_of_its_patch() { let anchors = |p: &PathData| p.subpaths.iter().flat_map(|s| s.anchors.clone()).collect::<Vec<_>>(); let vertical = shapes::line(Point::new(100.0, 0.0), Point::new(100.0, 100.0)); - let out = run("warp.arc", json!({"bend": 50, "version": 1}), &vertical); - assert!(anchors(&out).iter().all(|a| close(a.p.x, 100.0, 1e-9) && close(a.h_in.x, 100.0, 1e-9) && close(a.h_out.x, 100.0, 1e-9)), "{out:?}"); + let out = anchors(&run("warp.arc", json!({"bend": 50, "version": 1}), &vertical)); + assert!(out.len() >= 2, "{out:?}"); + assert!(out.iter().all(|a| close(a.p.x, 100.0, 1e-9) && close(a.h_in.x, 100.0, 1e-9) && close(a.h_out.x, 100.0, 1e-9)), "{out:?}"); let horizontal = shapes::line(Point::new(0.0, 50.0), Point::new(200.0, 50.0)); for style in ["bulge", "fisheye", "inflate", "squeeze"] { - let out = run(&format!("warp.{style}"), json!({"bend": 50, "version": 1}), &horizontal); - assert!( - anchors(&out).iter().all(|a| close(a.p.y, 50.0, 1e-9) && close(a.h_in.y, 50.0, 1e-9) && close(a.h_out.y, 50.0, 1e-9)), - "{style}: {out:?}" - ); + let out = anchors(&run(&format!("warp.{style}"), json!({"bend": 50, "version": 1}), &horizontal)); + assert!(out.len() >= 2, "{style}: {out:?}"); + assert!(out.iter().all(|a| close(a.p.y, 50.0, 1e-9) && close(a.h_in.y, 50.0, 1e-9) && close(a.h_out.y, 50.0, 1e-9)), "{style}: {out:?}"); } } @@ -2084,18 +2083,6 @@ fn bad_params_fall_back_to_defaults() { assert!(close(out.bounds().unwrap().width(), 124.0, 0.1)); } -#[test] -#[ignore] -fn bench_catalog_lookup() { - let t = std::time::Instant::now(); - let mut n = 0; - for _ in 0..10_000 { - n += crate::is_geometry("distort.roughen") as usize; - n += crate::merged_params("stylize.dropShadow", &serde_json::Value::Null).as_object().unwrap().len(); - } - eprintln!("10k lookups: {:?} ({n})", t.elapsed()); -} - #[test] fn a_repeat_of_a_symbol_whose_art_is_a_repeat_shares_the_instance_budget() { use std::sync::Arc; From beeeacafe5f12337dae918cd151a403b9a2ecf89 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 17:25:24 -0800 Subject: [PATCH 075/112] Tests: text and doc tests check what the code returns, not only that it is there Tests in vectorcraft-text and vectorcraft-doc that could pass on an empty result, or that only checked a result exists, now assert the values: - Blend: gradient steps assert their stop count before checking each stop's swatch, tint and plates; the odd dash blended to solid asserts the whole pattern; a copied step asserts its members. - Symbols: limiting depth keeps every symbol; a stroke override on type keeps the run it styles. - File fonts: an extreme descent clamps to the lowest table value and the Windows descent still fits. - Invert wrap on a tangled shape asserts the line still meets it. - Bidi, ligature carets, Thai and whitespace fallback: the glyph and line counts are asserted, Hebrew points stay in their letters' clusters, and every character of an isolate test has a glyph. - Glyph categories, trace views, compound shape modes and digit systems check written-out ids instead of a round trip over every value. Removed joins_on_a_circle_are_measured, which printed measurements and asserted nothing, and chord_placement_leaves_the_join_gap_above_the_baseline, which checked arithmetic done in the test itself; joined_glyphs_meet_on_a_curved_path covers joined type on a curve. --- crates/doc/src/blend.rs | 20 +++++- crates/doc/src/compound_shape.rs | 9 ++- crates/doc/src/depth.rs | 1 + crates/doc/src/symbol_overrides.rs | 1 + crates/doc/src/text/tests.rs | 9 ++- crates/doc/src/trace.rs | 9 ++- crates/text/src/file_font.rs | 11 ++- crates/text/src/fontdb/gsub.rs | 8 ++- crates/text/src/layout/region.rs | 1 + crates/text/src/tests.rs | 3 + crates/text/src/tests/bidi.rs | 9 +++ crates/text/src/tests/ligature_carets.rs | 3 +- crates/text/src/tests/path_joins.rs | 86 +----------------------- crates/text/src/tests/sysfonts.rs | 1 + 14 files changed, 62 insertions(+), 109 deletions(-) diff --git a/crates/doc/src/blend.rs b/crates/doc/src/blend.rs index 2770471f70..7c40d9d133 100644 --- a/crates/doc/src/blend.rs +++ b/crates/doc/src/blend.rs @@ -2784,10 +2784,13 @@ mod tests { Paint::Gradient(Box::new(GradientPaint::new(Gradient { stops, ..Gradient::default() }))) }; let Paint::Gradient(m) = lerp_paint(&spot_gradient(0.2), &spot_gradient(1.0), 0.5) else { panic!() }; + assert_eq!(m.gradient.stops.len(), 2); assert!(m.gradient.stops.iter().all(|s| s.swatch.as_deref() == Some("Spot") && (s.tint - 0.6).abs() < 1e-6), "{:?}", m.gradient.stops); let Paint::Gradient(m) = lerp_paint(&tinted(0.2), &spot_gradient(1.0), 0.5) else { panic!() }; + assert_eq!(m.gradient.stops.len(), 2); assert!(m.gradient.stops.iter().all(|s| s.swatch.as_deref() == Some("Spot") && (s.tint - 0.6).abs() < 1e-6), "{:?}", m.gradient.stops); let Paint::Gradient(m) = lerp_paint(&Paint::solid(Color::BLACK), &spot_gradient(1.0), 0.5) else { panic!() }; + assert_eq!(m.gradient.stops.len(), 2); assert!(m.gradient.stops.iter().all(|s| s.swatch.is_none()), "{:?}", m.gradient.stops); } @@ -2840,6 +2843,7 @@ mod tests { let a = gradient_paint(vec![spot_stop(0.0, 0.2, Some(p)), spot_stop(1.0, 0.2, Some(p))]); let b = gradient_paint(vec![spot_stop(0.0, 1.0, Some(q)), spot_stop(1.0, 1.0, Some(q))]); let Paint::Gradient(m) = lerp_paint(&a, &b, 0.25) else { panic!() }; + assert_eq!(m.gradient.stops.len(), 2); for s in &m.gradient.stops { assert_eq!(s.swatch.as_deref(), Some("Spot")); assert!((s.tint - 0.4).abs() < 1e-6, "{}", s.tint); @@ -2848,6 +2852,7 @@ mod tests { // Without plates on either side the steps print the spot ink alone, as before. let bare = |tint| gradient_paint(vec![spot_stop(0.0, tint, None), spot_stop(1.0, tint, None)]); let Paint::Gradient(m) = lerp_paint(&bare(0.2), &bare(1.0), 0.5) else { panic!() }; + assert_eq!(m.gradient.stops.len(), 2); assert!(m.gradient.stops.iter().all(|s| s.plates.is_none()), "{:?}", m.gradient.stops); } @@ -2882,10 +2887,12 @@ mod tests { let with = gradient_paint(vec![spot_stop(0.0, 1.0, Some(p)), spot_stop(1.0, 1.0, Some(p))]); let without = gradient_paint(vec![spot_stop(0.0, 1.0, None), spot_stop(1.0, 1.0, None)]); let Paint::Gradient(m) = lerp_paint(&without, &with, 0.25) else { panic!() }; + assert_eq!(m.gradient.stops.len(), 2); assert!(m.gradient.stops.iter().all(|s| s.swatch.as_deref() == Some("Spot")), "{:?}", m.gradient.stops); m.gradient.stops.iter().for_each(|s| assert_plates(s.plates, [0.1, 0.2, 0.0, 0.05])); // The ends keep their own plates. let Paint::Gradient(m) = lerp_paint(&without, &with, 0.0) else { panic!() }; + assert_eq!(m.gradient.stops.len(), 2); assert!(m.gradient.stops.iter().all(|s| s.plates.is_none()), "{:?}", m.gradient.stops); // Another swatch, or an unlinked stop: process steps with no plates, as before. @@ -2897,6 +2904,7 @@ mod tests { let plain = gradient_paint(vec![plain.clone(), GradientStop { offset: 1.0, ..plain }]); for b in [&other, &plain] { let Paint::Gradient(m) = lerp_paint(&with, b, 0.5) else { panic!() }; + assert_eq!(m.gradient.stops.len(), 2); assert!(m.gradient.stops.iter().all(|s| s.swatch.is_none() && s.plates.is_none()), "{:?}", m.gradient.stops); } } @@ -2906,11 +2914,14 @@ mod tests { let p = [0.4, 0.8, 0.0, 0.2]; let gradient = gradient_paint(vec![spot_stop(0.0, 1.0, Some(p)), spot_stop(1.0, 1.0, Some(p))]); let Paint::Gradient(g) = &gradient else { panic!() }; - assert!(solid_gradient(Color::BLACK, Some("Spot"), 0.2, &g.gradient).stops.iter().all(|s| s.plates.is_none())); + let linked = solid_gradient(Color::BLACK, Some("Spot"), 0.2, &g.gradient); + assert_eq!(linked.stops.len(), 2); + assert!(linked.stops.iter().all(|s| s.plates.is_none() && s.swatch.as_deref() == Some("Spot") && s.tint == 0.2), "{:?}", linked.stops); let solid = Paint::Solid { color: Color::cmyk(1.0, 0.7, 0.0, 0.4).tinted(0.2), swatch: Some("Spot".into()), tint: 0.2 }; // The solid's end has no plates: they grow from none toward the gradient's, both ways round. for (a, b, t) in [(&solid, &gradient, 0.25), (&gradient, &solid, 0.75)] { let Paint::Gradient(m) = lerp_paint(a, b, t) else { panic!() }; + assert_eq!(m.gradient.stops.len(), 2); for s in &m.gradient.stops { assert_eq!(s.swatch.as_deref(), Some("Spot")); assert!((s.tint - 0.4).abs() < 1e-6, "{}", s.tint); @@ -2919,6 +2930,7 @@ mod tests { } // A process solid unlinks the steps, and they take no plates. let Paint::Gradient(m) = lerp_paint(&Paint::solid(Color::BLACK), &gradient, 0.5) else { panic!() }; + assert_eq!(m.gradient.stops.len(), 2); assert!(m.gradient.stops.iter().all(|s| s.swatch.is_none() && s.plates.is_none()), "{:?}", m.gradient.stops); } @@ -3401,7 +3413,8 @@ mod tests { #[test] fn odd_dash_blends_to_solid_with_closed_gaps() { let d = lerp_dash(Some(&Dash { pattern: vec![2.0, 3.0, 4.0], ..Default::default() }), None, 1.0).unwrap(); - assert!(d.pattern.iter().skip(1).step_by(2).all(|g| *g == 0.0), "{:?}", d.pattern); + // Doubled to dash, gap, dash, gap, dash, gap; each dash takes the gap after it. + assert_eq!(d.pattern, [5.0, 0.0, 6.0, 0.0, 7.0, 0.0]); } #[test] @@ -3412,7 +3425,8 @@ mod tests { let mid = lerp_node(&a, &b, 0.4); let mut ids = vec![]; mid.walk(&mut |n| ids.push(n.id)); - assert!(ids.iter().all(|i| *i == NodeId(0)), "{ids:?}"); + // The step and its two members, all of them new. + assert_eq!(ids, [NodeId(0); 3]); } /// A blend of `a` and `b` spaced by `spacing`. diff --git a/crates/doc/src/compound_shape.rs b/crates/doc/src/compound_shape.rs index 3b36ff86dd..f3f4b83939 100644 --- a/crates/doc/src/compound_shape.rs +++ b/crates/doc/src/compound_shape.rs @@ -64,11 +64,10 @@ mod tests { #[test] fn modes_read_back_and_unknown_ones_are_add() { - for m in ShapeMode::ALL { - let v = serde_json::to_value(m).unwrap(); - assert_eq!(v, serde_json::json!(m.name())); - assert_eq!(serde_json::from_value::<ShapeMode>(v).unwrap(), m); - } + assert_eq!(serde_json::to_value(ShapeMode::Subtract).unwrap(), serde_json::json!("subtract")); + assert_eq!(serde_json::from_value::<ShapeMode>(serde_json::json!("exclude")).unwrap(), ShapeMode::Exclude); + assert_eq!(ShapeMode::parse("intersect"), Some(ShapeMode::Intersect)); + assert_eq!(ShapeMode::parse("Intersect"), None); for v in [serde_json::json!("divide"), serde_json::json!(3), serde_json::json!(null), serde_json::json!({"a": [1]})] { assert_eq!(serde_json::from_value::<ShapeMode>(v).unwrap(), ShapeMode::Add); } diff --git a/crates/doc/src/depth.rs b/crates/doc/src/depth.rs index c846dfc1c6..3872e16a54 100644 --- a/crates/doc/src/depth.rs +++ b/crates/doc/src/depth.rs @@ -613,6 +613,7 @@ mod tests { d.limit_depth_noting(&mut warnings); assert_eq!(warnings, [symbols_note()]); assert!(!d.too_deep(None), "{count} {last}"); + assert_eq!(d.symbols.len(), count, "every symbol is kept"); assert!(d.symbols.iter().all(|s| s.art.children().is_some()), "the art is still a group"); } // An edit that makes one hold itself is seen, whatever else stayed as it was. diff --git a/crates/doc/src/symbol_overrides.rs b/crates/doc/src/symbol_overrides.rs index 241c61fba8..d9017815c7 100644 --- a/crates/doc/src/symbol_overrides.rs +++ b/crates/doc/src/symbol_overrides.rs @@ -253,6 +253,7 @@ mod tests { let mut a = Node::group(NodeId(1), vec![Arc::new(text)]); apply(&mut a, &[SymbolOverride { path: vec![0], stroke: Some(red.clone()), ..Default::default() }]); let Some(NodeKind::Text(t)) = part(&a, &[0]).map(|n| &n.kind) else { panic!("type") }; + assert_eq!(t.runs.len(), 1); assert!(t.runs.iter().all(|r| r.style.stroke == red && r.style.stroke_width == 1.0), "the stroke draws at 1 pt"); // A path whose stroke has neither paint nor weight gets 1 pt too. diff --git a/crates/doc/src/text/tests.rs b/crates/doc/src/text/tests.rs index 9371947565..607fa12238 100644 --- a/crates/doc/src/text/tests.rs +++ b/crates/doc/src/text/tests.rs @@ -217,11 +217,10 @@ fn indic_digits_map_to_their_scripts_block() { assert_eq!(map(d, "a-Z ٪"), "a-Z ٪"); } assert_eq!(map(Digits::Devanagari, "page 12"), "page १२"); - for d in Digits::ALL { - assert_eq!(serde_json::to_value(d).unwrap(), d.id()); - assert_eq!(serde_json::from_value::<Digits>(d.id().into()).unwrap(), d); - assert_eq!(Digits::from_id(d.id()), Some(d)); - } + assert_eq!(serde_json::to_value(Digits::Devanagari).unwrap(), "devanagari"); + assert_eq!(serde_json::from_value::<Digits>("farsi".into()).unwrap(), Digits::Farsi); + assert_eq!(Digits::Malayalam.id(), "malayalam"); + assert_eq!(Digits::from_id("default"), Some(Digits::Default)); assert_eq!(Digits::from_id("roman"), None); assert!(serde_json::from_value::<Digits>("roman".into()).is_err()); } diff --git a/crates/doc/src/trace.rs b/crates/doc/src/trace.rs index a2d17cc990..f462e18300 100644 --- a/crates/doc/src/trace.rs +++ b/crates/doc/src/trace.rs @@ -98,11 +98,10 @@ mod tests { #[test] fn ids_round_trip_and_unknown_views_show_the_result() { - for v in TraceView::ALL { - assert_eq!(TraceView::from_id(v.id()), Some(v)); - assert_eq!(TraceView::from_id(&v.id().to_ascii_uppercase()), Some(v)); - assert!(v.shows_result() || v.shows_outlines() || v.shows_source(), "{v:?} shows something"); - } + assert_eq!(TraceView::Source.id(), "sourceImage"); + assert_eq!(TraceView::from_id("outlinesWithSourceImage"), Some(TraceView::OutlinesWithSource)); + assert_eq!(TraceView::from_id("TRACINGRESULT"), Some(TraceView::Result), "case does not matter"); + assert_eq!(TraceView::from_id("tracing"), None); let mut g = Node::group(crate::NodeId(1), vec![]); assert_eq!(g.trace_view(), TraceView::Result); g.extras_mut().trace = Some(Box::new(serde_json::json!({"view": "outlines"}))); diff --git a/crates/text/src/file_font.rs b/crates/text/src/file_font.rs index 21215aa5f5..077bbae28d 100644 --- a/crates/text/src/file_font.rs +++ b/crates/text/src/file_font.rs @@ -456,7 +456,14 @@ mod tests { fn extreme_negative_descent_does_not_overflow() { let mut i = info(); i.descent = -100_000.0; - let bytes = build_file_font(&i, &glyphs("a")); - assert!(bytes.is_some()); + let bytes = build_file_font(&i, &glyphs("a")).unwrap(); + // The descent stops at the lowest value the tables hold, and the Windows descent, its + // magnitude, still fits. + let font = skrifa::FontRef::new(&bytes).unwrap(); + let metrics = font.metrics(skrifa::instance::Size::unscaled(), skrifa::instance::LocationRef::default()); + assert_eq!(metrics.descent, f32::from(i16::MIN)); + assert_eq!(metrics.ascent, 1760.0, "the ascent is the default 0.88 em"); + use skrifa::raw::TableProvider; + assert_eq!(font.os2().unwrap().us_win_descent(), 32_768); } } diff --git a/crates/text/src/fontdb/gsub.rs b/crates/text/src/fontdb/gsub.rs index 2fef163351..9c8daf19bf 100644 --- a/crates/text/src/fontdb/gsub.rs +++ b/crates/text/src/fontdb/gsub.rs @@ -687,9 +687,11 @@ mod tests { #[test] fn kinds_round_trip_through_their_ids() { - for kind in GlyphCategoryKind::all() { - assert_eq!(GlyphCategoryKind::from_id(&kind.id()), Some(kind)); - } + assert_eq!(GlyphCategoryKind::StylisticSet(3).id(), "ss03"); + assert_eq!(GlyphCategoryKind::from_id("ss03"), Some(GlyphCategoryKind::StylisticSet(3))); + assert_eq!(GlyphCategoryKind::from_id("ss3"), None); + assert_eq!(GlyphCategoryKind::from_id("stylisticAlternates"), Some(GlyphCategoryKind::StylisticAlternates)); + assert_eq!(GlyphCategoryKind::from_id("figures"), Some(GlyphCategoryKind::Figures)); assert_eq!(GlyphCategoryKind::StylisticSet(7).features(), [*b"ss07"]); assert_eq!(GlyphCategoryKind::StylisticSet(20).features(), [*b"ss20"]); assert_eq!(GlyphCategoryKind::from_id("ss21"), None); diff --git a/crates/text/src/layout/region.rs b/crates/text/src/layout/region.rs index f2a0f1bbfe..033e632d92 100644 --- a/crates/text/src/layout/region.rs +++ b/crates/text/src/layout/region.rs @@ -1696,6 +1696,7 @@ fn invert_wrap_with_an_offset_bounds_its_work_on_a_tangled_shape() { assert!(GROWN_BAND_WORK.get() <= 2 * MAX_INVERT_WRAP_WORK, "{} steps", GROWN_BAND_WORK.get()); let contour: Vec<(f64, f64)> = star.iter().map(|p| (p.x, p.y)).collect(); let spans = invert_wrap_spans(&contour, 1.0, 10.0, 90.0); + assert!(!spans.is_empty(), "the line still meets the shape"); assert!(spans.iter().all(|&(a, b)| a >= 4.0 && b <= 96.0), "{spans:?}"); let square = [(40.0, 40.0), (60.0, 40.0), (60.0, 60.0), (40.0, 60.0)]; assert_spans(&invert_wrap_spans(&square, f64::NAN, 45.0, 55.0), &invert_wrap_spans(&square, 0.0, 45.0, 55.0)); diff --git a/crates/text/src/tests.rs b/crates/text/src/tests.rs index 40b29331f9..eb81d3c096 100644 --- a/crates/text/src/tests.rs +++ b/crates/text/src/tests.rs @@ -1028,6 +1028,7 @@ fn whitespace_the_primary_font_lacks_takes_the_fallback_face() { assert!((width - 60.0).abs() < 0.01, "あ あ sets at 3 em: {:?}", l.glyphs.iter().map(|g| g.advance).collect::<Vec<_>>()); assert_ne!(l.glyphs[1].font_id, primary.id()); let l = layout(db(), &point("a\tb", style(20.0))); + assert_eq!(l.glyphs.len(), 3, "{:?}", l.glyphs); assert!(l.glyphs.iter().all(|g| g.font_id == primary.id())); } @@ -2649,6 +2650,8 @@ fn thai_loanwords_stay_whole() { let lines: Vec<&str> = l.lines.iter().map(|ln| &text[ln.start..ln.end]).collect(); // No line ends inside the word, whatever the Thai font's widths put beside it. let word = text.find("โปรแกรม").unwrap(); + assert!(lines.len() > 1, "70 pt wraps the sentence: {lines:?}"); + assert!(lines.iter().any(|ln| ln.contains("โปรแกรม")), "one line holds the word: {lines:?}"); assert!(l.lines.iter().all(|ln| ln.end <= word || ln.end >= word + "โปรแกรม".len()), "{lines:?}"); } diff --git a/crates/text/src/tests/bidi.rs b/crates/text/src/tests/bidi.rs index a8f035aa6e..4a761dda20 100644 --- a/crates/text/src/tests/bidi.rs +++ b/crates/text/src/tests/bidi.rs @@ -254,6 +254,9 @@ fn paragraph_direction_is_independent_and_neutrals_do_not_force_ltr() { fn hebrew_marks_stay_with_base_clusters() { let s = "שָׁלוֹם"; let l = text_layout(s); + // Each glyph's source starts at one of the four letters, never at a point after one. + let starts: std::collections::BTreeSet<usize> = l.glyphs.iter().map(|g| g.byte).collect(); + assert_eq!(starts, [0, 6, 8, 12].into(), "{:?}", l.glyphs.iter().map(|g| (g.byte, g.len)).collect::<Vec<_>>()); for g in &l.glyphs { assert!(s.get(g.byte..g.byte + g.len).is_some()); } @@ -413,6 +416,10 @@ fn bidi_isolates_numbers_and_brackets_keep_valid_clusters() { for g in &l.glyphs { assert!(s.get(g.byte..g.byte + g.len).is_some()); } + // Every character but the isolate marks is drawn by a glyph whose source holds it. + for (i, c) in s.char_indices().filter(|&(_, c)| !matches!(c, '\u{2067}' | '\u{2069}')) { + assert!(l.glyphs.iter().any(|g| (g.byte..g.byte + g.len).contains(&i)), "{s}: {c:?} at {i} has no glyph"); + } assert!(!selection_quads(&l, 0, s.len()).is_empty()); } } @@ -432,6 +439,7 @@ fn right_aligned_wrapped_rtl_keeps_trailing_spaces_outside_content() { #[test] fn visual_arrows_cross_rtl_paragraph_boundaries() { let l = text_layout("שלום\nעולם"); + assert_eq!(l.lines.len(), 2); assert!(l.lines.iter().all(|l| l.rtl)); assert_eq!(caret_horizontal(&l, 8, false), 9); assert_eq!(caret_horizontal(&l, 9, true), 8); @@ -492,6 +500,7 @@ fn paragraph_direction_overrides_the_first_strong_character() { #[test] fn left_to_right_text_is_untouched() { let l = text_layout("Plain text, 123 (and more)."); + assert_eq!((l.glyphs.len(), l.lines.len()), ("Plain text, 123 (and more).".len(), 1)); assert!(l.glyphs.iter().all(|g| !g.rtl) && l.lines.iter().all(|l| !l.rtl)); let bytes: Vec<_> = l.glyphs.iter().map(|g| g.byte).collect(); assert!(bytes.windows(2).all(|w| w[0] < w[1])); diff --git a/crates/text/src/tests/ligature_carets.rs b/crates/text/src/tests/ligature_carets.rs index 9189bc2f0b..392c1295a6 100644 --- a/crates/text/src/tests/ligature_carets.rs +++ b/crates/text/src/tests/ligature_carets.rs @@ -529,7 +529,8 @@ fn manual_kerning_moves_a_right_to_left_ligature_stop_with_the_glyph() { fn a_letter_and_its_mark_has_no_inner_stop() { let db = FontDb::with_font_dirs(vec![]); let l = layout(&db, &point("e\u{0301}", "Source Sans 3")); - assert!(l.glyphs.iter().all(|g| g.carets.is_empty()), "{:?}", l.glyphs); + assert!(!l.glyphs.is_empty()); + assert!(l.glyphs.iter().all(|g| (g.byte, g.len) == (0, 3) && g.carets.is_empty()), "{:?}", l.glyphs); } /// On a path, a click on either half of the ligature goes to its nearer stop, and the selection of diff --git a/crates/text/src/tests/path_joins.rs b/crates/text/src/tests/path_joins.rs index 1ac96e3f0f..467b107b9d 100644 --- a/crates/text/src/tests/path_joins.rs +++ b/crates/text/src/tests/path_joins.rs @@ -3,7 +3,7 @@ //! stroke, is the measure. Fonts are installed ones (none is kept in the repository): the tests //! that need an Arabic font say so and stop without one. use crate::*; -use kurbo::{Affine, BezPath, Point, Shape}; +use kurbo::{BezPath, Point, Shape}; use std::sync::Arc; use vectorcraft_doc::{CharStyle, TextKind}; @@ -20,90 +20,6 @@ fn circle(r: f64) -> vectorcraft_geom::PathData { vectorcraft_geom::PathData::from_bezpath(&kurbo::Circle::new((0.0, 0.0), r).to_path(1e-3)) } -/// Type `s` in `style` on a circle of radius `r`, the whole loop for it. -fn on_circle(s: &str, style: CharStyle, r: f64) -> TextLayout { - let mut t = TextObject::point(Point::ZERO, s, style); - t.kind = TextKind::OnPath { path: circle(r), start: 0.25, end: None }; - layout(FontDb::global(), &t) -} - -/// For each pair of neighbouring glyphs on the line (in visual order, inside a word), how far -/// apart the right edge of the left one and the left edge of the right one are, at the baseline -/// and `h` above it. -fn gaps(l: &TextLayout, text: &str, h: f64) -> Vec<(f64, f64)> { - // Visual order: the glyphs as placed, sorted along the line by where their left edge is on it. - let edges: Vec<(Point, Point, Point, Point, usize)> = l - .glyphs - .iter() - .filter(|g| text.get(g.byte..g.byte + g.len).is_some_and(|c| !c.trim().is_empty())) - .map(|g| { - let [a, b, ..] = g.xf.as_coeffs(); - let sx = a.hypot(b); - let w = g.advance / sx; - let up = h / sx; - (g.xf * Point::new(0.0, 0.0), g.xf * Point::new(w, 0.0), g.xf * Point::new(0.0, -up), g.xf * Point::new(w, -up), g.byte) - }) - .collect(); - // Which word a byte is in: the spaces before it. - let word = |b: usize| text.get(..b).map_or(0, |t| t.chars().filter(|c| c.is_whitespace()).count()); - edges.windows(2).filter(|w| word(w[0].4) == word(w[1].4)).map(|w| ((w[0].1 - w[1].0).hypot(), (w[0].3 - w[1].2).hypot())).collect() -} - -/// The largest gaps (baseline, joining height) of type `s` on a circle of radius `r` at `size`. -fn worst(face: &FontFace, s: &str, size: f64, r: f64) -> (f64, f64) { - let style = CharStyle { font_family: face.family.clone(), font_style: face.style.clone(), size, ..CharStyle::default() }; - let l = on_circle(s, style, r); - gaps(&l, s, size * 0.25).into_iter().fold((0.0, 0.0), |(a, b), (x, y)| (f64::max(a, x), f64::max(b, y))) -} - -/// The measure, printed: joined Arabic and separate Latin on circles at three sizes. -#[test] -fn joins_on_a_circle_are_measured() { - let Some(face) = arabic_face() else { - eprintln!("SKIPPED: joins_on_a_circle_are_measured; no installed font covers Arabic"); - return; - }; - eprintln!("ASSERTIONS RUN: joins_on_a_circle_are_measured; Arabic font {} {}", face.family, face.style); - for size in [12.0, 29.0, 72.0] { - for r in [60.0, 110.0, 300.0] { - let (b, j) = worst(&face, "سلسلة متصلة", size, r); - let (lb, lj) = worst(&face, "minimum", size, r); - eprintln!("size {size:>4} r {r:>5}: arabic baseline {b:.4} join {j:.4} | latin baseline {lb:.4} at {lj:.4}"); - } - } - let _ = BezPath::new(); - let _ = Affine::IDENTITY; -} - -/// Chord placement, worked out here only (not in the layout): each glyph's baseline ends on the -/// circle, the glyph turned to the chord between them. Neighbours then meet at the baseline, and `h` -/// above it they stand apart by `h` times the angle between their chords, (a_i + a_{i+1}) / 2R. -#[test] -fn chord_placement_leaves_the_join_gap_above_the_baseline() { - let Some(face) = arabic_face() else { - eprintln!("SKIPPED: chord_placement_leaves_the_join_gap_above_the_baseline; no installed font covers Arabic"); - return; - }; - let (size, r) = (29.0, 110.0); - let style = CharStyle { font_family: face.family.clone(), font_style: face.style.clone(), size, ..CharStyle::default() }; - let s = "سلسلة"; - let l = on_circle(s, style, r); - let h = size * 0.25; - let advances: Vec<f64> = l.glyphs.iter().map(|g| g.advance).filter(|a| *a > 1e-6).collect(); - let mut worst: f64 = 0.0; - for w in advances.windows(2) { - let (a, b) = (w[0], w[1]); - // The chords' directions differ by the angle between their middles on the circle. - let turn = (a + b) / (2.0 * r); - let gap = 2.0 * h * (turn * 0.5).sin(); - let predicted = h * (a + b) / (2.0 * r); - assert!((gap - predicted).abs() < 0.01, "{gap} vs {predicted}"); - worst = worst.max(gap); - } - eprintln!("chord placement at {size} pt on radius {r}: baseline gap 0, join-height gap {worst:.3}"); - assert!(worst > 0.5, "chord placement alone leaves a visible gap: {worst}"); -} - /// A circle of radius `r` run the other way (clockwise): type on it stands on the inside, its /// tops towards the centre, as Flip puts it. fn circle_reversed(r: f64) -> vectorcraft_geom::PathData { diff --git a/crates/text/src/tests/sysfonts.rs b/crates/text/src/tests/sysfonts.rs index 246f589518..66ae287023 100644 --- a/crates/text/src/tests/sysfonts.rs +++ b/crates/text/src/tests/sysfonts.rs @@ -1151,6 +1151,7 @@ fn thai_falls_back_to_a_font_made_for_thai() { let l = layout(db, &TextObject::point(kurbo::Point::ZERO, "Thai ภาษาไทย", st)); let family = |g: &PositionedGlyph| db.face_by_id(g.font_id).map(|f| f.family.clone()).unwrap_or_default(); let (latin, thai_glyphs) = l.glyphs.split_at(5); + assert_eq!(thai_glyphs.len(), "ภาษาไทย".chars().count(), "a glyph for each Thai letter"); assert!(latin.iter().all(|g| family(g) == FALLBACK_FAMILY), "{:?}", latin.iter().map(family).collect::<Vec<_>>()); let first = crate::fontdb::THAI_FAMILIES.iter().find(|f| thai_glyphs.iter().all(|g| family(g).eq_ignore_ascii_case(f))); assert!(first.is_some(), "Thai drawn in {:?}; {thai} is installed", thai_glyphs.iter().map(family).collect::<Vec<_>>()); From f0dbad051c6778818ed916ea618fbc1a0276ee56 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 17:25:41 -0800 Subject: [PATCH 076/112] Tests: render and trace tests check what they claim Weak tests in vectorcraft-render and vectorcraft-trace now assert the behavior they name: - The stroke glow test checks that the glow is drawn and that four threads draw what one does, instead of only rendering. - The JPEG and palette id tests name saved ids and labels directly (gray, optimized, none, blackWhite), unknown and empty ids, instead of looping over every value and reading its own id back. - The trace presets test drops the loop over every preset name, which presets().len() already covers, and checks the [Default] and padded name lookups by their result. - Nested discs each get the disc below them as parent, checked exactly. - A 20 degree bend gets no corner under a 30 degree minimum turn, and gets one under a 10 degree minimum. - The gray BMP, reduced CMYK and tiled image tests check the size of what they read, and the long stroke tests check that one outline was made before checking that none is cropped. - The three drag timing probes assert that the frame after the drag is what a fresh renderer draws, in place of printing two hashes. --- crates/render/src/encode/tests_bmp.rs | 1 + crates/render/src/encode/tests_jpeg.rs | 17 ++++++----- crates/render/src/encode/tests_palette.rs | 17 +++++++---- crates/render/src/fx/tests.rs | 36 ++++++++++++----------- crates/render/src/tests/longstroke.rs | 14 +++++++-- crates/render/src/tests/memory.rs | 2 ++ crates/render/src/tests/viewraster.rs | 14 ++------- crates/trace/src/group.rs | 4 ++- crates/trace/src/logo/restore.rs | 8 ++++- crates/trace/src/tests.rs | 7 ++--- 10 files changed, 70 insertions(+), 50 deletions(-) diff --git a/crates/render/src/encode/tests_bmp.rs b/crates/render/src/encode/tests_bmp.rs index f458c1999b..64d3ecdb55 100644 --- a/crates/render/src/encode/tests_bmp.rs +++ b/crates/render/src/encode/tests_bmp.rs @@ -133,6 +133,7 @@ fn greys_and_impossible_combinations() { let px = art(w, h); for depth in [8, 24] { let img = decode(&bmp(&px, w, h, &BmpOptions { depth, gray: true, ..Default::default() }), craft_image_codecs::Format::Bmp); + assert_eq!(img.dimensions(), (w, h), "depth {depth}"); assert!(img.pixels().all(|p| p[0] == p[1] && p[1] == p[2]), "depth {depth}: greys"); } let bad = [ diff --git a/crates/render/src/encode/tests_jpeg.rs b/crates/render/src/encode/tests_jpeg.rs index 413781de13..375dcaf15a 100644 --- a/crates/render/src/encode/tests_jpeg.rs +++ b/crates/render/src/encode/tests_jpeg.rs @@ -164,15 +164,18 @@ fn colour_models_write_their_components_and_profiles() { #[test] fn model_and_method_ids_round_trip() { - for m in ColorModel::ALL { - assert_eq!(ColorModel::from_id(m.id()), Some(m)); - assert_eq!(ColorModel::from_id(m.label()), Some(m)); - } + // Saved options name a model or a method by id or label, in any case. + assert_eq!(ColorModel::from_id("cmyk"), Some(ColorModel::Cmyk)); + assert_eq!(ColorModel::from_id("RGB"), Some(ColorModel::Rgb)); + assert_eq!(ColorModel::from_id("gray"), Some(ColorModel::Gray)); + assert_eq!(ColorModel::from_id("Grayscale"), Some(ColorModel::Gray)); assert_eq!(ColorModel::from_id("grey"), Some(ColorModel::Gray)); - for m in Method::ALL { - assert_eq!(Method::from_id(m.id()), Some(m)); - } + assert_eq!(ColorModel::from_id("lab"), None); + assert_eq!(Method::from_id("optimized"), Some(Method::Optimized)); + assert_eq!(Method::from_id("baseline optimized"), Some(Method::Optimized)); + assert_eq!(Method::from_id("Progressive"), Some(Method::Progressive)); assert_eq!(Method::from_id("bogus"), None); + assert_eq!(Method::from_id(""), None); } /// A 20×10 pt document: a black-ink rectangle on the left half, an RGB red one on the right. diff --git a/crates/render/src/encode/tests_palette.rs b/crates/render/src/encode/tests_palette.rs index 837c62f359..d4067fc743 100644 --- a/crates/render/src/encode/tests_palette.rs +++ b/crates/render/src/encode/tests_palette.rs @@ -245,12 +245,17 @@ fn gif_decodes() { #[test] fn ids_round_trip() { - for r in Reduction::ALL { - assert_eq!(Reduction::from_id(r.id()), Some(r)); - } - for d in Dither::ALL { - assert_eq!(Dither::from_id(d.id()), Some(d)); - } + // Saved options name a reduction or a dither by id or label, in any case. + assert_eq!(Reduction::from_id("blackWhite"), Some(Reduction::BlackWhite)); + assert_eq!(Reduction::from_id("blackwhite"), Some(Reduction::BlackWhite)); + assert_eq!(Reduction::from_id("Black & White"), Some(Reduction::BlackWhite)); + assert_eq!(Reduction::from_id("selective"), Some(Reduction::Selective)); + assert_eq!(Reduction::from_id("restrictive"), None); + assert_eq!(Dither::from_id("none"), Some(Dither::None)); + assert_eq!(Dither::from_id("No Dither"), Some(Dither::None)); + assert_eq!(Dither::from_id("PATTERN"), Some(Dither::Pattern)); + assert_eq!(Dither::from_id("bayer"), None); + assert_eq!(Dither::from_id(""), None); } /// A `w`×`h` red image whose pixels have the opacity `alpha(x, y)`. diff --git a/crates/render/src/fx/tests.rs b/crates/render/src/fx/tests.rs index 757290ed1f..f843ce01f7 100644 --- a/crates/render/src/fx/tests.rs +++ b/crates/render/src/fx/tests.rs @@ -371,9 +371,16 @@ fn per_stroke_raster_effects_use_the_single_threaded_pipeline() { } d.remove(id).unwrap(); d.insert(Some(l), 0, n).unwrap(); - let mut r = Renderer::new(); - r.threads = 4; - let _ = r.render(&d, 100, 100, Affine::IDENTITY, &RenderOptions::default()); + let draw = |threads| { + let mut r = Renderer::new(); + r.threads = threads; + r.render(&d, 100, 100, Affine::IDENTITY, &RenderOptions::default()) + }; + let (threaded, single) = (draw(4), draw(1)); + // The stroke's glow shows outside it: red, where nothing else is drawn. + let glow = threaded.pixel(40, 14); + assert!(glow[3] > 0 && glow[0] > glow[1] && glow[0] > glow[2], "{glow:?}"); + assert!(threaded.pixels == single.pixels, "four threads draw what one does"); } #[test] @@ -1966,7 +1973,7 @@ fn rasters_made_over_moved_rasters_count_as_moved() { /// Reproduce #1257's moving, filtered rectangle: the first frame renders as before a drag, /// and the next eight render as the canvas renders a drag's frames (`interacting`). Then the /// eighth position renders as the canvas renders the frame after the drag, and that frame -/// renders once more with every raster cached. +/// renders once more with every raster cached. Both draw what a fresh renderer draws. /// Run with `cargo test -p vectorcraft-render texture_drag_perf -- --ignored --nocapture`. #[test] #[ignore = "manual timing probe; wall-clock performance depends on machine load"] @@ -2004,10 +2011,12 @@ fn texture_drag_perf() { } let mut time = |o: &RenderOptions| { let start = std::time::Instant::now(); - std::hint::black_box(r.render(&doc, 1800, 1500, view, o)); - start.elapsed().as_secs_f64() * 1000.0 + let image = r.render(&doc, 1800, 1500, view, o); + (start.elapsed().as_secs_f64() * 1000.0, image.pixels) }; - let (after, again) = (time(&opts), time(&opts)); + let ((after, after_px), (again, again_px)) = (time(&opts), time(&opts)); + let fresh = Renderer::new().render(&doc, 1800, 1500, view, &opts).pixels; + assert!(after_px == fresh && again_px == fresh, "{effect}: the frame after the drag draws what a fresh renderer draws"); ms.sort_by(f64::total_cmp); println!( "{effect}: moved CMYK rounded rectangle at 190.07%, DPI 1.5, 1800x1500: median {:.2} ms; samples {ms:?}; the frame after the drag {after:.2} ms, that frame again {again:.2} ms", @@ -2020,7 +2029,7 @@ fn texture_drag_perf() { /// view centered on the rectangle: the first frame renders as before a drag, and the next eight /// render as a drag's frames, once with `interacting` alone and once with `dragging` as well (as /// the canvas renders them). Then the eighth position renders as the canvas renders the frame -/// after the drag. The hashes of that frame and of a fresh renderer's frame compare builds. +/// after the drag, which draws what a fresh renderer draws. /// Run with `cargo test -p vectorcraft-render zoomed_drag_perf -- --ignored --nocapture`. #[test] #[ignore = "manual timing probe; wall-clock performance depends on machine load"] @@ -2030,12 +2039,6 @@ fn zoomed_drag_perf() { ("Gaussian Blur 8 pt", vec![("blur.gaussian", json!({"radius": 8}))]), ("Drop Shadow and Craquelure", vec![("stylize.dropShadow", json!({"blur": 7})), ("texture.craquelure", json!({}))]), ]; - let hash = |px: &[u8]| { - use std::hash::{Hash, Hasher}; - let mut h = std::hash::DefaultHasher::new(); - px.hash(&mut h); - h.finish() - }; for (name, effects) in sets { for zoom in [1.0, 4.0, 16.0, 64.0] { let base = doc_with(Rect::new(100.0, 100.0, 300.0, 250.0), Color::rgb(0.9, 0.4, 0.1), effects.clone()); @@ -2062,15 +2065,14 @@ fn zoomed_drag_perf() { let still = r.render(&doc, 2560, 1440, view, &opts); let after = start.elapsed().as_secs_f64() * 1000.0; let fresh = Renderer::new().render(&doc, 2560, 1440, view, &opts); + assert!(still.pixels == fresh.pixels, "{name} at {zoom}x, dragging {dragging}: the frame after the drag"); ms.sort_by(f64::total_cmp); println!( - "{name} at {:.0}%, dragging {dragging}: drag frames median {:.1} ms (min {:.1}, max {:.1}), {previewed} previewed; the frame after the drag {after:.1} ms; hashes {:016x} {:016x}", + "{name} at {:.0}%, dragging {dragging}: drag frames median {:.1} ms (min {:.1}, max {:.1}), {previewed} previewed; the frame after the drag {after:.1} ms", zoom * 100.0, (ms[3] + ms[4]) * 0.5, ms[0], ms[7], - hash(&still.pixels), - hash(&fresh.pixels) ); } } diff --git a/crates/render/src/tests/longstroke.rs b/crates/render/src/tests/longstroke.rs index a69ac094ae..28adeba7c2 100644 --- a/crates/render/src/tests/longstroke.rs +++ b/crates/render/src/tests/longstroke.rs @@ -275,12 +275,19 @@ fn short_dashed_strokes_are_outlined_whole() { let one = BezPath::from_vec(vec![kurbo::PathEl::MoveTo(Point::new(100.0, 100.0))]); let mut dot = one.clone(); dot.line_to((100.0, 100.0)); - for (what, bp) in - [("empty", BezPath::new()), ("one anchor", one), ("one anchor, closed on itself", dot), ("a ring of 40 anchors", ring(40, 80.0))] - { + // The ring is outlined once; the degenerate paths only have to draw what a whole outline draws. + for (what, bp, ring_of_40) in [ + ("empty", BezPath::new(), false), + ("one anchor", one, false), + ("one anchor, closed on itself", dot, false), + ("a ring of 40 anchors", ring(40, 80.0), true), + ] { let d = doc(&bp, st.clone()); let mut r = Renderer::new(); let img = render(&mut r, &d, Point::new(100.0, 100.0)); + if ring_of_40 { + assert_eq!(r.strokes.len(), 1, "{what}: one outline"); + } assert!(r.strokes.values().all(|e| e.crop.is_none()), "{what}: outlined whole"); assert!(img.pixels == whole(&d, Point::new(100.0, 100.0)).pixels, "{what}: the same pixels"); } @@ -393,6 +400,7 @@ fn a_stroke_a_wide_stroke_crosses_over_stays_whole() { let at = Point::new(20_000.0, 2.0); let mut r = Renderer::new(); let img = render(&mut r, &d, at); + assert_eq!(r.strokes.len(), 1, "one outline"); assert!(r.strokes.values().all(|e| e.crop.is_none())); assert!(img.pixels == whole(&d, at).pixels); } diff --git a/crates/render/src/tests/memory.rs b/crates/render/src/tests/memory.rs index d5009c2072..8579c314b8 100644 --- a/crates/render/src/tests/memory.rs +++ b/crates/render/src/tests/memory.rs @@ -2662,6 +2662,7 @@ fn a_reduced_cmyk_image_paints_its_own_inks() { let d = cmyk_doc_with("inks", blob, 8, 8); let on = RenderOptions { image_mips: true, ..Default::default() }; let inks = Renderer::new().render_region_inks(&d, Rect::new(0.0, 0.0, 8.0, 8.0), 0.25, &on); + assert_eq!(inks.len(), 2 * 2 * 4, "2 × 2 pixels of four inks"); for px in inks.as_chunks::<4>().0 { assert!(px.iter().zip(ink).all(|(a, b)| a.abs_diff(b) <= 1), "{px:?} vs {ink:?}"); } @@ -2805,6 +2806,7 @@ fn a_tiled_image_draws_what_the_whole_image_draws() { let plane = |ink| ink::ink_image(&key, &full, ink, d.images.get("seams"), false).1; let bytes = |pm: &Pixmap| pm.data().iter().flat_map(|p| [p.r, p.g, p.b, p.a]).collect::<Vec<u8>>(); let whole = ink::amounts(&bytes(&plane(Ink::Cmy)), &bytes(&plane(Ink::K))); + assert_eq!(drawn.len(), 300 * 40 * 4, "300 × 40 pixels of four inks"); for (i, got) in drawn.as_chunks::<4>().0.iter().enumerate() { let (x, y) = (x0 as usize + i % 300, i / 300); let want = &whole[(y * w as usize + x) * 4..][..4]; diff --git a/crates/render/src/tests/viewraster.rs b/crates/render/src/tests/viewraster.rs index 0087c1a4a8..0a69d9ba3c 100644 --- a/crates/render/src/tests/viewraster.rs +++ b/crates/render/src/tests/viewraster.rs @@ -420,18 +420,11 @@ fn a_shadow_over_a_cropped_shadow_keeps_to_the_earlier_ones_margin() { /// Time a drag of the square over each backdrop in a 2560 × 1440 view: the first frame renders as /// before a drag, the next eight as a drag's frames (`interacting` and `dragging`, as the canvas -/// renders them), then the frame after the drag. The hashes of that frame and of a fresh renderer's -/// frame compare builds. +/// renders them), then the frame after the drag, which draws what a fresh renderer draws. /// Run with `cargo test --release -p vectorcraft-render backdrop_drag_perf -- --ignored --nocapture`. #[test] #[ignore = "manual timing probe; wall-clock performance depends on machine load"] fn backdrop_drag_perf() { - let hash = |px: &[u8]| { - use std::hash::{Hash, Hasher}; - let mut h = std::hash::DefaultHasher::new(); - px.hash(&mut h); - h.finish() - }; let size = (2560, 1440); for (name, effects, zoom) in cases() { let (base, id) = backdrop(&effects); @@ -455,15 +448,14 @@ fn backdrop_drag_perf() { let still = r.render(&doc, size.0, size.1, xf, &opts); let after = start.elapsed().as_secs_f64() * 1000.0; let fresh = Renderer::new().render(&doc, size.0, size.1, xf, &opts); + assert!(still.pixels == fresh.pixels, "{name} at {zoom}x: the frame after the drag"); ms.sort_by(f64::total_cmp); println!( - "{name} at {:.0}%: first frame {first:.1} ms; drag frames median {:.1} ms (min {:.1}, max {:.1}), {previewed} previewed; the frame after the drag {after:.1} ms; hashes {:016x} {:016x}", + "{name} at {:.0}%: first frame {first:.1} ms; drag frames median {:.1} ms (min {:.1}, max {:.1}), {previewed} previewed; the frame after the drag {after:.1} ms", zoom * 100.0, (ms[3] + ms[4]) * 0.5, ms[0], ms[7], - hash(&still.pixels), - hash(&fresh.pixels) ); } } diff --git a/crates/trace/src/group.rs b/crates/trace/src/group.rs index a0e3b85020..1050166631 100644 --- a/crates/trace/src/group.rs +++ b/crates/trace/src/group.rs @@ -451,7 +451,9 @@ mod tests { let want = parents_by_pairs(&paths, 200, 200, stacked); let pairs = BOX_TESTS.with(std::cell::Cell::get); assert_eq!(found, want, "stacked {stacked}"); - assert!(want.iter().skip(1).all(Option::is_some), "stacked {stacked}: {want:?}"); + // Each disc lies inside the one below it, the smallest that holds it. + let chain: Vec<Option<usize>> = (0..paths.len()).map(|i| i.checked_sub(1)).collect(); + assert_eq!(want, chain, "stacked {stacked}"); assert!(tests <= pairs, "stacked {stacked}: {tests} box tests, {pairs} by pairs"); } } diff --git a/crates/trace/src/logo/restore.rs b/crates/trace/src/logo/restore.rs index 984a073f64..908d98923d 100644 --- a/crates/trace/src/logo/restore.rs +++ b/crates/trace/src/logo/restore.rs @@ -189,7 +189,13 @@ mod tests { } let (r, step) = resample_closed(&pts, 0.12).expect("resample"); let s0 = smooth_closed(&r, 0.18 / step); - let _ = restore_corners(&r, &s0, step, &RestoreParams { min_turn: 30.0, ..RestoreParams::default() }); + // The bend at (20, 0) is a candidate (turn 10), and only the minimum turn decides it. + let bend = |min_turn: f64| { + let (out, forced) = restore_corners(&r, &s0, step, &RestoreParams { turn: 10.0, min_turn, ..RestoreParams::default() }); + forced.iter().map(|&i| out[i].distance(Point::new(20.0, 0.0))).fold(f64::MAX, f64::min) + }; + assert!(bend(30.0) > 1.0, "a 20 degree bend under a 30 degree minimum: {} px from a corner", bend(30.0)); + assert!(bend(10.0) < 0.1, "under a 10 degree minimum it is one: {} px off", bend(10.0)); } #[test] diff --git a/crates/trace/src/tests.rs b/crates/trace/src/tests.rs index 3fd5c2000b..a461978600 100644 --- a/crates/trace/src/tests.rs +++ b/crates/trace/src/tests.rs @@ -912,11 +912,10 @@ fn snap_curves_to_lines_straightens_near_lines() { #[test] fn presets_resolve() { + // Every name resolves: `presets` leaves out a name `preset` does not know. assert_eq!(presets().len(), 15); - for n in PRESET_NAMES { - assert!(preset(n).is_some(), "{n}"); - } - assert!(preset("[Default]").is_some()); + assert_eq!(preset("[Default]"), preset("Default")); + assert_eq!(preset(" Line Art "), preset("line art")); assert_eq!(preset("16 colors").unwrap().colors, 16); assert_eq!(preset("Shades of Gray").unwrap().mode, Mode::Grayscale); assert_eq!(preset("flat logo").unwrap().mode, Mode::Logo); From 5b2b29c73f74b195dc36bd9af044723e5e5f4c71 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 17:28:06 -0800 Subject: [PATCH 077/112] Properties: an edit made during a drag is measured when the drag ends A scrubbed field or a canvas drag moves the revision while the sections are not measured. When the release itself left the revision unchanged, the panel skipped the measurement and kept the sizes from before the drag. The edit now stays pending until a frame runs without a drag or an open undo group. --- crates/ui-egui/src/panels/properties.rs | 9 ++++- crates/ui-egui/src/panels/properties/tests.rs | 37 +++++++++++++++++++ 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/panels/properties.rs b/crates/ui-egui/src/panels/properties.rs index 6194f28085..06d19cd822 100644 --- a/crates/ui-egui/src/panels/properties.rs +++ b/crates/ui-egui/src/panels/properties.rs @@ -31,6 +31,8 @@ pub struct PropertiesUi { content: Option<u64>, /// The document (uid, revision) the sections were last shown for. revision: Option<(u64, u64)>, + /// An edit made during a drag whose sections are not measured yet. + measure_pending: bool, } /// The key of [`PropertiesUi::edited_profiled`]: (document uid, revision, active Appearance row). @@ -72,9 +74,12 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { let content_changed = app.ui.properties_panel.content.replace(content) != Some(content); let edited = std::mem::replace(&mut app.ui.properties_panel.revision, revision) != revision; // A drag on the canvas, or a scrubbed field, moves the revision on every pointer move without changing which - // sections show: the sections are measured again for an edit once the drag ends, not on each move. + // sections show: the sections are measured again for an edit once the drag ends, not on each move. The edit stays + // pending until then, also when the release itself does not move the revision. let dragging = app.session.active().is_some_and(|st| st.interaction.is_some() || st.undo_group.is_some()); - let changed = content_changed || (edited && !dragging); + let pending = app.ui.properties_panel.measure_pending || edited; + let changed = content_changed || (pending && !dragging); + app.ui.properties_panel.measure_pending = pending && !changed; let mut sections = |ui: &mut Ui, _: &mut BodyCx<'_>| { // The reference panel's labels end in a colon beside fields that keep their own width. Stack::new().fill_width().labels(LabelScheme::Form).show(ui, |ui, _| { diff --git a/crates/ui-egui/src/panels/properties/tests.rs b/crates/ui-egui/src/panels/properties/tests.rs index c46bcbf6e4..dea62a6dfa 100644 --- a/crates/ui-egui/src/panels/properties/tests.rs +++ b/crates/ui-egui/src/panels/properties/tests.rs @@ -241,6 +241,43 @@ fn a_drag_does_not_measure_the_sections_on_each_move() { assert_eq!(frame(&mut app, vec![]).1, 1, "an edit without a drag measures the sections"); } +/// An edit made while an undo group is open, as a scrubbed field's drag makes, is measured once the group ends, also +/// when ending it does not move the document's revision. +#[test] +fn an_edit_during_a_drag_is_measured_when_the_drag_ends_without_a_new_revision() { + let measures = || SECTION_MEASURES.with(std::cell::Cell::get); + let mut app = new_app(); + let a = rect(&mut app, 100.0, 100.0, 80.0, 80.0); + app.run("select.set", json!({"ids": [a]})).unwrap(); + app.run("window.panel", json!({"panel": "properties"})).unwrap(); + let ctx = crate::testing::ui_context(); + let mut time = 0.0; + let mut frame = |app: &mut VectorcraftApp| { + time += 1.0 / 60.0; + let raw = egui::RawInput { + time: Some(time), + screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1600.0, 1000.0))), + focused: true, + ..Default::default() + }; + let measured = measures(); + let _ = crate::testing::app_frame(app, &ctx, raw); + measures() - measured + }; + for _ in 0..4 { + frame(&mut app); + } + app.run("edit.undoGroup.begin", json!({})).unwrap(); + assert_eq!(frame(&mut app), 0, "opening the group"); + app.run("object.move", json!({"dx": 5, "dy": 0})).unwrap(); + assert_eq!(frame(&mut app), 0, "an edit inside the group"); + let revision = app.session.active().unwrap().revision; + app.run("edit.undoGroup.end", json!({})).unwrap(); + assert_eq!(app.session.active().unwrap().revision, revision, "ending the group keeps the revision"); + assert_eq!(frame(&mut app), 1, "the end of the group measures the edit"); + assert_eq!(frame(&mut app), 0, "a settled frame"); +} + /// Start Global Edit in Quick Actions starts it on the one selected path, the button then reads /// Stop Global Edit, and Escape stops it. Selected type has no Start Global Edit button. #[test] From ccf57654197452f0eed5044b3e58f60016938865 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 17:35:21 -0800 Subject: [PATCH 078/112] Tests: assert counts and saved names in tool, path, 3D, brush and CAD tests Tests whose all() passed on an empty list now check the list's length or that it is not empty: - huge_circles_bridge_with_finite_anchors_or_are_refused (pathops bridge) - smooth_rounds_corners (pathops ops): the four corners stay, smoothed - a_held_rotation_turns_the_art_around_its_pin (tools ARAP): one point per mesh vertex - the_eraser_drag_area_matches_the_release_when_pressure_or_a_mode_starts_during_the_drag (tools gesture): one released point per press - every_effect_casts_a_shadow, inflate_cells_across_a_hole_edge_are_cut_to_the_shape, a_plane_has_only_a_front_and_a_hollow_solid_none and perspective_runs_0_to_160_degrees_with_the_eye_outside_the_object (three-d) - a_file_two_branches_include_is_followed_from_the_shallower_one (scriptcheck): one row per include line - pens_pick_colors_and_widths (cad HP-GL): four widths - junk_pressure_brushes_draw_finite_art (brush): all 12 cases draw Round trips that hold by construction (parse finds the id in ALL) are replaced with one saved name that must parse and one that must not: follow_names_parse (pathops shared edge), the shape kinds (pathops shapes), surfaces_parse_from_their_ids (three-d), the Quick Pen actions (tools), names_parse_and_serialize_as_names (plugins) and the brush variation modes, which also compare the serde names with the ids. crop_keeps_an_instance_whose_art_reaches_the_region (cad) names the entities written instead of checking that some were. the_saved_engine_preference_is_found (app) pins the GPU choices the preferences offer to the three the app reads. timing_unite_1000_circles (pathops) gets an ignore reason and checks that Unite gives one shape. Each changed assertion fails when the code under test is broken (an id renamed, a list emptied, a flush or instance dropped) and passes when it is restored. --- apps/vectorcraft/src/gpu/tests.rs | 7 +++---- crates/brush/src/tests.rs | 8 +++++++- crates/cad/src/hpgl/tests.rs | 2 +- crates/cad/src/tests.rs | 3 ++- crates/pathops/src/addons/pathtools/bridge.rs | 3 +++ crates/pathops/src/addons/pathtools/shapes.rs | 2 +- .../pathops/src/addons/pathtools/shared_edge/tests.rs | 6 ++---- crates/pathops/tests/it/ops.rs | 6 ++++-- crates/plugins/src/permissions.rs | 10 ++++------ crates/scriptcheck/src/tests.rs | 2 ++ crates/three-d/src/shadow/tests.rs | 2 +- crates/three-d/src/solid/tests.rs | 2 +- crates/three-d/src/solid/tests_face_map.rs | 3 ++- crates/three-d/src/tests.rs | 2 +- crates/three-d/src/tests/classic.rs | 6 ++---- crates/tools/src/distort/arap.rs | 3 ++- crates/tools/src/draw2/gesture/tests.rs | 3 ++- crates/tools/src/quickpen/tests.rs | 4 +--- 18 files changed, 41 insertions(+), 33 deletions(-) diff --git a/apps/vectorcraft/src/gpu/tests.rs b/apps/vectorcraft/src/gpu/tests.rs index 4b660854f6..118a78006c 100644 --- a/apps/vectorcraft/src/gpu/tests.rs +++ b/apps/vectorcraft/src/gpu/tests.rs @@ -553,10 +553,9 @@ fn the_saved_engine_preference_is_found() { let saved = prefs.to_json(); assert_eq!(power_preference(saved.get("gpuPreference").and_then(serde_json::Value::as_str), None), power); } - // Every choice Preferences offer means something here. - for (value, _) in vectorcraft_engine::cmd::prefscmds::GPU_PREFERENCES { - assert!(["automatic", "lowPower", "highPerformance"].contains(value), "{value}"); - } + // Preferences offer the three choices read above, and no other. + let offered: Vec<&str> = vectorcraft_engine::cmd::prefscmds::GPU_PREFERENCES.iter().map(|(value, _)| *value).collect(); + assert_eq!(offered, ["automatic", "lowPower", "highPerformance"]); } #[test] diff --git a/crates/brush/src/tests.rs b/crates/brush/src/tests.rs index 01821a08f1..7abfb33a4e 100644 --- a/crates/brush/src/tests.rs +++ b/crates/brush/src/tests.rs @@ -2220,7 +2220,10 @@ fn brushes_without_modes_vary_randomly_as_before() { serde_json::to_value(Variation::ALL).unwrap(), serde_json::json!(["fixed", "random", "pressure", "tilt", "bearing", "rotation", "stylusWheel"]) ); - assert!(Variation::ALL.iter().all(|v| Variation::parse(v.id()) == Some(*v) && serde_json::to_value(v).unwrap() == v.id())); + let ids: Vec<&str> = Variation::ALL.iter().map(|v| v.id()).collect(); + assert_eq!(serde_json::to_value(Variation::ALL).unwrap(), serde_json::json!(ids), "saved names are the ids"); + assert_eq!(Variation::parse("stylusWheel"), Some(Variation::StylusWheel)); + assert_eq!(Variation::parse("wheel"), None); assert!(!Variation::offered(false).contains(&Variation::StylusWheel) && Variation::offered(true).contains(&Variation::StylusWheel)); } @@ -2228,6 +2231,7 @@ fn brushes_without_modes_vary_randomly_as_before() { #[test] fn junk_pressure_brushes_draw_finite_art() { let bp = preview_path(120.0, 24.0); + let mut drawn = 0; for (size, var) in [(1e308, 1e308), (-1e308, 1e308), (0.0, -1e308), (f64::MAX, f64::MAX)] { for profile in [vec![], vec![(0.0, 2.0), (0.0, -1.0), (5.0, 0.5)], vec![(1.0, 1.0), (0.0, 0.0)]] { let out = stroke_pieces(&Document::new(1.0, 1.0), &pressure_calli(size, var), &bp, &pressed(profile)); @@ -2236,8 +2240,10 @@ fn junk_pressure_brushes_draw_finite_art() { all_points(n, &mut pts); } assert!(pts.iter().all(|p| p.x.is_finite() && p.y.is_finite()), "{size} {var}"); + drawn += usize::from(!pts.is_empty()); } } + assert_eq!(drawn, 12, "brushes that draw"); } /// A scatter brush of 10 × 4 pt rectangles whose size goes from `lo` % to `hi` % as `mode` says. diff --git a/crates/cad/src/hpgl/tests.rs b/crates/cad/src/hpgl/tests.rs index 9a350707a6..fdc31cb6cf 100644 --- a/crates/cad/src/hpgl/tests.rs +++ b/crates/cad/src/hpgl/tests.rs @@ -131,7 +131,7 @@ fn pens_pick_colors_and_widths() { let i = plot("IN;SP1;PW1;PD0,0,10,0;PU;PW2,2;SP2;PD0,10,10,10;PU;SP1;PD0,20,10,20;PU;IN;SP1;PD0,30,10,30;"); let widths: Vec<f64> = leaves(&i.document).iter().map(|n| stroke(n).width).collect(); let want = [MM, 2.0 * MM, MM, 0.35 * MM]; - assert!(widths.iter().zip(want).all(|(a, b)| (a - b).abs() < 1e-9), "{widths:?}"); + assert!(widths.len() == want.len() && widths.iter().zip(want).all(|(a, b)| (a - b).abs() < 1e-9), "{widths:?}"); } #[test] diff --git a/crates/cad/src/tests.rs b/crates/cad/src/tests.rs index 6140395323..16f4f97082 100644 --- a/crates/cad/src/tests.rs +++ b/crates/cad/src/tests.rs @@ -1448,7 +1448,8 @@ fn crop_keeps_an_instance_whose_art_reaches_the_region() { let art = path(&mut d, shapes::rectangle(Rect::new(100.0, 50.0, 140.0, 90.0)), Paint::solid(Color::rgb(1.0, 0.0, 0.0)), Paint::None, 0.0); d.symbols.push(vectorcraft_doc::Symbol { dynamic: false, name: "Far".into(), art: Arc::new(art) }); let o = DxfOptions { crop: true, ..opts(&d) }; - assert!(!kinds(&export(&d, &o).unwrap()).is_empty()); + // The red fill: its outline and its hatch. + assert_eq!(kinds(&export(&d, &o).unwrap()), ["LWPOLYLINE", "HATCH"]); } /// An instance stained blue by its fill writes its symbol's red art in blue, as the canvas draws it. diff --git a/crates/pathops/src/addons/pathtools/bridge.rs b/crates/pathops/src/addons/pathtools/bridge.rs index 2b2fd9512e..f1eaa29283 100644 --- a/crates/pathops/src/addons/pathtools/bridge.rs +++ b/crates/pathops/src/addons/pathtools/bridge.rs @@ -816,11 +816,14 @@ mod tests { // Squaring these lengths overflows f64. let (a, b) = (circle(0.0, 0.0, 5e153), circle(1.5e154, 0.0, 5e153)); let sp = smooth_bridge(a, b, 5e153).unwrap(); + // At least one anchor for each of the two circles and the two arcs. + assert!(sp.closed && sp.anchors.len() >= 4, "{}", sp.anchors.len()); assert!(sp.anchors.iter().all(|q| [q.p, q.h_in, q.h_out].iter().all(|p| p.x.is_finite() && p.y.is_finite()))); assert_smooth(&sp); // The two radius sums fit in f64, but not their total. let (a, b) = (circle(-5e307, 0.0, 1e307), circle(5e307, 0.0, 1e307)); let sp = smooth_bridge(a, b, 1.5e308).unwrap(); + assert!(sp.closed && sp.anchors.len() >= 4, "{}", sp.anchors.len()); assert!(sp.anchors.iter().all(|q| [q.p, q.h_in, q.h_out].iter().all(|p| p.x.is_finite() && p.y.is_finite()))); // The arcs' centers would lie beyond the largest f64. let (a, b) = (circle(0.0, 0.0, 1e308), circle(1.5e308, 0.0, 1e308)); diff --git a/crates/pathops/src/addons/pathtools/shapes.rs b/crates/pathops/src/addons/pathtools/shapes.rs index e0ecc241be..dc61429c34 100644 --- a/crates/pathops/src/addons/pathtools/shapes.rs +++ b/crates/pathops/src/addons/pathtools/shapes.rs @@ -609,12 +609,12 @@ mod tests { fn each_kind_draws_a_closed_outline_in_its_box() { for kind in ShapeKind::ALL { let s = shape(kind); - assert_eq!(ShapeKind::parse(kind.id()), Some(kind)); assert_eq!(s.check(), Ok(()), "{kind:?}"); let p = s.path().unwrap(); assert!(closed(&p) && within_box(&p, &s), "{kind:?}: {:?}", p.bounds()); assert!(p.anchors().all(|(_, _, a)| a.p.x.is_finite() && a.p.y.is_finite())); } + assert_eq!(ShapeKind::parse("gear"), Some(ShapeKind::Gear)); assert_eq!(ShapeKind::parse("cloud"), None); } diff --git a/crates/pathops/src/addons/pathtools/shared_edge/tests.rs b/crates/pathops/src/addons/pathtools/shared_edge/tests.rs index 38e7c49e3b..ef84d72f83 100644 --- a/crates/pathops/src/addons/pathtools/shared_edge/tests.rs +++ b/crates/pathops/src/addons/pathtools/shared_edge/tests.rs @@ -262,9 +262,7 @@ fn a_smooth_end_whose_handles_part_turns_into_a_corner() { } #[test] -fn follow_names_round_trip() { - for f in Follow::ALL { - assert_eq!(Follow::parse(f.id()), Some(f)); - } +fn follow_names_parse() { + assert_eq!(Follow::parse("b"), Some(Follow::Second)); assert_eq!(Follow::parse("up"), None); } diff --git a/crates/pathops/tests/it/ops.rs b/crates/pathops/tests/it/ops.rs index e26d0e69e9..504d8af795 100644 --- a/crates/pathops/tests/it/ops.rs +++ b/crates/pathops/tests/it/ops.rs @@ -738,6 +738,8 @@ fn simplify_levels_and_auto_simplify() { #[test] fn smooth_rounds_corners() { let s = smooth(&rect(0.0, 0.0, 10.0, 10.0), 1.0); + // The four corners stay, each made smooth. + assert_eq!(s.anchor_count(), 4, "{s:?}"); assert!(s.anchors().all(|(_, _, a)| a.has_in() && a.has_out())); let same = smooth(&rect(0.0, 0.0, 10.0, 10.0), 0.0); assert_eq!(same, rect(0.0, 0.0, 10.0, 10.0)); @@ -959,7 +961,7 @@ fn grid_split() { } #[test] -#[ignore] +#[ignore = "benchmark: prints how long Unite takes on 1000 circles; run by hand with --ignored"] fn timing_unite_1000_circles() { let mut seed = 0x1234_5678_u64; let mut rnd = || { @@ -971,8 +973,8 @@ fn timing_unite_1000_circles() { let circles: Vec<Shape> = (0..1000).map(|i| shape(circle(rnd() * 1000.0, rnd() * 1000.0, 5.0 + rnd() * 30.0), i)).collect(); let t = std::time::Instant::now(); let r = pathfinder(PathfinderOp::Unite, &circles); + assert_eq!(r.len(), 1, "Unite gives one compound shape"); println!("unite 1000 circles: {} ms, {} anchors", t.elapsed().as_millis(), r[0].path.anchor_count()); - assert!(!r.is_empty()); } #[test] diff --git a/crates/plugins/src/permissions.rs b/crates/plugins/src/permissions.rs index a78aeec09b..f7cf875a6c 100644 --- a/crates/plugins/src/permissions.rs +++ b/crates/plugins/src/permissions.rs @@ -330,13 +330,11 @@ mod tests { use super::*; #[test] - fn names_round_trip_and_serialize_as_names() { - for p in ALL { - assert_eq!(Permission::parse(p.name()), Some(p)); - assert_eq!(serde_json::to_value(p).unwrap(), serde_json::json!(p.name())); - } + fn names_parse_and_serialize_as_names() { + assert_eq!(serde_json::to_value(ALL).unwrap(), serde_json::json!(names(&ALL)), "saved names are the names"); + assert_eq!(Permission::parse("doc.write"), Some(Permission::DocWrite)); assert_eq!(Permission::parse("document.read"), None); - assert!(RESERVED.iter().all(|r| Permission::parse(r).is_none()), "reserved names are not granted"); + assert!(!RESERVED.is_empty() && RESERVED.iter().all(|r| Permission::parse(r).is_none()), "reserved names are not granted"); } #[test] diff --git a/crates/scriptcheck/src/tests.rs b/crates/scriptcheck/src/tests.rs index ea745aaebf..1edd1480f6 100644 --- a/crates/scriptcheck/src/tests.rs +++ b/crates/scriptcheck/src/tests.rs @@ -2697,6 +2697,8 @@ fn a_file_two_branches_include_is_followed_from_the_shallower_one() { ]); let limits = Limits { include_depth: 3, ..Limits::default() }; let r = check("main.jsx", b"#include 'a.jsxinc'\n#include 'b.jsxinc'\n", Some(&mut m), &limits); + // One row per #include line: main's two, a's, b's, c's and shared's. + assert_eq!(r.includes.len(), 6, "{:?}", includes(&r)); assert!(r.includes.iter().all(|i| i.status == IncludeStatus::Checked), "{:?}", includes(&r)); assert_eq!(r.outside.iter().map(|o| o.id).collect::<Vec<_>>(), ["network"]); } diff --git a/crates/three-d/src/shadow/tests.rs b/crates/three-d/src/shadow/tests.rs index f6f9806a43..790d5491c6 100644 --- a/crates/three-d/src/shadow/tests.rs +++ b/crates/three-d/src/shadow/tests.rs @@ -209,7 +209,7 @@ fn every_effect_casts_a_shadow() { assert!(plane.path(Shadow::default()).is_some()); let mut inflate = ShadowCaster::new(); let results = inflate.inflate(&[(&path, FillRule::NonZero)], &[true], bounds, Inflate::default(), View::default()); - assert!(results.iter().all(Result::is_ok)); + assert!(results.len() == 1 && results[0].is_ok(), "one result for the one path"); assert!(inflate.path(Shadow::default()).is_some()); let mut revolve = ShadowCaster::new(); revolve.revolve(&path, FillRule::NonZero, bounds, Revolve::default()).unwrap(); diff --git a/crates/three-d/src/solid/tests.rs b/crates/three-d/src/solid/tests.rs index a4db35adb0..570ea28d4d 100644 --- a/crates/three-d/src/solid/tests.rs +++ b/crates/three-d/src/solid/tests.rs @@ -880,7 +880,7 @@ fn inflate_cells_across_a_hole_edge_are_cut_to_the_shape() { let (p, r) = shape(&b); let v = View { rotation_x: -21.88, rotation_y: -23.4, rotation_z: 9.06, ..front() }; let f = inflate(&p, FillRule::EvenOdd, r, Inflate::default(), v).unwrap(); - assert!(f.iter().all(|f| f.contours.len() == 1), "every facet is one piece of the surface"); + assert!(!f.is_empty() && f.iter().all(|f| f.contours.len() == 1), "every facet is one piece of the surface"); // Straight on, the facets still cover exactly the shape. let flat = inflate(&p, FillRule::EvenOdd, r, Inflate::default(), front()).unwrap(); assert!(close(area(&flat), 220.0 * 220.0 - 100.0 * 90.0, 1e-3), "{}", area(&flat)); diff --git a/crates/three-d/src/solid/tests_face_map.rs b/crates/three-d/src/solid/tests_face_map.rs index ebbe95448a..b0fb4d4717 100644 --- a/crates/three-d/src/solid/tests_face_map.rs +++ b/crates/three-d/src/solid/tests_face_map.rs @@ -77,7 +77,8 @@ fn a_plane_has_only_a_front_and_a_hollow_solid_none() { let hollow = Extrude { cap: false, ..Extrude::default() }; assert_eq!(extrude_face_map(bounds, hollow, view, PlanarFace::Front), None); let facets = extrude(&path, FillRule::NonZero, bounds, hollow, view).unwrap(); - assert!(facets.iter().all(|f| f.end.is_none())); + // A hollow extrusion still draws its sides, and none of them is an end. + assert!(!facets.is_empty() && facets.iter().all(|f| f.end.is_none())); } #[test] diff --git a/crates/three-d/src/tests.rs b/crates/three-d/src/tests.rs index 069013c808..46cf515f08 100644 --- a/crates/three-d/src/tests.rs +++ b/crates/three-d/src/tests.rs @@ -181,7 +181,7 @@ fn perspective_runs_0_to_160_degrees_with_the_eye_outside_the_object() { assert!(eyes.windows(2).all(|w| w[0] > w[1]), "{eyes:?}"); let (p, b) = cylinder(); let wide = revolve(&p, b, Revolve { rotation_x: -30.0, perspective: 160.0, ..Default::default() }).unwrap(); - assert!(wide.iter().flat_map(|f| &f.points).all(|q| q.x.is_finite() && q.y.is_finite())); + assert!(!wide.is_empty() && wide.iter().flat_map(|f| &f.points).all(|q| q.x.is_finite() && q.y.is_finite())); assert_eq!(wide, revolve(&p, b, Revolve { rotation_x: -30.0, perspective: 400.0, ..Default::default() }).unwrap()); } #[test] diff --git a/crates/three-d/src/tests/classic.rs b/crates/three-d/src/tests/classic.rs index f460297453..fc0b703741 100644 --- a/crates/three-d/src/tests/classic.rs +++ b/crates/three-d/src/tests/classic.rs @@ -87,10 +87,8 @@ fn blend_steps_round_the_shading_to_that_many_levels() { } #[test] -fn surfaces_round_trip_through_their_ids() { - for surface in ClassicSurface::ALL { - assert_eq!(ClassicSurface::parse(surface.id()), Some(surface)); - } +fn surfaces_parse_from_their_ids() { + assert_eq!(ClassicSurface::parse("none"), Some(ClassicSurface::NoShading)); assert_eq!(ClassicSurface::parse("glossy"), None); assert_eq!(ClassicSurface::default(), ClassicSurface::Plastic); } diff --git a/crates/tools/src/distort/arap.rs b/crates/tools/src/distort/arap.rs index 10c355544c..4740bf556a 100644 --- a/crates/tools/src/distort/arap.rs +++ b/crates/tools/src/distort/arap.rs @@ -758,11 +758,12 @@ mod tests { }; // One pin, held at 0.4 rad: the whole shape turns rigidly around it. let d = deform(&m, &[Pin { angle: Some(0.4), ..Pin::new(c, c) }]); + assert!(!m.verts.is_empty() && d.len() == m.verts.len(), "{} of {}", d.len(), m.verts.len()); let err = m.verts.iter().zip(&d).map(|(a, b)| rot(*a).distance(*b)).fold(0.0, f64::max); assert!(err < 0.05, "{err}"); // A free pin alone leaves the shape where it is. let d = deform(&m, &[Pin::new(c, c)]); - assert!(m.verts.iter().zip(&d).all(|(a, b)| a.distance(*b) < 1e-3)); + assert!(d.len() == m.verts.len() && m.verts.iter().zip(&d).all(|(a, b)| a.distance(*b) < 1e-3)); // Held ends: the turned end turns, the other end stays. let left = Point::new(10.0, 50.0); let pins = [Pin { angle: Some(0.5), ..Pin::new(left, left) }, Pin::new(Point::new(190.0, 50.0), Point::new(190.0, 50.0))]; diff --git a/crates/tools/src/draw2/gesture/tests.rs b/crates/tools/src/draw2/gesture/tests.rs index c8aa002add..41e378649c 100644 --- a/crates/tools/src/draw2/gesture/tests.rs +++ b/crates/tools/src/draw2/gesture/tests.rs @@ -3752,7 +3752,8 @@ fn the_eraser_drag_area_matches_the_release_when_pressure_or_a_mode_starts_durin press(&mut t, upright, 0.5, PointerKind::Drag, 150.0); near(bounds(&t), (40.0, 147.5, 160.0, 152.5)); let released = t.stroke_json(); - assert!(released.as_array().is_some_and(|a| a.iter().all(|p| p.as_array().is_some_and(|p| p.len() == 3))), "{released}"); + // One entry per press so far (the press and two drags), each of three numbers. + assert!(released.as_array().is_some_and(|a| a.len() == 3 && a.iter().all(|p| p.as_array().is_some_and(|p| p.len() == 3))), "{released}"); press(&mut t, upright, 0.5, PointerKind::Up, 150.0); } diff --git a/crates/tools/src/quickpen/tests.rs b/crates/tools/src/quickpen/tests.rs index 34311e9d96..f182ce3787 100644 --- a/crates/tools/src/quickpen/tests.rs +++ b/crates/tools/src/quickpen/tests.rs @@ -139,9 +139,7 @@ fn actions_cycle_and_name_themselves() { assert_eq!(Stroke::Line.next(), Stroke::ContinuousArc); assert_eq!(Stroke::ContinuousArc.next(), Stroke::SharpArc); assert_eq!(Stroke::SharpArc.next(), Stroke::Line); - for s in Stroke::ALL { - assert_eq!(Stroke::parse(s.name()), Some(s)); - } + assert_eq!(Stroke::parse("sharpArc"), Some(Stroke::SharpArc)); assert_eq!(Stroke::parse("arc"), None); } From 52d08f0f9caea8b9dd4271764306d3827c41add7 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 17:38:19 -0800 Subject: [PATCH 079/112] Tests: SVG, PDF and EPS tests check what they claim Assertions that ran all() over a list that could be empty now check the list's length first: mesh points, image inks, glyph origins, imported text, the PDF mesh and arrowhead paths, and the resampled CMYK pixels. An image that takes a Warp from its art style is checked to keep none of the look's fills and strokes, instead of checking each of none. The convolve-matrix tests check that the filtered rectangle is imported, not only that the import returned Ok. The fan-out clip path test moves to a unit test that counts the clip paths read. The self-nesting symbol test checks that the other symbol comes back. The EPS level and preview id test checks the param values and the trimming and case rules instead of looping over every value. The ignored PDF text-heavy timing run says why it is ignored. A gradient that repeats or reflects with no stops now paints as one that pads. Before, PDF export wrote it as two 160 by 160 images and EPS wrote three runs of a conic where one that pads writes one; `Gradient::is_spread` is false without stops. `paint.setFill`'s params still report the spread. --- crates/color/src/gradient.rs | 5 +-- crates/color/src/gradient/spread/tests.rs | 4 +++ crates/eps/src/import/ai/mesh.rs | 2 ++ crates/eps/src/import/ai/read/ops.rs | 3 +- crates/eps/src/import/ai/tests.rs | 1 + crates/eps/src/import/tests_images.rs | 1 + crates/eps/src/import/tests_native.rs | 1 + crates/eps/src/tests.rs | 35 +++++++++++++-------- crates/pdf/src/images.rs | 1 + crates/pdf/src/tests/mesh_export.rs | 5 ++- crates/pdf/src/tests/spread.rs | 20 +++++++----- crates/pdf/src/tests/stroke.rs | 1 + crates/pdf/src/tests/text_placement.rs | 2 +- crates/svg/src/import/convert.rs | 37 +++++++++++++++++++++++ crates/svg/tests/convolve_overflow.rs | 23 +++++++++----- crates/svg/tests/it/import_details.rs | 15 --------- crates/svg/tests/it/import_text.rs | 6 +++- crates/svg/tests/it/svg_glyphs.rs | 1 + crates/svg/tests/it/symbols_layers.rs | 5 ++- crates/tools/src/params.rs | 2 +- 20 files changed, 120 insertions(+), 50 deletions(-) diff --git a/crates/color/src/gradient.rs b/crates/color/src/gradient.rs index 5982e37552..0f520b2f9d 100644 --- a/crates/color/src/gradient.rs +++ b/crates/color/src/gradient.rs @@ -464,9 +464,10 @@ impl Gradient { self.repeats.clamp(1, MAX_REPEATS) } /// Does it paint something other than its end colors past the ends of its stops, or run its - /// stops more than once: a linear, radial, conic or diamond gradient that repeats or reflects? + /// stops more than once: a linear, radial, conic or diamond gradient with stops that repeats or + /// reflects? One without stops paints as one that pads. pub fn is_spread(&self) -> bool { - !self.spread.is_pad() && self.kind != GradientKind::Freeform + !self.spread.is_pad() && self.kind != GradientKind::Freeform && !self.stops.is_empty() } /// The spread and count as the gradient paints them: Pad and 1 for one that pads (whatever /// count it keeps) and for a freeform one, else its spread and [`Self::repeat_count`]. Equal diff --git a/crates/color/src/gradient/spread/tests.rs b/crates/color/src/gradient/spread/tests.rs index ab088293da..c42b1acd61 100644 --- a/crates/color/src/gradient/spread/tests.rs +++ b/crates/color/src/gradient/spread/tests.rs @@ -36,6 +36,10 @@ fn spread_maps_the_parameter_to_a_place_along_the_stops() { let free = spread(GradientKind::Freeform, GradientSpread::Repeat, 3); assert_eq!(free.spread_param(0.7), 0.7); assert!(!free.is_spread() && !pad.is_spread() && repeat.is_spread()); + // Without stops it paints as one that pads. + let empty = Gradient { stops: vec![], ..repeat.clone() }; + assert!(!empty.is_spread()); + assert_eq!(empty.painted_spread(), (GradientSpread::Pad, 1)); assert!(repeat.spread_param(f64::NAN).is_nan()); // A count out of range (set in code) counts as the nearest one in range. assert_eq!(spread(GradientKind::Linear, GradientSpread::Repeat, 0).repeat_count(), 1); diff --git a/crates/eps/src/import/ai/mesh.rs b/crates/eps/src/import/ai/mesh.rs index 9e8a77e5dc..8e2a46c852 100644 --- a/crates/eps/src/import/ai/mesh.rs +++ b/crates/eps/src/import/ai/mesh.rs @@ -873,6 +873,7 @@ mod tests { } r.entry(&[V::Num(0.0), name("E")], Affine::IDENTITY); let mesh = r.one_mesh().unwrap(); + assert_eq!(mesh.points.len(), 9, "{mesh:?}"); assert!(mesh.points.iter().all(|q| q.p.x.is_finite() && q.p.y.is_finite() && q.handles.iter().all(|h| h.x.is_finite() && h.y.is_finite()))); } @@ -962,6 +963,7 @@ mod tests { assert!(!reader.unread, "{with_opacity} {data_first}"); let mesh = reader.one_mesh().unwrap(); let want = if with_opacity { 0.25 } else { 1.0 }; + assert_eq!(mesh.points.len(), 4, "{with_opacity} {data_first}: {mesh:?}"); assert!(mesh.points.iter().all(|p| p.opacity == want), "{with_opacity} {data_first}: {mesh:?}"); } } diff --git a/crates/eps/src/import/ai/read/ops.rs b/crates/eps/src/import/ai/read/ops.rs index bb5343e4f4..0b6ac8b9dd 100644 --- a/crates/eps/src/import/ai/read/ops.rs +++ b/crates/eps/src/import/ai/read/ops.rs @@ -2217,7 +2217,8 @@ mod tests { let ap = styled(&image, &look, &st, &paints).expect("an image takes one Warp"); let ids: Vec<&str> = ap.effects.iter().map(|e| e.id.as_str()).collect(); assert_eq!(ids, ["warp.arc"]); - assert!(ap.items.iter().all(|i| i.paint().is_none()), "{ap:?}"); + // The image's own look: none of the look's fills and strokes. + assert!(ap.items.is_empty(), "{ap:?}"); // Not on a path, nor on an image with an opacity mask. assert!(styled(&square(3, Paint::None), &look, &st, &paints).is_none()); let mut masked = image.clone(); diff --git a/crates/eps/src/import/ai/tests.rs b/crates/eps/src/import/ai/tests.rs index 0d09cf8dab..9ef4cbc840 100644 --- a/crates/eps/src/import/ai/tests.rs +++ b/crates/eps/src/import/ai/tests.rs @@ -291,6 +291,7 @@ fn object_tags_without_an_object_before_them_tag_nothing() { let doc = read7(&layer7("L", &body)).doc; let mut all = art(&doc); all.extend(all.iter().flat_map(|n| n.children().cloned().unwrap_or_default()).collect::<Vec<_>>()); + assert!(!all.is_empty(), "{body}: no art"); assert!(all.iter().all(|n| n.extras().attrs.is_none()), "{body}"); } for bad in ["(x) (y) XT\n", "/id 3 XT\n", "XT\n"] { diff --git a/crates/eps/src/import/tests_images.rs b/crates/eps/src/import/tests_images.rs index 6830fb5b41..e7fd734240 100644 --- a/crates/eps/src/import/tests_images.rs +++ b/crates/eps/src/import/tests_images.rs @@ -241,6 +241,7 @@ fn cmyk_jpegs_keep_their_ink_amounts() { /ImageMatrix [2 0 0 -2 0 2] /DataSource currentfile /ASCIIHexDecode filter /DCTDecode filter >> image\n{data}>" )); let got = inks(&r).data; + assert_eq!(got.len(), want.len(), "{decode}: {got:?}"); assert!(got.iter().zip(&want).all(|(a, b)| a.abs_diff(*b) <= 3), "{decode}: {got:?}"); } } diff --git a/crates/eps/src/import/tests_native.rs b/crates/eps/src/import/tests_native.rs index c5b6b61d58..9fdeba9ff5 100644 --- a/crates/eps/src/import/tests_native.rs +++ b/crates/eps/src/import/tests_native.rs @@ -8238,6 +8238,7 @@ fn type_with_a_distort_effect_comes_in_as_type_with_it_live() { // An angle that isn't a number: the drawing as paths, and no effect on the type. let (texts, paths) = open("Adobe Twirl", "NaN /Real (angle) ,\n"); assert_eq!(paths, 1, "{texts:?}"); + assert_eq!(texts.len(), 1, "{texts:?}"); assert!(texts.iter().all(|(_, effects)| effects.is_empty()), "{texts:?}"); } diff --git a/crates/eps/src/tests.rs b/crates/eps/src/tests.rs index 3b45578deb..dc40025954 100644 --- a/crates/eps/src/tests.rs +++ b/crates/eps/src/tests.rs @@ -301,12 +301,23 @@ fn spread_gradients_are_written_with_their_stops_repeated() { fn a_spread_gradient_without_stops_is_written() { use vectorcraft_color::GradientSpread; for kind in [GradientKind::Linear, GradientKind::Radial, GradientKind::Conic, GradientKind::Diamond] { - let g = GradientPaint::new(Gradient { spread: GradientSpread::Repeat, repeats: 3, ..Gradient::new(kind, vec![]) }); - let paint = Paint::Gradient(Box::new(g)); - let d = doc_with(|d| vec![path(d, shapes::rectangle(Rect::new(20.0, 20.0, 180.0, 180.0)), paint.clone(), paint, 4.0)]); - export(&d, &opts(&d), None, None).unwrap(); - export_legacy_ai(&d, &LegacyAiOptions::default()).unwrap(); - crate::export_ai_editing(&d, &crate::AiEditingOptions::default()).unwrap(); + let doc = |spread: GradientSpread| { + let g = GradientPaint::new(Gradient { spread, repeats: 3, ..Gradient::new(kind, vec![]) }); + let paint = Paint::Gradient(Box::new(g)); + doc_with(|d| vec![path(d, shapes::rectangle(Rect::new(20.0, 20.0, 180.0, 180.0)), paint.clone(), paint, 4.0)]) + }; + let (d, pad) = (doc(GradientSpread::Repeat), doc(GradientSpread::Pad)); + assert_eq!(page_of(&d, &opts(&d)), page_of(&pad, &opts(&pad)), "{kind:?}: EPS"); + assert_eq!( + export_legacy_ai(&d, &LegacyAiOptions::default()).unwrap().bytes, + export_legacy_ai(&pad, &LegacyAiOptions::default()).unwrap().bytes, + "{kind:?}: legacy .ai" + ); + assert_eq!( + crate::export_ai_editing(&d, &crate::AiEditingOptions::default()).unwrap().program, + crate::export_ai_editing(&pad, &crate::AiEditingOptions::default()).unwrap().program, + "{kind:?}: .ai editing data" + ); } } @@ -2359,15 +2370,15 @@ fn symbol_art_effects_are_written_where_they_draw() { #[test] fn level_preview_and_overprint_ids_read_back() { - for l in Level::ALL { - assert_eq!(Level::from_id(l.id()), Some(l)); - } + assert_eq!(Level::from_id("3"), Some(Level::Three)); assert_eq!(Level::from_id("LanguageLevel 2"), Some(Level::Two)); assert_eq!(Level::from_id("1"), None); - for p in Preview::ALL { - assert_eq!(Preview::from_id(p.id()), Some(p)); - } + assert_eq!(Level::from_id("23"), None); + assert_eq!(Preview::from_id(" TIFFCOLOR "), Some(Preview::TiffColor)); + assert_eq!(Preview::from_id("tiffBw"), Some(Preview::TiffBlackWhite)); + assert_eq!(Preview::from_id("tiff"), None); assert_eq!(Overprint::from_id("DISCARD"), Some(Overprint::Discard)); + assert_eq!(Overprint::from_id(""), None); } #[test] diff --git a/crates/pdf/src/images.rs b/crates/pdf/src/images.rs index bdf51da6f8..d6d68ee02b 100644 --- a/crates/pdf/src/images.rs +++ b/crates/pdf/src/images.rs @@ -915,6 +915,7 @@ mod tests { let (inks, alpha) = resampled_inks(inks, Some(alpha.clone()), &rule(&c, Kind::Color), (4, 1)).unwrap(); let alpha = alpha.unwrap(); let m = |c: u8, a: u8| (u16::from(c) * u16::from(a) / 255) as u8; + assert_eq!((inks.as_chunks::<4>().0.len(), alpha.len()), (4, 4), "{method}"); for (p, &a) in inks.as_chunks::<4>().0.iter().zip(&alpha) { assert!(a > 0 && p.iter().zip([40, 80, 120, 160]).all(|(&c, want)| m(c, a).abs_diff(m(want, a)) <= 1), "{method}: {p:?} at {a}"); } diff --git a/crates/pdf/src/tests/mesh_export.rs b/crates/pdf/src/tests/mesh_export.rs index cf8ad25e3b..b2e8ecb2f6 100644 --- a/crates/pdf/src/tests/mesh_export.rs +++ b/crates/pdf/src/tests/mesh_export.rs @@ -73,11 +73,14 @@ fn a_cmyk_mesh_is_written_smooth_in_its_inks() { let back = import(&export(&d, &PdfOptions::default()).unwrap()).unwrap(); let (meshes, paths) = kinds(&back); assert!(meshes >= 1 && paths <= 4, "meshes {meshes}, paths {paths}"); + let mut points = vec![]; back.walk(|n| { if let NodeKind::Mesh(m) = &n.kind { - assert!(m.points.iter().all(|p| matches!(p.color, Color::Cmyk { .. })), "{:?}", m.points); + points.extend(m.points.iter().map(|p| p.color)); } }); + assert!(!points.is_empty(), "the meshes have points"); + assert!(points.iter().all(|c| matches!(c, Color::Cmyk { .. })), "{points:?}"); assert_similar(&render_artboard(&d), &render_artboard(&back), 6.0, 0.02); } diff --git a/crates/pdf/src/tests/spread.rs b/crates/pdf/src/tests/spread.rs index ebfe655f9a..0a852ba664 100644 --- a/crates/pdf/src/tests/spread.rs +++ b/crates/pdf/src/tests/spread.rs @@ -236,17 +236,21 @@ fn a_perceptual_spot_gradient_too_long_once_repeated_is_an_image() { } } -/// A gradient that repeats with no stops (a file can hold one) exports, filled and stroked. +/// A gradient that repeats with no stops (a file can hold one) exports, filled and stroked, as the +/// same gradient that pads does. #[test] fn a_spread_gradient_without_stops_exports() { for kind in [GradientKind::Linear, GradientKind::Radial, GradientKind::Conic, GradientKind::Diamond] { - let g = GradientPaint::new(Gradient { spread: GradientSpread::Repeat, repeats: 3, ..Gradient::new(kind, vec![]) }); - let paint = Paint::Gradient(Box::new(g)); - let mut d = Document::new(200.0, 200.0); - let (l, id) = (d.layers[0].id, d.alloc_id()); - let ap = Appearance::basic(paint.clone(), paint, 4.0); - d.insert(Some(l), 0, Node::path(id, shapes::rectangle(Rect::new(20.0, 20.0, 180.0, 180.0)), ap)).unwrap(); - export(&d, &PdfOptions::default()).unwrap(); + let written = |spread: GradientSpread| { + let g = GradientPaint::new(Gradient { spread, repeats: 3, ..Gradient::new(kind, vec![]) }); + let paint = Paint::Gradient(Box::new(g)); + let mut d = Document::new(200.0, 200.0); + let (l, id) = (d.layers[0].id, d.alloc_id()); + let ap = Appearance::basic(paint.clone(), paint, 4.0); + d.insert(Some(l), 0, Node::path(id, shapes::rectangle(Rect::new(20.0, 20.0, 180.0, 180.0)), ap)).unwrap(); + uncompressed(&d, &PdfOptions { created: Some(0), ..PdfOptions::uncompressed() }) + }; + assert_eq!(written(GradientSpread::Repeat), written(GradientSpread::Pad), "{kind:?}"); } } diff --git a/crates/pdf/src/tests/stroke.rs b/crates/pdf/src/tests/stroke.rs index d57cbc42d0..881ebd4a4c 100644 --- a/crates/pdf/src/tests/stroke.rs +++ b/crates/pdf/src/tests/stroke.rs @@ -90,5 +90,6 @@ fn line_and_head_share_one_opacity_group() { _ => {} }); assert!(group_opacity.is_some_and(|o| (o - 0.5).abs() < 0.01), "{group_opacity:?}"); + assert!(!leaf_opacities.is_empty(), "the line and its head come back as paths"); assert!(leaf_opacities.iter().all(|o| (o - 1.0).abs() < 1e-3), "{leaf_opacities:?}"); } diff --git a/crates/pdf/src/tests/text_placement.rs b/crates/pdf/src/tests/text_placement.rs index 31ea411840..f64f8c4173 100644 --- a/crates/pdf/src/tests/text_placement.rs +++ b/crates/pdf/src/tests/text_placement.rs @@ -745,7 +745,7 @@ fn text_heavy(columns: usize, rows: usize) -> Vec<u8> { /// How long a text-heavy file takes to open as type (run by hand: `-- --ignored --nocapture`). #[test] -#[ignore] +#[ignore = "timing, run by hand"] fn perf_text_heavy_open() { let bytes = text_heavy(20, 200); for _ in 0..2 { diff --git a/crates/svg/src/import/convert.rs b/crates/svg/src/import/convert.rs index 676708a09d..a5e7bc3e63 100644 --- a/crates/svg/src/import/convert.rs +++ b/crates/svg/src/import/convert.rs @@ -297,3 +297,40 @@ pub(super) fn rule(r: usvg::FillRule) -> FillRule { usvg::FillRule::EvenOdd => FillRule::EvenOdd, } } + +#[cfg(test)] +mod tests { + use super::*; + + /// Clip paths are shared, so children that each name the next one multiply at every level: ten + /// children on seven levels would take 10^7 reads unbounded. The paths read stay within ten (the + /// children of one clip path) per clip path read, and the clip still has shapes. + #[test] + fn clip_paths_whose_children_fan_out_are_read_a_bounded_number_of_times() { + let mut defs = String::from(r#"<clipPath id="c0"><rect width="10" height="10"/></clipPath>"#); + for n in 1..8 { + let kids = format!(r#"<rect width="10" height="10" clip-path="url(#c{})"/>"#, n - 1).repeat(10); + defs += &format!(r#"<clipPath id="c{n}">{kids}</clipPath>"#); + } + let svg = format!( + r#"<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20"><defs>{defs}</defs><rect width="20" height="20" clip-path="url(#c7)"/></svg>"# + ); + let tree = usvg::Tree::from_str(&svg, &usvg::Options::default()).unwrap(); + let cp = tree + .root() + .children() + .iter() + .find_map(|c| match c { + usvg::Node::Group(g) => g.clip_path(), + _ => None, + }) + .unwrap(); + let visits = std::cell::Cell::new(0usize); + let shapes = clip_shapes(cp, Affine::IDENTITY, &|_, _| { + visits.set(visits.get() + 1); + None + }); + assert!(!shapes.is_empty()); + assert!(visits.get() <= 10 * MAX_CLIP_READS, "{} paths read", visits.get()); + } +} diff --git a/crates/svg/tests/convolve_overflow.rs b/crates/svg/tests/convolve_overflow.rs index 4c080e1944..2971027a67 100644 --- a/crates/svg/tests/convolve_overflow.rs +++ b/crates/svg/tests/convolve_overflow.rs @@ -8,8 +8,17 @@ // Integration tests: unwrapping and panicking on failure is fine here, unlike in shipped code (AGENTS.md › Robustness). #![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)] +use vectorcraft_doc::NodeKind; use vectorcraft_svg::import; +/// How many paths `svg` imports as: each file here holds one filtered rectangle. +fn paths(svg: &str) -> usize { + let d = import(svg).unwrap_or_else(|e| panic!("{e}: {svg}")); + let mut n = 0; + d.walk(|node| n += usize::from(matches!(node.kind, NodeKind::Path { .. }))); + n +} + /// An overflowing `order` with a `kernelMatrix` that parses (usvg `parser/filter.rs`). #[test] fn convolve_matrix_overflowing_order_with_kernel_is_refused() { @@ -44,7 +53,7 @@ fn convolve_matrix_large_but_fitting_order_still_imports() { let svg = format!( r#"<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><filter id="f"><feConvolveMatrix order="{order}"/></filter><rect width="4" height="4" filter="url(#f)"/></svg>"# ); - assert!(import(&svg).is_ok(), "order={order} fits the u32 multiply and must keep importing"); + assert_eq!(paths(&svg), 1, "order={order} fits the u32 multiply and must keep importing"); } } @@ -56,7 +65,7 @@ fn convolve_matrix_nonpositive_or_unparseable_order_still_imports() { let svg = format!( r#"<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><filter id="f"><feConvolveMatrix order="{order}" {kernel}/></filter><rect width="4" height="4" filter="url(#f)"/></svg>"# ); - assert!(import(&svg).is_ok(), "order={order} is usvg's pass-through and must keep importing"); + assert_eq!(paths(&svg), 1, "order={order} is usvg's pass-through and must keep importing"); } } @@ -65,18 +74,18 @@ fn convolve_matrix_nonpositive_or_unparseable_order_still_imports() { #[test] fn convolve_matrix_unparseable_or_mismatched_kernel_still_imports() { let mismatched = r#"<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><filter id="f"><feConvolveMatrix order="3" kernelMatrix="0 0 0 0 1 0 0 0"/></filter><rect width="4" height="4" filter="url(#f)"/></svg>"#; - assert!(import(mismatched).is_ok(), "a kernel of the wrong length is usvg's pass-through"); + assert_eq!(paths(mismatched), 1, "a kernel of the wrong length is usvg's pass-through"); let unparseable = r#"<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><filter id="f"><feConvolveMatrix order="3" kernelMatrix="1e999 0 0 0 0 0 0 0 0"/></filter><rect width="4" height="4" filter="url(#f)"/></svg>"#; - assert!(import(unparseable).is_ok(), "an unparseable kernel is usvg's pass-through"); + assert_eq!(paths(unparseable), 1, "an unparseable kernel is usvg's pass-through"); } /// Sane kernels keep importing: 3×3, 2×2, and a defaulted order. #[test] fn sane_convolve_matrices_still_import() { let three = r#"<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><filter id="f"><feConvolveMatrix order="3" kernelMatrix="0 0 0 0 1 0 0 0 0"/></filter><rect width="4" height="4" filter="url(#f)"/></svg>"#; - assert!(import(three).is_ok(), "an ordinary filter must still import"); + assert_eq!(paths(three), 1, "an ordinary filter must still import"); let two = r#"<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><filter id="f"><feConvolveMatrix order="2" kernelMatrix="0 1 1 0"/></filter><rect width="4" height="4" filter="url(#f)"/></svg>"#; - assert!(import(two).is_ok(), "a small kernel must still import"); + assert_eq!(paths(two), 1, "a small kernel must still import"); let defaulted = r#"<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><filter id="f"><feConvolveMatrix kernelMatrix="0 0 0 0 1 0 0 0 0"/></filter><rect width="4" height="4" filter="url(#f)"/></svg>"#; - assert!(import(defaulted).is_ok(), "a filter without order must still import"); + assert_eq!(paths(defaulted), 1, "a filter without order must still import"); } diff --git a/crates/svg/tests/it/import_details.rs b/crates/svg/tests/it/import_details.rs index a4046e3fe7..c96dd72adb 100644 --- a/crates/svg/tests/it/import_details.rs +++ b/crates/svg/tests/it/import_details.rs @@ -552,21 +552,6 @@ fn clip_path_child_with_chained_clip_path_intersects() { assert_eq!(mine.over_white(100, 25), [255, 255, 255], "top right is cut by inner clip"); } -/// Clip paths are shared, so children that each name the next one multiply at every level: ten -/// children on seven levels would take 10^7 reads unbounded. The import must still finish. -#[test] -fn clip_paths_whose_children_fan_out_still_import() { - let mut defs = String::from(r#"<clipPath id="c0"><rect width="10" height="10"/></clipPath>"#); - for n in 1..8 { - let kids = format!(r#"<rect width="10" height="10" clip-path="url(#c{})"/>"#, n - 1).repeat(10); - defs += &format!(r#"<clipPath id="c{n}">{kids}</clipPath>"#); - } - let svg = format!( - r#"<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20"><defs>{defs}</defs><rect width="20" height="20" clip-path="url(#c7)"/></svg>"# - ); - assert!(import_with_report(&svg).is_ok()); -} - #[test] fn clip_path_deep_chain_preserves_art() { let mut defs = String::from(r#"<clipPath id="c0"><rect width="100" height="100"/></clipPath>"#); diff --git a/crates/svg/tests/it/import_text.rs b/crates/svg/tests/it/import_text.rs index c8a1cfd4ed..9c1cac5890 100644 --- a/crates/svg/tests/it/import_text.rs +++ b/crates/svg/tests/it/import_text.rs @@ -226,7 +226,10 @@ fn a_use_of_a_text_passes_its_properties_on_to_the_text() { #[test] fn a_use_inside_the_text_it_shows_opens() { let d = open(r##"<text id="t" y="50" font-size="20">HI<use href="#t" font-size="100"/><tspan><use href="#t"/></tspan></text>"##); - assert!(texts(&d).iter().all(|t| close(t.first_style().size, 20.0, 1e-9)), "{:?}", texts(&d)); + let t = texts(&d); + assert_eq!(t.len(), 1, "{t:?}"); + assert_eq!(t[0].plain_text(), "HI"); + assert!(close(t[0].first_style().size, 20.0, 1e-9), "{t:?}"); } /// Past 1 MiB of text built for `<use>` elements, the rest show their text with its own properties. @@ -1232,6 +1235,7 @@ fn vertical_writing_mode_runs_down_a_path() { let b = path.bounds().unwrap(); assert!(close(b.x0, b.x1, 1e-9) && close(b.y0, 20.0, 1e-9) && b.height() > 20.0, "{b:?}"); let o = glyph_origins(t); + assert_eq!(o.len(), 4, "{o:?}"); assert!(o.windows(2).all(|w| w[1].y > w[0].y), "glyphs step down: {o:?}"); // The em box is centred on the column. let lay = layout(FontDb::global(), t); diff --git a/crates/svg/tests/it/svg_glyphs.rs b/crates/svg/tests/it/svg_glyphs.rs index 3e4ba8b697..b48c486446 100644 --- a/crates/svg/tests/it/svg_glyphs.rs +++ b/crates/svg/tests/it/svg_glyphs.rs @@ -56,6 +56,7 @@ fn current_color_and_context_colours_are_the_texts() { let (art, _) = glyph_art(doc.as_bytes(), 1, 1000.0, BLUE, None).unwrap(); let mut strokes = vec![]; art.walk(&mut |c| strokes.push(c.appearance.stroke_paint())); + assert_eq!(strokes.len(), seen.len(), "the same art without the text's stroke: {strokes:?}"); assert!(strokes.iter().all(|p| *p == Paint::None), "no stroke without the text's: {strokes:?}"); let plain = r##"<svg xmlns="http://www.w3.org/2000/svg"><g id="glyph1"><path fill="#f00" d="M0 0h5v-5z"/></g></svg>"##; assert!(!glyph_art(plain.as_bytes(), 1, 1000.0, BLUE, None).unwrap().1, "a document in its own colours"); diff --git a/crates/svg/tests/it/symbols_layers.rs b/crates/svg/tests/it/symbols_layers.rs index 1d1b4cc712..05e70265fa 100644 --- a/crates/svg/tests/it/symbols_layers.rs +++ b/crates/svg/tests/it/symbols_layers.rs @@ -554,7 +554,10 @@ fn symbols_inside_themselves_end() { d.symbols.push(Symbol { dynamic: false, name: "Loop".into(), art: Arc::new(g) }); instance(&mut d, "Loop", Affine::translate((20.0, 20.0))); let svg = export(&d, &ExportOptions::default()); - assert!(import(&svg).is_ok(), "{svg}"); + // The symbol that holds itself is not written into itself; the other one still comes back. + assert!(svg.matches("<use ").count() <= 3, "{svg}"); + let back = import(&svg).unwrap_or_else(|e| panic!("{e}: {svg}")); + assert!(back.symbols.iter().any(|s| s.name == "My Mark"), "{svg}"); } /// Two layers, the second hidden, each with a square. diff --git a/crates/tools/src/params.rs b/crates/tools/src/params.rs index c7a205a19e..9fe1fb2138 100644 --- a/crates/tools/src/params.rs +++ b/crates/tools/src/params.rs @@ -79,7 +79,7 @@ pub fn gradient_params(g: &GradientPaint) -> Value { v["method"] = json!(g.gradient.method.id()); } // A freeform gradient has no ends to spread past (`paint.setFill` refuses a spread for one). - if g.gradient.is_spread() { + if !g.gradient.spread.is_pad() && g.gradient.kind != vectorcraft_color::GradientKind::Freeform { v["spread"] = json!(g.gradient.spread.label().to_lowercase()); } // A gradient that pads keeps its count for later. From e8ecd67f2db0cd8e9511c74454230797979ec78f Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 17:39:31 -0800 Subject: [PATCH 080/112] Dock: the docked Tools card keeps its rounded top corners In the Classic look, the docked Tools card at the window edge drew a rounded dark bar over a body with square top corners, so the body's corners showed past the bar and the card's top corners did not look rounded. craft-libs#4723 paints the bar with the card's corner radius and starts the body under the bar. craft-libs moves to 823f0d1a, the head of #4723, which is the current pin a5669ed2 plus that fix; egui and winit stay at the revs craft-libs pins. craft-web-api and xtask pdf-deps move with the other craft-libs crates. the_docked_tools_card_keeps_its_rounded_top_corners checks the Classic and Modern looks at UI Scaling 100% and 200%: every opaque surface that reaches a top corner of the Tools card is rounded there at least as much as the card's foot. --- Cargo.lock | 172 +++++++++++----------- Cargo.toml | 76 +++++----- apps/vectorcraft-web/Cargo.toml | 2 +- crates/ui-egui/src/panel_docking/tests.rs | 59 ++++++++ xtask/src/pdf_deps.rs | 2 +- 5 files changed, 185 insertions(+), 126 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9a3010412f..985e7d0ae4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1231,7 +1231,7 @@ dependencies = [ [[package]] name = "craft" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "craft-automation", "craft-behavior", @@ -1272,7 +1272,7 @@ dependencies = [ [[package]] name = "craft-affinity" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "crc32fast", "flate2", @@ -1283,7 +1283,7 @@ dependencies = [ [[package]] name = "craft-appkit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "block2 0.6.2", "objc2 0.6.5", @@ -1295,7 +1295,7 @@ dependencies = [ [[package]] name = "craft-atomic" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "rustix 1.1.6", ] @@ -1303,7 +1303,7 @@ dependencies = [ [[package]] name = "craft-automation" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -1328,7 +1328,7 @@ dependencies = [ [[package]] name = "craft-behavior" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "accesskit", "bitflags 2.13.2", @@ -1346,7 +1346,7 @@ dependencies = [ [[package]] name = "craft-browse" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "craft-behavior", "craft-docpath", @@ -1364,7 +1364,7 @@ dependencies = [ [[package]] name = "craft-cdr" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "crc32fast", "flate2", @@ -1373,7 +1373,7 @@ dependencies = [ [[package]] name = "craft-cloud-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "egui", ] @@ -1381,7 +1381,7 @@ dependencies = [ [[package]] name = "craft-cms" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "md-5", "rayon", @@ -1390,12 +1390,12 @@ dependencies = [ [[package]] name = "craft-codepage" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" [[package]] name = "craft-color-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "craft-behavior", "craft-cms", @@ -1415,7 +1415,7 @@ dependencies = [ [[package]] name = "craft-control" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "craft-control-protocol", "craft-platform", @@ -1426,7 +1426,7 @@ dependencies = [ [[package]] name = "craft-control-protocol" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "getrandom 0.3.4", "serde_json", @@ -1436,7 +1436,7 @@ dependencies = [ [[package]] name = "craft-dds" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "rayon", ] @@ -1444,7 +1444,7 @@ dependencies = [ [[package]] name = "craft-dialogs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "block2 0.6.2", "craft-appkit", @@ -1470,7 +1470,7 @@ dependencies = [ [[package]] name = "craft-doc" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "blake3", "craft-ecproj-format", @@ -1486,7 +1486,7 @@ dependencies = [ [[package]] name = "craft-docpath" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "serde", ] @@ -1494,7 +1494,7 @@ dependencies = [ [[package]] name = "craft-draw" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1513,7 +1513,7 @@ dependencies = [ [[package]] name = "craft-dxf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "craft-codepage", "encoding_rs", @@ -1525,7 +1525,7 @@ dependencies = [ [[package]] name = "craft-ecproj-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "serde", "serde_json", @@ -1535,12 +1535,12 @@ dependencies = [ [[package]] name = "craft-eps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "fontique", "harfrust 0.13.3", @@ -1555,7 +1555,7 @@ dependencies = [ [[package]] name = "craft-font-manager" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -1574,7 +1574,7 @@ dependencies = [ [[package]] name = "craft-font-os-windows" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "windows-registry", "windows-sys 0.61.2", @@ -1583,7 +1583,7 @@ dependencies = [ [[package]] name = "craft-font-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "cap-primitives", "craft-atomic", @@ -1606,12 +1606,12 @@ dependencies = [ [[package]] name = "craft-fonts-build" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" [[package]] name = "craft-gif" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "gif", ] @@ -1619,7 +1619,7 @@ dependencies = [ [[package]] name = "craft-gzip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "flate2", ] @@ -1627,7 +1627,7 @@ dependencies = [ [[package]] name = "craft-host" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "bitflags 2.13.2", "craft-i18n", @@ -1640,7 +1640,7 @@ dependencies = [ [[package]] name = "craft-i18n" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "brotli 9.1.3", "brotli-decompressor 6.3.2", @@ -1670,7 +1670,7 @@ dependencies = [ [[package]] name = "craft-image-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "craft-dds", "craft-jpeg", @@ -1697,7 +1697,7 @@ dependencies = [ [[package]] name = "craft-imaging" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1715,7 +1715,7 @@ dependencies = [ [[package]] name = "craft-jpeg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "thiserror 2.0.21", ] @@ -1723,7 +1723,7 @@ dependencies = [ [[package]] name = "craft-jxl" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "brotli-decompressor 5.0.3", "jixel", @@ -1734,7 +1734,7 @@ dependencies = [ [[package]] name = "craft-keymap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "craft-host", "craft-i18n", @@ -1749,7 +1749,7 @@ dependencies = [ [[package]] name = "craft-layers" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "craft-behavior", "craft-i18n", @@ -1763,7 +1763,7 @@ dependencies = [ [[package]] name = "craft-menu" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "craft-behavior", "craft-host", @@ -1781,7 +1781,7 @@ dependencies = [ [[package]] name = "craft-metadata" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "brotli-decompressor 6.3.2", "chrono", @@ -1793,7 +1793,7 @@ dependencies = [ [[package]] name = "craft-metafile" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "encoding_rs", "image", @@ -1804,7 +1804,7 @@ dependencies = [ [[package]] name = "craft-mime" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "chrono", "craft-codepage", @@ -1814,7 +1814,7 @@ dependencies = [ [[package]] name = "craft-nightly" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "uds_windows", "winsafe", @@ -1823,7 +1823,7 @@ dependencies = [ [[package]] name = "craft-pages" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "craft-behavior", "craft-keymap", @@ -1839,7 +1839,7 @@ dependencies = [ [[package]] name = "craft-pcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "flate2", "serde", @@ -1850,7 +1850,7 @@ dependencies = [ [[package]] name = "craft-pdf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "hayro-interpret", "hayro-syntax", @@ -1862,7 +1862,7 @@ dependencies = [ [[package]] name = "craft-platform" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "async-channel", "async-io", @@ -1895,7 +1895,7 @@ dependencies = [ [[package]] name = "craft-plotter" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "kurbo 0.13.1", "thiserror 2.0.21", @@ -1904,7 +1904,7 @@ dependencies = [ [[package]] name = "craft-print" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "craft-behavior", "craft-host", @@ -1928,7 +1928,7 @@ dependencies = [ [[package]] name = "craft-proof" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "log", "miniz_oxide 0.9.1", @@ -1939,7 +1939,7 @@ dependencies = [ [[package]] name = "craft-ps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "craft-eps", "flate2", @@ -1953,7 +1953,7 @@ dependencies = [ [[package]] name = "craft-psd" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "encoding_rs", "flate2", @@ -1964,7 +1964,7 @@ dependencies = [ [[package]] name = "craft-quit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "dispatch2", "egui", @@ -1977,7 +1977,7 @@ dependencies = [ [[package]] name = "craft-review" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -1996,7 +1996,7 @@ dependencies = [ [[package]] name = "craft-settings" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "craft-atomic", "craft-host", @@ -2013,7 +2013,7 @@ dependencies = [ [[package]] name = "craft-stream-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "fax", "hayro-ccitt", @@ -2024,7 +2024,7 @@ dependencies = [ [[package]] name = "craft-svg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "craft-image-codecs", "craft-xml", @@ -2045,7 +2045,7 @@ dependencies = [ [[package]] name = "craft-table" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "craft-behavior", "craft-keymap", @@ -2057,7 +2057,7 @@ dependencies = [ [[package]] name = "craft-text" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "craft-behavior", "craft-font-manager", @@ -2082,7 +2082,7 @@ dependencies = [ [[package]] name = "craft-theme" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "bitflags 2.13.2", "craft-tracked", @@ -2097,7 +2097,7 @@ dependencies = [ [[package]] name = "craft-theme-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "craft-atomic", "craft-behavior", @@ -2112,7 +2112,7 @@ dependencies = [ [[package]] name = "craft-tiff" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "serde", "thiserror 2.0.21", @@ -2122,7 +2122,7 @@ dependencies = [ [[package]] name = "craft-time" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "serde", "thiserror 2.0.21", @@ -2131,7 +2131,7 @@ dependencies = [ [[package]] name = "craft-timeline" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "craft-behavior", "craft-keymap", @@ -2146,12 +2146,12 @@ dependencies = [ [[package]] name = "craft-tracked" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" [[package]] name = "craft-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "craft-cloud-ui", "craft-ui-canvas", @@ -2165,7 +2165,7 @@ dependencies = [ [[package]] name = "craft-ui-canvas" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "craft-behavior", "craft-i18n", @@ -2181,7 +2181,7 @@ dependencies = [ [[package]] name = "craft-ui-contract" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "accesskit", "craft-behavior", @@ -2219,7 +2219,7 @@ dependencies = [ [[package]] name = "craft-ui-macros" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2230,7 +2230,7 @@ dependencies = [ [[package]] name = "craft-ui-panels" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "craft-behavior", "craft-host", @@ -2248,7 +2248,7 @@ dependencies = [ [[package]] name = "craft-ui-patterns" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "craft-behavior", "craft-host", @@ -2269,7 +2269,7 @@ dependencies = [ [[package]] name = "craft-ui-shell" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "craft-behavior", "craft-host", @@ -2290,7 +2290,7 @@ dependencies = [ [[package]] name = "craft-ui-widgets" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "craft-behavior", "craft-host", @@ -2309,7 +2309,7 @@ dependencies = [ [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "base64 0.22.1", "chrono", @@ -2341,7 +2341,7 @@ dependencies = [ [[package]] name = "craft-vectorcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "flate2", "serde", @@ -2352,7 +2352,7 @@ dependencies = [ [[package]] name = "craft-wayland" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "raw-window-handle", "wayland-backend", @@ -2362,7 +2362,7 @@ dependencies = [ [[package]] name = "craft-web-api" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "js-sys", "serde_json", @@ -2373,7 +2373,7 @@ dependencies = [ [[package]] name = "craft-win32" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "winsafe", ] @@ -2381,7 +2381,7 @@ dependencies = [ [[package]] name = "craft-window" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "craft-appkit", "craft-atomic", @@ -2413,7 +2413,7 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "quick-xml 0.41.0", "serde", @@ -3772,7 +3772,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a" [[package]] name = "hayro-cmap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "brotli 8.0.4", "hayro-postscript", @@ -3781,7 +3781,7 @@ dependencies = [ [[package]] name = "hayro-interpret" version = "0.7.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "bitflags 2.13.2", "hayro-cmap", @@ -3799,7 +3799,7 @@ dependencies = [ [[package]] name = "hayro-jbig2" version = "0.3.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "fearless_simd", "hayro-ccitt", @@ -3817,12 +3817,12 @@ dependencies = [ [[package]] name = "hayro-postscript" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" [[package]] name = "hayro-syntax" version = "0.7.2" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "flate2", "hayro-ccitt", @@ -4805,7 +4805,7 @@ dependencies = [ [[package]] name = "krilla" version = "0.8.2" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "base64 0.22.1", "bumpalo", @@ -4962,7 +4962,7 @@ checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" [[package]] name = "linesweeper" version = "0.5.0" -source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" +source = "git+https://github.com/storytold/craft-libs?rev=823f0d1a40cd485a3cb0730e610d46333e8aa7e0#823f0d1a40cd485a3cb0730e610d46333e8aa7e0" dependencies = [ "arrayvec", "kurbo 0.13.1", diff --git a/Cargo.toml b/Cargo.toml index e1a20cac68..56bfdc826f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,51 +10,51 @@ license = "MIT OR Apache-2.0" rust-version = "1.95" [workspace.dependencies] -craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0", default-features = false, features = ["interpret", "write"] } -craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } +craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0" } +craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0", default-features = false, features = ["interpret", "write"] } +craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0" } +craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0" } # Language packs: the Craft apps' shared font store installs them (#4936). -craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } +craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0" } +craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0" } # The `.vectorcraft` envelope: its members, version, embedded images and the data after the JSON. -craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } +craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0" } +craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0" } # `.pcraft` documents: their manifest, full-size composite, preview, layer pixels and ICC profile. -craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0", features = ["pcraft-pixels"] } +craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0", features = ["pcraft-pixels"] } # Native Affinity documents (craft-libs#914). -craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } +craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0" } # Bounded CDR (v1-v27) and CMX (32-bit) reader (craft-libs#778). -craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } +craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0" } # SVG parsing, limits, SVGZ and writer (craft-libs#778). -craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0", features = ["tree"] } -craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } +craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0", features = ["tree"] } +craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0" } # EPS container, previews, ASCII85 and DSC comments (craft-libs#778). -craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } +craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0" } # DXF tags, reader and writer (craft-libs#778, #926, #927). -craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } +craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0" } +craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0" } # WMF, EMF and EMF+ reader (craft-libs#778). -craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0", default-features = false, features = ["read", "write"] } -craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } +craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0" } +craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0" } +craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0" } +craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0" } +craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0" } +craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0", default-features = false, features = ["read", "write"] } +craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0" } +craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0" } +craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0" } +craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0" } # The framework facade (`craft::ui`, `craft::settings`, `craft::platform`, ...). No default features: each crate names # the members it imports. -craft = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } +craft = { git = "https://github.com/storytold/craft-libs", rev = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0" } # Below the egui layer, so not through the facade: the colour harmony rules and their settings (craft-color-ui # without its `ui` feature), the colour type they work in, and the craft-fonts tables the text crate's build writes. -craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } +craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0" } +craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0" } +craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0" } # Nightly profile isolation, launch protocol, and security fence. -craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } +craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0" } # internal vectorcraft-geom = { path = "crates/geom" } vectorcraft-color = { path = "crates/color" } @@ -194,13 +194,13 @@ lto = "thin" codegen-units = 1 [patch.crates-io] -hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -krilla = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } -linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" } +hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0" } +hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0" } +hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0" } +hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0" } +hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0" } +krilla = { git = "https://github.com/storytold/craft-libs", rev = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0" } +linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0" } ecolor = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } emath = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } epaint = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } diff --git a/apps/vectorcraft-web/Cargo.toml b/apps/vectorcraft-web/Cargo.toml index 30d529a5e7..ba3bc2c321 100644 --- a/apps/vectorcraft-web/Cargo.toml +++ b/apps/vectorcraft-web/Cargo.toml @@ -28,7 +28,7 @@ egui_extras = { workspace = true } # `wgpu` pulls egui-wgpu's defaults: WebGPU plus the WebGL2 fallback. eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit"] } # The page command API (storytold/craft-libs#413): the request plumbing behind window.vectorcraft. -craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0", version = "0.1.0" } +craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0", version = "0.1.0" } wasm-bindgen = "0.2" serde_json = { workspace = true } diff --git a/crates/ui-egui/src/panel_docking/tests.rs b/crates/ui-egui/src/panel_docking/tests.rs index 3476f5c2b0..ea85426b5d 100644 --- a/crates/ui-egui/src/panel_docking/tests.rs +++ b/crates/ui-egui/src/panel_docking/tests.rs @@ -1107,6 +1107,65 @@ fn a_docked_column_is_never_narrower_than_the_panel_minimum() { assert!(body_width(&h, "Properties") >= PANEL_MIN_WIDTH - 0.5, "saved 100 pt wide: {}", body_width(&h, "Properties")); } +/// The opaque rects the last frame painted inside `cell`. +fn opaque_rects_in(shapes: &[egui::epaint::ClippedShape], cell: Rect) -> Vec<egui::epaint::RectShape> { + crate::tests_labels::painted_shapes(shapes) + .into_iter() + .filter_map(|(shape, transform, _)| match shape { + egui::Shape::Rect(r) if r.fill.a() == 255 => { + let mut r = r.clone(); + r.rect = transform * r.rect; + cell.expand(0.75).contains_rect(r.rect).then_some(r) + } + _ => None, + }) + .collect() +} + +/// The docked Tools card, in each color scheme and at UI Scaling 100% and 200%: its bar and its body keep to the +/// card's rounded top corners. Every opaque surface that reaches a top corner of the card is rounded there at least as +/// much as the card's foot is, so no square corner shows past the bar's rounded one. +#[test] +fn the_docked_tools_card_keeps_its_rounded_top_corners() { + let near = |a: f32, b: f32| (a - b).abs() <= 0.75; + for scheme in ["classic", "modern"] { + for scaling in [1.0, 2.0] { + let case = format!("{scheme} at {scaling}"); + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.session.prefs.ui_color_scheme = scheme.into(); + app.session.prefs.ui_scaling = scaling; + Arc::make_mut(&mut app.ui.dock_workspace).replace(builtin_workspace(&[], 2)); + let ctx = crate::testing::ui_context(); + let mut shapes = Vec::new(); + for frame in 0..4 { + let input = egui::RawInput { time: Some(f64::from(frame) * 0.05), screen_rect: Some(SCREEN), ..Default::default() }; + shapes = crate::testing::app_frame(&mut app, &ctx, input).shapes; + } + let cell = app.dock_rt.columns.iter().find(|(panel, _)| panel == crate::toolbar::TOOLS).map(|(_, rect)| *rect); + let cell = cell.unwrap_or_else(|| panic!("{case}: the Tools column is docked")); + let rects = opaque_rects_in(&shapes, cell); + // The card's foot: the largest surface in the column with rounded lower corners. + let foot = rects + .iter() + .filter(|r| r.corner_radius.sw > 0 && r.corner_radius.se > 0) + .max_by(|a, b| a.rect.area().total_cmp(&b.rect.area())) + .unwrap_or_else(|| panic!("{case}: the Tools card is painted: {rects:?}")); + let spans = |r: &&egui::epaint::RectShape| near(r.rect.left(), foot.rect.left()) && near(r.rect.right(), foot.rect.right()); + let top = rects.iter().filter(spans).map(|r| r.rect.top()).fold(foot.rect.top(), f32::min); + let at_top: Vec<_> = rects.iter().filter(|r| near(r.rect.top(), top)).collect(); + let left: Vec<_> = at_top.iter().filter(|r| near(r.rect.left(), foot.rect.left())).collect(); + let right: Vec<_> = at_top.iter().filter(|r| near(r.rect.right(), foot.rect.right())).collect(); + assert!(!left.is_empty() && !right.is_empty(), "{case}: the card's top is painted: {at_top:?}"); + for r in left { + assert!(r.corner_radius.nw >= foot.corner_radius.sw, "{case}: a square corner shows at the card's top left: {r:?}"); + } + for r in right { + assert!(r.corner_radius.ne >= foot.corner_radius.se, "{case}: a square corner shows at the card's top right: {r:?}"); + } + } + } +} + /// A tab group dragged out of the icon column by its grip floats as an expanded panel: its tabs show /// in the window, and a click on each tab shows that panel. #[test] diff --git a/xtask/src/pdf_deps.rs b/xtask/src/pdf_deps.rs index 216d23d43d..f98d2ead3d 100644 --- a/xtask/src/pdf_deps.rs +++ b/xtask/src/pdf_deps.rs @@ -5,7 +5,7 @@ use std::process::Command; use serde_json::Value; -const REV: &str = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"; +const REV: &str = "823f0d1a40cd485a3cb0730e610d46333e8aa7e0"; const PACKAGES: &[(&str, &str, &str)] = &[ ("craft-pdf", "0.1.0", REV), ("krilla", "0.8.2", REV), From 38debaa67e2df25a7d0146fb98501c8f0fedd264 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 17:39:41 -0800 Subject: [PATCH 081/112] Tests: ui-egui tests outside the panels check counts and waits - Artboard frame tests assert how many frames are drawn before checking each one, so a canvas that draws no frames fails them. - Find Font's refresh test checks the document's one family and the one row it shows instead of checking every row of a list that may be empty. - The freeform paint chip test also checks an opaque point and the chip's size, and the holographic test checks the foil chip's size. - The background wait tests (Quit, packaging and export made at once) open the writer's gate when the UI thread starts waiting, through a test-only hook in background::wait_until, instead of after a sleep. Each asserts that the wait happened. - Cancel Open waits for the file to be read before Cancel instead of sleeping after it. - The automation roots test checks that the open keeps the same roots. - The brightness test reads the saved ids and old labels in place of a round trip through its own table. - Removed every_tool_cursors_hotspot_lies_inside_its_icon_box, which every_tool_cursors_hotspot_is_on_its_glyph covers, and message_dump_lists_the_reported_messages and the schema phrase loop, which held by construction. - dump_source_strings is ignored with a reason; the translator commands in docs/development.md pass --ignored. --- crates/ui-egui/src/background.rs | 11 +++++++ crates/ui-egui/src/canvas/artboards/tests.rs | 26 +++++++++++----- crates/ui-egui/src/cursors/tests.rs | 10 ------ crates/ui-egui/src/dialogs/tests_package.rs | 16 +++------- crates/ui-egui/src/dialogs/tests_screens.rs | 8 ++--- crates/ui-egui/src/find_font.rs | 7 +++-- crates/ui-egui/src/i18n/tests.rs | 32 +++++--------------- crates/ui-egui/src/opening/tests.rs | 7 +++-- crates/ui-egui/src/paint_preview.rs | 16 +++++++--- crates/ui-egui/src/tests/background.rs | 20 ++++++++---- crates/ui-egui/src/theme.rs | 15 +++++---- docs/development.md | 4 +-- docs/target-app-parity.md | 2 +- 13 files changed, 89 insertions(+), 85 deletions(-) diff --git a/crates/ui-egui/src/background.rs b/crates/ui-egui/src/background.rs index 57a9bf1086..33c7d37e28 100644 --- a/crates/ui-egui/src/background.rs +++ b/crates/ui-egui/src/background.rs @@ -331,10 +331,21 @@ pub fn wait_all(app: &mut VectorcraftApp) { wait_until(app, |_| false); } +#[cfg(test)] +thread_local! { + /// Run once on this thread when [`wait_until`] next starts to wait for a job's result, so a test + /// lets a held job finish only once the wait has started. + pub(crate) static ON_WAIT: std::cell::RefCell<Option<Box<dyn FnOnce()>>> = const { std::cell::RefCell::new(None) }; +} + /// Apply the jobs' results as they arrive (in the order the jobs were started) until `ready` holds /// or no job is left. pub fn wait_until(app: &mut VectorcraftApp, ready: impl Fn(&VectorcraftApp) -> bool) { while !ready(app) && !app.background.jobs.is_empty() { + #[cfg(test)] + if let Some(waiting) = ON_WAIT.with_borrow_mut(Option::take) { + waiting(); + } let Some(done) = app.background.results.as_ref().and_then(|(_, rx)| rx.recv().ok()) else { // No result can arrive: the jobs can't finish. for job in std::mem::take(&mut app.background.jobs) { diff --git a/crates/ui-egui/src/canvas/artboards/tests.rs b/crates/ui-egui/src/canvas/artboards/tests.rs index 662f46db4a..19e0d91c11 100644 --- a/crates/ui-egui/src/canvas/artboards/tests.rs +++ b/crates/ui-egui/src/canvas/artboards/tests.rs @@ -29,9 +29,11 @@ fn the_artboard_tool_names_its_active_artboard_once() { assert!(names.iter().enumerate().all(|(i, n)| n.as_deref().is_some_and(|n| n.starts_with(&format!("{:02} - ", i + 1))))); let mut single = app_with(1); use_tool(&mut single, "selection"); - assert!(frames_of(&single, false).iter().all(|f| f.name.is_none())); + let unnamed = frames_of(&single, false); + assert!(unnamed.len() == 1 && unnamed[0].name.is_none(), "{:?}", unnamed.len()); use_tool(&mut single, "artboard"); - assert!(frames_of(&single, false).iter().all(|f| f.name.is_some())); + let named = frames_of(&single, false); + assert!(named.len() == 1 && named[0].name.is_some(), "{:?}", named.len()); use_tool(&mut app, "artboard"); assert_eq!(frames_of(&app, false).iter().filter(|f| f.name.is_some()).count(), 2); } @@ -53,10 +55,14 @@ fn outline_has_white_artboards_on_a_white_canvas_with_line_edges() { let st = app.session.active().unwrap(); assert_eq!(pasteboard_color(&app, st, true), PasteboardColor::Custom(DataColor::new(Color32::WHITE))); assert_eq!(border(true), PageBorder::Line); - assert!(frames_of(&app, true).iter().all(|f| f.fill == Some(PageFill::Color(DataColor::new(Color32::WHITE))))); + let outline = frames_of(&app, true); + assert_eq!(outline.len(), 2, "a frame for each artboard"); + assert!(outline.iter().all(|f| f.fill == Some(PageFill::Color(DataColor::new(Color32::WHITE))))); assert_eq!(pasteboard_color(&app, st, false), PasteboardColor::Default); assert_eq!(border(false), PageBorder::DropShadow); - assert!(frames_of(&app, false).iter().all(|f| f.fill.is_some())); + let preview = frames_of(&app, false); + assert_eq!(preview.len(), 2, "a frame for each artboard"); + assert!(preview.iter().all(|f| f.fill.is_some())); } /// Overprint Preview, and Separations Preview, which turns it on, draw a white canvas around the artboards and no @@ -83,7 +89,9 @@ fn overprint_preview_draws_a_white_canvas_without_shadows() { assert_eq!(border(false), PageBorder::DropShadow, "{at}"); } assert_eq!(border(true), PageBorder::Line, "{at}"); - assert!(frames_of(&app, false).iter().all(|f| f.fill.is_some()), "{at}"); + let frames = frames_of(&app, false); + assert_eq!(frames.len(), 2, "{at}: a frame for each artboard"); + assert!(frames.iter().all(|f| f.fill.is_some()), "{at}"); } } app.run("view.overprintPreview", json!({"on": true})).unwrap(); @@ -182,7 +190,9 @@ fn paper_is_the_artboard_color_times_the_simulated_paper() { assert_eq!(artboard_paper(&ab, Color32::WHITE), Color32::from_rgb(51, 102, 153)); // The frame carries the same fill. app.run("view.transparencyGrid", json!({})).unwrap(); - assert!(frames_of(&app, false).iter().all(|f| matches!(f.fill, Some(PageFill::Checker(_))))); + let frames = frames_of(&app, false); + assert_eq!(frames.len(), 1, "the artboard's frame"); + assert!(frames.iter().all(|f| matches!(f.fill, Some(PageFill::Checker(_))))); } #[test] @@ -205,7 +215,9 @@ fn the_transparency_grid_follows_each_document_and_the_view_menu_label() { assert_eq!(menus::dynamic_label(&app, "view.transparencyGrid", ""), "Show Transparency Grid"); assert_eq!(app.run("view.transparencyGrid", json!({})).unwrap(), json!({"on": true})); assert!(shows_transparency_grid(app.session.active().unwrap())); - assert!(frames_of(&app, false).iter().all(|f| matches!(f.fill, Some(PageFill::Checker(_))))); + let frames = frames_of(&app, false); + assert_eq!(frames.len(), 1, "the artboard's frame"); + assert!(frames.iter().all(|f| matches!(f.fill, Some(PageFill::Checker(_))))); assert_eq!(menus::dynamic_label(&app, "view.transparencyGrid", ""), "Hide Transparency Grid"); app.run("document.activate", json!({"index": 0})).unwrap(); assert!(!shows_transparency_grid(app.session.active().unwrap())); diff --git a/crates/ui-egui/src/cursors/tests.rs b/crates/ui-egui/src/cursors/tests.rs index 2f6821f8a9..f4c1d52986 100644 --- a/crates/ui-egui/src/cursors/tests.rs +++ b/crates/ui-egui/src/cursors/tests.rs @@ -1,15 +1,5 @@ use super::*; -/// A hotspot is data a typo moves off the glyph: every painted tool cursor's lies in its icon's box. -#[test] -fn every_tool_cursors_hotspot_lies_inside_its_icon_box() { - for c in GLYPHS { - if let cb::Cursor::Painted(PaintedCursor::Tool { hotspot, .. }) = tool_cursor(c) { - assert!((0.0..=24.0).contains(&hotspot.x) && (0.0..=24.0).contains(&hotspot.y), "{c:?}: {hotspot:?}"); - } - } -} - /// A click lands where the glyph points: in every painted tool cursor's image, the icon's own /// mark color (not only its halo) covers the hotspot pixel or one next to it. #[test] diff --git a/crates/ui-egui/src/dialogs/tests_package.rs b/crates/ui-egui/src/dialogs/tests_package.rs index 392e77a4ed..0378bbb2a6 100644 --- a/crates/ui-egui/src/dialogs/tests_package.rs +++ b/crates/ui-egui/src/dialogs/tests_package.rs @@ -345,13 +345,9 @@ fn a_dirty_documents_save_is_written_before_its_package() { app.session.execute("prefs.set", &json!({"values": {"backgroundExport": false}})).unwrap(); app.run("shape.rectangle", json!({"x": 0, "y": 0, "width": 10, "height": 10})).unwrap(); package_dialog(&mut app, &out); - let opener = gate.clone(); - let release = std::thread::spawn(move || { - std::thread::sleep(std::time::Duration::from_millis(50)); - opener.open(); - }); + let waited = gate.open_on_wait(); reply(&mut app).unwrap(); - release.join().unwrap(); + assert!(waited.get(), "the package waited for the save"); assert_eq!(written(&files), [doc]); assert!(app.background.jobs.is_empty() && !app.session.active().unwrap().is_dirty()); assert!(app.ui.status.starts_with("Packaged 3 files in "), "the package's status came last: {}", app.ui.status); @@ -451,14 +447,10 @@ fn a_package_made_at_once_waits_for_one_in_the_background() { // the background. app.session.execute("prefs.set", &json!({"values": {"backgroundExport": false}})).unwrap(); package_dialog(&mut app, &out); - let opener = gate.clone(); - let release = std::thread::spawn(move || { - std::thread::sleep(std::time::Duration::from_millis(500)); - opener.open(); - }); + let waited = gate.open_on_wait(); reply(&mut app).unwrap(); + assert!(waited.get(), "the package made at once waited for the one in the background"); assert!(app.background.jobs.is_empty(), "the package in the background was written first"); - release.join().unwrap(); assert_eq!(written(&files).len(), 3); assert!(std::path::Path::new(&out).join("card Folder/card.vectorcraft").is_file()); } diff --git a/crates/ui-egui/src/dialogs/tests_screens.rs b/crates/ui-egui/src/dialogs/tests_screens.rs index 89961fe1da..01266d6a18 100644 --- a/crates/ui-egui/src/dialogs/tests_screens.rs +++ b/crates/ui-egui/src/dialogs/tests_screens.rs @@ -653,14 +653,10 @@ fn an_export_made_at_once_waits_for_one_in_the_background() { let p = json!({"folder": folder, "formats": [{"format": "svg"}]}); assert_eq!(app.run("file.exportForScreens", p.clone()).unwrap()["background"], true); background_export(&mut app, false); - let opener = gate.clone(); - let release = std::thread::spawn(move || { - std::thread::sleep(std::time::Duration::from_millis(500)); - opener.open(); - }); + let waited = gate.open_on_wait(); let r = app.run("file.exportForScreens", p).unwrap(); + assert!(waited.get(), "the export made at once waited for the one in the background"); assert!(app.background.jobs.is_empty(), "the export in the background was written first"); - release.join().unwrap(); let file = format!("{folder}/Artboard-1.svg"); assert_eq!((written(&files), r["files"].clone()), (vec![file.clone()], json!([file]))); assert_eq!(app.ui.status, format!("Exported 1 file to {folder}")); diff --git a/crates/ui-egui/src/find_font.rs b/crates/ui-egui/src/find_font.rs index 65e2a030d2..6b49903050 100644 --- a/crates/ui-egui/src/find_font.rs +++ b/crates/ui-egui/src/find_font.rs @@ -1208,11 +1208,12 @@ mod tests { d.pending = Some(Action::ChangeAll); }); pump_now(&mut app); - assert!(fonts(&mut app).iter().all(|f| f["family"] == "Source Serif 4"), "the document changed"); - let d = opened(&app); let now = fonts(&mut app); + let families: Vec<&Value> = now.iter().map(|f| &f["family"]).collect(); + assert_eq!(families, [&json!("Source Serif 4")], "the document changed"); + let d = opened(&app); assert_eq!(d.rows, replacement_rows(&app, "document", &now), "the rows follow the document"); - assert!(d.rows.iter().all(|r| r.family == "Source Serif 4"), "{:?}", d.rows); + assert_eq!(d.rows.iter().map(|r| r.family.as_str()).collect::<Vec<_>>(), ["Source Serif 4"], "{:?}", d.rows); assert!(d.pending.is_none(), "the press was taken"); } diff --git a/crates/ui-egui/src/i18n/tests.rs b/crates/ui-egui/src/i18n/tests.rs index bfb29c30da..93cbaf97b8 100644 --- a/crates/ui-egui/src/i18n/tests.rs +++ b/crates/ui-egui/src/i18n/tests.rs @@ -798,11 +798,12 @@ fn literal_spans(code: &str) -> Vec<(usize, usize)> { out } -/// For translators, `cargo test -p vectorcraft-ui-egui dump_source_strings` writes every English -/// interface string to `VECTORCRAFT_I18N_DUMP=<file>`, and every status and error message as a +/// For translators, `cargo test -p vectorcraft-ui-egui dump_source_strings -- --ignored` writes every +/// English interface string to `VECTORCRAFT_I18N_DUMP=<file>`, and every status and error message as a /// catalog template that [`untranslated_report`] checks to `VECTORCRAFT_I18N_DUMP_MESSAGES=<file>`, /// one per line. #[test] +#[ignore = "translator tool: writes the files VECTORCRAFT_I18N_DUMP and VECTORCRAFT_I18N_DUMP_MESSAGES name"] fn dump_source_strings() { if let Ok(path) = std::env::var("VECTORCRAFT_I18N_DUMP") { let mut all = crate::menus::menu_strings(); @@ -813,27 +814,11 @@ fn dump_source_strings() { std::fs::write(path, text).expect("write dump"); } if let Ok(path) = std::env::var("VECTORCRAFT_I18N_DUMP_MESSAGES") { - std::fs::write(path, message_dump()).expect("write dump"); + let text: String = reported_messages().iter().map(|m| format!("{m}\n")).collect(); + std::fs::write(path, text).expect("write dump"); } } -/// The text [`dump_source_strings`] writes to `VECTORCRAFT_I18N_DUMP_MESSAGES`. -fn message_dump() -> String { - reported_messages().iter().map(|m| format!("{m}\n")).collect() -} - -/// The translators' message dump lists every message the untranslated report checks, the -/// phrases a parameter schema's error builds included. -#[test] -fn message_dump_lists_the_reported_messages() { - let dump = message_dump(); - let lines: std::collections::BTreeSet<&str> = dump.lines().collect(); - for phrase in SCHEMA_PHRASES { - assert!(lines.contains(phrase), "the dump skips {phrase:?}"); - } - assert!(lines.contains("the color book is cut short")); -} - /// Languages whose catalogs leave [`MENU_KEEP_AS_IS`] in English. const KEEPS_MENU_NAMES: [&str; 20] = ["cs", "de", "el", "es", "fr", "hi", "hu", "it", "ja", "ka", "ko", "pl", "pt-br", "ru", "sv", "uk", "vi", "fi", "tr", "ca"]; @@ -1199,9 +1184,9 @@ fn reported_messages() -> std::collections::BTreeSet<String> { } /// The untranslated report checks the messages of the effects and of the crates whose errors the -/// engine and the effects pass on, and the phrases a parameter schema's error builds. +/// engine and the effects pass on. #[test] -fn untranslated_report_checks_every_message_crate_and_schema_phrase() { +fn untranslated_report_checks_every_message_crate() { let reported = reported_messages(); let passed_on = [ ("effects", "the SVG filter has no primitives"), @@ -1214,9 +1199,6 @@ fn untranslated_report_checks_every_message_crate_and_schema_phrase() { assert!(message_literals_in(&[krate]).contains(m), "{krate}: {m}"); assert!(reported.contains(m), "the report skips {krate}: {m}"); } - for phrase in SCHEMA_PHRASES { - assert!(reported.contains(*phrase), "the report skips the schema phrase {phrase:?}"); - } } /// Banner Hems and Grommets' errors and the status of a recovery copy that failed without a folder diff --git a/crates/ui-egui/src/opening/tests.rs b/crates/ui-egui/src/opening/tests.rs index 0dd4c4c3b7..d9f334105c 100644 --- a/crates/ui-egui/src/opening/tests.rs +++ b/crates/ui-egui/src/opening/tests.rs @@ -439,7 +439,9 @@ fn a_file_opened_under_automation_roots_finishes_under_them() { start(&mut app, "/art/Scoped.vectorcraft", vectorcraft_format::save(&vectorcraft_doc::Document::new(10.0, 10.0), false)) }); let scope = app.opening.pending[0].scope.clone(); - assert!(scope.run(file_access::current).is_some(), "the roots go with the open"); + assert!(file_access::current().is_none(), "the desktop has no roots here"); + let (given, kept) = (roots.expect("roots for the folder"), scope.run(file_access::current).expect("the roots go with the open")); + assert!(std::sync::Arc::ptr_eq(&given, &kept), "the open keeps the roots it started under"); } /// A file asked for again while it is still being read is not read a second time (#3455). @@ -600,10 +602,11 @@ fn cancelling_an_open_opens_nothing() { let before = app.session.documents().len(); start(&mut app, "/art/Big.vectorcraft", bytes("Big")); assert!(crate::menus::enabled(&app, "file.cancelOpen")); + // The file has been read and its result waits for the next frame when Cancel is pressed. + wait_read(&mut app); assert_eq!(app.run("file.cancelOpen", json!({})).unwrap()["cancelled"], 1); assert!(app.opening.pending.is_empty() && !long_operation_busy(&app)); assert!(!app.ui.status.starts_with("Opening"), "{}", app.ui.status); - std::thread::sleep(std::time::Duration::from_millis(50)); poll(&mut app); assert_eq!(app.session.documents().len(), before); assert_ne!(app.ui.recent_files.first().map(String::as_str), Some("/art/Big.vectorcraft")); diff --git a/crates/ui-egui/src/paint_preview.rs b/crates/ui-egui/src/paint_preview.rs index ad49d9e373..2aaa86ba1b 100644 --- a/crates/ui-egui/src/paint_preview.rs +++ b/crates/ui-egui/src/paint_preview.rs @@ -300,11 +300,16 @@ mod tests { fn freeform_chip_shows_the_points_opacity() { use vectorcraft_color::{Freeform, FreeformPoint}; use vectorcraft_geom::kurbo::Point; - let mut gp = paint(GradientKind::Freeform, 0.0); - let clear = FreeformPoint { opacity: 0.0, ..FreeformPoint::new(Point::new(10.0, 10.0), Color::BLACK) }; - gp.freeform = Some(Freeform { points: vec![clear], ..Default::default() }); - let chip = gradient_chip_colors(&gp, 20.0, 20.0, 4, 4); - assert!(chip.iter().all(|c| c.a() == 0), "{chip:?}"); + let chip = |opacity: f32| { + let mut gp = paint(GradientKind::Freeform, 0.0); + let point = FreeformPoint { opacity, ..FreeformPoint::new(Point::new(10.0, 10.0), Color::BLACK) }; + gp.freeform = Some(Freeform { points: vec![point], ..Default::default() }); + gradient_chip_colors(&gp, 20.0, 20.0, 4, 4) + }; + let (clear, opaque) = (chip(0.0), chip(1.0)); + assert_eq!((clear.len(), opaque.len()), (25, 25), "a color at each corner of the 4 by 4 cells"); + assert!(clear.iter().all(|c| c.a() == 0), "{clear:?}"); + assert!(opaque.iter().all(|c| *c == Color32::BLACK), "{opaque:?}"); } /// A Holographic glow's chip is clear at the corners and nearly opaque at the center; a foil's @@ -320,6 +325,7 @@ mod tests { assert!([0, 4, 20, 24].iter().all(|&i| glow[i].a() == 0), "{glow:?}"); assert!(glow[2 * 5 + 2].a() >= 240, "{glow:?}"); let foil = chip("Prism Veil"); + assert_eq!(foil.len(), glow.len(), "the same 5 by 5 corners"); assert!(foil.iter().all(|c| c.a() == 255), "{foil:?}"); } diff --git a/crates/ui-egui/src/tests/background.rs b/crates/ui-egui/src/tests/background.rs index fe90152db4..98cb20bbc9 100644 --- a/crates/ui-egui/src/tests/background.rs +++ b/crates/ui-egui/src/tests/background.rs @@ -28,6 +28,18 @@ impl Gate { std::thread::sleep(std::time::Duration::from_millis(1)); } } + + /// Open the gate once this thread starts to wait for a background job ([`background::wait_until`]). + /// The flag returned says whether it did. + pub(crate) fn open_on_wait(&self) -> std::rc::Rc<std::cell::Cell<bool>> { + let (gate, opened) = (self.clone(), std::rc::Rc::new(std::cell::Cell::new(false))); + let flag = opened.clone(); + background::ON_WAIT.set(Some(Box::new(move || { + flag.set(true); + gate.open(); + }))); + opened + } } /// Gives `app` a window host over `jobs`, as the window installs it, so its background work runs @@ -347,14 +359,10 @@ fn quitting_waits_for_background_saves() { let (mut app, files) = app(gate.clone()); app.run("file.new", json!({"width": 100, "height": 100})).unwrap(); app.run("file.save", json!({"path": "/docs/q.vectorcraft"})).unwrap(); - let opener = gate.clone(); - let release = std::thread::spawn(move || { - std::thread::sleep(std::time::Duration::from_millis(50)); - opener.open(); - }); + let waited = gate.open_on_wait(); // Without waiting, the document would still count as modified and Quit would ask about it. let r: Value = app.run("app.quit", json!({})).unwrap(); - release.join().unwrap(); + assert!(waited.get(), "Quit waited for the save"); assert!(r.is_null(), "{r}"); assert_eq!(app.ui.status, "quit"); assert_eq!(written(&files), ["/docs/q.vectorcraft"]); diff --git a/crates/ui-egui/src/theme.rs b/crates/ui-egui/src/theme.rs index 374fe2b460..09b5eec0b0 100644 --- a/crates/ui-egui/src/theme.rs +++ b/crates/ui-egui/src/theme.rs @@ -218,13 +218,16 @@ pub fn mono(size: f32) -> FontId { mod tests { use super::*; - /// The saved strings are what Preferences and old settings files hold. + /// Preferences saves a brightness by its id, and old settings files hold its label, in any + /// case; any other text is not a brightness. #[test] - fn brightness_roundtrip() { - for b in Brightness::ALL { - assert_eq!(Brightness::parse(b.id()), Some(b)); - assert_eq!(Brightness::parse(b.label()), Some(b)); - } + fn brightness_reads_saved_ids_and_old_labels() { + assert_eq!(Brightness::MediumDark.id(), "mediumDark", "the id Preferences saves"); + assert_eq!(Brightness::parse("mediumDark"), Some(Brightness::MediumDark)); + assert_eq!(Brightness::parse("Medium Light"), Some(Brightness::MediumLight)); + assert_eq!(Brightness::parse("LIGHT"), Some(Brightness::Light)); + assert_eq!(Brightness::parse("medium"), None); + assert_eq!(Brightness::parse(""), None); } /// A size `app_sizes` cannot read is only logged and dropped, which brings the pill buttons back unnoticed. diff --git a/docs/development.md b/docs/development.md index 4244e28738..27cec890a1 100644 --- a/docs/development.md +++ b/docs/development.md @@ -294,7 +294,7 @@ other `sv-*` locale resolve to it), Georgian (`ka`, complete; `ka-GE` and `ka_GE placeholders and ellipses agree, command ids exist, every row of a partial catalog is a string the UI shows, the UI fonts have every glyph, no Simplified characters in `zh-hant`) pick it up. Set `complete_menus` once the menus and `tl!` literals are translated; the untranslated report then lists what the catalog lacks - (`VECTORCRAFT_I18N_DUMP=strings.txt cargo test -p vectorcraft-ui-egui dump_source_strings` lists every + (`VECTORCRAFT_I18N_DUMP=strings.txt cargo test -p vectorcraft-ui-egui dump_source_strings -- --ignored` lists every English string). - A missing translation never fails a test or a build: the interface shows the English text until a translator adds the row. `cargo xtask i18n-report` prints, per language, the strings its catalog lacks (menu strings, @@ -329,7 +329,7 @@ other `sv-*` locale resolve to it), Georgian (`ka`, complete; `ka-GE` and `ka_GE `bad(…)` or `failed(…)`, and the messages a `.map_err(|e| …)` closure returns (from each `if` branch, `match` arm and statement of a block) or the handler a `.map_err(name)` names returns (a closure bound with `let name = |e| …;` or a function `fn name(…)`), and skips calls inside comments - (`VECTORCRAFT_I18N_DUMP_MESSAGES=messages.txt cargo test -p vectorcraft-ui-egui dump_source_strings` lists them + (`VECTORCRAFT_I18N_DUMP_MESSAGES=messages.txt cargo test -p vectorcraft-ui-egui dump_source_strings -- --ignored` lists them all). A missing row shows the English message. Other languages show messages in English until they add `@msg` rows. - Not translated on purpose: names that are user data (layers, swatches, fonts, documents), the tab diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index aa49d934ac..0eec247ea8 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1360,7 +1360,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - In that Liquify warning, the tool's name and each kind of object it left (graphs, type, symbols, images, meshes, envelopes, repeats, placed documents, blends) are shown in the interface language too, in the order the command lists them and joined as the language joins a list, in each catalog that translates all status and error messages (`liquify-tool`, `liquify-kind` and `liquify-list-*` rows); a kind that Liquify does not list leaves the tool and the list in English (`liquify_warning_translates_its_tool_and_kinds_in_every_complete_catalog`). - An effect a plug-in's output or an importer plug-in's objects carry that VectorCraft refuses (``[0] `id`: reason``) shows in the status bar with its reason in the interface language inside `plug-in output: …` and `can't open …`, in every catalog that translates all status and error messages; the index and the effect id stay as they are, and a JSON array in a message stays as it is (`nested_effect_refusals_translate_with_their_reason`, `bracketed_message_parts_translate_only_as_exact_messages`). - A filter run (`plugin.run`) or plug-in command whose output changes no object and none of the data the plug-in keeps with the document records no undo step and leaves a saved document unmodified, with its objects still selected; a run that may call commands records none when its calls leave the document as it was (engine `plugins::a_filter_run_that_changes_nothing_records_no_undo_step`, `plugins::a_filter_that_keeps_the_same_data_records_no_undo_step`, `plugins::a_plugin_command_that_changes_nothing_records_no_undo_step`). - - The untranslated report lists the status and error messages of the effects, swatch libraries, raster sizes and encoders, 3D solids and path operations that a catalog lacks, the messages that a `.map_err` closure or a named error handler returns, and the phrases a parameter schema's error builds for what a value must be (`untranslated_report_checks_every_message_crate_and_schema_phrase`, `message_scan_reads_map_err_closures`, `message_scan_reads_named_map_err_handlers`). + - The untranslated report lists the status and error messages of the effects, swatch libraries, raster sizes and encoders, 3D solids and path operations that a catalog lacks, the messages that a `.map_err` closure or a named error handler returns, and the phrases a parameter schema's error builds for what a value must be (`untranslated_report_checks_every_message_crate`, `message_scan_reads_map_err_closures`, `message_scan_reads_named_map_err_handlers`). - The Swedish catalog has rows for the Apply SVG Filter and Check Spelling command names, the SVG Filter effect's name, which also names its undo step, and the 3D and Materials panel's note that graphics map onto the Plane, Extrude and Revolve object types, so these show in Swedish instead of English (`swedish_svg_filter_spelling_and_3d_labels_are_complete`). - Spanish messages (2026-11-13): the Spanish catalog (`crates/ui-egui/src/i18n/es.tsv`) has an `@msg` row for 114 of the 167 status and error messages that the untranslated report (`untranslated_report`) lists as missing in all 23 complete-message languages: the errors of the image encoders, color profiles, swatch exchange files and color books, 3D and Revolve, path operations, DXF import, the script engine and the parameter checks. Open #7211 and #7378 translate 51 of the others (the composite font and SVG filter errors), and 2 stay in English. The rows keep the placeholders, backticked names, accepted values and limits of their English (`spanish_translates_encoder_profile_swatch_revolve_and_parameter_errors`); native review remains; scores and estimates unchanged. - Export commands run through MCP, the control channel or the CLI refuse a key that no format takes, and warn about a key that only another format takes (`{"format": "pdf", "quality": 80}` writes the PDF with the warning "`quality` was not used: PDF files don't read it"; `an_option_only_another_format_reads_gets_a_note`, `control_export_notes_an_option_the_format_does_not_read`, `convert_warns_about_an_unused_option_only_when_one_was_given`), and a command that writes one format (`document.exportPdf`, `document.exportEps`, `document.exportDxf`) or takes one format's options (`document.pdfSettings`, `pdf.preset.save`) refuses a key that format doesn't take. An unknown key inside `marks`, `bleed`, `compression`, `output`, `advanced`, `security` or `flattener` is refused by its path. From 293bde7afeb94021fc484c3b69d8801e3651ff51 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 17:41:04 -0800 Subject: [PATCH 082/112] Tests: panel tests check results, not that a list is non-empty or every catalog has a row Panel tests that could pass on an empty list, that only checked a control was there, or that looped over every language or preset now check the result: - Character, Glyphs and OpenType: the underline, kashida, size, Up/Down, glyph form and Proportional Metrics checks compare the text each setting reaches (for example "AB" underlined, then none) instead of `all()` over the runs, which passed when a frame had no runs. - Actions: the built-in actions play on a selection and each makes an undo step, instead of only looking up their command ids. - Color Wheel: Show Out-of-Gamut Colors is checked by what the wheel and the box draw with it on and off. The test that loaded a profile and only checked the box was shown is removed, and two copies of the junk-parameter test are removed (the one in tests_color_wheel_vision.rs runs with and without a document). The error-translation tests check German and Japanese instead of every catalog. - History and Paragraph: the name and Mojikumi checks use a few languages instead of every catalog, and the Numbered List presets are checked by one style instead of every number style. - Graphic Styles, Stroke and Swatches: the rename, profile preview and row menu checks count what they read before checking each item. - Image Trace: the off-thread trace test waits on the trace's own channel through a new test-only `trace_runs::finish_all`, instead of polling with a sleep for up to 30 seconds. --- .../ui-egui/src/panels/actions/tests_files.rs | 22 +++++++-- crates/ui-egui/src/panels/character/tests.rs | 48 ++++++++++++------- crates/ui-egui/src/panels/glyphs/tests.rs | 17 ++++--- crates/ui-egui/src/panels/graphic_styles.rs | 3 +- crates/ui-egui/src/panels/history.rs | 19 ++++++-- .../ui-egui/src/panels/image_trace/tests.rs | 6 +-- crates/ui-egui/src/panels/opentype.rs | 21 +++++--- crates/ui-egui/src/panels/paragraph/tests.rs | 10 ++-- crates/ui-egui/src/panels/stroke.rs | 10 ++-- .../src/panels/swatches/tests/context_menu.rs | 4 +- .../src/panels/tests_color_wheel_box.rs | 22 ++------- .../src/panels/tests_color_wheel_gamut.rs | 48 +++++-------------- .../src/panels/tests_color_wheel_harmony.rs | 7 +-- .../src/panels/tests_color_wheel_opacity.rs | 11 ----- crates/ui-egui/src/trace_runs.rs | 27 ++++++++--- 15 files changed, 145 insertions(+), 130 deletions(-) diff --git a/crates/ui-egui/src/panels/actions/tests_files.rs b/crates/ui-egui/src/panels/actions/tests_files.rs index a88cbc36fe..396c3d6af9 100644 --- a/crates/ui-egui/src/panels/actions/tests_files.rs +++ b/crates/ui-egui/src/panels/actions/tests_files.rs @@ -53,12 +53,24 @@ fn browser_picks_load_and_replace_action_sets_without_a_file_reader() { } } +/// Each built-in action plays on a selection it applies to (text for Outline Text, two +/// overlapping rectangles otherwise) and edits the drawing, so its commands and their +/// parameters are ones the engine accepts. #[test] -fn defaults_are_valid_commands() { - for a in default_sets().actions { - for step in a.steps { - assert!(vectorcraft_engine::find_command(&step.command).is_some(), "{}", step.command); - } +fn built_in_actions_play_and_edit_the_drawing() { + for (idx, a) in default_sets().actions.iter().enumerate() { + let mut app = new_app(); + app.run("file.new", json!({"width": 400, "height": 400})).unwrap(); + let ids: Vec<Value> = if a.steps.iter().any(|s| s.command.starts_with("type.")) { + vec![app.run("text.create", json!({"x": 20, "y": 40, "text": "Ab"})).unwrap()["id"].clone()] + } else { + [10, 30].iter().map(|x| app.run("shape.rectangle", json!({"x": x, "y": 10, "width": 40, "height": 40})).unwrap()["id"].clone()).collect() + }; + app.run("select.set", json!({ "ids": ids })).unwrap(); + app.ui.actions = default_list(); + let before = undo_steps(&app); + play(&mut app, 0, idx).unwrap_or_else(|e| panic!("{}: {e}", a.name)); + assert!(undo_steps(&app) > before, "{} edits the drawing", a.name); } } diff --git a/crates/ui-egui/src/panels/character/tests.rs b/crates/ui-egui/src/panels/character/tests.rs index 6713eb3033..d1f6be332e 100644 --- a/crates/ui-egui/src/panels/character/tests.rs +++ b/crates/ui-egui/src/panels/character/tests.rs @@ -7,6 +7,18 @@ use vectorcraft_doc::text::TypeAntiAlias; use vectorcraft_doc::{CharStyle, NodeId, NodeKind}; use vectorcraft_engine::Session; +/// The different values in `items`, in the order they first appear: `[v]` when every item is `v`, +/// and empty when there are no items. +fn distinct<T: PartialEq>(items: impl IntoIterator<Item = T>) -> Vec<T> { + let mut out = Vec::new(); + for item in items { + if !out.contains(&item) { + out.push(item); + } + } + out +} + /// `value` is `want` (the panel's fields are single precision). fn near(value: Option<f32>, want: f64) -> bool { value.is_some_and(|v| (f64::from(v) - want).abs() < 1e-6) @@ -844,14 +856,16 @@ fn underline_command_underlines_a_mixed_selection() { let id = app.run("text.create", json!({"x": 20, "y": 50, "text": "AB", "size": 12})).unwrap()["id"].as_u64().unwrap(); app.run("text.setRangeStyle", json!({"id": id, "start": 0, "end": 1, "underline": true})).unwrap(); app.run("select.set", json!({"ids": [id]})).unwrap(); + // The underlined characters, in order. let underlined = |app: &VectorcraftApp| match &app.session.active().unwrap().doc.node(NodeId(id)).unwrap().kind { - NodeKind::Text(t) => t.runs.iter().map(|r| r.style.underline).collect::<Vec<_>>(), + NodeKind::Text(t) => t.runs.iter().filter(|r| r.style.underline).map(|r| r.text.as_str()).collect::<String>(), _ => panic!("text"), }; + assert_eq!(underlined(&app), "A"); assert_eq!(super::toggle_underline(&mut app), Ok(json!(true))); - assert!(underlined(&app).iter().all(|u| *u), "{:?}", underlined(&app)); + assert_eq!(underlined(&app), "AB"); assert_eq!(super::toggle_underline(&mut app), Ok(json!(false))); - assert!(underlined(&app).iter().all(|u| !*u), "{:?}", underlined(&app)); + assert_eq!(underlined(&app), ""); } /// At a caret in text the Type tool edits, with no characters selected, the Character @@ -902,15 +916,15 @@ fn kashidas_menu_item_handles_default_and_mixed_ranges() { assert!(!state(&app, &row).1); fire(&mut app, &row); assert!(state(&app, &row).1); - let kashidas = |app: &VectorcraftApp| story_frame(app, id).runs.iter().map(|r| r.style.kashidas).collect::<Vec<_>>(); - assert!(kashidas(&app).iter().all(|v| *v)); + let kashidas = |app: &VectorcraftApp| distinct(story_frame(app, id).runs.iter().map(|r| r.style.kashidas)); + assert_eq!(kashidas(&app), [true]); app.select_tool("type"); app.session.apply_actions(vec![vectorcraft_tools::Action::Notify("text.editNew".into())]).unwrap(); app.session.set_tool_option("select", &json!({"start": 1, "end": 1})); assert!(!state(&app, &row).0, "disabled at an empty caret"); // The result is not the point: a disabled row must leave the text as it was. let _ = run(&mut app, &row.id, &row.params); - assert!(kashidas(&app).iter().all(|v| *v), "an empty caret leaves all characters unchanged"); + assert_eq!(kashidas(&app), [true], "an empty caret leaves all characters unchanged"); } /// Reset Panel sets every character attribute the panel shows, except the font family, style @@ -1112,7 +1126,7 @@ fn select_all_in_threaded_text_formats_and_copies_the_whole_story() { crate::panels::paragraph::run_on_paragraphs(&mut app, "text.setFormat", json!({"spaceBefore": 4})).unwrap(); for id in [a, b] { let t = frame(&app, id); - assert!(t.runs.iter().all(|r| (r.style.size - 9.0).abs() < 1e-9), "every character of frame {id} is 9 pt"); + assert_eq!(distinct(t.runs.iter().map(|r| r.style.size)), [9.0], "every character of frame {id} is 9 pt"); assert!((t.para_at(0).space_before - 4.0).abs() < 1e-9, "frame {id}'s paragraphs take the space"); } assert!(intercept_text_command(&mut app, "edit.copy").is_some()); @@ -1174,9 +1188,9 @@ fn story_changes_follow_the_edited_frames_thread_after_the_first_saved_frame_lea assert_eq!(text_story(&app), Some(vec![NodeId(b), NodeId(c)])); format(&mut app, json!({"size": 9})); - assert!(story_sizes(&app, a).iter().all(|s| (*s - 12.0).abs() < 1e-9), "the frame that left keeps its size"); + assert_eq!(distinct(story_sizes(&app, a)), [12.0], "the frame that left keeps its size"); for id in [b, c] { - assert!(story_sizes(&app, id).iter().all(|s| (*s - 9.0).abs() < 1e-9), "frame {id} takes the size"); + assert_eq!(distinct(story_sizes(&app, id)), [9.0], "frame {id} takes the size"); } } @@ -1262,26 +1276,28 @@ fn selection_tool_changes_reach_every_frame_of_the_story() { style(&mut app, json!({"size": 9})); assert_eq!(undo_steps(&app), steps + 1, "one undo step"); for id in frames { - assert!(story_sizes(&app, id).iter().all(|s| (*s - 9.0).abs() < 1e-9), "frame {id} takes the size"); + assert_eq!(distinct(story_sizes(&app, id)), [9.0], "frame {id} takes the size"); } - assert!(story_sizes(&app, other).iter().all(|s| (*s - 12.0).abs() < 1e-9), "other type keeps its size"); + assert_eq!(distinct(story_sizes(&app, other)), [12.0], "other type keeps its size"); app.run("edit.undo", json!({})).unwrap(); for id in frames { - assert!(story_sizes(&app, id).iter().all(|s| (*s - 12.0).abs() < 1e-9), "undo gives frame {id} its size back"); + assert_eq!(distinct(story_sizes(&app, id)), [12.0], "undo gives frame {id} its size back"); } format(&mut app, json!({"underline": true})); + let underline = |app: &VectorcraftApp, id: u64| distinct(story_frame(app, id).runs.iter().map(|r| r.style.underline)); for id in frames { - assert!(story_frame(&app, id).runs.iter().all(|r| r.style.underline), "frame {id} is underlined"); + assert_eq!(underline(&app, id), [true], "frame {id} is underlined"); } - assert!(story_frame(&app, other).runs.iter().all(|r| !r.style.underline)); + assert_eq!(underline(&app, other), [false]); // Tate-chu-yoko Settings and Warichu Settings set their values through `run_format`. run_format(&mut app, json!({"tcyUpDown": 2})).unwrap(); + let up_down = |app: &VectorcraftApp, id: u64| distinct(story_frame(app, id).runs.iter().map(|r| r.style.tcy_up_down)); for id in frames { - assert!(story_frame(&app, id).runs.iter().all(|r| (r.style.tcy_up_down - 2.0).abs() < 1e-9), "frame {id} takes Up/Down"); + assert_eq!(up_down(&app, id), [2.0], "frame {id} takes Up/Down"); } - assert!(story_frame(&app, other).runs.iter().all(|r| r.style.tcy_up_down.abs() < 1e-9)); + assert_eq!(up_down(&app, other), [0.0]); } /// The fields show a value only when every frame of the selected story has it: a hidden frame that diff --git a/crates/ui-egui/src/panels/glyphs/tests.rs b/crates/ui-egui/src/panels/glyphs/tests.rs index 0886975276..e8eae923bd 100644 --- a/crates/ui-egui/src/panels/glyphs/tests.rs +++ b/crates/ui-egui/src/panels/glyphs/tests.rs @@ -208,9 +208,7 @@ fn east_asian_glyph_forms_in_the_panel_menu_set_the_selected_characters_form() { assert!(!rows(&app).contains(&form_ref(GlyphForm::Jis78)), "hidden without Show East Asian Options"); app.session.prefs.show_east_asian_options = true; let shown = rows(&app); - for form in GlyphForm::ALL { - assert!(shown.contains(&form_ref(form)), "{form:?} in {shown:?}"); - } + assert!(shown.contains(&form_ref(GlyphForm::Jis78)), "shown with Show East Asian Options: {shown:?}"); const FAMILY: &str = "BIZ UDMincho"; if FontDb::global().face(FAMILY, "Regular").is_none_or(|f| f.family != FAMILY) { eprintln!("skipped: built without craft-fonts (set CRAFT_FONTS_DIR to a craft-fonts checkout to run it)"); @@ -231,7 +229,7 @@ fn east_asian_glyph_forms_in_the_panel_menu_set_the_selected_characters_form() { app.run("text.setRangeStyle", json!({"id": id, "start": 0, "end": 3, "font": fallback})).unwrap(); select(&mut app, 0, 6); choose(&mut app, GlyphForm::Jis83); - assert!(forms(&app).iter().all(|(_, f)| *f == GlyphForm::Jis83), "{:?}", forms(&app)); + assert_eq!(in_form(&forms(&app), GlyphForm::Jis83), "亜唖", "{:?}", forms(&app)); app.run("text.setRangeStyle", json!({"id": id, "start": 0, "end": 3, "font": FAMILY})).unwrap(); app.run("text.setRangeStyle", json!({"id": id, "glyphForm": "default"})).unwrap(); select(&mut app, 3, 6); @@ -244,7 +242,12 @@ fn east_asian_glyph_forms_in_the_panel_menu_set_the_selected_characters_form() { assert_eq!(undo_len(&app), n); assert_eq!(forms(&app)[1].1, GlyphForm::Jis78); choose(&mut app, GlyphForm::Default); - assert!(forms(&app).iter().all(|(_, f)| *f == GlyphForm::Default), "{:?}", forms(&app)); + assert_eq!(in_form(&forms(&app), GlyphForm::Default), "亜唖", "{:?}", forms(&app)); +} + +/// The characters of `runs` (text and form) drawn in `form`, in order. +fn in_form(runs: &[(String, GlyphForm)], form: GlyphForm) -> String { + runs.iter().filter(|(_, f)| *f == form).map(|(text, _)| text.as_str()).collect() } /// At a caret the glyph form rows act on all the text of the object, so they are checked, and skipped as changing nothing, by @@ -256,14 +259,14 @@ fn glyph_form_items_at_a_caret_follow_all_the_text() { app.session.prefs.show_east_asian_options = true; let node = NodeId(id.as_u64().unwrap_or(0)); let forms = |app: &VectorcraftApp| match &app.session.active().unwrap().doc.node(node).unwrap().kind { - NodeKind::Text(t) => t.runs.iter().map(|r| r.style.glyph_form).collect::<Vec<_>>(), + NodeKind::Text(t) => t.runs.iter().map(|r| (r.text.clone(), r.style.glyph_form)).collect::<Vec<_>>(), _ => panic!("text"), }; app.run("text.setRangeStyle", json!({"id": id, "start": 0, "end": 3, "glyphForm": "jis78"})).unwrap(); select(&mut app, 6, 6); assert_eq!(selection_glyph_form(&app), None, "the caret's form is not every character's"); choose(&mut app, GlyphForm::Default); - assert!(forms(&app).iter().all(|f| *f == GlyphForm::Default), "{:?}", forms(&app)); + assert_eq!(in_form(&forms(&app), GlyphForm::Default), "亜唖", "{:?}", forms(&app)); app.run("text.setRangeStyle", json!({"id": id, "glyphForm": "jis78"})).unwrap(); select(&mut app, 6, 6); assert_eq!(selection_glyph_form(&app), Some(GlyphForm::Jis78)); diff --git a/crates/ui-egui/src/panels/graphic_styles.rs b/crates/ui-egui/src/panels/graphic_styles.rs index e6668323a8..7d59220a48 100644 --- a/crates/ui-egui/src/panels/graphic_styles.rs +++ b/crates/ui-egui/src/panels/graphic_styles.rs @@ -1756,7 +1756,8 @@ mod tests { let app = panel.app(); let names: Vec<Vec<String>> = app.session.documents().iter().map(|st| st.doc.graphic_styles.iter().map(|g| g.name.clone()).collect()).collect(); - assert!(names.iter().all(|n| n.iter().any(|g| g == "Mine")), "no style is renamed: {names:?}"); + let kept = names.iter().filter(|n| n.iter().any(|g| g == "Mine")).count(); + assert_eq!(kept, 2, "both documents keep their style named Mine: {names:?}"); } /// The New and Delete buttons name what an Alt-click does, and an Alt-click does it: New asks for a name, Delete diff --git a/crates/ui-egui/src/panels/history.rs b/crates/ui-egui/src/panels/history.rs index 7650b4d79c..2e0c5b2c57 100644 --- a/crates/ui-egui/src/panels/history.rs +++ b/crates/ui-egui/src/panels/history.rs @@ -292,6 +292,15 @@ mod tests { use crate::tests::panel_harness::Panel; use craft::ui::contract::Role; + /// English and two translated interface languages, one of them with another script. + fn some_languages() -> [crate::i18n::Lang; 3] { + [ + crate::i18n::Lang::EN, + crate::i18n::Lang::from_code("de").expect("de registered"), + crate::i18n::Lang::from_code("ja").expect("ja registered"), + ] + } + /// A step named after a style lists the template's translation with the style's name in it as /// the document holds it, also when the name looks like a template, like a step with a row of /// its own (`Apply Brush`) or like another template's name; the Normal style's name is @@ -338,7 +347,7 @@ mod tests { /// plain row, else the menu item's row without the ellipsis; a name with no row has none. #[test] fn plain_steps_read_the_menu_row_and_unknown_steps_have_no_name() { - for lang in crate::i18n::Lang::all() { + for lang in some_languages() { let menu_row = crate::i18n::has(lang, "Clean Up…").then(|| crate::i18n::tr(lang, "Clean Up…").trim_end_matches('…').to_string()); let plain_row = crate::i18n::has(lang, "Clean Up").then(|| crate::i18n::tr(lang, "Clean Up").to_string()); assert_eq!(step_name(lang, "Clean Up"), plain_row.or(menu_row), "{}", lang.code()); @@ -347,7 +356,7 @@ mod tests { assert_eq!(step_name(ja, "No Such Step"), None); } - /// Every built-in effect has one name in each language: History (and Edit › Undo and Redo) + /// Every built-in effect has one name in each language checked: History (and Edit › Undo and Redo) /// names the step that applied it, and the Appearance panel its row, with the text of its /// Effect menu item without the ellipsis, which is the effect's `@id` row or the row of its /// menu label with the ellipsis. @@ -366,7 +375,7 @@ mod tests { } assert!(steps.len() * 2 > vectorcraft_effects::effect_catalog().len(), "only {} effects applied", steps.len()); let mut differ = Vec::new(); - for lang in crate::i18n::Lang::all() { + for lang in some_languages() { crate::i18n::set_current(lang); for (e, h) in &steps { let cmd = if e.defaults.as_object().is_some_and(|o| o.is_empty()) { "effect.apply" } else { "effect.dialog" }; @@ -385,14 +394,14 @@ mod tests { } /// A step another command names like an effect (Object › Transform's `Transform`, the name of - /// Distort & Transform › Transform) keeps its own name in every language. + /// Distort & Transform › Transform) keeps its own name in each language checked. #[test] fn a_step_named_like_an_effect_keeps_its_own_name() { let mut app = app_with_two_rectangles(); app.session.execute("object.transform", &json!({ "matrix": [1, 0, 0, 1, 5, 0] })).unwrap(); let h = app.session.active().unwrap().history.undo.last().cloned().unwrap(); assert_eq!((h.label.as_str(), h.effect()), ("Transform", None)); - for lang in crate::i18n::Lang::all() { + for lang in some_languages() { assert_eq!(entry_name(lang, &h), step_name(lang, "Transform"), "{}", lang.code()); } } diff --git a/crates/ui-egui/src/panels/image_trace/tests.rs b/crates/ui-egui/src/panels/image_trace/tests.rs index 1c7a51edc3..7a1085a152 100644 --- a/crates/ui-egui/src/panels/image_trace/tests.rs +++ b/crates/ui-egui/src/panels/image_trace/tests.rs @@ -1280,11 +1280,7 @@ fn a_trace_off_the_ui_thread_is_adopted_when_it_lands() { assert_eq!(undo(&panel.app()), steps, "not traced yet"); { let mut app = panel.app(); - let t0 = std::time::Instant::now(); - while !app.trace_runs.running.is_empty() && t0.elapsed() < std::time::Duration::from_secs(30) { - crate::trace_runs::poll(&mut app); - std::thread::sleep(std::time::Duration::from_millis(5)); - } + crate::trace_runs::finish_all(&mut app); assert_eq!(undo(&app), steps + 1, "one undo step"); assert_eq!(param(&app, "strokes"), Some(json!(true))); let st = &app.ui.image_trace_panel.shown; diff --git a/crates/ui-egui/src/panels/opentype.rs b/crates/ui-egui/src/panels/opentype.rs index d61efcb289..43174d8f9e 100644 --- a/crates/ui-egui/src/panels/opentype.rs +++ b/crates/ui-egui/src/panels/opentype.rs @@ -887,6 +887,7 @@ mod tests { let r = toggle_ref(tag); assert!(rows.iter().any(|row| matches!(row, PanelRow::Submenu(_, sub) if has_row(sub, &r))), "the submenu has a row for {tag}"); } + // Only an installed face without bundled fonts can offer no set; the rows above are checked. let Some((first, flag, _)) = sets.first() else { return }; let (label, tag) = (set_label(first), flag.tag().unwrap()); set(&mut app, OtFeatures { small_caps: true, ..Default::default() }); @@ -972,7 +973,9 @@ mod tests { assert_eq!(state_of(&app, &toggle_ref(tag)), Some(toggled(label, false)), "{label}"); run(&mut app, TOGGLE, &json!({"tag": tag})).unwrap().unwrap(); let runs = run_features(&mut app, &id, 8); - assert!(runs.iter().all(|(_, f)| f.as_array().is_some_and(|f| f.iter().any(|x| x == tag))), "{label}: {runs:?}"); + let tagged: String = + runs.iter().filter(|(_, f)| f.as_array().is_some_and(|f| f.iter().any(|x| x == tag))).map(|(t, _)| t.as_str()).collect(); + assert_eq!(tagged, "かなAB", "{label}: {runs:?}"); } } @@ -1023,6 +1026,11 @@ mod tests { } } + /// The characters of `runs` ([`metrics_runs`]) whose Proportional Metrics and features `keep` accepts. + fn text_where(runs: &[(String, bool, Vec<String>)], keep: impl Fn(bool, &[String]) -> bool) -> String { + runs.iter().filter(|(_, on, f)| keep(*on, f)).map(|(t, _, _)| t.as_str()).collect() + } + /// Where the panel menu's top-level rows list the command `r`. fn row_index(rows: &[PanelRow], r: &CommandRef) -> Option<usize> { rows.iter().position(|row| matches!(row, PanelRow::Command(c) if c == r)) @@ -1068,13 +1076,14 @@ mod tests { assert_eq!(run(&mut app, METRICS, &json!({})), Some(Ok(json!({"on": true})))); assert_eq!(undo_steps(&app), undo + 1); let runs = metrics_runs(&app, &id); - assert!(runs.iter().all(|(_, on, _)| *on), "{runs:?}"); - assert_eq!(runs.iter().map(|(t, _, f)| (t.as_str(), f.clone())).collect::<Vec<_>>(), [("か", vec!["smcp".to_string()]), ("なAB", vec![])]); + assert_eq!(runs, [("か".to_string(), true, vec!["smcp".to_string()]), ("なAB".to_string(), true, vec![])]); assert_eq!(state_of(&app, &metrics), Some(toggled("Proportional Metrics", true))); assert_eq!(run(&mut app, METRICS, &json!({})), Some(Ok(json!({"on": false})))); assert_eq!(undo_steps(&app), undo + 2); let runs = metrics_runs(&app, &id); - assert!(runs.iter().all(|(_, on, f)| !*on && (f.is_empty() || *f == ["smcp"])), "{runs:?}"); + assert_eq!(text_where(&runs, |on, _| on), "", "{runs:?}"); + assert_eq!(text_where(&runs, |_, f| f == ["smcp"]), "か", "each run keeps its features: {runs:?}"); + assert_eq!(text_where(&runs, |_, f| f.is_empty()), "なAB", "{runs:?}"); } /// With the Selection tool, Proportional Metrics turns on for the whole selected object. At a @@ -1089,7 +1098,7 @@ mod tests { let id = app.session.execute("text.create", &json!({"x": 10, "y": 40, "text": "かなAB"})).unwrap()["id"].clone(); app.session.execute("select.set", &json!({"ids": [id]})).unwrap(); run(&mut app, METRICS, &json!({})).unwrap().unwrap(); - assert!(metrics_runs(&app, &id).iter().all(|(_, on, _)| *on), "{:?}", metrics_runs(&app, &id)); + assert_eq!(text_where(&metrics_runs(&app, &id), |on, _| on), "かなAB"); let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); app.session.prefs.show_east_asian_options = true; @@ -1104,7 +1113,7 @@ mod tests { assert_eq!(state_of(&app, &CommandRef::new(METRICS)), Some(toggled("Proportional Metrics", false))); run(&mut app, METRICS, &json!({})).unwrap().unwrap(); let runs = metrics_runs(&app, &id); - assert!(runs.iter().all(|(_, on, _)| *on), "{runs:?}"); + assert_eq!(text_where(&runs, |on, _| on), "かなAB", "{runs:?}"); } /// With Real-time Drawing off, Proportional Metrics and H or V Style decide from the text with diff --git a/crates/ui-egui/src/panels/paragraph/tests.rs b/crates/ui-egui/src/panels/paragraph/tests.rs index 75310b3f35..8d2ea06ab8 100644 --- a/crates/ui-egui/src/panels/paragraph/tests.rs +++ b/crates/ui-egui/src/panels/paragraph/tests.rs @@ -282,7 +282,7 @@ fn kinsoku_set_shows_a_custom_set_by_name() { } /// The Mojikumi Set menu lists None, the four other predefined sets and Line-end Punctuation Half -/// Width, each under its own label in every interface language. Each entry sets the selected +/// Width, each under its own label in English and in Japanese. Each entry sets the selected /// paragraphs' set in one undo step and is shown as the current set; paragraphs with different /// sets show a blank menu, and Reset Panel gives them Line-end Punctuation Half Width. #[test] @@ -290,7 +290,7 @@ fn mojikumi_menu_offers_and_sets_every_predefined_set() { let keys: Vec<&str> = mojikumi_sets().iter().map(|s| s.2).collect(); assert_eq!(keys, ["none", "yakumonoHankaku", "gyomatsuYakumonoHankaku", "gyomatsuYakumonoZenkaku", "yakumonoZenkaku", "lineEndHalf"]); use crate::i18n::LangExt as _; - for lang in crate::i18n::Lang::all() { + for lang in [crate::i18n::Lang::EN, crate::i18n::Lang::from_code("ja").expect("ja registered")] { crate::i18n::set_current(lang); let labels: std::collections::BTreeSet<&str> = mojikumi_sets().iter().map(|s| s.0).collect(); crate::i18n::set_current(crate::i18n::Lang::EN); @@ -680,10 +680,8 @@ fn the_numbered_list_button_and_its_presets_set_the_list_and_reset_panel_clears_ assert_eq!(lists(&app), (numbered(NumberStyle::Arabic), None), "the caret's paragraph"); assert_eq!(numbers_shown(&app), Some(Some(NumberStyle::Arabic)), "the button shows pressed"); assert_eq!(number_sample(NumberStyle::UpperRoman, 3), "I, II, III"); - for style in NumberStyle::ALL { - set_number_style(&mut app, Some(style)); - assert_eq!(lists(&app), (numbered(style), None), "{}", number_sample(style, 3)); - } + set_number_style(&mut app, Some(NumberStyle::UpperRoman)); + assert_eq!(lists(&app), (numbered(NumberStyle::UpperRoman), None), "a preset picks its style"); set_number_style(&mut app, None); assert_eq!(lists(&app), (None, None)); app.session.set_tool_option("selectAll", &json!(true)); diff --git a/crates/ui-egui/src/panels/stroke.rs b/crates/ui-egui/src/panels/stroke.rs index 7f71d73da4..0a8ce3b8da 100644 --- a/crates/ui-egui/src/panels/stroke.rs +++ b/crates/ui-egui/src/panels/stroke.rs @@ -903,11 +903,15 @@ mod tests { let r = Rect::from_min_size(pos2(10.0, 10.0), egui::vec2(80.0, 16.0)); let (top, bottom) = profile_outline(r, 1.0, Some(&[(0.0, 1.0, 1.0), (0.5, 10.0, 10.0), (1.0, 1.0, 1.0)])); let all: Vec<_> = top.iter().chain(&bottom).collect(); - assert!(all.iter().all(|p| p.y >= r.top() && p.y <= r.bottom()), "{all:?}"); - let middle = all.iter().map(|p| (p.y - r.center().y).abs()).fold(0.0, f32::max); + let (highest, lowest) = all.iter().fold((f32::INFINITY, f32::NEG_INFINITY), |(lo, hi), p| (lo.min(p.y), hi.max(p.y))); + assert!(highest >= r.top() && lowest <= r.bottom(), "the outline stays in its box: {all:?}"); + // How far the outline reaches from the box's middle line. + let reach = |top: &[egui::Pos2], bottom: &[egui::Pos2]| top.iter().chain(bottom).map(|p| (p.y - r.center().y).abs()).fold(0.0, f32::max); + let middle = reach(&top, &bottom); assert!((middle - (r.height() / 2.0 - 1.0)).abs() < 1e-3, "the widest point fills the box ({middle})"); let (top, bottom) = profile_outline(r, 1.0, None); - assert!(top.iter().chain(&bottom).all(|p| (p.y - r.center().y).abs() <= 0.35 * (r.height() / 2.0 - 1.0) + 1e-3)); + let plain = reach(&top, &bottom); + assert!(plain > 0.0 && plain <= 0.35 * (r.height() / 2.0 - 1.0) + 1e-3, "the plain bar keeps its look ({plain})"); } #[test] diff --git a/crates/ui-egui/src/panels/swatches/tests/context_menu.rs b/crates/ui-egui/src/panels/swatches/tests/context_menu.rs index bca7cf7852..06c5ce6caa 100644 --- a/crates/ui-egui/src/panels/swatches/tests/context_menu.rs +++ b/crates/ui-egui/src/panels/swatches/tests/context_menu.rs @@ -23,7 +23,9 @@ fn item_commands_run_on_the_clicked_swatch_and_paint_nothing() { let mut app = app(); select_rows(&mut app, &["Black"]); let (before, paint, undo) = (doc(&app), app.session.paint.fill.clone(), undo_steps(&app)); - assert!(enabled(&app, "Red").iter().all(|(_, on)| *on), "every item is enabled on a user swatch"); + let items = enabled(&app, "Red"); + assert_eq!(items.len(), ITEMS.len(), "{items:?}"); + assert!(items.iter().all(|(_, on)| *on), "every item is enabled on a user swatch: {items:?}"); menu(&mut app, "Red", "options"); assert_eq!(dialog_field(&app, KIND, "name"), json!("Red")); assert_eq!((doc(&app), undo_steps(&app)), (before.clone(), undo), "opening the dialog changes nothing"); diff --git a/crates/ui-egui/src/panels/tests_color_wheel_box.rs b/crates/ui-egui/src/panels/tests_color_wheel_box.rs index 77660aedc2..4397e098e6 100644 --- a/crates/ui-egui/src/panels/tests_color_wheel_box.rs +++ b/crates/ui-egui/src/panels/tests_color_wheel_box.rs @@ -103,23 +103,21 @@ fn ui_color_wheel_sets_and_reads_the_view_and_the_channel() { assert_eq!(ui["ui"]["color_wheel"], with(json!({"view": "box", "channel": "green"}))); } -/// The command's errors are translated in the catalogs that translate status and error messages, -/// and each translation keeps the accepted values. +/// The command's errors are shown in the interface language (German and Japanese here), and each +/// translation keeps the accepted values. #[test] fn ui_color_wheel_errors_are_translated() { let errors = [ ("`view` must be wheel or box", &["wheel", "box"][..]), ("`channel` must be hue, saturation, brightness, red, green or blue", &["hue", "saturation", "brightness", "red", "green", "blue"][..]), ]; - for code in [ - "cs", "de", "el", "es", "fr", "hi", "hu", "it", "ja", "ka", "ko", "pl", "pt-br", "ru", "sv", "uk", "vi", "zh-hans", "zh-hant", "fi", "tr", - "ca", "nl", "bs", "da", "id", - ] { + for code in ["de", "ja"] { let lang = crate::i18n::Lang::from_code(code).expect("registered"); for (error, values) in errors { let shown = crate::i18n::message(lang, error); assert_ne!(shown, error, "{code}"); - assert!(values.iter().all(|v| shown.contains(v)), "{code}: {shown}"); + let missing: Vec<&str> = values.iter().copied().filter(|v| !shown.contains(v)).collect(); + assert!(missing.is_empty(), "{code}: {shown} lacks {missing:?}"); } } } @@ -147,16 +145,6 @@ fn ui_color_wheel_rejects_other_params() { assert_eq!(app.ui.color_wheel, Settings { view: View::Box, channel: Channel::Red, ..Default::default() }, "an error changes nothing"); } -/// `ui.colorWheel` answers every junk parameter without a panic. -#[test] -fn ui_color_wheel_answers_junk_params_without_a_panic() { - let doc = crate::menus::UI_COMMANDS.iter().find(|c| c.0 == "ui.colorWheel").expect("registered").3; - let mut app = app(json!("#336699"), "hue"); - for p in vectorcraft_testkit::strategies::junk_params(doc, "/nonexistent").into_iter().chain(vectorcraft_testkit::strategies::junk_values()) { - let _ = app.run("ui.colorWheel", p); - } -} - /// The settings survive a JSON round trip of the preferences, and a saved value this build does /// not know reads as the key's default without losing the other preferences. #[test] diff --git a/crates/ui-egui/src/panels/tests_color_wheel_gamut.rs b/crates/ui-egui/src/panels/tests_color_wheel_gamut.rs index 230485922f..b19877ec58 100644 --- a/crates/ui-egui/src/panels/tests_color_wheel_gamut.rs +++ b/crates/ui-egui/src/panels/tests_color_wheel_gamut.rs @@ -38,44 +38,20 @@ fn uncalibrated_cmyk_marks_nothing() { }); } -/// A profile loaded again under the same name can change which colors are printable while the -/// color settings stay the same; the panel keeps drawing through the change. +/// In the wheel's square and in the box, Show Out-of-Gamut Colors changes what the panel draws, +/// and turning it off again draws the panel as it was. #[test] -fn the_grid_is_computed_again_after_a_profile_is_loaded() { - if !crate::testing::in_own_process("panels::tests_color_wheel_gamut::the_grid_is_computed_again_after_a_profile_is_loaded") { - return; +fn the_setting_shades_the_wheel_and_the_box() { + for view in ["wheel", "box"] { + let mut p = Panel::new(app("#3366cc", view, false)); + let off = p.fx.frame_shapes(); + p.run("ui.colorWheel", json!({"gamut": true})); + let on = p.fx.frame_shapes(); + // Compared without printing: a frame holds thousands of shapes. + assert!(on != off, "{view}: the shading is drawn"); + p.run("ui.colorWheel", json!({"gamut": false})); + assert!(p.fx.frame_shapes() == off, "{view}: off draws no shading"); } - let mut p = Panel::new(app("#3366cc", "box", true)); - /// Unregisters the profile when dropped, also after a failed assertion. - struct Unregister(&'static str); - impl Drop for Unregister { - fn drop(&mut self) { - cms::unregister_icc(self.0); - } - } - let name = "Color Wheel Gamut Reload CMYK"; - let bytes = cms::icc_bytes(cms::GENERIC_CMYK).unwrap(); - cms::register_icc(&bytes, Some(name.into())).unwrap(); - let _unregister = Unregister(name); - p.fx.idle(2); - assert!(p.fx.by_label("Color box").is_some()); -} - -/// The wheel's square and the Hue box both show with the setting on. -#[test] -fn the_wheel_and_the_hue_box_shade_the_same_cells() { - let mut p = Panel::new(app("#3366cc", "wheel", true)); - assert!(p.fx.by_label("Saturation and brightness").is_some()); - p.run("ui.colorWheel", json!({"view": "box"})); - assert!(p.fx.by_label("Color box").is_some()); -} - -/// With Show Out-of-Gamut Colors off, the panel still draws and the setting reads off. -#[test] -fn with_the_setting_off_no_grid_is_computed() { - let p = Panel::new(app("#3366cc", "box", false)); - assert!(!p.app().ui.color_wheel.gamut); - assert!(p.fx.by_label("Color box").is_some()); } /// `ui.colorWheel {gamut}` sets the setting and keeps the others; a key set to null keeps its value diff --git a/crates/ui-egui/src/panels/tests_color_wheel_harmony.rs b/crates/ui-egui/src/panels/tests_color_wheel_harmony.rs index 8a8ddf4768..be2cf16ae3 100644 --- a/crates/ui-egui/src/panels/tests_color_wheel_harmony.rs +++ b/crates/ui-egui/src/panels/tests_color_wheel_harmony.rs @@ -114,17 +114,14 @@ fn ui_color_wheel_sets_the_harmony_and_its_rule() { assert_eq!(got["harmonyRule"], json!("splitComplementary")); } -/// The errors are translated in the catalogs that translate status and error messages, and each +/// The errors are shown in the interface language (German and Japanese here), and each /// translation keeps the key and the accepted values. #[test] fn ui_color_wheel_harmony_errors_are_translated() { let mut app = VectorcraftApp::new(Session::new(), Default::default()); let flag = app.run("ui.colorWheel", json!({"harmony": 1})).unwrap_err(); let rule = app.run("ui.colorWheel", json!({"harmonyRule": "shades"})).unwrap_err(); - for code in [ - "cs", "de", "el", "es", "fr", "hi", "hu", "it", "ja", "ka", "ko", "pl", "pt-br", "ru", "sv", "uk", "vi", "zh-hans", "zh-hant", "fi", "tr", - "ca", "nl", "bs", "da", "id", - ] { + for code in ["de", "ja"] { let lang = crate::i18n::Lang::from_code(code).expect("registered"); let shown = crate::i18n::message(lang, &flag); assert!(shown != flag && shown.contains("`harmony`"), "{code}: {shown}"); diff --git a/crates/ui-egui/src/panels/tests_color_wheel_opacity.rs b/crates/ui-egui/src/panels/tests_color_wheel_opacity.rs index f3b5ca6a47..58cb9a84b4 100644 --- a/crates/ui-egui/src/panels/tests_color_wheel_opacity.rs +++ b/crates/ui-egui/src/panels/tests_color_wheel_opacity.rs @@ -433,14 +433,3 @@ fn the_row_is_gray_with_nothing_selected_and_on_type() { let p = Panel::new(app); assert!(disabled(&p)); } - -/// `ui.colorWheel` answers every junk parameter, with and without a document, without a panic. -#[test] -fn ui_color_wheel_answers_junk_params_without_a_panic() { - let doc = crate::menus::UI_COMMANDS.iter().find(|c| c.0 == "ui.colorWheel").expect("registered").3; - for mut app in [app(), VectorcraftApp::new(Session::new(), Default::default())] { - for p in vectorcraft_testkit::strategies::junk_params(doc, "/nonexistent").into_iter().chain(vectorcraft_testkit::strategies::junk_values()) { - let _ = app.run("ui.colorWheel", p); - } - } -} diff --git a/crates/ui-egui/src/trace_runs.rs b/crates/ui-egui/src/trace_runs.rs index c554b21add..183d7bbe7e 100644 --- a/crates/ui-egui/src/trace_runs.rs +++ b/crates/ui-egui/src/trace_runs.rs @@ -153,15 +153,30 @@ pub fn poll(app: &mut VectorcraftApp) { } Err(TryRecvError::Disconnected) => None, }; - let r = app.trace_runs.running.remove(i); - // The status bar no longer says it is tracing. - if app.ui.status == format!("{}…", crate::i18n::msg(LABEL)) { - app.ui.status.clear(); - } - finish(app, r, done); + land(app, i, done); } } +/// Waits for each trace running to end, in the order they were started, and applies it as +/// [`poll`] does once it is done. +#[cfg(test)] +pub(crate) fn finish_all(app: &mut VectorcraftApp) { + while let Some(r) = app.trace_runs.running.first() { + let done = r.done.recv().ok(); + land(app, 0, done); + } +} + +/// Takes trace `i`, which has ended with `done`, off the list and applies it. +fn land(app: &mut VectorcraftApp, i: usize, done: Option<Done>) { + let r = app.trace_runs.running.remove(i); + // The status bar no longer says it is tracing. + if app.ui.status == format!("{}…", crate::i18n::msg(LABEL)) { + app.ui.status.clear(); + } + finish(app, r, done); +} + /// Applies trace `r`'s result in its document, which becomes the active one again, as its command /// would while the object, its image and the settings are as they were and the document was not /// reverted; else why it has none, in the status bar. From c6662b1f24b8aae5f9043a1c1a6dd73ff6d93cf3 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 17:42:49 -0800 Subject: [PATCH 083/112] Tests: presets_resolve checks every listed preset name resolves `presets()` leaves out a name that `preset` does not know, so the test now compares its length with `PRESET_NAMES` and checks that list holds 15 names, in place of a fixed count of 15 resolved presets. --- crates/trace/src/tests.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/trace/src/tests.rs b/crates/trace/src/tests.rs index a461978600..b834ea4b4a 100644 --- a/crates/trace/src/tests.rs +++ b/crates/trace/src/tests.rs @@ -913,7 +913,8 @@ fn snap_curves_to_lines_straightens_near_lines() { #[test] fn presets_resolve() { // Every name resolves: `presets` leaves out a name `preset` does not know. - assert_eq!(presets().len(), 15); + assert_eq!(PRESET_NAMES.len(), 15); + assert_eq!(presets().len(), PRESET_NAMES.len()); assert_eq!(preset("[Default]"), preset("Default")); assert_eq!(preset(" Line Art "), preset("line art")); assert_eq!(preset("16 colors").unwrap().colors, 16); From 771e73d4056199bb9721206338eefc8a5a936c41 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 17:47:59 -0800 Subject: [PATCH 084/112] Tests: Hebrew mark clusters must cover the whole word hebrew_marks_stay_with_base_clusters now calls assert_source_coverage, so glyphs that start at the four letters but leave the marks out of their source ranges fail the test. --- crates/text/src/tests/bidi.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/crates/text/src/tests/bidi.rs b/crates/text/src/tests/bidi.rs index 4a761dda20..68fb50f4ec 100644 --- a/crates/text/src/tests/bidi.rs +++ b/crates/text/src/tests/bidi.rs @@ -257,9 +257,7 @@ fn hebrew_marks_stay_with_base_clusters() { // Each glyph's source starts at one of the four letters, never at a point after one. let starts: std::collections::BTreeSet<usize> = l.glyphs.iter().map(|g| g.byte).collect(); assert_eq!(starts, [0, 6, 8, 12].into(), "{:?}", l.glyphs.iter().map(|g| (g.byte, g.len)).collect::<Vec<_>>()); - for g in &l.glyphs { - assert!(s.get(g.byte..g.byte + g.len).is_some()); - } + assert_source_coverage(s, &l); assert!(l.glyphs.iter().all(|g| g.rtl)); } From 8f66d6ce5041ef96fd99d55744104f181f8f91c5 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 17:52:24 -0800 Subject: [PATCH 085/112] xtask: test-lint sleep rule reads counted loops, aliases and nested blocks - A `while n < bound` loop that adds to or subtracts from `n` in its body counts its own passes, so calls in the bound (`attempts.len()`) no longer exempt the sleep. A condition that also has `&&` or `||` keeps its calls as polling evidence. - A change to the loop or spawn closure around a reported sleep counts as a change to the hit, so an edit that removes the poll from the condition fails the changed-line check. - `use std::thread::spawn as spawn_thread;` and `use std::thread::sleep as nap;` no longer bring in the bare names, and `thread::sleep_ms` no longer matches `thread::sleep`. - A `thread::spawn` path counts only where a `use` binds `thread` to `std::thread`, so a local `mod thread` with its own `spawn` is not exempt. - A `;` inside a nested block in a loop condition (`while !ready({ let key = 1; key })`) no longer ends the header, and a block after `||` stays part of the condition. - A sleep in a `let` initializer block inside a dropped spawn closure is exempt like the closure's other sleeps; the same block inside a polling loop is still reported. --- xtask/src/test_lint.rs | 198 +++++++++++++++++++++++++++++++++-------- 1 file changed, 163 insertions(+), 35 deletions(-) diff --git a/xtask/src/test_lint.rs b/xtask/src/test_lint.rs index c1a0682dad..3068e0ce83 100644 --- a/xtask/src/test_lint.rs +++ b/xtask/src/test_lint.rs @@ -244,7 +244,8 @@ pub struct Hit { pub first: usize, pub last: usize, /// Other lines whose change counts as a change to the hit, by file: the `cfg` attributes that - /// turn a `never-run` test off, on its module or on a `mod` declaration in another file. + /// turn a `never-run` test off, on its module or on a `mod` declaration in another file, and + /// the loop or spawn closure around a `sleep`. pub also: Vec<(String, usize, usize)>, } @@ -2961,11 +2962,20 @@ fn ignore_reason(src: &[u8]) -> Option<&[u8]> { src.get(body..end) } +/// What the file's `use` items bring in for a `thread::spawn` call. +#[derive(Clone, Copy)] +struct Imports { + /// `spawn` names `std::thread::spawn`. + spawn: bool, + /// `thread` names `std::thread`. + thread: bool, +} + fn sleep_hits(file: &File) -> Vec<Hit> { let m = &file.m; // A bare `sleep(…)` counts only where a `use` brings in `thread::sleep`. let imported = thread_import(m, "sleep"); - let spawn_imported = thread_import(m, "spawn"); + let imports = Imports { spawn: thread_import(m, "spawn"), thread: std_thread_import(m) }; words(m, b"sleep", 0, m.len()) .into_iter() .filter(|&at| { @@ -2978,19 +2988,56 @@ fn sleep_hits(file: &File) -> Vec<Hit> { Some(p) => p.ends_with(b"thread") && !p.ends_with(b"_thread"), None => imported && !before.ends_with(b".") && !before.ends_with(b"fn"), }; - thread_sleep && !polls_or_releases(m, at, spawn_imported) + thread_sleep && !polls_or_releases(m, at, imports) + }) + .map(|at| { + let mut hit = file.hit(at, Rule::Sleep, file.test_at(at), "sleeps in test code".into()); + // An edit to the loop or spawn around the sleep can remove what exempted it. + if let Some(WaitBlock { start, open, through_other }) = wait_block(m, at) { + let head_at = start + (m[start..open].len() - m[start..open].trim_ascii_start().len()); + if !through_other || closure_head(m[start..open].trim_ascii()) { + let close = matching(m, open).unwrap_or(m.len().saturating_sub(1)); + hit.also.push((hit.path.clone(), file.lines.of(head_at), file.lines.of(close))); + } + } + hit }) - .map(|at| file.hit(at, Rule::Sleep, file.test_at(at), "sleeps in test code".into())) .collect() } -/// Whether a `use` brings in `thread::<name>`, alone or in a `thread::{…}` list. +/// Whether a `use` brings in `thread::<name>` under its own name, alone or in a `thread::{…}` +/// list. An alias (`thread::spawn as spawn_thread`) brings in another name. fn thread_import(m: &[u8], name: &str) -> bool { let path = format!("thread::{name}"); + let alias = format!("as{name}"); + words(m, b"use", 0, m.len()).into_iter().any(|u| { + // `norm` drops spaces, so `spawn as s` reads `spawnass`. + let item = norm(&m[u..statement_end(m, u)]); + let named = |i: usize| { + let rest = &item[i + path.len()..]; + let rest = rest.strip_prefix(alias.as_str()).unwrap_or(rest); + !item.as_bytes()[..i].last().copied().is_some_and(is_ident) && !rest.bytes().next().is_some_and(is_ident) + }; + item.match_indices(&path).any(|(i, _)| named(i)) + || item.split_once("thread::{").is_some_and(|(_, list)| !words(list.as_bytes(), name.as_bytes(), 0, list.len()).is_empty()) + }) +} + +/// Whether a `use` binds the name `thread` to `std::thread`: `use std::thread;`, +/// `use std::{thread, …};` or `use std::thread::{self, …};`. +fn std_thread_import(m: &[u8]) -> bool { words(m, b"use", 0, m.len()).into_iter().any(|u| { let item = norm(&m[u..statement_end(m, u)]); - item.contains(&path) - || item.split_once("thread::{").is_some_and(|(_, list)| !words(list.as_bytes(), name.as_bytes(), 0, list.len()).is_empty()) + let item = item.strip_prefix("use").unwrap_or(&item); + let item = item.strip_prefix("::").unwrap_or(item); + let Some(rest) = item.strip_prefix("std::") else { return false }; + words(rest.as_bytes(), b"thread", 0, rest.len()).into_iter().any(|i| { + let before = rest.as_bytes()[..i].last().copied(); + let after = &rest[i + "thread".len()..]; + // Directly after `std::`, or a top-level member of a `std::{…}` list. + let top = i == 0 || (matches!(before, Some(b'{' | b',')) && rest[..i].matches('{').count() == 1 + rest[..i].matches('}').count()); + top && (after.is_empty() || after.starts_with([';', ',', '}']) || after.starts_with("::{self")) + }) }) } @@ -3058,7 +3105,8 @@ fn enclosing_block(m: &[u8], at: usize) -> Option<(usize, usize)> { Some(o) => j = o, None => break j + 1, }, - b';' | b'{' => break j + 1, + b';' if nest == 0 => break j + 1, + b'{' => break j + 1, _ => {} } }; @@ -3083,13 +3131,18 @@ fn opening_brace(m: &[u8], close: usize) -> Option<usize> { } /// Whether a block whose `{` follows `before` is an operand in a condition: it follows `while`, -/// `if`, `match`, `&&`, `!` or a comparison. +/// `if`, `match`, `&&`, `||`, `!` or a comparison. fn condition_block(before: &[u8]) -> bool { let before = before.trim_ascii_end(); let keyword = |w: &[u8]| before.ends_with(w) && !before.len().checked_sub(w.len() + 1).is_some_and(|j| is_ident(before[j])); // A `!` after a name is a macro's (`m! { … }`), not a negation. let not = before.strip_suffix(b"!").is_some_and(|b| !b.trim_ascii_end().last().copied().is_some_and(is_ident)); - keyword(b"while") || keyword(b"if") || keyword(b"match") || before.ends_with(b"&&") || not || before.ends_with(b"=") + // `||` after an operand is an `or`; after `(`, `,`, `=`, `move` or `return` it starts a closure. + let or = before.strip_suffix(b"||").map(<[u8]>::trim_ascii_end).is_some_and(|b| { + let ends_word = |w: &[u8]| b.ends_with(w) && !b.len().checked_sub(w.len() + 1).is_some_and(|j| is_ident(b[j])); + b.last().copied().is_some_and(|c| is_ident(c) || matches!(c, b')' | b']' | b'}' | b'?')) && !ends_word(b"move") && !ends_word(b"return") + }); + keyword(b"while") || keyword(b"if") || keyword(b"match") || before.ends_with(b"&&") || or || not || before.ends_with(b"=") } /// `head` without a leading loop label (`'outer:`). @@ -3114,20 +3167,22 @@ const NOT_PATH: &[&[u8]] = &[ b"await", b"const", b"static", b"mut", b"ref", b"dyn", b"impl", ]; -/// Whether the sleep at `at` is the pause of a loop that checks a condition, or the delay of a -/// spawned thread's fallback release. A `while` or `loop` around it polls when its condition or -/// body calls a function or method other than [`TIME_CALLS`] and [`PASS_THROUGH_CALLS`] (a -/// flag's `load`, a `poll`, a progress read). A macro such as `println!`, a call inside the -/// arguments of `stringify!` or of the sleep itself, a nested `fn` name and `Duration::new` do -/// not count. A closure passed to a `thread::spawn` call whose handle is dropped runs beside the -/// test, which does not wait for it. -fn polls_or_releases(m: &[u8], at: usize, spawn_imported: bool) -> bool { - if let Some((name, end)) = expression_closure_call(m, at) { - return &m[name..end] == b"spawn" && dropped_spawn(m, name, spawn_imported); - } +/// The block that decides whether the sleep at `at` waits: the nearest `while` or `loop`, or the +/// nearest closure without parameters, around it. +struct WaitBlock { + open: usize, + start: usize, + /// The walk passed a block other than an `if`, `else`, `match` or match arm, such as a `let` + /// initializer. Only a closure exempts the sleep then. + through_other: bool, +} + +/// The [`WaitBlock`] around `at`. The walk stops at a function. +fn wait_block(m: &[u8], at: usize) -> Option<WaitBlock> { let mut at = at; - let (open, start) = loop { - let Some((open, start)) = enclosing_block(m, at) else { return false }; + let mut through_other = false; + loop { + let (open, start) = enclosing_block(m, at)?; let head = m[start..open].trim_ascii(); let labeled = strip_label(head); let keyword = |w: &[u8]| head.starts_with(w) && !head.get(w.len()).copied().is_some_and(is_ident); @@ -3135,22 +3190,63 @@ fn polls_or_releases(m: &[u8], at: usize, spawn_imported: bool) -> bool { // A `loop` can be the value of a `let` (`let p = loop { … };`), so it ends the head. let ends_loop = labeled.ends_with(b"loop") && !labeled.len().checked_sub(5).is_some_and(|j| is_ident(labeled[j])); if starts_while || ends_loop || closure_head(head) { - break (open, start); + return Some(WaitBlock { open, start, through_other }); + } + if !words(head, b"fn", 0, head.len()).is_empty() { + return None; } if !head.is_empty() && !keyword(b"if") && !keyword(b"else") && !keyword(b"match") && !head.ends_with(b"=>") { - return false; + through_other = true; } at = open; - }; + } +} + +/// Whether the `while` loop with head `head` counts its own passes: its condition compares a name +/// with `<`, `<=`, `>`, `>=` or `!=` and nothing else, and its body adds to or subtracts from it. +fn counted_while(m: &[u8], head: &[u8], open: usize, close: usize) -> bool { + let Some(cond) = head.strip_prefix(b"while") else { return false }; + let cond = cond.trim_ascii_start(); + let n = cond.iter().take_while(|&&c| is_ident(c)).count(); + if n == 0 || cond[0].is_ascii_digit() || cond.windows(2).any(|w| w == b"&&" || w == b"||") { + return false; + } + let op = cond[n..].trim_ascii_start(); + let compares = (op.starts_with(b"<") && !op.starts_with(b"<<")) || (op.starts_with(b">") && !op.starts_with(b">>")) || op.starts_with(b"!="); + compares + && words(m, &cond[..n], open, close).into_iter().any(|w| { + let after = skip_ws(m, w + n); + matches!(m.get(after..after + 2), Some(b"+=" | b"-=")) + }) +} + +/// Whether the sleep at `at` is the pause of a loop that checks a condition, or the delay of a +/// spawned thread's fallback release. A `while` or `loop` around it polls when its condition or +/// body calls a function or method other than [`TIME_CALLS`] and [`PASS_THROUGH_CALLS`] (a +/// flag's `load`, a `poll`, a progress read). A macro such as `println!`, a call inside the +/// arguments of `stringify!` or of the sleep itself, a nested `fn` name and `Duration::new` do +/// not count. A closure passed to a `thread::spawn` call whose handle is dropped runs beside the +/// test, which does not wait for it. In `while n < bound` with `n += 1` or `n -= 1` in the body, +/// the loop counts its own passes, so only calls in the body count. +fn polls_or_releases(m: &[u8], at: usize, imports: Imports) -> bool { + if let Some((name, end)) = expression_closure_call(m, at) { + return &m[name..end] == b"spawn" && dropped_spawn(m, name, imports); + } + let Some(WaitBlock { open, start, through_other }) = wait_block(m, at) else { return false }; let head = m[start..open].trim_ascii(); if closure_head(head) { let head_at = start + (m[start..open].len() - m[start..open].trim_ascii_start().len()); return words(head, b"spawn", 0, head.len()) .into_iter() - .any(|s| head.get(skip_ws(head, s + "spawn".len())) == Some(&b'(') && dropped_spawn(m, head_at + s, spawn_imported)); + .any(|s| head.get(skip_ws(head, s + "spawn".len())) == Some(&b'(') && dropped_spawn(m, head_at + s, imports)); + } + // A sleep inside another block, such as a `let` initializer, in the loop is reported. + if through_other { + return false; } let close = matching(m, open).unwrap_or(m.len()); - let found = calls_at(m, start, close); + let from = if counted_while(m, strip_label(head), open, close) { open } else { start }; + let found = calls_at(m, from, close); // The arguments of `stringify!` and of a sleep are not polling work. let skipped: Vec<(usize, usize)> = found .iter() @@ -3220,17 +3316,18 @@ fn expression_closure_call(m: &[u8], at: usize) -> Option<(usize, usize)> { } /// Whether the `spawn(…)` call whose name starts at `at` starts a thread and drops its handle. -/// The call is the whole statement: a path ending in `thread::` (or none, where a `use` brings in -/// `thread::spawn`) before it and a `;` after it. A `let`, an assignment, an argument or a chained -/// `.join()` keeps the handle, and a test that joins it waits for the sleep. -fn dropped_spawn(m: &[u8], at: usize, spawn_imported: bool) -> bool { +/// The call is the whole statement: `std::thread::` before it (or `thread::` where a `use` binds +/// `thread` to `std::thread`, or no path where a `use` brings in `thread::spawn`) and a `;` after +/// it. A `let`, an assignment, an argument or a chained `.join()` keeps the handle, and a test +/// that joins it waits for the sleep. +fn dropped_spawn(m: &[u8], at: usize, imports: Imports) -> bool { let from = m[..at].iter().rposition(|&c| !(is_ident(c) || c == b':' || c.is_ascii_whitespace())).map_or(0, |j| j + 1); if !matches!(m[..from].last().copied(), None | Some(b';' | b'{' | b'}')) { return false; } let path = m[from..at].trim_ascii(); let path = path.strip_prefix(b"::").map_or(path, <[u8]>::trim_ascii_start); - let mut last: &[u8] = b""; + let mut segments: Vec<&[u8]> = vec![]; let mut i = 0; while i < path.len() { if !is_ident(path[i]) || path[i].is_ascii_digit() { @@ -3240,17 +3337,24 @@ fn dropped_spawn(m: &[u8], at: usize, spawn_imported: bool) -> bool { while i < path.len() && is_ident(path[i]) { i += 1; } - last = &path[segment..i]; + let last = &path[segment..i]; if NOT_PATH.contains(&last) { return false; } + segments.push(last); i = skip_ws(path, i); if path.get(i..i + 2) != Some(&b"::"[..]) { return false; } i = skip_ws(path, i + 2); } - let thread = if path.is_empty() { spawn_imported } else { last == b"thread" }; + // A `thread::` path names the standard library's module only where a `use` binds it. + let thread = match segments[..] { + [] => imports.spawn, + [b"thread"] => imports.thread, + [b"std", b"thread"] => true, + _ => false, + }; let paren = skip_ws(m, at + "spawn".len()); thread && matching(m, paren).is_some_and(|close| m.get(skip_ws(m, close + 1)) == Some(&b';')) } @@ -5477,6 +5581,12 @@ mod tests { "fn wait() {\n while ScheduleDuration::new().pending {\n thread::sleep(D);\n }\n}\n", "#[test]\nfn t() {\n std::thread::spawn(|| std::thread::sleep(D));\n assert_eq!(f(), 1);\n}\n", "use std::thread::{self, spawn};\n#[test]\nfn t() {\n spawn(|| {\n thread::sleep(D);\n });\n assert_eq!(f(), 1);\n}\n", + "fn wait() {\n while !ready({ let key = 1; key }) {\n thread::sleep(D);\n }\n}\n", + "fn wait(pending: bool) {\n while pending || { ready() } {\n thread::sleep(D);\n }\n}\n", + "#[test]\nfn t() {\n std::thread::spawn(|| {\n let () = {\n std::thread::sleep(D);\n };\n });\n assert_eq!(f(), 1);\n}\n", + "use std::thread;\n#[test]\nfn t() {\n thread::spawn(|| {\n thread::sleep(D);\n });\n assert_eq!(f(), 1);\n}\n", + "use std::{thread, time::Duration};\n#[test]\nfn t() {\n thread::spawn(|| {\n thread::sleep(Duration::ZERO);\n });\n assert_eq!(f(), 1);\n}\n", + "fn wait(q: &Q) {\n while q.len() < 3 {\n thread::sleep(D);\n }\n}\n", ]; for src in polls { assert_eq!(hits(src), [], "{src}"); @@ -5503,12 +5613,26 @@ mod tests { "fn wait(t0: Instant) {\n while t0.elapsed() < D {\n let _ = stringify!(probe());\n std::thread::sleep(D);\n }\n}\n", "#[test]\nfn t() {\n while !ready() {\n std::thread::spawn(|| std::thread::sleep(D)).join().unwrap();\n }\n assert_eq!(f(), 1);\n}\n", "fn wait() -> u8 {\n let mut n = 0;\n let r = loop {\n n += 1;\n if n == 3 {\n break n;\n }\n thread::sleep(D);\n };\n r\n}\n", + "fn wait() {\n let attempts = [0, 1, 2];\n let mut n = 0;\n while n < attempts.len() {\n thread::sleep(D);\n n += 1;\n }\n}\n", + "use std::thread::spawn as spawn_thread;\nfn spawn(f: impl FnOnce()) {\n f();\n}\n#[test]\nfn t() {\n spawn(|| {\n std::thread::sleep(D);\n });\n assert_eq!(f(), 1);\n}\n", + "mod thread {\n pub fn spawn(f: impl FnOnce()) {\n f();\n }\n}\n#[test]\nfn t() {\n thread::spawn(|| {\n std::thread::sleep(D);\n });\n assert_eq!(f(), 1);\n}\n", + "#[test]\nfn t() {\n let h = std::thread::spawn(|| {\n let () = {\n std::thread::sleep(D);\n };\n });\n h.join().unwrap();\n}\n", + "fn wait(r: &R) {\n while !r.load(SeqCst) {\n let x = {\n thread::sleep(D);\n 1\n };\n }\n}\n", ]; for src in timed { assert_eq!(hits(src).iter().filter(|h| h.1 == "sleep").count(), 1, "{src}"); } } + #[test] + fn an_edit_to_the_loop_around_a_sleep_counts_as_a_change() { + let src = "fn wait() {\n let mut n = 0;\n while n < 3 {\n thread::sleep(D);\n n += 1;\n }\n}\n"; + let found = lint_file("crates/x/src/tests.rs", src, &ctx()); + assert_eq!(found.iter().map(|h| (h.rule, h.line)).collect::<Vec<_>>(), [(Rule::Sleep, 4)]); + assert!(touches(&found[0], Some(&[3].into_iter().collect())), "a change to the loop's condition"); + assert!(!touches(&found[0], Some(&[2].into_iter().collect())), "a change outside the loop"); + } + #[test] fn sleep_needs_the_thread_function() { let local = "fn sleep() -> u8 { 42 }\n#[test]\nfn t() {\n assert_eq!(sleep(), 42);\n}\n"; @@ -5517,6 +5641,10 @@ mod tests { let src = format!("{import}\n#[test]\nfn t() {{\n sleep(D);\n assert_eq!(f(), 42);\n}}\n"); assert_eq!(hits(&src), [(4, "sleep")], "{import}"); } + for import in ["use std::thread::sleep as nap;", "use std::thread::sleep_ms;", "use std::thread::{sleep as nap};"] { + let src = format!("{import}\nfn sleep(_: u8) {{}}\n#[test]\nfn t() {{\n sleep(1);\n assert_eq!(f(), 42);\n}}\n"); + assert_eq!(hits(&src), [], "{import}"); + } assert_eq!(hits("#[test]\nfn t() {\n std :: thread :: sleep(D);\n assert_eq!(f(), 1);\n}\n"), [(3, "sleep")]); } From 5071f17319e719d98f6b60a8d7221f4722810fa3 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 17:53:19 -0800 Subject: [PATCH 086/112] Tests: skip the Hebrew mark cluster test when no font covers Hebrew hebrew_marks_stay_with_base_clusters asserts exact glyph start offsets, which depend on the face that shapes the word. It now skips, as the sibling font-dependent tests do, when no installed face covers shin, lamed, vav and final mem. --- crates/text/src/tests/bidi.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/text/src/tests/bidi.rs b/crates/text/src/tests/bidi.rs index 68fb50f4ec..bf47f56d5a 100644 --- a/crates/text/src/tests/bidi.rs +++ b/crates/text/src/tests/bidi.rs @@ -253,6 +253,10 @@ fn paragraph_direction_is_independent_and_neutrals_do_not_force_ltr() { #[test] fn hebrew_marks_stay_with_base_clusters() { let s = "שָׁלוֹם"; + if FontDb::global().face_covering('ש').is_none_or(|face| !['ל', 'ו', 'ם'].into_iter().all(|c| face.covers(c))) { + eprintln!("SKIPPED: hebrew_marks_stay_with_base_clusters; no installed font covers Hebrew shin, lamed, vav and final mem"); + return; + } let l = text_layout(s); // Each glyph's source starts at one of the four letters, never at a point after one. let starts: std::collections::BTreeSet<usize> = l.glyphs.iter().map(|g| g.byte).collect(); From de093cfdeab1bdae8bbe49c4bd42f7b652ee21da Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 17:44:19 -0800 Subject: [PATCH 087/112] Panels: a Window-menu panel keeps showing while art is selected and moved A panel opened from the Window menu, such as Learn or Image Trace, floats in an OS window. craft-libs hid floating panel windows while the main window showed any layer that takes keys, including the Contextual Task Bar over selected art. The panel's window then hid and came back as art was selected, and while it was hidden the canvas still counted its area as covered by a window. A Selection tool move released there was given up, and the art went back to where the move started. craft-libs main (storytold/craft-libs `2e9d498e`) hides floating panel windows only under popup and modal layers. The craft-libs pin moves to craft-libs main, `858bea9d`, with the egui revision that craft-libs pins (`861d60a6`). The winit revision is unchanged. A test opens Learn and Image Trace through their Window menu commands, selects and moves a rectangle, and checks that each panel's OS window shows on every frame and that the move ends where it was released. --- Cargo.lock | 194 +++++++++--------- Cargo.toml | 98 ++++----- apps/vectorcraft-web/Cargo.toml | 2 +- .../ui-egui/src/panel_docking/native_tests.rs | 48 +++++ xtask/src/pdf_deps.rs | 2 +- 5 files changed, 196 insertions(+), 148 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ae1e726a80..cdec652277 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1231,7 +1231,7 @@ dependencies = [ [[package]] name = "craft" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "craft-automation", "craft-behavior", @@ -1272,7 +1272,7 @@ dependencies = [ [[package]] name = "craft-affinity" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "crc32fast", "flate2", @@ -1283,7 +1283,7 @@ dependencies = [ [[package]] name = "craft-appkit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "block2 0.6.2", "objc2 0.6.5", @@ -1295,7 +1295,7 @@ dependencies = [ [[package]] name = "craft-atomic" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "rustix 1.1.6", ] @@ -1303,7 +1303,7 @@ dependencies = [ [[package]] name = "craft-automation" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -1328,7 +1328,7 @@ dependencies = [ [[package]] name = "craft-behavior" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "accesskit", "bitflags 2.13.2", @@ -1346,7 +1346,7 @@ dependencies = [ [[package]] name = "craft-browse" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "craft-behavior", "craft-docpath", @@ -1364,7 +1364,7 @@ dependencies = [ [[package]] name = "craft-cdr" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "crc32fast", "flate2", @@ -1373,7 +1373,7 @@ dependencies = [ [[package]] name = "craft-cloud-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "egui", ] @@ -1381,7 +1381,7 @@ dependencies = [ [[package]] name = "craft-cms" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "md-5", "rayon", @@ -1390,12 +1390,12 @@ dependencies = [ [[package]] name = "craft-codepage" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" [[package]] name = "craft-color-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "craft-behavior", "craft-cms", @@ -1415,7 +1415,7 @@ dependencies = [ [[package]] name = "craft-control" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "craft-control-protocol", "craft-platform", @@ -1426,7 +1426,7 @@ dependencies = [ [[package]] name = "craft-control-protocol" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "getrandom 0.3.4", "serde_json", @@ -1436,7 +1436,7 @@ dependencies = [ [[package]] name = "craft-dds" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "rayon", ] @@ -1444,7 +1444,7 @@ dependencies = [ [[package]] name = "craft-dialogs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "block2 0.6.2", "craft-appkit", @@ -1470,7 +1470,7 @@ dependencies = [ [[package]] name = "craft-doc" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "blake3", "craft-ecproj-format", @@ -1486,7 +1486,7 @@ dependencies = [ [[package]] name = "craft-docpath" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "serde", ] @@ -1494,7 +1494,7 @@ dependencies = [ [[package]] name = "craft-draw" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1513,7 +1513,7 @@ dependencies = [ [[package]] name = "craft-dxf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "craft-codepage", "encoding_rs", @@ -1525,7 +1525,7 @@ dependencies = [ [[package]] name = "craft-ecproj-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "serde", "serde_json", @@ -1535,12 +1535,12 @@ dependencies = [ [[package]] name = "craft-eps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "fontique", "harfrust 0.13.3", @@ -1555,7 +1555,7 @@ dependencies = [ [[package]] name = "craft-font-manager" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -1574,7 +1574,7 @@ dependencies = [ [[package]] name = "craft-font-os-windows" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "windows-registry", "windows-sys 0.61.2", @@ -1583,7 +1583,7 @@ dependencies = [ [[package]] name = "craft-font-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "cap-primitives", "craft-atomic", @@ -1606,12 +1606,12 @@ dependencies = [ [[package]] name = "craft-fonts-build" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" [[package]] name = "craft-gif" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "gif", ] @@ -1619,7 +1619,7 @@ dependencies = [ [[package]] name = "craft-gzip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "flate2", ] @@ -1627,7 +1627,7 @@ dependencies = [ [[package]] name = "craft-host" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "bitflags 2.13.2", "craft-i18n", @@ -1640,7 +1640,7 @@ dependencies = [ [[package]] name = "craft-i18n" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "brotli 9.1.3", "brotli-decompressor 6.3.2", @@ -1670,7 +1670,7 @@ dependencies = [ [[package]] name = "craft-image-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "craft-dds", "craft-jpeg", @@ -1697,7 +1697,7 @@ dependencies = [ [[package]] name = "craft-imaging" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1715,7 +1715,7 @@ dependencies = [ [[package]] name = "craft-jpeg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "thiserror 2.0.21", ] @@ -1723,7 +1723,7 @@ dependencies = [ [[package]] name = "craft-jxl" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "brotli-decompressor 5.0.3", "jixel", @@ -1734,7 +1734,7 @@ dependencies = [ [[package]] name = "craft-keymap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "craft-host", "craft-i18n", @@ -1749,7 +1749,7 @@ dependencies = [ [[package]] name = "craft-layers" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "craft-behavior", "craft-i18n", @@ -1763,7 +1763,7 @@ dependencies = [ [[package]] name = "craft-menu" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "craft-behavior", "craft-host", @@ -1781,7 +1781,7 @@ dependencies = [ [[package]] name = "craft-metadata" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "brotli-decompressor 6.3.2", "chrono", @@ -1793,7 +1793,7 @@ dependencies = [ [[package]] name = "craft-metafile" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "encoding_rs", "image", @@ -1804,7 +1804,7 @@ dependencies = [ [[package]] name = "craft-mime" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "chrono", "craft-codepage", @@ -1814,7 +1814,7 @@ dependencies = [ [[package]] name = "craft-nightly" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "uds_windows", "winsafe", @@ -1823,7 +1823,7 @@ dependencies = [ [[package]] name = "craft-pages" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "craft-behavior", "craft-keymap", @@ -1839,7 +1839,7 @@ dependencies = [ [[package]] name = "craft-pcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "flate2", "serde", @@ -1850,7 +1850,7 @@ dependencies = [ [[package]] name = "craft-pdf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "hayro-interpret", "hayro-syntax", @@ -1862,7 +1862,7 @@ dependencies = [ [[package]] name = "craft-platform" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "async-channel", "async-io", @@ -1895,7 +1895,7 @@ dependencies = [ [[package]] name = "craft-plotter" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "kurbo 0.13.1", "thiserror 2.0.21", @@ -1904,7 +1904,7 @@ dependencies = [ [[package]] name = "craft-print" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "craft-behavior", "craft-host", @@ -1928,7 +1928,7 @@ dependencies = [ [[package]] name = "craft-proof" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "log", "miniz_oxide 0.9.1", @@ -1939,7 +1939,7 @@ dependencies = [ [[package]] name = "craft-ps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "craft-eps", "flate2", @@ -1953,7 +1953,7 @@ dependencies = [ [[package]] name = "craft-psd" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "encoding_rs", "flate2", @@ -1964,7 +1964,7 @@ dependencies = [ [[package]] name = "craft-quit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "dispatch2", "egui", @@ -1977,7 +1977,7 @@ dependencies = [ [[package]] name = "craft-review" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -1996,7 +1996,7 @@ dependencies = [ [[package]] name = "craft-settings" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "craft-atomic", "craft-host", @@ -2013,7 +2013,7 @@ dependencies = [ [[package]] name = "craft-stream-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "fax", "hayro-ccitt", @@ -2024,7 +2024,7 @@ dependencies = [ [[package]] name = "craft-svg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "craft-image-codecs", "craft-xml", @@ -2045,7 +2045,7 @@ dependencies = [ [[package]] name = "craft-table" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "craft-behavior", "craft-keymap", @@ -2057,7 +2057,7 @@ dependencies = [ [[package]] name = "craft-text" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "craft-behavior", "craft-font-manager", @@ -2082,7 +2082,7 @@ dependencies = [ [[package]] name = "craft-theme" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "bitflags 2.13.2", "craft-tracked", @@ -2097,7 +2097,7 @@ dependencies = [ [[package]] name = "craft-theme-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "craft-atomic", "craft-behavior", @@ -2112,7 +2112,7 @@ dependencies = [ [[package]] name = "craft-tiff" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "serde", "thiserror 2.0.21", @@ -2122,7 +2122,7 @@ dependencies = [ [[package]] name = "craft-time" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "serde", "thiserror 2.0.21", @@ -2131,7 +2131,7 @@ dependencies = [ [[package]] name = "craft-timeline" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "craft-behavior", "craft-keymap", @@ -2146,12 +2146,12 @@ dependencies = [ [[package]] name = "craft-tracked" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" [[package]] name = "craft-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "craft-cloud-ui", "craft-ui-canvas", @@ -2165,7 +2165,7 @@ dependencies = [ [[package]] name = "craft-ui-canvas" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -2182,7 +2182,7 @@ dependencies = [ [[package]] name = "craft-ui-contract" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "accesskit", "craft-behavior", @@ -2220,7 +2220,7 @@ dependencies = [ [[package]] name = "craft-ui-macros" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2231,7 +2231,7 @@ dependencies = [ [[package]] name = "craft-ui-panels" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "craft-behavior", "craft-host", @@ -2249,7 +2249,7 @@ dependencies = [ [[package]] name = "craft-ui-patterns" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "craft-behavior", "craft-host", @@ -2270,7 +2270,7 @@ dependencies = [ [[package]] name = "craft-ui-shell" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "craft-behavior", "craft-host", @@ -2291,7 +2291,7 @@ dependencies = [ [[package]] name = "craft-ui-widgets" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "craft-behavior", "craft-host", @@ -2310,7 +2310,7 @@ dependencies = [ [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "base64 0.22.1", "chrono", @@ -2342,7 +2342,7 @@ dependencies = [ [[package]] name = "craft-vectorcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "flate2", "serde", @@ -2353,7 +2353,7 @@ dependencies = [ [[package]] name = "craft-wayland" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "raw-window-handle", "wayland-backend", @@ -2363,7 +2363,7 @@ dependencies = [ [[package]] name = "craft-web-api" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "js-sys", "serde_json", @@ -2374,7 +2374,7 @@ dependencies = [ [[package]] name = "craft-win32" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "winsafe", ] @@ -2382,7 +2382,7 @@ dependencies = [ [[package]] name = "craft-window" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "craft-appkit", "craft-atomic", @@ -2414,7 +2414,7 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "quick-xml 0.41.0", "serde", @@ -2759,7 +2759,7 @@ checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" [[package]] name = "ecolor" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" +source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6" dependencies = [ "bytemuck", "emath", @@ -2792,7 +2792,7 @@ dependencies = [ [[package]] name = "eframe" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" +source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6" dependencies = [ "ahash", "bytemuck", @@ -2827,7 +2827,7 @@ dependencies = [ [[package]] name = "egui" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" +source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6" dependencies = [ "accesskit", "ahash", @@ -2846,7 +2846,7 @@ dependencies = [ [[package]] name = "egui-wgpu" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" +source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6" dependencies = [ "ahash", "bytemuck", @@ -2865,7 +2865,7 @@ dependencies = [ [[package]] name = "egui-winit" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" +source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6" dependencies = [ "accesskit_winit", "arboard", @@ -2890,7 +2890,7 @@ dependencies = [ [[package]] name = "egui_extras" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" +source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6" dependencies = [ "ahash", "egui", @@ -2904,7 +2904,7 @@ dependencies = [ [[package]] name = "egui_glow" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" +source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6" dependencies = [ "bytemuck", "egui", @@ -2917,7 +2917,7 @@ dependencies = [ [[package]] name = "egui_kittest" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" +source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6" dependencies = [ "dify", "eframe", @@ -2943,7 +2943,7 @@ checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" [[package]] name = "emath" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" +source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6" dependencies = [ "bytemuck", ] @@ -3024,7 +3024,7 @@ dependencies = [ [[package]] name = "epaint" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" +source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6" dependencies = [ "ahash", "bytemuck", @@ -3050,7 +3050,7 @@ dependencies = [ [[package]] name = "epaint_default_fonts" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" +source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6" dependencies = [ "brotli 9.1.3", "brotli-decompressor 6.3.2", @@ -3773,7 +3773,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a" [[package]] name = "hayro-cmap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "brotli 8.0.4", "hayro-postscript", @@ -3782,7 +3782,7 @@ dependencies = [ [[package]] name = "hayro-interpret" version = "0.7.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "bitflags 2.13.2", "hayro-cmap", @@ -3800,7 +3800,7 @@ dependencies = [ [[package]] name = "hayro-jbig2" version = "0.3.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "fearless_simd", "hayro-ccitt", @@ -3818,12 +3818,12 @@ dependencies = [ [[package]] name = "hayro-postscript" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" [[package]] name = "hayro-syntax" version = "0.7.2" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "flate2", "hayro-ccitt", @@ -4806,7 +4806,7 @@ dependencies = [ [[package]] name = "krilla" version = "0.8.2" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "base64 0.22.1", "bumpalo", @@ -4963,7 +4963,7 @@ checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" [[package]] name = "linesweeper" version = "0.5.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" dependencies = [ "arrayvec", "kurbo 0.13.1", diff --git a/Cargo.toml b/Cargo.toml index 71ece379bf..76fc6cb0e1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,51 +10,51 @@ license = "MIT OR Apache-2.0" rust-version = "1.95" [workspace.dependencies] -craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8", default-features = false, features = ["interpret", "write"] } -craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } +craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e", default-features = false, features = ["interpret", "write"] } +craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } +craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } # Language packs: the Craft apps' shared font store installs them (#4936). -craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } +craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } # The `.vectorcraft` envelope: its members, version, embedded images and the data after the JSON. -craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } +craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } # `.pcraft` documents: their manifest, full-size composite, preview, layer pixels and ICC profile. -craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8", features = ["pcraft-pixels"] } +craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e", features = ["pcraft-pixels"] } # Native Affinity documents (craft-libs#914). -craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } # Bounded CDR (v1-v27) and CMX (32-bit) reader (craft-libs#778). -craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } # SVG parsing, limits, SVGZ and writer (craft-libs#778). -craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8", features = ["tree"] } -craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e", features = ["tree"] } +craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } # EPS container, previews, ASCII85 and DSC comments (craft-libs#778). -craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } # DXF tags, reader and writer (craft-libs#778, #926, #927). -craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } +craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } # WMF, EMF and EMF+ reader (craft-libs#778). -craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8", default-features = false, features = ["read", "write"] } -craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } +craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } +craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } +craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } +craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } +craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e", default-features = false, features = ["read", "write"] } +craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } +craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } +craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } +craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } # The framework facade (`craft::ui`, `craft::settings`, `craft::platform`, ...). No default features: each crate names # the members it imports. -craft = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +craft = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } # Below the egui layer, so not through the facade: the colour harmony rules and their settings (craft-color-ui # without its `ui` feature), the colour type they work in, and the craft-fonts tables the text crate's build writes. -craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } +craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } +craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } # Nightly profile isolation, launch protocol, and security fence. -craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } # internal vectorcraft-geom = { path = "crates/geom" } vectorcraft-color = { path = "crates/color" } @@ -194,22 +194,22 @@ lto = "thin" codegen-units = 1 [patch.crates-io] -hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -krilla = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -ecolor = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } -emath = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } -epaint = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } -epaint_default_fonts = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } -egui = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } -egui-winit = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } -egui-wgpu = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } -egui_glow = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } -egui_extras = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } -egui_kittest = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } -eframe = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } +hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } +hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } +hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } +hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } +hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } +krilla = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } +linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } +ecolor = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } +emath = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } +epaint = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } +epaint_default_fonts = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } +egui = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } +egui-winit = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } +egui-wgpu = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } +egui_glow = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } +egui_extras = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } +egui_kittest = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } +eframe = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } winit = { git = "https://github.com/storytold/winit.git", rev = "0dfcec0eb62fda5904137a63a6dd0c3d83295f45" } diff --git a/apps/vectorcraft-web/Cargo.toml b/apps/vectorcraft-web/Cargo.toml index ba85754a00..e98c904597 100644 --- a/apps/vectorcraft-web/Cargo.toml +++ b/apps/vectorcraft-web/Cargo.toml @@ -28,7 +28,7 @@ egui_extras = { workspace = true } # `wgpu` pulls egui-wgpu's defaults: WebGPU plus the WebGL2 fallback. eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit"] } # The page command API (storytold/craft-libs#413): the request plumbing behind window.vectorcraft. -craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8", version = "0.1.0" } +craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e", version = "0.1.0" } wasm-bindgen = "0.2" serde_json = { workspace = true } diff --git a/crates/ui-egui/src/panel_docking/native_tests.rs b/crates/ui-egui/src/panel_docking/native_tests.rs index 3ceb28ad9f..ca5d09c205 100644 --- a/crates/ui-egui/src/panel_docking/native_tests.rs +++ b/crates/ui-egui/src/panel_docking/native_tests.rs @@ -25,6 +25,9 @@ struct Window { hovered: Vec<egui::HoveredFile>, dropped: Vec<egui::DroppedFileHandle>, close_requested: bool, + /// Whether the window shows on the desktop: the builder's visibility when it opened, then each + /// `Visible` command. + visible: bool, frames: usize, /// The texts its last frame drew, with their rects in the window. texts: Vec<(String, Rect)>, @@ -72,6 +75,7 @@ impl Host { ViewportCommand::OuterPosition(pos) => window.rect = Rect::from_min_size(*pos, window.rect.size()), ViewportCommand::InnerSize(size) => window.rect = Rect::from_min_size(window.rect.min, *size), ViewportCommand::CancelClose => window.close_requested = false, + ViewportCommand::Visible(visible) => window.visible = *visible, _ => {} } } @@ -91,6 +95,7 @@ impl Host { hovered: Vec::new(), dropped: Vec::new(), close_requested: false, + visible: builder.visible != Some(false), frames: 0, texts: Vec::new(), nodes: Vec::new(), @@ -572,3 +577,46 @@ fn copy_and_cut_in_a_native_window_act_on_the_art_while_another_windows_label_ha assert!(![copied, cut].concat().iter().any(|t| t == LABEL), "{what}: the floating window copied no label text"); } } + +/// A panel opened from the Window menu floats in an OS window that keeps showing while the art on +/// the canvas is selected and moved, and the Selection tool's move ends where it is released. +#[test] +fn a_window_menu_panel_stays_shown_while_art_is_selected_and_moved() { + for (command, params, panel) in + [("window.learn", json!({}), crate::panels::learn::ID), ("window.panel", json!({"panel": "imageTrace", "toggle": true}), "imageTrace")] + { + let mut h = Harness::new(); + h.app.select_tool("selection"); + let id = h.app.run("shape.rectangle", json!({"x": 280, "y": 180, "width": 60, "height": 50})).unwrap()["id"].as_u64().unwrap(); + let id = vectorcraft_doc::NodeId(id); + h.app.run("select.none", json!({})).unwrap(); + h.app.run(command, params).unwrap(); + h.frames(4); + let viewport = h.viewport(panel); + let shown = |h: &Harness| h.host.borrow().windows.get(&viewport).is_some_and(|w| w.visible); + assert!(shown(&h), "{panel}: the window shows"); + let left = |h: &Harness| h.app.session.active().unwrap().doc.node(id).and_then(|n| n.geometric_bounds()).map(|b| b.min_x()).unwrap(); + let before = left(&h); + let undo = h.app.session.active().unwrap().history.undo.len(); + let view = h.app.canvas_view().expect("the canvas was drawn"); + let from = view.to_screen(vectorcraft_geom::Point::new(310.0, 205.0)); + let to = from + vec2(-40.0, 30.0); + let window = h.host.borrow().windows[&viewport].rect.translate(-ORIGIN.to_vec2()); + assert!(view.rect.contains(from) && view.rect.contains(to), "{panel}: the move stays on the canvas"); + assert!(!window.contains(from) && !window.contains(to), "{panel}: the move stays clear of the window"); + h.frame(vec![Event::PointerMoved(from), button(from, true)]); + assert!(shown(&h), "{panel}: the window shows with the art selected"); + for k in 1..=6 { + h.frame(vec![Event::PointerMoved(from + (to - from) * (k as f32 / 6.0))]); + assert!(shown(&h), "{panel}: the window shows during the move"); + } + h.frame(vec![Event::PointerMoved(to), button(to, false)]); + h.frames(3); + assert!(shown(&h), "{panel}: the window shows after the move"); + let st = h.app.session.active().unwrap(); + assert!(st.interaction.is_none(), "{panel}: no move is left open"); + assert_eq!(st.history.undo.len(), undo + 1, "{panel}: the move is one undo step"); + let moved = view.to_doc(to).x - view.to_doc(from).x; + assert!((left(&h) - before - moved).abs() < moved.abs() / 2.0, "{panel}: the art stays where it was released"); + } +} diff --git a/xtask/src/pdf_deps.rs b/xtask/src/pdf_deps.rs index 4b7e8ebb2f..f3b028767f 100644 --- a/xtask/src/pdf_deps.rs +++ b/xtask/src/pdf_deps.rs @@ -5,7 +5,7 @@ use std::process::Command; use serde_json::Value; -const REV: &str = "edbf2117a322c82d672050ca813b95beb835c3e8"; +const REV: &str = "858bea9d966874f00a3685f76dd6d2b074f7cb6e"; const PACKAGES: &[(&str, &str, &str)] = &[ ("craft-pdf", "0.1.0", REV), ("krilla", "0.8.2", REV), From 450a821ae4dfc2bc75123ec6bef7ccf0ec8f96bf Mon Sep 17 00:00:00 2001 From: ruchirguitar <info@jeevantirth.org> Date: Wed, 2 Dec 2026 07:35:21 +0530 Subject: [PATCH 088/112] .ai import: say where unchecked page type over hidden type goes --- crates/eps/src/import/native/plan.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/eps/src/import/native/plan.rs b/crates/eps/src/import/native/plan.rs index a15c272222..f2dfba3377 100644 --- a/crates/eps/src/import/native/plan.rs +++ b/crates/eps/src/import/native/plan.rs @@ -556,7 +556,9 @@ pub(super) fn plan( let mut spare: Vec<Vec<Arc<Node>>> = vec![]; // The word searches below are held to their own budget: past it, type where made type that shows // draws is taken to be that type (made type is there either way), and type where only made type - // that doesn't show lies stays on the page (it would not show otherwise). + // that doesn't show lies is spare type, as any type no text object takes: it goes into a slot + // or with another text object's type, else it is left out with a note (taken as the hidden + // type, it would be dropped unnoted). let (mut checks, mut unchecked) = (WordChecks::new(), false); for (j, object) in shown.iter().enumerate() { match owner.get(j).copied().flatten() { From 1bfbed4161cc87aaf5c79ef77ea71cf365760786 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 18:13:43 -0800 Subject: [PATCH 089/112] Tests: engine command and integration tests check what they claim Tests that passed on an empty list, a missing write or a fixed sleep now check the result itself: - The folder search deadline test waits for the walker to block, then ends the search's time with Search::expire instead of sleeping past a 0.2 s limit. The deadline is kept as nanoseconds after the start so a test can move it. - The stale current layer tests check that the compound path still holds only the paths it was made from; the send-to-layer test sets the stale id itself, since undo now restores the earlier layer. - BMP gray export draws a red square and checks it comes out a middle gray; a black and white page passed with gray turned off. - Rewriting an EPS the import read whole checks the file changed and reopens with its art. - The local Affinity sample test is ignored with a reason instead of returning at once without AFFINITY_SAMPLES. - all() checks over anchors, seam fills, graph marks, legend rows, label looks, retype fonts, text runs, dimension lines and preflight ids now also pin the count or the text, so an empty result fails. --- .../engine/src/cmd/addons/image/mask/tests.rs | 1 + .../engine/src/cmd/addons/pathtools/tests.rs | 1 + .../engine/src/cmd/addons/typetools/tests.rs | 3 ++- crates/engine/src/cmd/buildcmds/trace.rs | 2 ++ crates/engine/src/cmd/clipboard.rs | 8 ++++-- crates/engine/src/cmd/draw2/smooth.rs | 2 +- crates/engine/src/cmd/fileio/tests_tiffbmp.rs | 11 ++++++-- crates/engine/src/cmd/findfiles/tests.rs | 17 +++++++++--- crates/engine/src/cmd/findfiles/walk.rs | 22 +++++++++++---- crates/engine/src/cmd/graph/tests.rs | 27 ++++++++++++++----- crates/engine/src/cmd/retype_tests.rs | 4 ++- crates/engine/src/cmd/typecmd/area_tests.rs | 3 +++ crates/engine/src/cmd/typecmd/block_tests.rs | 2 ++ crates/engine/src/tests.rs | 5 +++- crates/engine/tests/it/affinity_local.rs | 5 ++-- crates/engine/tests/it/dimensions.rs | 1 + crates/engine/tests/it/lossy_overwrite.rs | 12 +++++++-- crates/engine/tests/it/preflight.rs | 4 ++- 18 files changed, 102 insertions(+), 28 deletions(-) diff --git a/crates/engine/src/cmd/addons/image/mask/tests.rs b/crates/engine/src/cmd/addons/image/mask/tests.rs index 46c33a3871..b1e76927c6 100644 --- a/crates/engine/src/cmd/addons/image/mask/tests.rs +++ b/crates/engine/src/cmd/addons/image/mask/tests.rs @@ -449,6 +449,7 @@ fn cropping_off_the_pixel_grid_keeps_the_hidden_colors_in_the_pixels() { }) .unwrap() .to_rgba8(); + assert_eq!(own.dimensions(), (6, 5), "the cut's pixels"); assert!(own.pixels().all(|p| p.0[3] == 255), "the cut pixels are the image's own, white included"); assert_eq!(drawn(d, id, 0, 0)[3], 0, "white is hidden"); s.execute(REMOVE_COLOR_MASK, &json!({"ids": [id.0]})).unwrap(); diff --git a/crates/engine/src/cmd/addons/pathtools/tests.rs b/crates/engine/src/cmd/addons/pathtools/tests.rs index 584f33dc36..1b16421c8d 100644 --- a/crates/engine/src/cmd/addons/pathtools/tests.rs +++ b/crates/engine/src/cmd/addons/pathtools/tests.rs @@ -237,6 +237,7 @@ fn add_points_splits_selected_segments_evenly() { let n = steps(&s); assert_eq!(s.execute("addon.pathtools.addPoints", &json!({"count": 3})).unwrap()["added"], json!(3)); let xs: Vec<f64> = path(&s, l).anchors().map(|(_, _, a)| a.p.x).collect(); + assert_eq!(xs.len(), 5, "{xs:?}"); assert!(xs.iter().zip([0.0, 25.0, 50.0, 75.0, 100.0]).all(|(x, w)| (x - w).abs() < 1e-3), "{xs:?}"); assert_eq!(steps(&s), n + 1); refuses(&mut s, "addon.pathtools.addPoints", &[json!({"count": 0}), json!({"count": 101}), json!({"count": 1.5})]); diff --git a/crates/engine/src/cmd/addons/typetools/tests.rs b/crates/engine/src/cmd/addons/typetools/tests.rs index a8518719be..148ccd4b9a 100644 --- a/crates/engine/src/cmd/addons/typetools/tests.rs +++ b/crates/engine/src/cmd/addons/typetools/tests.rs @@ -69,7 +69,8 @@ fn a_straight_ramp_sizes_each_letter_and_skips_spaces() { assert_eq!(sizes, [('a', 10.0), ('b', 20.0), (' ', 20.0), ('c', 30.0), ('d', 40.0)], "the space keeps its size"); assert_eq!(obj(&s, id).plain_text(), "ab cd", "the text stays live"); s.execute("edit.undo", &json!({})).unwrap(); - assert!(styles(&s, id).iter().all(|(_, st)| st.size == 20.0), "undone"); + let undone: Vec<(char, f64)> = styles(&s, id).into_iter().map(|(c, st)| (c, st.size)).collect(); + assert_eq!(undone, [('a', 20.0), ('b', 20.0), (' ', 20.0), ('c', 20.0), ('d', 20.0)], "undone"); } #[test] diff --git a/crates/engine/src/cmd/buildcmds/trace.rs b/crates/engine/src/cmd/buildcmds/trace.rs index 693608574e..a4e2892f39 100644 --- a/crates/engine/src/cmd/buildcmds/trace.rs +++ b/crates/engine/src/cmd/buildcmds/trace.rs @@ -1586,6 +1586,8 @@ mod trace_limit_tests { // anchors each. let strokes = |f: &tr::SeamFills| f.strokes.iter().map(|tp| tp.path.anchor_count()).sum::<usize>(); let outlined = seams_within(&res, ¶ms, (24, 16), MAX_TRACE_ANCHORS, true, &go).unwrap().unwrap(); + assert!(!outlined.strokes.is_empty(), "{res:?}"); + assert_eq!(outlined.strokes.len(), all.as_ref().unwrap().strokes.len(), "one outline for each seam fill: {outlined:?}"); assert!(outlined.strokes.iter().all(|tp| tp.stroke.is_none() && !tp.path.is_empty()), "{outlined:?}"); let n = strokes(all.as_ref().unwrap()); assert!(strokes(&outlined) <= SEAM_OUTLINE_ANCHORS * n, "{} outline anchors, {n} stroke anchors", strokes(&outlined)); diff --git a/crates/engine/src/cmd/clipboard.rs b/crates/engine/src/cmd/clipboard.rs index 610498f56a..20cb4c96ab 100644 --- a/crates/engine/src/cmd/clipboard.rs +++ b/crates/engine/src/cmd/clipboard.rs @@ -696,9 +696,13 @@ mod tests { let c = s.execute("object.compoundPath.make", &json!({})).unwrap()["id"].as_u64().unwrap(); assert_eq!(c, layer, "the scenario needs the id to be reused"); s.execute("edit.paste", &json!({})).unwrap(); - let d = &s.doc().unwrap().doc; + let st = s.doc().unwrap(); + let d = &st.doc; let compound = d.node(NodeId(c)).unwrap(); - assert!(compound.children().unwrap().iter().all(|ch| matches!(ch.kind, vectorcraft_doc::NodeKind::Path { .. }))); + assert_eq!(compound.children().unwrap().len(), 1, "the compound path holds only the rectangle it was made from"); + let pasted = st.selection.objects.clone(); + assert_eq!(pasted.len(), 1); + assert!(d.parent_of(pasted[0]).is_some_and(|p| d.node(p).unwrap().is_layer()), "the copy lands on a layer"); } #[test] diff --git a/crates/engine/src/cmd/draw2/smooth.rs b/crates/engine/src/cmd/draw2/smooth.rs index ef9cd71850..c1cb80c939 100644 --- a/crates/engine/src/cmd/draw2/smooth.rs +++ b/crates/engine/src/cmd/draw2/smooth.rs @@ -1722,7 +1722,7 @@ mod tests { let jags = polyline(&ring); let sp = SubPath::new(jags.clone(), true); assert!(subpath_len(&sp) < 24.0); - assert!(smooth_corners(&jags, true, 1e-6).iter().all(|c| *c), "each jag turns sharply at its anchor"); + assert_eq!(smooth_corners(&jags, true, 1e-6), vec![true; 16], "each jag turns sharply at its anchor"); assert_eq!(smooth_corners(&jags, true, 12.0), vec![false; 16]); assert_eq!(smooth_corners(&polyline(&[(0.0, 0.0), (6.0, 0.0), (3.0, 5.196)]), true, 12.0), vec![true; 3]); } diff --git a/crates/engine/src/cmd/fileio/tests_tiffbmp.rs b/crates/engine/src/cmd/fileio/tests_tiffbmp.rs index f36fa14b8d..74df5216aa 100644 --- a/crates/engine/src/cmd/fileio/tests_tiffbmp.rs +++ b/crates/engine/src/cmd/fileio/tests_tiffbmp.rs @@ -104,8 +104,15 @@ fn bmp_options_reach_the_file() { assert_eq!(i32::from_le_bytes(flipped[22..26].try_into().unwrap()), -40, "top-down rows"); let os2 = bmp(&mut s, json!({"fileFormat": "os2", "depth": 4})); assert_eq!(u32::from_le_bytes(os2[14..18].try_into().unwrap()), 12, "OS/2 core header"); - let gray = image::load_from_memory_with_format(&bmp(&mut s, json!({"colorModel": "gray", "depth": 8})), image::ImageFormat::Bmp).unwrap(); - assert!(gray.to_rgb8().pixels().all(|p| p[0] == p[1] && p[1] == p[2])); + // A red square, whose gray is neither black nor white. + let red = s.execute("shape.rectangle", &json!({"x": 0, "y": 0, "width": 10, "height": 40})).unwrap()["id"].clone(); + s.execute("paint.setFill", &json!({"ids": [red], "color": "#ff0000"})).unwrap(); + let gray = + image::load_from_memory_with_format(&bmp(&mut s, json!({"colorModel": "gray", "depth": 8})), image::ImageFormat::Bmp).unwrap().to_rgb8(); + assert_eq!(gray.dimensions(), (60, 40)); + assert!(gray.pixels().all(|p| p[0] == p[1] && p[1] == p[2])); + let [r, _, _] = gray.get_pixel(5, 20).0; + assert!(r > 0 && r < 255, "red is a middle gray: {r}"); for bad in [ json!({"depth": 2}), json!({"depth": 24, "rle": true}), diff --git a/crates/engine/src/cmd/findfiles/tests.rs b/crates/engine/src/cmd/findfiles/tests.rs index 9340e5a8c6..923054a86f 100644 --- a/crates/engine/src/cmd/findfiles/tests.rs +++ b/crates/engine/src/cmd/findfiles/tests.rs @@ -318,13 +318,24 @@ fn the_search_answers_at_its_deadline_while_a_walker_is_blocked() { let root = tree("blocked", &["f.ttf"]); let (tx, rx) = mpsc::channel(); let started = Instant::now(); - let s = begin(root.clone(), rules(&root), Limits { seconds: 0.2, ..Limits::default() }, 1, 1, Arc::new(Blocked(Mutex::new(rx)))); - std::thread::sleep(Duration::from_millis(300)); + let s = begin(root.clone(), rules(&root), Limits::default(), 1, 1, Arc::new(Blocked(Mutex::new(rx)))); + // The walker is blocked reading the file. + let until = Instant::now() + WAIT; + while s.progress().read == 0 && Instant::now() < until { + std::thread::sleep(Duration::from_millis(2)); + } + assert_eq!((s.progress().state(), s.progress().read), ("searching", 1)); + s.expire(); let p = s.progress(); // The search ended when it answered, and it ran no longer than the test has waited. let waited = started.elapsed().as_secs_f64(); assert_eq!((p.state(), p.stopped()), ("stopped", Some("time")), "{p:?}"); - assert!(p.seconds >= 0.2 && p.seconds <= waited, "{p:?}, {waited} s"); + assert!(p.seconds <= waited, "{p:?}, {waited} s"); + assert_eq!(s.progress().seconds, p.seconds, "the time it ended at stays"); + // A limit of no seconds has run out as the search starts; a long one hasn't. + let (_tx0, rx0) = mpsc::channel(); + let none = begin(root.clone(), rules(&root), Limits { seconds: 0.0, ..Limits::default() }, 1, 1, Arc::new(Blocked(Mutex::new(rx0)))); + assert_eq!(none.progress().stopped(), Some("time")); let (tx2, rx2) = mpsc::channel(); let s2 = begin(root.clone(), rules(&root), Limits::default(), 1, 1, Arc::new(Blocked(Mutex::new(rx2)))); let until = Instant::now() + WAIT; diff --git a/crates/engine/src/cmd/findfiles/walk.rs b/crates/engine/src/cmd/findfiles/walk.rs index ae05a04838..1512bd76c5 100644 --- a/crates/engine/src/cmd/findfiles/walk.rs +++ b/crates/engine/src/cmd/findfiles/walk.rs @@ -238,12 +238,18 @@ impl Search { self.shared.finish(&mut w, End::Stopped); } + /// Move the search's deadline to now, as if its time had run out. + #[cfg(test)] + pub(crate) fn expire(&self) { + self.shared.deadline.store(0, Ordering::Relaxed); + } + /// Where the search stands. Past its deadline it has ended ([`End::Time`]), even while a walker /// is still waiting for a slow folder or file. pub fn progress(&self) -> Progress { let s = &self.shared; let mut w = s.lock(); - if w.end.is_none() && Instant::now() >= s.deadline { + if w.end.is_none() && s.time_up() { s.finish(&mut w, End::Time); } Progress { @@ -310,7 +316,7 @@ pub(crate) fn start_in( entries: AtomicU64::new(0), read: AtomicU64::new(0), started, - deadline: started + Duration::from_secs_f64(seconds), + deadline: AtomicU64::new(u64::try_from(Duration::from_secs_f64(seconds).as_nanos()).unwrap_or(u64::MAX)), limits, items, given: rules, @@ -355,7 +361,8 @@ struct Shared { entries: AtomicU64, read: AtomicU64, started: Instant, - deadline: Instant, + /// Nanoseconds after `started` at which the search's time is up. + deadline: AtomicU64, limits: Limits, items: usize, /// The rules given to [`start`], else this computer's, read by the first walker. @@ -419,7 +426,12 @@ impl Shared { /// Whether to stop listing and reading: the search ended or its time is up. fn should_stop(&self) -> bool { - self.stop.load(Ordering::Relaxed) || Instant::now() >= self.deadline + self.stop.load(Ordering::Relaxed) || self.time_up() + } + + /// Whether the search's time is up: [`Shared::deadline`] nanoseconds passed since it started. + fn time_up(&self) -> bool { + u64::try_from(self.started.elapsed().as_nanos()).unwrap_or(u64::MAX) >= self.deadline.load(Ordering::Relaxed) } /// Whether the folders waiting to be listed and `more` folders found in the folder being listed @@ -618,7 +630,7 @@ fn walker(s: &Shared) { if w.end.is_some() { return; } - if Instant::now() >= s.deadline { + if s.time_up() { s.finish(&mut w, End::Time); return; } diff --git a/crates/engine/src/cmd/graph/tests.rs b/crates/engine/src/cmd/graph/tests.rs index 5ac5a3bb51..46585a522a 100644 --- a/crates/engine/src/cmd/graph/tests.rs +++ b/crates/engine/src/cmd/graph/tests.rs @@ -2588,6 +2588,7 @@ fn a_line_series_draws_its_kept_stroke_on_the_line_and_its_kept_fill_on_the_mark s.execute("graph.setData", &json!({"rows": [[1, 2], [3, 4]]})).unwrap(); let (drawn, others) = line_parts(&s, id); assert_eq!((drawn.appearance.fill_paint(), drawn.appearance.stroke_paint()), (Paint::None, red)); + assert!(!others.is_empty(), "the markers and the legend swatch are drawn"); assert!(others.iter().all(|m| m.appearance.fill_paint() == blue), "{others:?}"); } @@ -4867,7 +4868,7 @@ fn blanks_read_back_as_null_and_year_header_rows_still_read_as_headers() { #[test] fn a_huge_ragged_grid_is_capped() { let g = GraphSpec { rows: vec![vec![0.0; vectorcraft_doc::MAX_GRAPH_SERIES + 10]; 3], ..GraphSpec::default() }; - assert!(g.cells().iter().all(|r| r.len() == vectorcraft_doc::MAX_GRAPH_SERIES)); + assert_eq!(g.cells().iter().map(Vec::len).collect::<Vec<_>>(), [vectorcraft_doc::MAX_GRAPH_SERIES; 3]); } #[test] @@ -6720,7 +6721,9 @@ fn designs_and_markers_survive_save_and_open() { d.graph_designs.push(vectorcraft_doc::GraphDesign { name: "Dot".into(), art: std::sync::Arc::new(dot) }); let art = super::generate(&mut d, &g); let s0 = art.iter().find(|n| n.extras().series_index == Some(0)).unwrap(); - assert!(s0.children().unwrap().iter().all(|n| matches!(n.kind, NodeKind::Path { .. }))); + let marks = s0.children().unwrap(); + assert!(!marks.is_empty(), "the series still has its markers"); + assert!(marks.iter().all(|n| matches!(n.kind, NodeKind::Path { .. }))); } #[test] @@ -6773,7 +6776,9 @@ fn designs_too_big_for_a_graph_are_refused_and_drawn_as_squares() { let mut d = (*s.doc().unwrap().doc).clone(); let art = super::generate(&mut d, &g); let s0 = art.iter().find(|n| n.extras().series_index == Some(0)).unwrap(); - assert!(s0.children().unwrap().iter().all(|n| matches!(n.kind, NodeKind::Path { .. }))); + let marks = s0.children().unwrap(); + assert!(!marks.is_empty(), "the series still has its markers"); + assert!(marks.iter().all(|n| matches!(n.kind, NodeKind::Path { .. }))); // Too many objects for one design. let ids: Vec<u64> = (0..2001) .map(|i| s.execute("shape.rectangle", &json!({"x": i % 40, "y": i / 40, "width": 1, "height": 1})).unwrap()["id"].as_u64().unwrap()) @@ -7157,7 +7162,9 @@ fn graph_column_params_are_checked_and_designs_too_big_are_drawn_plain() { let mut d = (*s.doc().unwrap().doc).clone(); let art = super::generate(&mut d, &g); let s0 = art.iter().find(|n| n.extras().series_index == Some(0)).unwrap(); - assert!(s0.children().unwrap().iter().all(|n| matches!(n.kind, NodeKind::Path { .. }))); + let marks = s0.children().unwrap(); + assert!(!marks.is_empty(), "the series still has its markers"); + assert!(marks.iter().all(|n| matches!(n.kind, NodeKind::Path { .. }))); // Columns of 0 on a value axis from 10,000 to 10,001 run 2,000,000 points from the clamped zero line: a copy each // 0.1 is past the budget too. let far = one_series(&mut s, "column", &[0.0, 0.0]); @@ -7840,7 +7847,9 @@ fn the_legend_across_top_keeps_above_labels_over_the_plot() { let n = s.doc().unwrap().doc.node(col).unwrap().clone(); let texts: Vec<_> = group(&n, "Legend").children().unwrap().iter().filter_map(|c| c.geometric_bounds()).collect(); let last_row = texts.iter().map(|b| b.y0).fold(f64::MIN, f64::max); - assert!(texts.iter().filter(|b| b.y0 < last_row - 1e-6).all(|b| b.x1 <= 400.0 + 1e-6), "{texts:?}"); + let above: Vec<_> = texts.iter().filter(|b| b.y0 < last_row - 1e-6).collect(); + assert!(!above.is_empty(), "the legend takes more than one row: {texts:?}"); + assert!(above.iter().all(|b| b.x1 <= 400.0 + 1e-6), "{texts:?}"); } #[test] @@ -8024,6 +8033,7 @@ fn formatting_the_whole_graphs_text_survives_it_being_drawn_again() { s.execute("select.set", &json!({"ids": [id.0]})).unwrap(); s.execute("text.setStyle", &json!({"size": 12})).unwrap(); let looks = label_looks(&mut s, id); + assert!(!looks.is_empty()); assert!(looks.iter().all(|(_, size, _)| (*size - 12.0).abs() < 1e-6), "{looks:?}"); let g = spec(&s, id); assert!(g.label_styles.values.is_some() && g.label_styles.categories.is_some() && g.label_styles.legend.is_some()); @@ -9145,10 +9155,13 @@ fn line_look(n: &vectorcraft_doc::Node) -> (String, f64, f32) { (stroke, n.appearance.stroke_width(), n.opacity) } -/// The looks of graph `id`'s lines after it is drawn again. +/// The looks of graph `id`'s lines after it is drawn again: more than three (a radar graph's +/// three spokes come first, then its rings). fn redrawn_line_looks(s: &mut Session, id: NodeId) -> Vec<(String, f64, f32)> { s.execute("graph.setData", &json!({"id": id.0, "csv": ",2024,2025\nQ1,3,2\nQ2,5,4\nQ3,-1,6"})).unwrap(); - line_nodes(s, id).iter().map(line_look).collect() + let looks: Vec<_> = line_nodes(s, id).iter().map(line_look).collect(); + assert!(looks.len() > 3, "the graph is drawn with its lines: {looks:?}"); + looks } /// A stroke, a weight, no stroke or an opacity given to one axis line is kept for every axis line and tick mark when the diff --git a/crates/engine/src/cmd/retype_tests.rs b/crates/engine/src/cmd/retype_tests.rs index 5f89bc1284..1c0e353a15 100644 --- a/crates/engine/src/cmd/retype_tests.rs +++ b/crates/engine/src/cmd/retype_tests.rs @@ -1099,7 +1099,9 @@ fn lines_that_do_not_stack_as_a_paragraph_stay_apart() { s.execute("select.set", &json!({"ids": [a]})).unwrap(); let r = s.execute("type.retype", &json!({})).unwrap(); assert_eq!(r["texts"], json!(["Top", "Far", "Askew"]), "{r}"); - assert!(r["fonts"].as_array().unwrap().iter().all(|f| f["area"] == json!(false)), "{r}"); + let fonts = r["fonts"].as_array().unwrap(); + assert!(!fonts.is_empty(), "{r}"); + assert!(fonts.iter().all(|f| f["area"] == json!(false)), "{r}"); } #[test] diff --git a/crates/engine/src/cmd/typecmd/area_tests.rs b/crates/engine/src/cmd/typecmd/area_tests.rs index 85a9e7510c..771c2d7f7d 100644 --- a/crates/engine/src/cmd/typecmd/area_tests.rs +++ b/crates/engine/src/cmd/typecmd/area_tests.rs @@ -1854,9 +1854,12 @@ fn kana_style_and_roman_italics_are_character_features() { } assert_eq!(runs(&s), before); s.execute("text.setRangeStyle", &json!({"id": id, "featureChanges": ["-hkna", "-ital"]})).unwrap(); + let text = |s: &Session| runs(s).into_iter().map(|(t, _)| t).collect::<String>(); + assert_eq!(text(&s), "かなAB"); assert!(runs(&s).iter().all(|(_, f)| f.is_empty()), "{:?}", runs(&s)); s.execute("charStyle.new", &json!({"name": "Kana", "attrs": {"features": ["hkna", "ital"]}})).unwrap(); s.execute("charStyle.apply", &json!({"name": "Kana", "id": id})).unwrap(); + assert_eq!(text(&s), "かなAB"); assert!(runs(&s).iter().all(|(_, f)| *f == ["hkna", "ital"]), "{:?}", runs(&s)); let e = s.execute("charStyle.new", &json!({"name": "Bad", "attrs": {"features": ["ital=2"]}})).unwrap_err().to_string(); assert!(e.contains("unknown OpenType feature `ital=2`"), "{e}"); diff --git a/crates/engine/src/cmd/typecmd/block_tests.rs b/crates/engine/src/cmd/typecmd/block_tests.rs index eb4afa3760..9fccd38bb4 100644 --- a/crates/engine/src/cmd/typecmd/block_tests.rs +++ b/crates/engine/src/cmd/typecmd/block_tests.rs @@ -257,6 +257,7 @@ fn gaps_set_word_spacing_and_leading() { // The layout uses the gap as the Desired word spacing; the paragraph keeps its own. assert_eq!(t.para_at(0).justification.word_spacing, [80.0, 100.0, 133.0]); assert_eq!(t.layout_justification(t.para_at(0)).word_spacing, [80.0, 300.0, 300.0]); + assert_eq!(t.plain_text(), "two words\nthree more words", "the runs hold the text"); assert!(t.runs.iter().all(|r| (r.style.leading.unwrap() - r.style.size - 6.0).abs() < 1e-9), "{:?}", t.runs); assert_block(&t); assert!(size_at(&t, 0) < size_at(&plain, 0), "wider word spaces leave the letters less room"); @@ -850,6 +851,7 @@ fn a_range_leading_change_with_block_on_moves_the_line_gap() { let t = text(&s, id); assert!((t.area.line_gap - 5.0).abs() < 1e-9, "line gap {}", t.area.line_gap); assert!(leading_at(&t, 4).is_some_and(|l| (l - second - 5.0).abs() < 1e-9), "{:?}", leading_at(&t, 4)); + assert_eq!(t.plain_text(), "BIG\na much longer second line\nmid one", "the runs hold the text"); assert!(t.runs.iter().all(|r| r.style.leading.is_some_and(|l| (l - r.style.size - 5.0).abs() < 1e-9)), "every line spreads"); // Reset Panel's form: the leading is set and Block keeps the line gap. s.execute("text.setRangeStyle", &json!({"id": id, "start": 4, "end": 10, "leading": "auto", "keepLineGap": true})).unwrap(); diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 97201a51e6..edb9a1e631 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -4498,11 +4498,14 @@ fn stale_current_layer_id_never_targets_a_reused_id() { s.execute("select.set", &json!({"ids": [a.0, b.0]})).unwrap(); let c = NodeId(s.execute("object.compoundPath.make", &json!({})).unwrap()["id"].as_u64().unwrap()); assert_eq!(c, layer, "precondition: id reused"); + // Undo gives back the layer that was current before New Layer; a remembered id left over + // from elsewhere still names the compound path now. + s.doc_mut().unwrap().active_layer = Some(c); let d = rect(&mut s, 50.0, 50.0, 10.0, 10.0); s.execute("select.set", &json!({"ids": [d.0]})).unwrap(); s.execute("object.arrange.sendToCurrentLayer", &json!({})).unwrap(); let doc = &s.doc().unwrap().doc; - assert!(doc.node(c).unwrap().children().unwrap().iter().all(|n| n.path_data().is_some())); + assert_eq!(doc.node(c).unwrap().children().unwrap().len(), 2, "the compound path holds only the two rectangles it was made from"); assert!(doc.parent_of(d).is_some_and(|p| doc.node(p).unwrap().is_layer())); // layer.delete without an id must not delete the compound path. s.execute("layer.delete", &json!({})).ok(); diff --git a/crates/engine/tests/it/affinity_local.rs b/crates/engine/tests/it/affinity_local.rs index 54df4a4612..30ab6d2163 100644 --- a/crates/engine/tests/it/affinity_local.rs +++ b/crates/engine/tests/it/affinity_local.rs @@ -2,7 +2,7 @@ //! recursively) opens as editable art, and each artboard is compared with the thumbnail Affinity //! stored in the file. Reports the mean difference per artboard (0–255, both on white); with //! `AFFINITY_SAMPLES_OUT` set, writes each board's thumbnail crop and render side by side there. -//! Skipped when `AFFINITY_SAMPLES` is unset (as in CI). +//! Ignored by default; run it with `--ignored` and `AFFINITY_SAMPLES` set. use std::path::{Path, PathBuf}; @@ -28,8 +28,9 @@ fn on_white(p: &[u8]) -> [f64; 3] { } #[test] +#[ignore = "local samples: set AFFINITY_SAMPLES to a folder of Affinity documents"] fn local_affinity_documents_render_like_their_thumbnails() { - let Some(root) = std::env::var_os("AFFINITY_SAMPLES").map(PathBuf::from) else { return }; + let root = PathBuf::from(std::env::var_os("AFFINITY_SAMPLES").expect("AFFINITY_SAMPLES names the folder of documents to check")); let out = std::env::var_os("AFFINITY_SAMPLES_OUT").map(PathBuf::from); let mut paths = Vec::new(); files(&root, &mut paths); diff --git a/crates/engine/tests/it/dimensions.rs b/crates/engine/tests/it/dimensions.rs index bad590987d..1379cc0683 100644 --- a/crates/engine/tests/it/dimensions.rs +++ b/crates/engine/tests/it/dimensions.rs @@ -476,6 +476,7 @@ fn turned_horizontal_dimensions_stay_horizontal() { let mut ys = [d.a.y.round(), d.b.y.round()]; ys.sort_by(f64::total_cmp); assert_eq!(ys, [180.0, 280.0]); + assert_eq!(path_ends(&s, id)[2].len(), 2, "{:?}", path_ends(&s, id)); assert!(path_ends(&s, id)[2].iter().all(|(_, y)| (y - 130.0).abs() < 1e-6), "{:?}", path_ends(&s, id)); let line = run(&mut s, "shape.line", json!({"x1":100,"y1":400,"x2":200,"y2":400}))["id"].as_u64().unwrap(); let anchor = |anchor: u64| json!({"node":line,"subpath":0,"anchor":anchor}); diff --git a/crates/engine/tests/it/lossy_overwrite.rs b/crates/engine/tests/it/lossy_overwrite.rs index 559e45a33e..27ad030b15 100644 --- a/crates/engine/tests/it/lossy_overwrite.rs +++ b/crates/engine/tests/it/lossy_overwrite.rs @@ -76,10 +76,18 @@ fn a_file_the_import_left_things_out_of_is_not_written_over_unasked() { fn a_file_the_import_read_whole_is_written_over_as_before() { let d = dir("b"); let src = d.join("plain.eps"); - std::fs::write(&src, "%!PS-Adobe-3.0 EPSF-3.0\n%%BoundingBox: 0 0 100 100\n%%EndComments\n0 0 1 0 setcmykcolor 10 10 moveto 14 10 lineto 14 14 lineto closepath fill\nshowpage\n%%EOF\n").unwrap(); + let original = "%!PS-Adobe-3.0 EPSF-3.0\n%%BoundingBox: 0 0 100 100\n%%EndComments\n0 0 1 0 setcmykcolor 10 10 moveto 14 10 lineto 14 14 lineto closepath fill\nshowpage\n%%EOF\n"; + std::fs::write(&src, original).unwrap(); let mut s = Session::new(); - s.execute("document.open", &json!({ "path": src.to_string_lossy() })).unwrap(); + let opened = s.execute("document.open", &json!({ "path": src.to_string_lossy() })).unwrap(); + assert_eq!(opened["warnings"], json!([]), "{opened}"); s.execute("document.export", &json!({ "path": src.to_string_lossy(), "format": "eps" })).unwrap(); + let written = std::fs::read(&src).unwrap(); + assert_ne!(written, original.as_bytes(), "the export wrote over the file"); + let mut again = Session::new(); + again.execute("document.open", &json!({ "path": src.to_string_lossy() })).unwrap(); + let doc = &again.doc().unwrap().doc; + assert!(doc.layers.iter().any(|l| l.children().is_some_and(|c| !c.is_empty())), "the square is in the file written"); std::fs::remove_dir_all(d).ok(); } diff --git a/crates/engine/tests/it/preflight.rs b/crates/engine/tests/it/preflight.rs index 73f6066bd3..5dcfddf7b2 100644 --- a/crates/engine/tests/it/preflight.rs +++ b/crates/engine/tests/it/preflight.rs @@ -209,7 +209,9 @@ fn preflight_resource_font_finding_locates_its_instance() { s.execute("symbol.new", &json!({ "name": "Label" })).unwrap(); let r = check(&mut s); let f = r["findings"].as_array().unwrap().iter().find(|f| f["code"] == "missingFont").unwrap(); - assert!(f["ids"].as_array().unwrap().iter().all(|id| s.doc().unwrap().doc.node(NodeId(id.as_u64().unwrap())).is_some()), "{r}"); + let ids = f["ids"].as_array().unwrap(); + assert!(!ids.is_empty(), "the finding names where the font is used: {r}"); + assert!(ids.iter().all(|id| s.doc().unwrap().doc.node(NodeId(id.as_u64().unwrap())).is_some()), "{r}"); } struct Folder(std::path::PathBuf); From 40cd9932ebae7faea379d4f8becab28016bfb5ff Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 18:25:16 -0800 Subject: [PATCH 090/112] xtask: test-lint sleep rule checks the spawn call, std imports and counted loops MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - A spawned sleep is exempt only when the closure is the direct argument of `spawn`, not of a call inside it such as `spawn(prepare(|| …))`. - A bare `spawn` or `sleep`, and a `thread::` path, count only where a `use` brings them in from `std::thread`; `crate::thread::spawn` and `std::thread::{self as worker}` do not. - A sleep hit inside a spawned closure spans through the end of the spawn statement, so an edit that adds `.join()` there counts as a change. The brace-less `spawn(|| thread::sleep(D))` form gets the same span. - A block operand after a spaced `<` or `>` stays in the loop condition. - `while n < bound` with `n = n + 1` or `n = n - 1` in the body is a counted loop, like `n += 1`. - Calls inside the arguments of `println!`, `eprintln!` and the log macros are not polling work. --- xtask/src/test_lint.rs | 135 ++++++++++++++++++++++++++++++++--------- 1 file changed, 107 insertions(+), 28 deletions(-) diff --git a/xtask/src/test_lint.rs b/xtask/src/test_lint.rs index 3068e0ce83..69f3f50744 100644 --- a/xtask/src/test_lint.rs +++ b/xtask/src/test_lint.rs @@ -2993,10 +2993,15 @@ fn sleep_hits(file: &File) -> Vec<Hit> { .map(|at| { let mut hit = file.hit(at, Rule::Sleep, file.test_at(at), "sleeps in test code".into()); // An edit to the loop or spawn around the sleep can remove what exempted it. - if let Some(WaitBlock { start, open, through_other }) = wait_block(m, at) { + if let Some((name, _)) = expression_closure_call(m, at).filter(|&(name, end)| &m[name..end] == b"spawn") { + let end = spawn_statement_end(m, name).unwrap_or(m.len().saturating_sub(1)); + hit.also.push((hit.path.clone(), file.lines.of(name), file.lines.of(end))); + } else if let Some(WaitBlock { start, open, through_other }) = wait_block(m, at) { let head_at = start + (m[start..open].len() - m[start..open].trim_ascii_start().len()); if !through_other || closure_head(m[start..open].trim_ascii()) { let close = matching(m, open).unwrap_or(m.len().saturating_sub(1)); + // A spawn's span runs through the statement, which holds the use of its handle. + let close = closure_spawn(m, start, open).and_then(|s| spawn_statement_end(m, s)).map_or(close, |end| end.max(close)); hit.also.push((hit.path.clone(), file.lines.of(head_at), file.lines.of(close))); } } @@ -3005,8 +3010,9 @@ fn sleep_hits(file: &File) -> Vec<Hit> { .collect() } -/// Whether a `use` brings in `thread::<name>` under its own name, alone or in a `thread::{…}` -/// list. An alias (`thread::spawn as spawn_thread`) brings in another name. +/// Whether a `use` brings in `std::thread::<name>` under its own name, alone or in a `thread::{…}` +/// list. An alias (`thread::spawn as spawn_thread`) brings in another name, and `crate::thread` +/// is not the standard library's module. fn thread_import(m: &[u8], name: &str) -> bool { let path = format!("thread::{name}"); let alias = format!("as{name}"); @@ -3018,25 +3024,35 @@ fn thread_import(m: &[u8], name: &str) -> bool { let rest = rest.strip_prefix(alias.as_str()).unwrap_or(rest); !item.as_bytes()[..i].last().copied().is_some_and(is_ident) && !rest.bytes().next().is_some_and(is_ident) }; - item.match_indices(&path).any(|(i, _)| named(i)) - || item.split_once("thread::{").is_some_and(|(_, list)| !words(list.as_bytes(), name.as_bytes(), 0, list.len()).is_empty()) + item.match_indices(&path).any(|(i, _)| named(i) && under_std(&item[..i])) + || item.match_indices("thread::{").any(|(i, _)| { + let list = &item[i + "thread::{".len()..]; + let list = &list[..list.find('}').unwrap_or(list.len())]; + under_std(&item[..i]) && !words(list.as_bytes(), name.as_bytes(), 0, list.len()).is_empty() + }) }) } +/// Whether a member of a `use` item whose normalized text before the member is `pre` sits directly +/// under `std`: right after `use std::`, or a top-level member of a `use std::{…}` list. +fn under_std(pre: &str) -> bool { + let pre = pre.strip_prefix("use").unwrap_or(pre); + let pre = pre.strip_prefix("::").unwrap_or(pre); + let Some(rest) = pre.strip_prefix("std::") else { return false }; + rest.is_empty() || (rest.starts_with('{') && rest.ends_with(['{', ',']) && rest.matches('{').count() == 1 + rest.matches('}').count()) +} + /// Whether a `use` binds the name `thread` to `std::thread`: `use std::thread;`, /// `use std::{thread, …};` or `use std::thread::{self, …};`. fn std_thread_import(m: &[u8]) -> bool { words(m, b"use", 0, m.len()).into_iter().any(|u| { let item = norm(&m[u..statement_end(m, u)]); - let item = item.strip_prefix("use").unwrap_or(&item); - let item = item.strip_prefix("::").unwrap_or(item); - let Some(rest) = item.strip_prefix("std::") else { return false }; - words(rest.as_bytes(), b"thread", 0, rest.len()).into_iter().any(|i| { - let before = rest.as_bytes()[..i].last().copied(); - let after = &rest[i + "thread".len()..]; - // Directly after `std::`, or a top-level member of a `std::{…}` list. - let top = i == 0 || (matches!(before, Some(b'{' | b',')) && rest[..i].matches('{').count() == 1 + rest[..i].matches('}').count()); - top && (after.is_empty() || after.starts_with([';', ',', '}']) || after.starts_with("::{self")) + words(item.as_bytes(), b"thread", 0, item.len()).into_iter().any(|i| { + let after = &item[i + "thread".len()..]; + // `{self as worker}` binds another name. + let self_member = + after.strip_prefix("::{").is_some_and(|list| list[..list.find('}').unwrap_or(list.len())].split(',').any(|x| x == "self")); + under_std(&item[..i]) && (after.is_empty() || after.starts_with([';', ',', '}']) || self_member) }) }) } @@ -3045,6 +3061,10 @@ fn std_thread_import(m: &[u8]) -> bool { /// `elapsed().checked_sub(D).unwrap()`. const PASS_THROUGH_CALLS: &[&str] = &["unwrap", "expect", "unwrap_or", "unwrap_or_default", "unwrap_or_else"]; +/// Macros that print or log their arguments, such as the `println!("{}", t0.elapsed())` of a +/// wait on the clock. +const LOG_MACROS: &[&str] = &["print!", "println!", "eprint!", "eprintln!", "trace!", "debug!", "info!", "warn!", "error!", "log!"]; + /// Calls that only read or build a time, which a wait on the clock alone makes. const TIME_CALLS: &[&str] = &[ "sleep", @@ -3142,7 +3162,11 @@ fn condition_block(before: &[u8]) -> bool { let ends_word = |w: &[u8]| b.ends_with(w) && !b.len().checked_sub(w.len() + 1).is_some_and(|j| is_ident(b[j])); b.last().copied().is_some_and(|c| is_ident(c) || matches!(c, b')' | b']' | b'}' | b'?')) && !ends_word(b"move") && !ends_word(b"return") }); - keyword(b"while") || keyword(b"if") || keyword(b"match") || before.ends_with(b"&&") || or || not || before.ends_with(b"=") + // A comparison or shift has a space before `<` or `>` (`0 < { … }`); a generic (`Option<u8> {`), + // `->` and `=>` do not. + let angles = before.iter().rev().take_while(|&&c| c == b'<' || c == b'>').count(); + let compares = (1..=2).contains(&angles) && before.len().checked_sub(angles + 1).is_some_and(|j| before[j].is_ascii_whitespace()); + keyword(b"while") || keyword(b"if") || keyword(b"match") || before.ends_with(b"&&") || or || not || compares || before.ends_with(b"=") } /// `head` without a leading loop label (`'outer:`). @@ -3213,10 +3237,21 @@ fn counted_while(m: &[u8], head: &[u8], open: usize, close: usize) -> bool { } let op = cond[n..].trim_ascii_start(); let compares = (op.starts_with(b"<") && !op.starts_with(b"<<")) || (op.starts_with(b">") && !op.starts_with(b">>")) || op.starts_with(b"!="); + let name = &cond[..n]; compares - && words(m, &cond[..n], open, close).into_iter().any(|w| { + && words(m, name, open, close).into_iter().any(|w| { let after = skip_ws(m, w + n); - matches!(m.get(after..after + 2), Some(b"+=" | b"-=")) + if matches!(m.get(after..after + 2), Some(b"+=" | b"-=")) { + return true; + } + // `n = n + 1` or `n = n - 1`. + if m.get(after) != Some(&b'=') || m.get(after + 1) == Some(&b'=') { + return false; + } + let value = skip_ws(m, after + 1); + m.get(value..value + n) == Some(name) + && !m.get(value + n).copied().is_some_and(is_ident) + && matches!(m.get(skip_ws(m, value + n)), Some(b'+' | b'-')) }) } @@ -3224,10 +3259,11 @@ fn counted_while(m: &[u8], head: &[u8], open: usize, close: usize) -> bool { /// spawned thread's fallback release. A `while` or `loop` around it polls when its condition or /// body calls a function or method other than [`TIME_CALLS`] and [`PASS_THROUGH_CALLS`] (a /// flag's `load`, a `poll`, a progress read). A macro such as `println!`, a call inside the -/// arguments of `stringify!` or of the sleep itself, a nested `fn` name and `Duration::new` do -/// not count. A closure passed to a `thread::spawn` call whose handle is dropped runs beside the -/// test, which does not wait for it. In `while n < bound` with `n += 1` or `n -= 1` in the body, -/// the loop counts its own passes, so only calls in the body count. +/// arguments of `stringify!`, of a [`LOG_MACROS`] macro or of the sleep itself, a nested `fn` name +/// and `Duration::new` do not count. A closure passed directly to a `thread::spawn` call whose +/// handle is dropped runs beside the test, which does not wait for it. In `while n < bound` with +/// `n += 1`, `n -= 1`, `n = n + 1` or `n = n - 1` in the body, the loop counts its own passes, so +/// only calls in the body count. fn polls_or_releases(m: &[u8], at: usize, imports: Imports) -> bool { if let Some((name, end)) = expression_closure_call(m, at) { return &m[name..end] == b"spawn" && dropped_spawn(m, name, imports); @@ -3235,10 +3271,7 @@ fn polls_or_releases(m: &[u8], at: usize, imports: Imports) -> bool { let Some(WaitBlock { open, start, through_other }) = wait_block(m, at) else { return false }; let head = m[start..open].trim_ascii(); if closure_head(head) { - let head_at = start + (m[start..open].len() - m[start..open].trim_ascii_start().len()); - return words(head, b"spawn", 0, head.len()) - .into_iter() - .any(|s| head.get(skip_ws(head, s + "spawn".len())) == Some(&b'(') && dropped_spawn(m, head_at + s, imports)); + return closure_spawn(m, start, open).is_some_and(|s| dropped_spawn(m, s, imports)); } // A sleep inside another block, such as a `let` initializer, in the loop is reported. if through_other { @@ -3247,10 +3280,10 @@ fn polls_or_releases(m: &[u8], at: usize, imports: Imports) -> bool { let close = matching(m, open).unwrap_or(m.len()); let from = if counted_while(m, strip_label(head), open, close) { open } else { start }; let found = calls_at(m, from, close); - // The arguments of `stringify!` and of a sleep are not polling work. + // The arguments of `stringify!`, of a logging macro and of a sleep are not polling work. let skipped: Vec<(usize, usize)> = found .iter() - .filter(|(_, name, _)| name == "stringify!" || name == "sleep") + .filter(|(_, name, _)| name == "stringify!" || name == "sleep" || LOG_MACROS.contains(&name.as_str())) .filter_map(|(p, name, _)| { let o = skip_ws(m, p + name.len()); matching(m, o).map(|c| (o, c)) @@ -3279,6 +3312,32 @@ fn polls_or_releases(m: &[u8], at: usize, imports: Imports) -> bool { }) } +/// The start of the name of the `spawn(…)` call that takes the closure whose head is `m[start..open]` +/// as its argument directly (`spawn(|| {`, `spawn(move || {`), not through another call such as +/// `spawn(prepare(|| {`. +fn closure_spawn(m: &[u8], start: usize, open: usize) -> Option<usize> { + let head = &m[start..open]; + words(head, b"spawn", 0, head.len()).into_iter().rev().find_map(|s| { + let paren = skip_ws(head, s + "spawn".len()); + if head.get(paren) != Some(&b'(') { + return None; + } + let arg = head[paren + 1..].trim_ascii_start(); + let arg = match arg.strip_prefix(b"move") { + Some(rest) if !rest.first().copied().is_some_and(is_ident) => rest.trim_ascii_start(), + _ => arg, + }; + arg.starts_with(b"||").then_some(start + s) + }) +} + +/// The offset of the `;` that ends the statement holding the `spawn(…)` call whose name starts at +/// `at`, so an edit that keeps or joins the handle (`).join().unwrap();`) falls in the hit's span. +fn spawn_statement_end(m: &[u8], at: usize) -> Option<usize> { + let close = matching(m, skip_ws(m, at + "spawn".len()))?; + Some(statement_end(m, close + 1).min(m.len().saturating_sub(1))) +} + /// For a sleep that is the whole body of a closure without braces (`spawn(|| thread::sleep(D))`), /// the start and end of the name of the call that takes the closure. fn expression_closure_call(m: &[u8], at: usize) -> Option<(usize, usize)> { @@ -3317,7 +3376,7 @@ fn expression_closure_call(m: &[u8], at: usize) -> Option<(usize, usize)> { /// Whether the `spawn(…)` call whose name starts at `at` starts a thread and drops its handle. /// The call is the whole statement: `std::thread::` before it (or `thread::` where a `use` binds -/// `thread` to `std::thread`, or no path where a `use` brings in `thread::spawn`) and a `;` after +/// `thread` to `std::thread`, or no path where a `use` brings in `std::thread::spawn`) and a `;` after /// it. A `let`, an assignment, an argument or a chained `.join()` keeps the handle, and a test /// that joins it waits for the sleep. fn dropped_spawn(m: &[u8], at: usize, imports: Imports) -> bool { @@ -5587,6 +5646,8 @@ mod tests { "use std::thread;\n#[test]\nfn t() {\n thread::spawn(|| {\n thread::sleep(D);\n });\n assert_eq!(f(), 1);\n}\n", "use std::{thread, time::Duration};\n#[test]\nfn t() {\n thread::spawn(|| {\n thread::sleep(Duration::ZERO);\n });\n assert_eq!(f(), 1);\n}\n", "fn wait(q: &Q) {\n while q.len() < 3 {\n thread::sleep(D);\n }\n}\n", + "fn wait(q: &Q) {\n while 0 < { q.len() } {\n thread::sleep(D);\n }\n}\n", + "fn wait(q: &Q) {\n while 3 > { q.len() } {\n thread::sleep(D);\n }\n}\n", ]; for src in polls { assert_eq!(hits(src), [], "{src}"); @@ -5618,6 +5679,11 @@ mod tests { "mod thread {\n pub fn spawn(f: impl FnOnce()) {\n f();\n }\n}\n#[test]\nfn t() {\n thread::spawn(|| {\n std::thread::sleep(D);\n });\n assert_eq!(f(), 1);\n}\n", "#[test]\nfn t() {\n let h = std::thread::spawn(|| {\n let () = {\n std::thread::sleep(D);\n };\n });\n h.join().unwrap();\n}\n", "fn wait(r: &R) {\n while !r.load(SeqCst) {\n let x = {\n thread::sleep(D);\n 1\n };\n }\n}\n", + "fn wait() {\n let attempts = [0, 1, 2];\n let mut n = 0;\n while n < attempts.len() {\n thread::sleep(D);\n n = n + 1;\n }\n}\n", + "#[test]\nfn t() {\n std::thread::spawn(prepare(|| {\n std::thread::sleep(D);\n }));\n assert_eq!(f(), 1);\n}\n", + "fn wait(t0: Instant) {\n while t0.elapsed() < D {\n println!(\"{}\", 1u8.to_string());\n thread::sleep(D);\n }\n}\n", + "use crate::thread::spawn;\n#[test]\nfn t() {\n spawn(|| {\n std::thread::sleep(D);\n });\n assert_eq!(f(), 1);\n}\n", + "use std::thread::{self as worker};\nmod thread {\n pub fn spawn(f: impl FnOnce()) {\n f();\n }\n}\n#[test]\nfn t() {\n thread::spawn(|| {\n std::thread::sleep(D);\n });\n assert_eq!(f(), 1);\n}\n", ]; for src in timed { assert_eq!(hits(src).iter().filter(|h| h.1 == "sleep").count(), 1, "{src}"); @@ -5633,6 +5699,19 @@ mod tests { assert!(!touches(&found[0], Some(&[2].into_iter().collect())), "a change outside the loop"); } + #[test] + fn an_edit_that_joins_a_spawned_sleep_counts_as_a_change() { + let block = "#[test]\nfn t() {\n std::thread::spawn(move || {\n std::thread::sleep(D);\n })\n .join()\n .unwrap();\n assert_eq!(f(), 1);\n}\n"; + let bare = + "#[test]\nfn t() {\n std::thread::spawn(|| std::thread::sleep(D))\n .join()\n .unwrap();\n assert_eq!(f(), 1);\n}\n"; + for (src, line, join) in [(block, 4, 7), (bare, 3, 5)] { + let found = lint_file("crates/x/src/tests.rs", src, &ctx()); + assert_eq!(found.iter().map(|h| (h.rule, h.line)).collect::<Vec<_>>(), [(Rule::Sleep, line)], "{src}"); + assert!(touches(&found[0], Some(&[join].into_iter().collect())), "a change to the join: {src}"); + assert!(!touches(&found[0], Some(&[join + 1].into_iter().collect())), "a change after the statement: {src}"); + } + } + #[test] fn sleep_needs_the_thread_function() { let local = "fn sleep() -> u8 { 42 }\n#[test]\nfn t() {\n assert_eq!(sleep(), 42);\n}\n"; From cd6c575ae654b6961e5ad0c545914f9beefcfe9f Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 18:29:53 -0800 Subject: [PATCH 091/112] Tests: engine tests assert results instead of only success Engine tests in crates/engine/src/tests that passed on a broken result now check the result: - cancel: Export PDF under a canceled token stops, and outside it the whole file is written. - ids_without_selection: each command refuses with nothing selected, then changes the object given in one undo step. - pathops: every bad input is refused and changes nothing. - plugins: the folder's plug-in is listed as loaded, nothing is loaded once the folder is cleared, and it loads again when set again. - brushlib: the pasted brush and its pattern equal the copied ones. - build: Image Trace keeps a preset's settings passed back, for one preset with an enhanced version and one without, in place of a loop over every preset. - strokegeom: two width profiles and two arrowheads are checked by value, in place of a round trip over every preset and arrowhead. - script_xmp: the ACL test fails instead of returning when the default ACL cannot be set. - Tests that checked every item of a list now also check its length, so an empty list fails (bboxrotate, build, clippaint, colormgmt, constrain_new, dynamic_symbols, freeform, gradient). Removed: a manual timing probe in areafit, covered by auto_height_in_columns_lays_out_the_columns_twice_a_keystroke, and two plug-in file generators in plugins that ran only with an environment variable set, covered by live_effects_are_given_their_object_s_paints and filters_set_effects_and_stroke_styles. object.path.simplify now refuses a negative tolerance and a level outside 0 to 100, which it clamped before. --- crates/engine/src/cmd/pathops.rs | 6 +++ crates/engine/src/tests/areafit.rs | 46 ------------------- crates/engine/src/tests/bboxrotate.rs | 8 ++-- crates/engine/src/tests/brushlib.rs | 7 ++- crates/engine/src/tests/build.rs | 39 ++++++++++++---- crates/engine/src/tests/cancel.rs | 7 ++- crates/engine/src/tests/clippaint.rs | 4 +- crates/engine/src/tests/colormgmt.rs | 4 +- crates/engine/src/tests/constrain_new.rs | 4 +- crates/engine/src/tests/dynamic_symbols.rs | 4 +- crates/engine/src/tests/freeform.rs | 5 +- crates/engine/src/tests/gradient.rs | 5 ++ .../engine/src/tests/ids_without_selection.rs | 5 ++ crates/engine/src/tests/pathops.rs | 6 ++- crates/engine/src/tests/plugins.rs | 39 ++-------------- crates/engine/src/tests/script_xmp.rs | 13 ++---- crates/engine/src/tests/strokegeom.rs | 17 +++---- 17 files changed, 99 insertions(+), 120 deletions(-) diff --git a/crates/engine/src/cmd/pathops.rs b/crates/engine/src/cmd/pathops.rs index 2132375a44..cacafa5d06 100644 --- a/crates/engine/src/cmd/pathops.rs +++ b/crates/engine/src/cmd/pathops.rs @@ -1563,6 +1563,12 @@ pub fn auto_simplify_level(s: &Session) -> Result<f64> { fn simplify(s: &mut Session, p: &Value) -> Result<Value> { const C: &str = "object.path.simplify"; let (auto, given_level, given_tolerance) = (switch_or(p, "auto", false, C)?, number_given(p, "level", C)?, length_given(p, "tolerance", C)?); + if given_tolerance.is_some_and(|t| t < 0.0) { + return Err(bad(C, "`tolerance` must be 0 or more")); + } + if given_level.is_some_and(|l| !(0.0..=100.0).contains(&l)) { + return Err(bad(C, "`level` must be from 0 to 100")); + } let corner_angle = number_given(p, "cornerAngle", C)?.unwrap_or(30.0).clamp(0.0, 180.0); let (straight_lines, whole) = (switch_or(p, "straightLines", false, C)?, switch_or(p, "wholePaths", false, C)?); // With auto, the slider's level is Auto-Simplify's for the selection's size; otherwise it is the level given. diff --git a/crates/engine/src/tests/areafit.rs b/crates/engine/src/tests/areafit.rs index 7d8f759cf5..046271982f 100644 --- a/crates/engine/src/tests/areafit.rs +++ b/crates/engine/src/tests/areafit.rs @@ -374,52 +374,6 @@ fn auto_height_in_columns_matches_the_full_search_when_lines_start_small() { } } -/// Time typing at the start of a story of 5,000, 20,000 and 50,000 characters in Auto Size area -/// type in 2 and 3 columns: 20 letters typed one at a time with the Type tool, with Auto Size as it -/// runs and with `FULL_SEARCH` on (the columns laid out at every step of the bisection). -/// Run with `cargo test --release -p vectorcraft-engine --lib auto_height_in_columns_typing_timing -- --ignored --nocapture`. -#[test] -#[ignore = "manual timing probe; wall-clock performance depends on machine load"] -fn auto_height_in_columns_typing_timing() { - use crate::cmd::typecmd::{COLUMN_LAYOUTS, FULL_SEARCH}; - const WORDS: &str = "The quick brown fox jumps over the lazy dog and keeps running far beyond the first frame of this story. "; - let v = ViewInfo::default(); - for n in [5_000, 20_000, 50_000] { - let story = format!("{}\n", WORDS.repeat(6).trim_end()).repeat(n / 600 + 1)[..n].to_string(); - for cols in [2, 3] { - let mut row = format!("{n} characters in {cols} columns:"); - for full in [false, true] { - FULL_SEARCH.with(|c| c.set(full)); - let mut s = Session::new(); - s.execute("file.new", &json!({"width": 4400, "height": 1200})).unwrap(); - let area = json!({"width": 500, "height": 100, "fit": "autoHeight"}); - let id = s.execute("text.create", &json!({"x": 20, "y": 20, "size": 9, "text": story, "area": area})).unwrap()["id"].clone(); - s.execute("select.set", &json!({"ids": [id]})).unwrap(); - s.execute("text.areaOptions", &json!({"columns": cols, "gutter": 12})).unwrap(); - s.select_tool("type", v).unwrap(); - for kind in [PointerKind::Down, PointerKind::Up] { - s.pointer(&PointerEvent::new(kind, 21.0, 24.0), v).unwrap(); - } - let layouts = COLUMN_LAYOUTS.with(std::cell::Cell::get); - let mut ms: Vec<f64> = "abcdefghijklmnopqrst" - .chars() - .map(|ch| { - let start = std::time::Instant::now(); - s.tool_text(&ch.to_string(), v).unwrap(); - start.elapsed().as_secs_f64() * 1000.0 - }) - .collect(); - let per_key = (COLUMN_LAYOUTS.with(std::cell::Cell::get) - layouts) as f64 / ms.len() as f64; - ms.sort_by(f64::total_cmp); - let how = if full { "every step laid out" } else { "Auto Size" }; - row += &format!(" {how} {:.1} ms a keystroke ({per_key:.1} column layouts);", ms[ms.len() / 2]); - } - FULL_SEARCH.with(|c| c.set(false)); - println!("{row}"); - } - } -} - #[test] fn shrink_text_round_trips_through_the_native_format() { let mut s = session(); diff --git a/crates/engine/src/tests/bboxrotate.rs b/crates/engine/src/tests/bboxrotate.rs index eec4ee191a..f34a611390 100644 --- a/crates/engine/src/tests/bboxrotate.rs +++ b/crates/engine/src/tests/bboxrotate.rs @@ -553,7 +553,7 @@ fn reset_bounding_box_squares_the_objects_inside_a_group() { // The group and both members, in one step. assert_eq!(s.execute("object.resetBoundingBox", &json!({})).unwrap()["changed"], 3); assert_eq!(undo_len(&s), n + 1); - assert!(object_angles(&s).iter().all(|a| *a == 0.0), "{:?}", object_angles(&s)); + assert_eq!(object_angles(&s), [0.0; 3], "the group and both members"); s.execute("object.ungroup", &json!({})).unwrap(); assert_eq!(selection_box(&s).angle, 0.0); assert_eq!(s.execute("object.resetBoundingBox", &json!({})).unwrap()["changed"], 0); @@ -709,9 +709,11 @@ fn reset_bounding_box_squares_every_box_rotate_bounding_box_turned() { let art = (anchors(&s, a), anchors(&s, c)); // The group, the masked object, its mask's art and the other rectangle. assert_eq!(s.execute("object.rotateBoundingBox", &json!({"angle": 25})).unwrap()["changed"], 4); - assert!(object_angles(&s).iter().all(|x| near(*x, 25.0)), "{:?}", object_angles(&s)); + let turned = object_angles(&s); + assert_eq!(turned.len(), 4, "{turned:?}"); + assert!(turned.iter().all(|x| near(*x, 25.0)), "{turned:?}"); assert_eq!(s.execute("object.resetBoundingBox", &json!({})).unwrap()["changed"], 4); - assert!(object_angles(&s).iter().all(|x| *x == 0.0), "{:?}", object_angles(&s)); + assert_eq!(object_angles(&s), [0.0; 4]); assert_eq!((anchors(&s, a), anchors(&s, c)), art); } diff --git a/crates/engine/src/tests/brushlib.rs b/crates/engine/src/tests/brushlib.rs index f2fe9860ca..2e809eaed9 100644 --- a/crates/engine/src/tests/brushlib.rs +++ b/crates/engine/src/tests/brushlib.rs @@ -1247,10 +1247,13 @@ fn pasted_brushed_art_brings_the_patterns_its_brush_art_uses() { run(&mut s, "brush.apply", json!({"name": "Dotted Band", "ids": [line]})); run(&mut s, "select.set", json!({"ids": [line]})); run(&mut s, "edit.copy", json!({})); + let (brush, dots) = (vectorcraft_brush::find(doc(&s), "Dotted Band"), doc(&s).pattern("Dots").cloned()); run(&mut s, "file.new", json!({"width": 200, "height": 200})); + assert_eq!((vectorcraft_brush::find(doc(&s), "Dotted Band"), doc(&s).pattern("Dots")), (None, None), "a new document has neither"); run(&mut s, "edit.paste", json!({})); - assert!(vectorcraft_brush::find(doc(&s), "Dotted Band").is_some()); - assert!(doc(&s).pattern("Dots").is_some(), "the brush's art is filled with it"); + assert_eq!(vectorcraft_brush::find(doc(&s), "Dotted Band"), brush); + assert_eq!(doc(&s).pattern("Dots").cloned(), dots, "the brush's art is filled with it"); + assert!(dots.is_some()); } #[test] diff --git a/crates/engine/src/tests/build.rs b/crates/engine/src/tests/build.rs index adb5d04af5..514015066b 100644 --- a/crates/engine/src/tests/build.rs +++ b/crates/engine/src/tests/build.rs @@ -2533,6 +2533,9 @@ fn shape_builder_erase_click_or_drag_from_inside_a_narrow_overlap_deletes_it() { assert_eq!(r["edges"].as_u64(), Some(0), "{points}: {r}"); let d = &s.doc().unwrap().doc; let left: Vec<f64> = d.children(d.default_layer()).unwrap().iter().filter_map(|c| c.geometric_bounds()).map(|b| b.width()).collect(); + let erased = r["regions"].as_u64().unwrap(); + assert!((1..=3).contains(&erased), "{points}: {r}"); + assert_eq!(left.len() as u64, 3 - erased, "{points}: the regions not erased stay: {left:?}"); assert!(left.iter().all(|w| *w > 2.0), "{points}: no strip is left: {left:?}"); } } @@ -4583,6 +4586,7 @@ fn live_paint_group_default_clears_the_faces_and_gives_the_edges_a_thin_black_st s.execute("paint.setStroke", &json!({"color": "#0000ff"})).unwrap(); s.execute("paint.default", &json!({})).unwrap(); let (faces, edges) = part_looks(&s, g); + assert_eq!((faces.len(), edges.len() >= 4), (3, true), "{}", edges.len()); assert!(faces.iter().all(|f| f.fill_paint().is_none() && f.stroke_paint().is_none())); assert!(edges.iter().all(|e| e.stroke_paint() == Paint::solid(Color::BLACK) && e.stroke_width() == 0.5 && e.fill_paint().is_none())); assert_eq!(sources_looks(&s, g), sources0); @@ -4627,6 +4631,7 @@ fn live_paint_group_invert_recolors_the_faces_fill() { let (_, edges0) = part_looks(&s, g); s.execute("paint.invert", &json!({"stroke": false})).unwrap(); let (faces, edges) = part_looks(&s, g); + assert_eq!((faces.len(), edges.len() >= 4), (3, true), "{}", edges.len()); assert!(faces.iter().all(|f| f.fill_paint() == Paint::solid(Color::rgb(0.0, 1.0, 1.0)))); assert_eq!(edges, edges0); assert_eq!(sources_looks(&s, g), sources0); @@ -4634,12 +4639,14 @@ fn live_paint_group_invert_recolors_the_faces_fill() { s.execute("paint.invert", &json!({"stroke": true, "target": "contents"})).unwrap(); let (faces1, edges1) = part_looks(&s, g); assert_eq!(faces1, faces); + assert_eq!(edges1.len(), edges.len()); assert!(edges1.iter().all(|e| e.stroke_paint() == Paint::solid(Color::WHITE))); assert_eq!(sources_looks(&s, g), sources0); // A gradient edit of the fill goes to the faces only. s.execute("paint.setFill", &json!({"gradient": {}})).unwrap(); s.execute("paint.editGradient", &json!({"stroke": false, "angle": 45})).unwrap(); let (faces2, edges2) = part_looks(&s, g); + assert_eq!(faces2.len(), 3); assert!(faces2.iter().all(|f| matches!(f.fill_paint(), Paint::Gradient(_)))); assert_eq!(edges2, edges1, "edges take no fill gradient"); assert_eq!(sources_looks(&s, g), sources0); @@ -4674,7 +4681,9 @@ fn live_paint_group_gradient_vector_and_freeform_edits_change_its_faces() { assert_eq!(sources_looks(&s, g), sources0); s.execute("paint.setFill", &json!({"gradient": {"kind": "freeform"}})).unwrap(); s.execute("paint.freeform.addPoint", &json!({"stroke": false, "at": [25, 50], "color": "#00ff00"})).unwrap(); - assert!(part_looks(&s, g).0.iter().all(|f| matches!(f.fill_paint(), Paint::Gradient(gr) if gr.freeform.is_some()))); + let faces_now = part_looks(&s, g).0; + assert_eq!(faces_now.len(), face_ids.len()); + assert!(faces_now.iter().all(|f| matches!(f.fill_paint(), Paint::Gradient(gr) if gr.freeform.is_some()))); assert_eq!(part_looks(&s, g).1, edges0); assert_eq!(sources_looks(&s, g), sources0); } @@ -4944,16 +4953,19 @@ fn live_paint_group_contents_edits_follow_the_group_rule() { let sources0 = sources_looks(&s, g); s.execute("appearance.addFill", &json!({"target": "contents"})).unwrap(); let (faces1, edges1) = part_looks(&s, g); + assert_eq!((faces0.len(), faces1.len(), edges0.len() >= 4), (3, 3, true), "{}", edges0.len()); assert!(faces1.iter().zip(&faces0).all(|(f, f0)| f.items.len() == f0.items.len() + 1), "every face takes a new fill"); assert_eq!(edges1, edges0, "edges take no new fill"); s.execute("appearance.addStroke", &json!({"target": "contents"})).unwrap(); let (faces2, edges2) = part_looks(&s, g); assert_eq!(faces2, faces1, "faces take no new stroke"); + assert_eq!(edges2.len(), edges1.len()); assert!(edges2.iter().zip(&edges1).all(|(e, e0)| e.items.len() == e0.items.len() + 1), "every edge takes a new stroke"); // A stroke row edit of the contents reaches the edges, not the faces. s.execute("stroke.set", &json!({"target": "contents", "item": 0, "weight": 7})).unwrap(); let (faces3, edges3) = part_looks(&s, g); assert_eq!(faces3, faces2, "faces keep their rows"); + assert_eq!(edges3.len(), edges2.len()); assert!(edges3.iter().all(|e| e.stroke_at(Some(0)).map(|st| st.width) == Some(7.0)), "every edge's stroke row takes the weight"); s.execute("appearance.clear", &json!({"target": "contents"})).unwrap(); assert_eq!(sources_looks(&s, g), sources0, "the hidden source paths keep their appearance"); @@ -5203,6 +5215,7 @@ fn live_paint_group_contents_take_a_graphic_style_by_kind() { s.execute("graphicStyle.apply", &json!({"name": "Both", "target": "contents", "add": add})).unwrap(); assert!(parts_hold_their_kind(&s, g), "add {add}: faces hold fills and edges strokes"); let (faces, edges) = part_looks(&s, g); + assert_eq!((faces.len(), edges.len() >= 4), (3, true), "add {add}: {}", edges.len()); assert!(faces.iter().all(|a| a.items.iter().any(|it| *it.paint() == red)), "add {add}: each face takes the style's fill"); assert!(edges.iter().all(|a| a.items.iter().any(|it| *it.paint() == blue)), "add {add}: each edge takes the style's stroke"); let n = node(&s, g); @@ -6199,6 +6212,7 @@ fn live_paint_bucket_edge_double_click_after_filling_a_face_paints_the_joined_ed let black = Paint::solid(Color::rgb(0.0, 0.0, 0.0)); let green = Paint::solid(Color::from_hex("#00ff00").unwrap()); let all = edges_in(&s, g, Rect::new(-1.0, -1.0, 101.0, 51.0)); + assert!(all.len() >= 3, "the outline and the shared edge: {all:?}"); paint_parts(&mut s, &all, &black, &[(a, black.clone()), (b, black.clone())]); let v = ViewInfo::default(); s.select_tool("livePaintBucket", v).unwrap(); @@ -9217,16 +9231,23 @@ fn image_trace_refuses_an_unknown_setting() { } } -/// Every preset's settings, as imageTrace.presets lists them, trace when passed back whole. +/// A preset's settings, as imageTrace.presets lists them, trace when passed back whole, and the +/// trace keeps them: a preset with an enhanced version, both ways, and a preset without one. #[test] -fn image_trace_takes_every_preset_back_as_params() { +fn image_trace_takes_a_preset_back_as_params() { let list = session().execute("imageTrace.presets", &json!({})).unwrap(); - for preset in list["presets"].as_array().unwrap() { - for params in [&preset["params"], &preset["enhanced"]].into_iter().filter(|p| !p.is_null()) { - let mut s = session(); - image_doc(&mut s); - let r = s.execute("imageTrace.make", &json!({"preset": preset["name"], "params": params})); - assert!(r.is_ok(), "{}: {r:?}", preset["name"]); + let preset = |name: &str| list["presets"].as_array().unwrap().iter().find(|p| p["name"] == name).unwrap().clone(); + let (six, flat) = (preset("6 Colors"), preset("Flat Logo")); + for (name, params) in [("6 Colors", &six["params"]), ("6 Colors", &six["enhanced"]), ("Flat Logo", &flat["params"])] { + let mut s = session(); + image_doc(&mut s); + let r = s.execute("imageTrace.make", &json!({"preset": name, "params": params})).unwrap(); + let stored = node(&s, NodeId(r["id"].as_u64().unwrap())).extras().trace.clone().unwrap(); + assert_eq!(stored["preset"], name); + let given = params.as_object().unwrap(); + assert!(given.len() > 1, "{name}: {params}"); + for (key, value) in given { + assert_eq!(&stored["params"][key], value, "{name}: `{key}` is kept"); } } } diff --git a/crates/engine/src/tests/cancel.rs b/crates/engine/src/tests/cancel.rs index 9a044ead89..b369db85cb 100644 --- a/crates/engine/src/tests/cancel.rs +++ b/crates/engine/src/tests/cancel.rs @@ -87,5 +87,10 @@ fn nothing_is_cancelled_outside_a_scope() { token.cancel(); // The token only counts for work run under it, on its thread. let mut s = session(1); - assert!(s.execute("document.exportPdf", &json!({})).is_ok()); + let r = cancel::scope(&token, None, || s.execute("document.exportPdf", &json!({}))); + assert!(matches!(r, Err(EngineError::Cancelled)), "under the token: {r:?}"); + let r = s.execute("document.exportPdf", &json!({})).unwrap(); + let bytes = vectorcraft_format::base64_decode(r["dataBase64"].as_str().unwrap()).unwrap(); + assert!(bytes.starts_with(b"%PDF-"), "outside it the whole file is written"); + assert!(bytes.ends_with(b"%%EOF"), "to its end"); } diff --git a/crates/engine/src/tests/clippaint.rs b/crates/engine/src/tests/clippaint.rs index 1355c11b7d..0d596fe3b2 100644 --- a/crates/engine/src/tests/clippaint.rs +++ b/crates/engine/src/tests/clippaint.rs @@ -155,5 +155,7 @@ fn type_as_a_clipping_path_paints_its_characters() { let p = paint(&s); assert!(p.stroke.is_none()); let NodeKind::Text(fill) = &p.fill.expect("the characters' fill paints").kind else { panic!("type") }; - assert!(fill.runs.iter().all(|r| r.style.fill.color().is_some() && r.style.stroke.is_none())); + assert_eq!(fill.plain_text(), "Clip"); + let blue = vectorcraft_color::Color::from_hex("#0000ff"); + assert!(!fill.runs.is_empty() && fill.runs.iter().all(|r| r.style.fill.color() == blue && r.style.stroke.is_none()), "{:?}", fill.runs); } diff --git a/crates/engine/src/tests/colormgmt.rs b/crates/engine/src/tests/colormgmt.rs index 46d03c0379..55ed42ec7a 100644 --- a/crates/engine/src/tests/colormgmt.rs +++ b/crates/engine/src/tests/colormgmt.rs @@ -739,7 +739,9 @@ fn separations_preview_compares_the_visible_plates_as_a_set() { assert_eq!(sep(&mut s, json!({"plates": ["Cyan", "Magenta", "Yellow", "Black"]})), all, "every plate in plate order"); sep(&mut s, json!({"plates": ["Cyan", "Cyan"]})); let r = s.execute("view.separationsPreview", &json!({"toggle": "Cyan"})).unwrap(); - assert!(r["plates"].as_array().unwrap().iter().all(|p| p["visible"] == false), "{r}"); + let plates = r["plates"].as_array().unwrap(); + assert_eq!(plates.len(), 4, "{r}"); + assert!(plates.iter().all(|p| p["visible"] == false), "{r}"); } /// Each plate's visibility in a `view.separationsPreview` or `color.plates` reply, in plate order. diff --git a/crates/engine/src/tests/constrain_new.rs b/crates/engine/src/tests/constrain_new.rs index 9a26e45867..24b5a063d6 100644 --- a/crates/engine/src/tests/constrain_new.rs +++ b/crates/engine/src/tests/constrain_new.rs @@ -345,7 +345,9 @@ fn constrain_angle_turns_the_new_objects_bounding_box() { let id = NodeId(s.execute("shape.polarGrid", &json!({"x": 0, "y": 0, "width": 40, "height": 20, "rotation": -30})).unwrap()["id"].as_u64().unwrap()); let n = s.doc().unwrap().doc.node(id).unwrap().clone(); - assert!(n.children().unwrap().iter().all(|c| close(c.bbox_angle, 30.0))); + let lines = n.children().unwrap(); + assert!(lines.len() > 1, "{}", lines.len()); + assert!(lines.iter().all(|c| close(c.bbox_angle, 30.0))); s.execute("text.create", &json!({"x": 10, "y": 20, "text": "Hi", "rotation": -30})).unwrap(); assert!(close(selection_rotation(&s), 30.0)); s.execute("text.create", &json!({"x": 10, "y": 20, "text": "Hi"})).unwrap(); diff --git a/crates/engine/src/tests/dynamic_symbols.rs b/crates/engine/src/tests/dynamic_symbols.rs index e406c1b4f2..b8c6f782f1 100644 --- a/crates/engine/src/tests/dynamic_symbols.rs +++ b/crates/engine/src/tests/dynamic_symbols.rs @@ -1350,7 +1350,9 @@ fn a_stroke_on_a_picked_type_object_without_a_weight_draws() { s.execute("paint.setStroke", &json!({"color": "#ff0000"})).unwrap(); let part = s.doc().unwrap().selected_symbol_part().unwrap(); let NodeKind::Text(tx) = &part.kind else { panic!("type: {part:?}") }; - assert!(tx.runs.iter().all(|r| r.style.stroke_width == 1.0 && !r.style.stroke.is_none()), "{:?}", tx.runs); + assert_eq!(tx.plain_text(), "Hi"); + let red = Paint::solid(vectorcraft_color::Color::from_hex("#ff0000").unwrap()); + assert!(!tx.runs.is_empty() && tx.runs.iter().all(|r| r.style.stroke_width == 1.0 && r.style.stroke == red), "{:?}", tx.runs); } /// The colors the Fill and Stroke proxies show, as `paint.proxies` replies them. diff --git a/crates/engine/src/tests/freeform.rs b/crates/engine/src/tests/freeform.rs index 99810296ef..dda0f04cc4 100644 --- a/crates/engine/src/tests/freeform.rs +++ b/crates/engine/src/tests/freeform.rs @@ -115,7 +115,9 @@ fn cmyk_stops_recolor_the_points_with_inks() { let id = shape(&mut s, "shape.rectangle", 100.0, 100.0, 100.0, 100.0); run(&mut s, "paint.setFill", json!({"gradient": {"kind": "linear", "stops": cyan_to_black}})); run(&mut s, "paint.editGradient", json!({"kind": "freeform"})); - assert!(points(&s, id).points.iter().all(|p| cyan_and_black(p.color)), "{:?}", points(&s, id).points); + let placed = points(&s, id).points; + assert!(!placed.is_empty()); + assert!(placed.iter().all(|p| cyan_and_black(p.color)), "{placed:?}"); } #[test] @@ -181,6 +183,7 @@ fn reapplied_gradients_place_their_points_afresh() { let other = shape(&mut s, "shape.rectangle", 400.0, 300.0, 100.0, 100.0); run(&mut s, "paint.lastGradient", json!({})); let (a, (b, _)) = (points(&s, id), node(&s, other).proxy_freeform(false, None).unwrap()); + assert!(!a.points.is_empty() && b.points.len() == a.points.len(), "{:?}", b.points); assert!(b.points.iter().all(|p| p.at.x >= 400.0 && p.at.y >= 300.0), "{:?}", b.points); assert_eq!(a.points.iter().map(|p| p.color.to_hex()).collect::<Vec<_>>(), b.points.iter().map(|p| p.color.to_hex()).collect::<Vec<_>>()); } diff --git a/crates/engine/src/tests/gradient.rs b/crates/engine/src/tests/gradient.rs index 14cdb653b5..0c4bc3d0d3 100644 --- a/crates/engine/src/tests/gradient.rs +++ b/crates/engine/src/tests/gradient.rs @@ -38,8 +38,11 @@ fn new_gradient_defaults_follow_the_cmyk_document_mode() { let id = rect(&mut s, 10.0, 10.0, 100.0, 100.0); s.execute("paint.editGradient", &json!({"kind":kind})).unwrap(); let g = fill_gradient(&s, id); + assert!(g.gradient.stops.len() >= 2, "{kind}: {:?}", g.gradient.stops); assert!(g.gradient.stops.iter().all(|stop| matches!(stop.color, Color::Cmyk { .. })), "{kind}: {:?}", g.gradient.stops); + assert_eq!(g.freeform.is_some(), kind == "freeform", "{kind}"); if let Some(freeform) = g.freeform { + assert!(!freeform.points.is_empty()); assert!(freeform.points.iter().all(|point| matches!(point.color, Color::Cmyk { .. })), "freeform points must use the same color model"); } } @@ -52,6 +55,7 @@ fn editing_an_explicit_rgb_gradient_in_cmyk_keeps_its_color_model() { let id = rect(&mut s, 10.0, 10.0, 100.0, 100.0); s.execute("paint.editGradient", &json!({"kind":"linear","keepModel":true})).unwrap(); let before = fill_gradient(&s, id).gradient.stops; + assert_eq!(before.len(), 2, "{before:?}"); assert!(before.iter().all(|stop| matches!(stop.color, Color::Rgb { .. }))); s.execute("paint.editGradient", &json!({"angle":45})).unwrap(); assert_eq!(fill_gradient(&s, id).gradient.stops, before); @@ -67,6 +71,7 @@ fn drawing_a_new_gradient_vector_uses_cmyk_default_stops() { let appearance = &node(&s, id).appearance; let paint = if stroke { appearance.stroke_paint() } else { appearance.fill_paint() }; let Paint::Gradient(g) = paint else { panic!("not a gradient") }; + assert_eq!(g.gradient.stops.len(), 2, "stroke={stroke}: {:?}", g.gradient.stops); assert!(g.gradient.stops.iter().all(|stop| matches!(stop.color, Color::Cmyk { .. })), "stroke={stroke}: {:?}", g.gradient.stops); } } diff --git a/crates/engine/src/tests/ids_without_selection.rs b/crates/engine/src/tests/ids_without_selection.rs index cc7e03114f..a5ec82dd28 100644 --- a/crates/engine/src/tests/ids_without_selection.rs +++ b/crates/engine/src/tests/ids_without_selection.rs @@ -25,10 +25,15 @@ fn ids_stand_in_for_the_selection() { ("object.makePixelPerfect", json!({})), ] { let (mut s, id) = doc_with_rect(); + assert!(s.execute(cmd, ¶ms).is_err(), "{cmd}: nothing selected and no ids"); + let (before, undo) = (s.doc().unwrap().doc.clone(), s.doc().unwrap().history.undo.len()); let mut p = params; p["ids"] = json!([id]); let r = s.execute(cmd, &p); assert!(r.is_ok(), "{cmd}: {r:?}"); + let st = s.doc().unwrap(); + assert_ne!(st.doc, before, "{cmd}: the object given is changed"); + assert_eq!(st.history.undo.len(), undo + 1, "{cmd}: one undo step"); } } diff --git a/crates/engine/src/tests/pathops.rs b/crates/engine/src/tests/pathops.rs index f4e251638f..802748e407 100644 --- a/crates/engine/src/tests/pathops.rs +++ b/crates/engine/src/tests/pathops.rs @@ -1794,12 +1794,16 @@ fn commands_reject_bad_input() { ("object.path.offsetPath", json!({"offset": "abc"})), ("object.path.offsetPath", json!({"offset": 1e300})), ("object.path.simplify", json!({"tolerance": -5})), + ("object.path.simplify", json!({"level": 101})), ("object.path.splitIntoGrid", json!({"rows": 1e9, "columns": -1})), ("text.setStyle", json!({"size": -3})), ("type.createOutlines", json!({})), ("object.pathfinder.divide", json!({"junk": [1, 2]})), ] { - let _ = s.execute(c, &p); + let (before, undo) = (s.doc().unwrap().doc.clone(), s.doc().unwrap().history.undo.len()); + let r = s.execute(c, &p); + assert!(r.is_err(), "{c} {p}: {r:?}"); + assert_eq!((&s.doc().unwrap().doc, s.doc().unwrap().history.undo.len()), (&before, undo), "{c} {p}: nothing changes"); } } diff --git a/crates/engine/src/tests/plugins.rs b/crates/engine/src/tests/plugins.rs index 5fe28b4639..2ff8994879 100644 --- a/crates/engine/src/tests/plugins.rs +++ b/crates/engine/src/tests/plugins.rs @@ -1916,19 +1916,6 @@ fn refresh_takes_objects_in_definition_art() { assert_eq!(listed(&mut s), [kept.0]); } -/// `CRAFT_PLUGIN_PAINTS_WASM=<folder>` saves a test live effect to try in the app -/// (`stroke-width-test-effect.wasm`): it draws a triangle over the area 100,80–300,230 while its -/// object's stroke is 5 pt wide, and hands the geometry back otherwise. -#[test] -fn stroke_width_test_effect() { - let Some(dir) = std::env::var_os("CRAFT_PLUGIN_PAINTS_WASM") else { return }; - let triangle = PathData::single(SubPath::polyline(&[Point::new(100.0, 230.0), Point::new(300.0, 230.0), Point::new(200.0, 80.0)], true)); - let manifest = r#"{"id":"org.example.strokewidth","name":"Stroke Width (test plug-in)","version":"1","kind":"effect", - "description":"Draws a triangle while the object's stroke is 5 pt wide.","params":{}}"#; - let src = tpl::when_given(manifest, tpl::Given::Input, r#""width":5.0"#, &json!({"objects": [{"path": triangle}]}).to_string()); - std::fs::write(std::path::Path::new(&dir).join("stroke-width-test-effect.wasm"), wat::parse_str(src).unwrap()).unwrap(); -} - /// A filter is given its objects' effect records and their strokes' join, cap and miter limit, and /// may return them. The records are admitted as effect.apply would admit them; one that isn't /// refuses the whole output, and nothing changes. @@ -1978,26 +1965,6 @@ fn filters_set_effects_and_stroke_styles() { } } -/// `CRAFT_PLUGIN_FRAME_WASM=<folder>` saves a test filter to try in the app -/// (`rough-frame-test-filter.wasm`): it adds a frame around 60,40–340,260 with a 6 pt stroke with -/// round joins and caps, roughened by the Roughen effect. -#[test] -fn rough_frame_test_filter() { - let Some(dir) = std::env::var_os("CRAFT_PLUGIN_FRAME_WASM") else { return }; - let frame = PathData::single(SubPath::polyline( - &[Point::new(60.0, 40.0), Point::new(340.0, 40.0), Point::new(340.0, 260.0), Point::new(60.0, 260.0)], - true, - )); - let ink = json!({"type": "solid", "color": {"model": "rgb", "r": 0.15, "g": 0.2, "b": 0.45}}); - let out = json!({"objects": [{"name": "Frame", "path": frame, "fills": [], - "strokes": [{"paint": ink, "width": 6, "join": "round", "cap": "round"}], - "effects": [{"id": "distort.roughen", "params": {"size": 2, "detail": 8, "points": "smooth"}}]}]}); - let manifest = r#"{"id":"org.example.frame","name":"Rough Frame (test plug-in)","version":"1","kind":"filter", - "description":"Adds a frame whose stroke is roughened by the Roughen effect.","params":{}}"#; - let src = tpl::returning(manifest, &out.to_string()); - std::fs::write(std::path::Path::new(&dir).join("rough-frame-test-filter.wasm"), wat::parse_str(src).unwrap()).unwrap(); -} - /// A filter keeps data with the document: it writes it with `documentData` in the same undo step as /// its objects (`null` removes it) and reads what it last wrote in `_context.documentData`, which /// no other filter is given. It is the document's foreign data, so the native file keeps it with @@ -2177,11 +2144,13 @@ fn plugins_folder_set_again_after_clearing_installs_its_plugins() { let mut s = session(); let folder = json!({"key": "pluginsFolder", "value": dir.0.display().to_string()}); run(&mut s, "prefs.set", folder.clone()); - assert!(vectorcraft_plugins::registry::get(id).is_some(), "installed from the folder"); + assert_eq!(run(&mut s, "plugin.list", json!({}))["folder"]["loaded"], json!([id]), "installed from the folder"); run(&mut s, "plugin.remove", json!({"id": id})); + assert!(vectorcraft_plugins::registry::get(id).is_none()); run(&mut s, "prefs.set", json!({"key": "pluginsFolder", "value": ""})); + assert_eq!(run(&mut s, "plugin.list", json!({}))["folder"]["loaded"], json!(null), "a cleared folder loads nothing"); run(&mut s, "prefs.set", folder); - assert!(vectorcraft_plugins::registry::get(id).is_some(), "installed again when the folder is set again"); + assert_eq!(run(&mut s, "plugin.list", json!({}))["folder"]["loaded"], json!([id]), "installed again when the folder is set again"); run(&mut s, "plugin.remove", json!({"id": id})); } diff --git a/crates/engine/src/tests/script_xmp.rs b/crates/engine/src/tests/script_xmp.rs index 4fbbc1741d..687df5cd0e 100644 --- a/crates/engine/src/tests/script_xmp.rs +++ b/crates/engine/src/tests/script_xmp.rs @@ -730,8 +730,7 @@ fn a_temporary_file_starts_private() { /// A replaced sidecar that had no access ACL takes none from its folder's default ACL, whose named /// users the sidecar's group bits would let in. The default ACL is set through its extended -/// attribute, so the test runs where the `acl` tools are not installed. (Skipped on a file system -/// without ACLs.) +/// attribute, so the test runs where the `acl` tools are not installed. #[cfg(target_os = "linux")] #[test] fn a_replaced_sidecar_takes_no_inherited_acl() { @@ -752,14 +751,8 @@ fn a_replaced_sidecar_takes_no_inherited_acl() { acl.extend(perm.to_le_bytes()); acl.extend(id.to_le_bytes()); } - match rustix::fs::setxattr(parent, "system.posix_acl_default", &acl, rustix::fs::XattrFlags::empty()) { - Ok(()) => {} - Err(e) if e == rustix::io::Errno::NOTSUP => { - let _ = std::fs::remove_dir_all(base); - return; - } - Err(e) => panic!("setting the default ACL: {e}"), - } + rustix::fs::setxattr(parent, "system.posix_acl_default", &acl, rustix::fs::XattrFlags::empty()) + .unwrap_or_else(|e| panic!("setting the default ACL (the temporary folder's file system needs ACLs): {e}")); let mut buf = vec![0u8; 4096]; let probe = parent.join("probe"); std::fs::write(&probe, b"").unwrap(); diff --git a/crates/engine/src/tests/strokegeom.rs b/crates/engine/src/tests/strokegeom.rs index af3eb52936..b9bd87c492 100644 --- a/crates/engine/src/tests/strokegeom.rs +++ b/crates/engine/src/tests/strokegeom.rs @@ -34,12 +34,10 @@ fn arrow_align_is_set_per_stroke_and_validated() { #[test] fn profiles_come_from_the_preset_catalogue() { let (mut s, id) = session_with_line(); - for p in WidthProfile::PRESETS { - s.execute("stroke.set", &json!({"profile": p.id})).unwrap(); - let st = stroke(&s, id); - assert_eq!(WidthProfile::id_of(st.profile.as_ref()), p.id); - } - assert!(stroke(&s, id).profile.is_some()); + s.execute("stroke.set", &json!({"profile": "lens"})).unwrap(); + assert_eq!(stroke(&s, id).profile.map(|p| p.points), Some(vec![(0.0, 0.0, 0.0), (0.5, 1.0, 1.0), (1.0, 0.0, 0.0)])); + s.execute("stroke.set", &json!({"profile": "pinch"})).unwrap(); + assert_eq!(stroke(&s, id).profile.map(|p| p.points), Some(vec![(0.0, 1.0, 1.0), (0.5, 0.25, 0.25), (1.0, 1.0, 1.0)])); s.execute("stroke.set", &json!({"profile": "uniform"})).unwrap(); assert!(stroke(&s, id).profile.is_none(), "uniform is the plain stroke"); assert!(s.execute("stroke.set", &json!({"profile": "zigzag"})).is_err()); @@ -53,9 +51,12 @@ fn profiles_come_from_the_preset_catalogue() { for a in vectorcraft_doc::Arrowhead::ALL { let name = serde_json::to_value(&a).unwrap(); assert!(spec.params.contains(name.as_str().unwrap()), "{name}"); - s.execute("stroke.set", &json!({"endArrow": name})).unwrap(); - assert_eq!(stroke(&s, id).end_arrow, Some(a)); } + s.execute("stroke.set", &json!({"endArrow": "TriangleOpen", "startArrow": "Diamond"})).unwrap(); + let st = stroke(&s, id); + assert_eq!((st.start_arrow, st.end_arrow), (Some(Arrowhead::Diamond), Some(Arrowhead::TriangleOpen))); + assert!(s.execute("stroke.set", &json!({"endArrow": "Arrow999"})).is_err()); + assert_eq!(stroke(&s, id).end_arrow, Some(Arrowhead::TriangleOpen), "a refused name changes nothing"); } #[test] From dd059ff67d124e2769c268437bb864bfaa6497ae Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 19:13:31 -0800 Subject: [PATCH 092/112] Dependencies: pin craft-libs at 77ade517 craft-libs main moved after the merge of main. The pin moves to `77ade517`, which adds craft-libs #4644, #4053, #4723, #3662 and #4635. The egui and winit revisions are unchanged. --- Cargo.lock | 172 ++++++++++++++++---------------- Cargo.toml | 76 +++++++------- apps/vectorcraft-web/Cargo.toml | 2 +- xtask/src/pdf_deps.rs | 2 +- 4 files changed, 126 insertions(+), 126 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cdec652277..d0216e2962 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1231,7 +1231,7 @@ dependencies = [ [[package]] name = "craft" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-automation", "craft-behavior", @@ -1272,7 +1272,7 @@ dependencies = [ [[package]] name = "craft-affinity" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "crc32fast", "flate2", @@ -1283,7 +1283,7 @@ dependencies = [ [[package]] name = "craft-appkit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "block2 0.6.2", "objc2 0.6.5", @@ -1295,7 +1295,7 @@ dependencies = [ [[package]] name = "craft-atomic" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "rustix 1.1.6", ] @@ -1303,7 +1303,7 @@ dependencies = [ [[package]] name = "craft-automation" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -1328,7 +1328,7 @@ dependencies = [ [[package]] name = "craft-behavior" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "accesskit", "bitflags 2.13.2", @@ -1346,7 +1346,7 @@ dependencies = [ [[package]] name = "craft-browse" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-docpath", @@ -1364,7 +1364,7 @@ dependencies = [ [[package]] name = "craft-cdr" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "crc32fast", "flate2", @@ -1373,7 +1373,7 @@ dependencies = [ [[package]] name = "craft-cloud-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "egui", ] @@ -1381,7 +1381,7 @@ dependencies = [ [[package]] name = "craft-cms" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "md-5", "rayon", @@ -1390,12 +1390,12 @@ dependencies = [ [[package]] name = "craft-codepage" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" [[package]] name = "craft-color-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-cms", @@ -1415,7 +1415,7 @@ dependencies = [ [[package]] name = "craft-control" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-control-protocol", "craft-platform", @@ -1426,7 +1426,7 @@ dependencies = [ [[package]] name = "craft-control-protocol" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "getrandom 0.3.4", "serde_json", @@ -1436,7 +1436,7 @@ dependencies = [ [[package]] name = "craft-dds" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "rayon", ] @@ -1444,7 +1444,7 @@ dependencies = [ [[package]] name = "craft-dialogs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "block2 0.6.2", "craft-appkit", @@ -1470,7 +1470,7 @@ dependencies = [ [[package]] name = "craft-doc" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "blake3", "craft-ecproj-format", @@ -1486,7 +1486,7 @@ dependencies = [ [[package]] name = "craft-docpath" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "serde", ] @@ -1494,7 +1494,7 @@ dependencies = [ [[package]] name = "craft-draw" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1513,7 +1513,7 @@ dependencies = [ [[package]] name = "craft-dxf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-codepage", "encoding_rs", @@ -1525,7 +1525,7 @@ dependencies = [ [[package]] name = "craft-ecproj-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "serde", "serde_json", @@ -1535,12 +1535,12 @@ dependencies = [ [[package]] name = "craft-eps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "fontique", "harfrust 0.13.3", @@ -1555,7 +1555,7 @@ dependencies = [ [[package]] name = "craft-font-manager" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -1574,7 +1574,7 @@ dependencies = [ [[package]] name = "craft-font-os-windows" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "windows-registry", "windows-sys 0.61.2", @@ -1583,7 +1583,7 @@ dependencies = [ [[package]] name = "craft-font-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "cap-primitives", "craft-atomic", @@ -1606,12 +1606,12 @@ dependencies = [ [[package]] name = "craft-fonts-build" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" [[package]] name = "craft-gif" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "gif", ] @@ -1619,7 +1619,7 @@ dependencies = [ [[package]] name = "craft-gzip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "flate2", ] @@ -1627,7 +1627,7 @@ dependencies = [ [[package]] name = "craft-host" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "bitflags 2.13.2", "craft-i18n", @@ -1640,7 +1640,7 @@ dependencies = [ [[package]] name = "craft-i18n" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "brotli 9.1.3", "brotli-decompressor 6.3.2", @@ -1670,7 +1670,7 @@ dependencies = [ [[package]] name = "craft-image-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-dds", "craft-jpeg", @@ -1697,7 +1697,7 @@ dependencies = [ [[package]] name = "craft-imaging" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1715,7 +1715,7 @@ dependencies = [ [[package]] name = "craft-jpeg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "thiserror 2.0.21", ] @@ -1723,7 +1723,7 @@ dependencies = [ [[package]] name = "craft-jxl" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "brotli-decompressor 5.0.3", "jixel", @@ -1734,7 +1734,7 @@ dependencies = [ [[package]] name = "craft-keymap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-host", "craft-i18n", @@ -1749,7 +1749,7 @@ dependencies = [ [[package]] name = "craft-layers" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-i18n", @@ -1763,7 +1763,7 @@ dependencies = [ [[package]] name = "craft-menu" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-host", @@ -1781,7 +1781,7 @@ dependencies = [ [[package]] name = "craft-metadata" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "brotli-decompressor 6.3.2", "chrono", @@ -1793,7 +1793,7 @@ dependencies = [ [[package]] name = "craft-metafile" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "encoding_rs", "image", @@ -1804,7 +1804,7 @@ dependencies = [ [[package]] name = "craft-mime" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "chrono", "craft-codepage", @@ -1814,7 +1814,7 @@ dependencies = [ [[package]] name = "craft-nightly" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "uds_windows", "winsafe", @@ -1823,7 +1823,7 @@ dependencies = [ [[package]] name = "craft-pages" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-keymap", @@ -1839,7 +1839,7 @@ dependencies = [ [[package]] name = "craft-pcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "flate2", "serde", @@ -1850,7 +1850,7 @@ dependencies = [ [[package]] name = "craft-pdf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "hayro-interpret", "hayro-syntax", @@ -1862,7 +1862,7 @@ dependencies = [ [[package]] name = "craft-platform" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "async-channel", "async-io", @@ -1895,7 +1895,7 @@ dependencies = [ [[package]] name = "craft-plotter" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "kurbo 0.13.1", "thiserror 2.0.21", @@ -1904,7 +1904,7 @@ dependencies = [ [[package]] name = "craft-print" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-host", @@ -1928,7 +1928,7 @@ dependencies = [ [[package]] name = "craft-proof" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "log", "miniz_oxide 0.9.1", @@ -1939,7 +1939,7 @@ dependencies = [ [[package]] name = "craft-ps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-eps", "flate2", @@ -1953,7 +1953,7 @@ dependencies = [ [[package]] name = "craft-psd" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "encoding_rs", "flate2", @@ -1964,7 +1964,7 @@ dependencies = [ [[package]] name = "craft-quit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "dispatch2", "egui", @@ -1977,7 +1977,7 @@ dependencies = [ [[package]] name = "craft-review" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -1996,7 +1996,7 @@ dependencies = [ [[package]] name = "craft-settings" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-atomic", "craft-host", @@ -2013,7 +2013,7 @@ dependencies = [ [[package]] name = "craft-stream-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "fax", "hayro-ccitt", @@ -2024,7 +2024,7 @@ dependencies = [ [[package]] name = "craft-svg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-image-codecs", "craft-xml", @@ -2045,7 +2045,7 @@ dependencies = [ [[package]] name = "craft-table" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-keymap", @@ -2057,7 +2057,7 @@ dependencies = [ [[package]] name = "craft-text" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-font-manager", @@ -2082,7 +2082,7 @@ dependencies = [ [[package]] name = "craft-theme" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "bitflags 2.13.2", "craft-tracked", @@ -2097,7 +2097,7 @@ dependencies = [ [[package]] name = "craft-theme-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-atomic", "craft-behavior", @@ -2112,7 +2112,7 @@ dependencies = [ [[package]] name = "craft-tiff" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "serde", "thiserror 2.0.21", @@ -2122,7 +2122,7 @@ dependencies = [ [[package]] name = "craft-time" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "serde", "thiserror 2.0.21", @@ -2131,7 +2131,7 @@ dependencies = [ [[package]] name = "craft-timeline" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-keymap", @@ -2146,12 +2146,12 @@ dependencies = [ [[package]] name = "craft-tracked" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" [[package]] name = "craft-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-cloud-ui", "craft-ui-canvas", @@ -2165,7 +2165,7 @@ dependencies = [ [[package]] name = "craft-ui-canvas" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -2182,7 +2182,7 @@ dependencies = [ [[package]] name = "craft-ui-contract" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "accesskit", "craft-behavior", @@ -2220,7 +2220,7 @@ dependencies = [ [[package]] name = "craft-ui-macros" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2231,7 +2231,7 @@ dependencies = [ [[package]] name = "craft-ui-panels" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-host", @@ -2249,7 +2249,7 @@ dependencies = [ [[package]] name = "craft-ui-patterns" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-host", @@ -2270,7 +2270,7 @@ dependencies = [ [[package]] name = "craft-ui-shell" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-host", @@ -2291,7 +2291,7 @@ dependencies = [ [[package]] name = "craft-ui-widgets" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-host", @@ -2310,7 +2310,7 @@ dependencies = [ [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "base64 0.22.1", "chrono", @@ -2342,7 +2342,7 @@ dependencies = [ [[package]] name = "craft-vectorcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "flate2", "serde", @@ -2353,7 +2353,7 @@ dependencies = [ [[package]] name = "craft-wayland" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "raw-window-handle", "wayland-backend", @@ -2363,7 +2363,7 @@ dependencies = [ [[package]] name = "craft-web-api" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "js-sys", "serde_json", @@ -2374,7 +2374,7 @@ dependencies = [ [[package]] name = "craft-win32" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "winsafe", ] @@ -2382,7 +2382,7 @@ dependencies = [ [[package]] name = "craft-window" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-appkit", "craft-atomic", @@ -2414,7 +2414,7 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "quick-xml 0.41.0", "serde", @@ -3773,7 +3773,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a" [[package]] name = "hayro-cmap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "brotli 8.0.4", "hayro-postscript", @@ -3782,7 +3782,7 @@ dependencies = [ [[package]] name = "hayro-interpret" version = "0.7.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "bitflags 2.13.2", "hayro-cmap", @@ -3800,7 +3800,7 @@ dependencies = [ [[package]] name = "hayro-jbig2" version = "0.3.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "fearless_simd", "hayro-ccitt", @@ -3818,12 +3818,12 @@ dependencies = [ [[package]] name = "hayro-postscript" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" [[package]] name = "hayro-syntax" version = "0.7.2" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "flate2", "hayro-ccitt", @@ -4806,7 +4806,7 @@ dependencies = [ [[package]] name = "krilla" version = "0.8.2" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "base64 0.22.1", "bumpalo", @@ -4963,7 +4963,7 @@ checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" [[package]] name = "linesweeper" version = "0.5.0" -source = "git+https://github.com/storytold/craft-libs?rev=858bea9d966874f00a3685f76dd6d2b074f7cb6e#858bea9d966874f00a3685f76dd6d2b074f7cb6e" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "arrayvec", "kurbo 0.13.1", diff --git a/Cargo.toml b/Cargo.toml index 76fc6cb0e1..843f9cbb53 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,51 +10,51 @@ license = "MIT OR Apache-2.0" rust-version = "1.95" [workspace.dependencies] -craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } -craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e", default-features = false, features = ["interpret", "write"] } -craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } -craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } +craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6", default-features = false, features = ["interpret", "write"] } +craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # Language packs: the Craft apps' shared font store installs them (#4936). -craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } -craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } +craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # The `.vectorcraft` envelope: its members, version, embedded images and the data after the JSON. -craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } -craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } +craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # `.pcraft` documents: their manifest, full-size composite, preview, layer pixels and ICC profile. -craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e", features = ["pcraft-pixels"] } +craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6", features = ["pcraft-pixels"] } # Native Affinity documents (craft-libs#914). -craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } +craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # Bounded CDR (v1-v27) and CMX (32-bit) reader (craft-libs#778). -craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } +craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # SVG parsing, limits, SVGZ and writer (craft-libs#778). -craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e", features = ["tree"] } -craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } +craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6", features = ["tree"] } +craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # EPS container, previews, ASCII85 and DSC comments (craft-libs#778). -craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } +craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # DXF tags, reader and writer (craft-libs#778, #926, #927). -craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } -craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } +craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # WMF, EMF and EMF+ reader (craft-libs#778). -craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } -craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } -craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } -craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } -craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } -craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e", default-features = false, features = ["read", "write"] } -craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } -craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } -craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } -craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } +craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6", default-features = false, features = ["read", "write"] } +craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # The framework facade (`craft::ui`, `craft::settings`, `craft::platform`, ...). No default features: each crate names # the members it imports. -craft = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } +craft = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # Below the egui layer, so not through the facade: the colour harmony rules and their settings (craft-color-ui # without its `ui` feature), the colour type they work in, and the craft-fonts tables the text crate's build writes. -craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } -craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } -craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } +craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # Nightly profile isolation, launch protocol, and security fence. -craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } +craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # internal vectorcraft-geom = { path = "crates/geom" } vectorcraft-color = { path = "crates/color" } @@ -194,13 +194,13 @@ lto = "thin" codegen-units = 1 [patch.crates-io] -hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } -hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } -hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } -hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } -hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } -krilla = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } -linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e" } +hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +krilla = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } ecolor = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } emath = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } epaint = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } diff --git a/apps/vectorcraft-web/Cargo.toml b/apps/vectorcraft-web/Cargo.toml index e98c904597..70aae32f73 100644 --- a/apps/vectorcraft-web/Cargo.toml +++ b/apps/vectorcraft-web/Cargo.toml @@ -28,7 +28,7 @@ egui_extras = { workspace = true } # `wgpu` pulls egui-wgpu's defaults: WebGPU plus the WebGL2 fallback. eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit"] } # The page command API (storytold/craft-libs#413): the request plumbing behind window.vectorcraft. -craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "858bea9d966874f00a3685f76dd6d2b074f7cb6e", version = "0.1.0" } +craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6", version = "0.1.0" } wasm-bindgen = "0.2" serde_json = { workspace = true } diff --git a/xtask/src/pdf_deps.rs b/xtask/src/pdf_deps.rs index f3b028767f..542a3e8c41 100644 --- a/xtask/src/pdf_deps.rs +++ b/xtask/src/pdf_deps.rs @@ -5,7 +5,7 @@ use std::process::Command; use serde_json::Value; -const REV: &str = "858bea9d966874f00a3685f76dd6d2b074f7cb6e"; +const REV: &str = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6"; const PACKAGES: &[(&str, &str, &str)] = &[ ("craft-pdf", "0.1.0", REV), ("krilla", "0.8.2", REV), From 7b692b99c12b983a536542ed1be7d9688f939887 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 19:31:18 -0800 Subject: [PATCH 093/112] Tests: SCHEMA_PHRASES checked against the parameter schema's errors SCHEMA_PHRASES in the i18n tests lists the phrases the parameter schema's wrong-type error uses for what a value must be, and untranslated_report reports them as messages to translate. The list was a hand copy of apischema's expected() and range_text(), and no test compared the two, so a changed phrase there would leave the catalogs translating a phrase the app no longer shows. schema_phrases_hold_what_the_schema_error_says builds a wrong-type error through ParamSchema::validate for a plain number, numbers with inclusive and exclusive bounds with and without a unit, an integer with a minimum, an enum and a list, puts the schema's own values back as placeholders, and checks that each resulting phrase is in SCHEMA_PHRASES. --- crates/ui-egui/src/i18n/tests.rs | 48 ++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/crates/ui-egui/src/i18n/tests.rs b/crates/ui-egui/src/i18n/tests.rs index 5d61df7f89..0cd3e75886 100644 --- a/crates/ui-egui/src/i18n/tests.rs +++ b/crates/ui-egui/src/i18n/tests.rs @@ -1936,6 +1936,54 @@ fn f(p: &Value) -> Result<()> { assert_eq!(source_messages(code, &engine, &consts), ["the name is too long", "`path` is empty"]); } +/// What the parameter schema's error says a value of `ty` must be, for `bad`, a value of another +/// type. +fn schema_expected(ty: vectorcraft_apischema::Type, bad: serde_json::Value) -> String { + use vectorcraft_apischema::{Param, ParamSchema, Problem}; + let params: &'static [Param] = Box::leak(Box::new([Param::new("v", ty)])); + let refused = ParamSchema::new(params, "").validate(&serde_json::json!({ "v": bad })); + match refused { + Err(e) => match e.problem { + Problem::WrongType { expected, .. } => expected, + other => panic!("{ty:?} refused {other:?}, not a value of the wrong type"), + }, + Ok(_) => panic!("{ty:?} took a value of another type"), + } +} + +/// `text` with each of `values`, found in order, written as the next unnamed placeholder. +fn with_placeholders(text: &str, values: &[&str]) -> String { + let (mut out, mut rest) = (String::new(), text); + for (n, value) in values.iter().enumerate() { + let at = rest.find(value).unwrap_or_else(|| panic!("{text:?} does not hold {value:?}")); + out.push_str(&rest[..at]); + out.push_str(&format!("{{_{}}}", n + 1)); + rest = &rest[at + value.len()..]; + } + out + rest +} + +/// The phrase the parameter schema's error builds for a number's range and unit, an integer's +/// range, a choice of names and a value with no range is one [`SCHEMA_PHRASES`] lists, with the +/// schema's own values as placeholders. +#[test] +fn schema_phrases_hold_what_the_schema_error_says() { + use vectorcraft_apischema::{Bound, Type}; + let cases: [(Type, serde_json::Value, &[&str]); 7] = [ + (Type::NUMBER, "x".into(), &[]), + (Type::Number { min: Some(Bound::Inclusive(1.5)), max: Some(Bound::Inclusive(2.5)), unit: None }, "x".into(), &["1.5", "2.5"]), + (Type::Number { min: Some(Bound::Exclusive(1.5)), max: Some(Bound::Inclusive(2.5)), unit: Some("pt") }, "x".into(), &["1.5", "2.5", "pt"]), + (Type::Number { min: None, max: Some(Bound::Exclusive(2.5)), unit: Some("deg") }, "x".into(), &["2.5", "deg"]), + (Type::Integer { min: Some(3), max: None }, "x".into(), &["3"]), + (Type::Enum(&["left", "right"]), true.into(), &["\"left\", \"right\""]), + (Type::Array(&Type::String), "x".into(), &[]), + ]; + for (ty, bad, values) in cases { + let phrase = with_placeholders(&schema_expected(ty, bad), values); + assert!(SCHEMA_PHRASES.contains(&phrase.as_str()), "{ty:?}: SCHEMA_PHRASES lacks {phrase:?}"); + } +} + /// The phrases a parameter schema's error uses for what a value must be, as `@msg` sources: one /// for each type, and for a number each range and unit form. const SCHEMA_PHRASES: &[&str] = &[ From 7c4edc2219735df237d80864f050f590ce3793f0 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 19:34:12 -0800 Subject: [PATCH 094/112] Tests: graph marker tests count the markers, not the series' children Three graph tests checked only that a series group has children. A line series also holds its line, and a column series holds its column, so the check passed with no markers drawn. The tests now count the 5-point squares at the data points, check the line and the column on their own, and count the legend swatch only where the graph draws a legend. --- crates/engine/src/cmd/graph/tests.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/cmd/graph/tests.rs b/crates/engine/src/cmd/graph/tests.rs index 46585a522a..dad642b1d6 100644 --- a/crates/engine/src/cmd/graph/tests.rs +++ b/crates/engine/src/cmd/graph/tests.rs @@ -6722,8 +6722,13 @@ fn designs_and_markers_survive_save_and_open() { let art = super::generate(&mut d, &g); let s0 = art.iter().find(|n| n.extras().series_index == Some(0)).unwrap(); let marks = s0.children().unwrap(); - assert!(!marks.is_empty(), "the series still has its markers"); assert!(marks.iter().all(|n| matches!(n.kind, NodeKind::Path { .. }))); + assert_eq!(marks.iter().filter(|n| sized(n, 5.0)).count(), 1, "a default square at the one data point"); +} + +/// Whether `n` is a square `side` points across (a default point marker is 5, a default legend swatch 8). +fn sized(n: &vectorcraft_doc::Node, side: f64) -> bool { + n.geometric_bounds().is_some_and(|b| (b.width() - side).abs() < 1e-6 && (b.height() - side).abs() < 1e-6) } #[test] @@ -6777,8 +6782,10 @@ fn designs_too_big_for_a_graph_are_refused_and_drawn_as_squares() { let art = super::generate(&mut d, &g); let s0 = art.iter().find(|n| n.extras().series_index == Some(0)).unwrap(); let marks = s0.children().unwrap(); - assert!(!marks.is_empty(), "the series still has its markers"); assert!(marks.iter().all(|n| matches!(n.kind, NodeKind::Path { .. }))); + assert_eq!(marks.iter().filter(|n| sized(n, 5.0)).count(), 200, "a default square at each of the 200 points"); + let line = marks.iter().filter(|n| n.geometric_bounds().is_some_and(|b| b.width() > 100.0)).count(); + assert_eq!(line, 1, "the series line is drawn as well"); // Too many objects for one design. let ids: Vec<u64> = (0..2001) .map(|i| s.execute("shape.rectangle", &json!({"x": i % 40, "y": i / 40, "width": 1, "height": 1})).unwrap()["id"].as_u64().unwrap()) @@ -7163,8 +7170,11 @@ fn graph_column_params_are_checked_and_designs_too_big_are_drawn_plain() { let art = super::generate(&mut d, &g); let s0 = art.iter().find(|n| n.extras().series_index == Some(0)).unwrap(); let marks = s0.children().unwrap(); - assert!(!marks.is_empty(), "the series still has its markers"); assert!(marks.iter().all(|n| matches!(n.kind, NodeKind::Path { .. }))); + assert_eq!(marks.iter().filter(|n| sized(n, 8.0)).count(), 1, "a default square as the legend swatch"); + let columns: Vec<_> = marks.iter().filter(|n| !sized(n, 8.0)).collect(); + assert_eq!(columns.len(), 1, "one plain column for the one value"); + assert!(columns[0].geometric_bounds().is_some_and(|b| b.height() > 8.0), "the column has the value's height"); // Columns of 0 on a value axis from 10,000 to 10,001 run 2,000,000 points from the clamped zero line: a copy each // 0.1 is past the budget too. let far = one_series(&mut s, "column", &[0.0, 0.0]); From 36161768e51233e0c99fe36d4e805d0b112b41b5 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 19:45:47 -0800 Subject: [PATCH 095/112] Tests: check both axes of the move in the Window-panel test The moved-art assertion accepted a horizontal move as short as half the release distance and never read the vertical position. The test now turns snapping and Smart Guides off before the drag and checks that the rectangle's corner moves by the document displacement between press and release on both axes. --- .../ui-egui/src/panel_docking/native_tests.rs | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/crates/ui-egui/src/panel_docking/native_tests.rs b/crates/ui-egui/src/panel_docking/native_tests.rs index ca5d09c205..63d22da892 100644 --- a/crates/ui-egui/src/panel_docking/native_tests.rs +++ b/crates/ui-egui/src/panel_docking/native_tests.rs @@ -587,6 +587,10 @@ fn a_window_menu_panel_stays_shown_while_art_is_selected_and_moved() { { let mut h = Harness::new(); h.app.select_tool("selection"); + h.app.ui.view.smart_guides = false; + h.app.ui.view.snap_to_point = false; + h.app.ui.view.snap_to_grid = false; + h.app.ui.view.snap_to_pixel = false; let id = h.app.run("shape.rectangle", json!({"x": 280, "y": 180, "width": 60, "height": 50})).unwrap()["id"].as_u64().unwrap(); let id = vectorcraft_doc::NodeId(id); h.app.run("select.none", json!({})).unwrap(); @@ -595,8 +599,11 @@ fn a_window_menu_panel_stays_shown_while_art_is_selected_and_moved() { let viewport = h.viewport(panel); let shown = |h: &Harness| h.host.borrow().windows.get(&viewport).is_some_and(|w| w.visible); assert!(shown(&h), "{panel}: the window shows"); - let left = |h: &Harness| h.app.session.active().unwrap().doc.node(id).and_then(|n| n.geometric_bounds()).map(|b| b.min_x()).unwrap(); - let before = left(&h); + let corner = |h: &Harness| { + let b = h.app.session.active().unwrap().doc.node(id).and_then(|n| n.geometric_bounds()).unwrap(); + (b.min_x(), b.min_y()) + }; + let before = corner(&h); let undo = h.app.session.active().unwrap().history.undo.len(); let view = h.app.canvas_view().expect("the canvas was drawn"); let from = view.to_screen(vectorcraft_geom::Point::new(310.0, 205.0)); @@ -616,7 +623,13 @@ fn a_window_menu_panel_stays_shown_while_art_is_selected_and_moved() { let st = h.app.session.active().unwrap(); assert!(st.interaction.is_none(), "{panel}: no move is left open"); assert_eq!(st.history.undo.len(), undo + 1, "{panel}: the move is one undo step"); - let moved = view.to_doc(to).x - view.to_doc(from).x; - assert!((left(&h) - before - moved).abs() < moved.abs() / 2.0, "{panel}: the art stays where it was released"); + let (dx, dy) = (view.to_doc(to).x - view.to_doc(from).x, view.to_doc(to).y - view.to_doc(from).y); + let after = corner(&h); + assert!( + (after.0 - before.0 - dx).abs() < 0.01 && (after.1 - before.1 - dy).abs() < 0.01, + "{panel}: the art stays where it was released: moved by ({}, {}), released at ({dx}, {dy})", + after.0 - before.0, + after.1 - before.1 + ); } } From d1c255fa648babe512b08fb606ab42d79acf9bcf Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 19:54:14 -0800 Subject: [PATCH 096/112] xtask: test-lint never-run lists tests that build on macOS or Windows without failing never-run failed the check on tests of macOS- or Windows-only code, such as the touchpad gesture tests in quickpenwheel.rs and the Windows performance counter tests in vectorcraft-cli's perf.rs. CI cannot build them on Linux, and they run locally on their platform. A never-run hit on a test that still builds on macOS (aarch64 or x86_64) or Windows (x86_64 or aarch64) is now listed with the report-only rules, and its note says which platform to run it on. A test that no desktop target builds, such as one gated on target_os = "ios" or all(windows, unix), still fails the check. --- docs/development.md | 2 +- xtask/src/test_lint.rs | 61 ++++++++++++++++++++++++++++++++++++------ 2 files changed, 54 insertions(+), 9 deletions(-) diff --git a/docs/development.md b/docs/development.md index 4244e28738..88b302f4fa 100644 --- a/docs/development.md +++ b/docs/development.md @@ -353,7 +353,7 @@ The app decides which cursors exist; whoever draws them works from the list. For ## Test lint -`cargo xtask test-lint` (part of `cargo xtask ci`) checks tests that a wrong result can pass, in the lines and tests changed since a base. It fails on an `assert_eq!` or `assert_ne!` of an expression with itself, such as `assert_eq!(x, x)` (`self-compare`), `#[ignore]` without a reason (`ignore-without-reason`), `thread::sleep` in test code (`sleep`), test code that reads Rust source outside the audits listed in `SOURCE_AUDITS` (`reads-source`), and a test that a `cfg` on it or on a `mod` above it excludes from every CI target that builds the crate (`never-run`). `never-run` reports a test only when it can evaluate the `cfg` on every such target; a predicate it does not evaluate, such as a `feature`, counts as unknown, so `#[cfg(all(feature = "gpu", not(feature = "gpu")))]` is not reported. It lists the hits of the other rules without failing: a test whose only checks are that a value exists or a collection is not empty (`is_ok`, `is_some`, `!is_empty`, `len() > 0`: `only-weak`), `assert!(….all(…))` on a collection the test does not show to be non-empty (`all-unguarded`), a process test that checks only the exit status, a test with no assertion and no asserting helper, a silent early `return` on a value from the code under test, an environment variable that no CI leg sets, and the hits of `census`, `mirror`, `constant-echo`, `fixture-only` and `exact-pixel`. The base is `--base <rev>` or `TEST_LINT_BASE`; in CI it is the first parent of the checked-out commit, and elsewhere the merge base with `upstream/main` or `origin/main`. Hits on unchanged lines are counted but do not fail it. A `// test-lint: allow <rule> <reason>` comment exempts its own line and the line below it; `xtask/src/test_lint.rs` lists the rules and their ids. `cargo xtask test-lint --all` lists every hit in the workspace by crate and rule, and does not fail. +`cargo xtask test-lint` (part of `cargo xtask ci`) checks tests that a wrong result can pass, in the lines and tests changed since a base. It fails on an `assert_eq!` or `assert_ne!` of an expression with itself, such as `assert_eq!(x, x)` (`self-compare`), `#[ignore]` without a reason (`ignore-without-reason`), `thread::sleep` in test code (`sleep`), test code that reads Rust source outside the audits listed in `SOURCE_AUDITS` (`reads-source`), and a test that a `cfg` on it or on a `mod` above it excludes from every CI target that builds the crate (`never-run`). `never-run` reports a test only when it can evaluate the `cfg` on every such target; a predicate it does not evaluate, such as a `feature`, counts as unknown, so `#[cfg(all(feature = "gpu", not(feature = "gpu")))]` is not reported. A `never-run` test that still builds on macOS or Windows, such as a test of a macOS-only module, is listed without failing; run it locally on that platform. It lists the hits of the other rules without failing: a test whose only checks are that a value exists or a collection is not empty (`is_ok`, `is_some`, `!is_empty`, `len() > 0`: `only-weak`), `assert!(….all(…))` on a collection the test does not show to be non-empty (`all-unguarded`), a process test that checks only the exit status, a test with no assertion and no asserting helper, a silent early `return` on a value from the code under test, an environment variable that no CI leg sets, and the hits of `census`, `mirror`, `constant-echo`, `fixture-only` and `exact-pixel`. The base is `--base <rev>` or `TEST_LINT_BASE`; in CI it is the first parent of the checked-out commit, and elsewhere the merge base with `upstream/main` or `origin/main`. Hits on unchanged lines are counted but do not fail it. A `// test-lint: allow <rule> <reason>` comment exempts its own line and the line below it; `xtask/src/test_lint.rs` lists the rules and their ids. `cargo xtask test-lint --all` lists every hit in the workspace by crate and rule, and does not fail. ## Tests diff --git a/xtask/src/test_lint.rs b/xtask/src/test_lint.rs index f1667d2cb0..9c05a8281e 100644 --- a/xtask/src/test_lint.rs +++ b/xtask/src/test_lint.rs @@ -55,7 +55,9 @@ //! test bound (in scope) to such values, so nothing the code under test returned is checked; //! * `never-run`: a test that the `cfg` attributes on it, on the items around it or on the `mod` //! declarations above its file leave out of every target CI runs tests on (Linux and FreeBSD on -//! x86_64, and Windows for the app and the UI crate's print tests); +//! x86_64, and Windows for the app and the UI crate's print tests). A test that still builds on +//! macOS or Windows is listed without failing the check: it tests code or behavior of that +//! platform and runs locally there; //! * `exact-pixel`: in a file that uses egui, an assertion that a screen rect (an identifier `rect`, //! `rect_…` or `…_rect`, whole or through a corner, edge or size) equals numbers written out. //! @@ -72,8 +74,8 @@ //! `fn` line. An allow without a reason exempts nothing. //! //! `cargo xtask test-lint` fails on hits of `self-compare`, `ignore-without-reason`, `sleep`, -//! `reads-source` and `never-run` in the lines and tests changed since a base, and lists the other -//! rules' hits there without failing. The base is `--base <rev>` or `TEST_LINT_BASE`; in GitHub Actions the first parent of `HEAD` (a pull request's +//! `reads-source` and `never-run` (except a test that builds on macOS or Windows) in the lines and +//! tests changed since a base, and lists the other rules' hits there without failing. The base is `--base <rev>` or `TEST_LINT_BASE`; in GitHub Actions the first parent of `HEAD` (a pull request's //! merge commit is checked out, and a shallow checkout fetches that parent); elsewhere the merge //! base of `HEAD` and `upstream/main` or `origin/main`. Uncommitted and untracked files count as //! changed. Hits on unchanged lines are counted but do not fail it. `--all` lists every hit in the @@ -243,9 +245,17 @@ pub struct Hit { /// Other lines whose change counts as a change to the hit, by file: the `cfg` attributes that /// turn a `never-run` test off, on its module or on a `mod` declaration in another file. pub also: Vec<(String, usize, usize)>, + /// A `never-run` hit on a test that builds on macOS or Windows, which CI does not test on: it is + /// listed with the report-only rules. + pub report_only: bool, } impl Hit { + /// Whether the hit fails the check when it is on a changed line. + fn fails(&self) -> bool { + self.rule.fails() && !self.report_only + } + fn show(&self) -> String { let test = if self.test.is_empty() { String::new() } else { format!(" `{}`", self.test) }; format!("{}:{}: [{}]{test}: {}", self.path, self.line, self.rule.id(), self.note) @@ -355,7 +365,7 @@ impl Options { fn finish(counted: &[Hit], older: usize, files: usize, base: &str) -> Result<(), String> { let older = if older == 0 { String::new() } else { format!("; {older} hit(s) on unchanged lines of those files are not counted") }; - let (failing, reported): (Vec<&Hit>, Vec<&Hit>) = counted.iter().partition(|h| h.rule.fails()); + let (failing, reported): (Vec<&Hit>, Vec<&Hit>) = counted.iter().partition(|h| h.fails()); if !reported.is_empty() { println!( "test-lint: {} hit(s) of report-only rules in the lines changed since {base} (they do not fail the check):\n {}", @@ -1214,7 +1224,7 @@ struct File<'a> { impl File<'_> { fn hit(&self, at: usize, rule: Rule, test: &str, note: String) -> Hit { let line = self.lines.of(at); - Hit { path: self.path.to_owned(), line, rule, test: test.to_owned(), note, first: line, last: line, also: vec![] } + Hit { path: self.path.to_owned(), line, rule, test: test.to_owned(), note, first: line, last: line, also: vec![], report_only: false } } fn test_at(&self, pos: usize) -> &str { @@ -3317,6 +3327,15 @@ const CI_TARGETS: &[Target] = &[Target { os: "linux", family: "unix", arch: "x86 /// The printing workflow also runs the app's tests and the UI crate's print tests on Windows. const WINDOWS_TARGET: Target = Target { os: "windows", family: "windows", arch: "x86_64" }; +/// Desktop targets that CI does not test on, by name. A test that builds on one of them tests code +/// or behavior of that platform. +const PLATFORM_TARGETS: &[(&str, Target)] = &[ + ("macOS", Target { os: "macos", family: "unix", arch: "aarch64" }), + ("macOS", Target { os: "macos", family: "unix", arch: "x86_64" }), + ("Windows", Target { os: "windows", family: "windows", arch: "x86_64" }), + ("Windows", Target { os: "windows", family: "windows", arch: "aarch64" }), +]; + fn windows_runs(path: &str) -> bool { path.starts_with("apps/vectorcraft/") || path == "crates/ui-egui/src/tests/printps.rs" } @@ -3592,7 +3611,14 @@ fn never_run(v: &View, ctx: &Ctx) -> Option<Hit> { let off = |t: &Target| preds.iter().any(|p| cfg_value(p, t) == Some(false)); if CI_TARGETS.iter().chain(windows).all(off) { let shown: Vec<String> = preds.iter().filter(|p| p.as_str() != "test").map(|p| format!("cfg({p})")).collect(); - let mut hit = v.whole(Rule::NeverRun, format!("{} leaves it out of every target CI tests on", shown.join(", "))); + let mut note = format!("{} leaves it out of every target CI tests on", shown.join(", ")); + let mut builds: Vec<&str> = PLATFORM_TARGETS.iter().filter(|(_, t)| !off(t)).map(|(name, _)| *name).collect(); + builds.dedup(); + if !builds.is_empty() { + note += &format!("; it builds on {}, so run it there", builds.join(" and ")); + } + let mut hit = v.whole(Rule::NeverRun, note); + hit.report_only = !builds.is_empty(); // A change to an attribute that turns the test off counts as a change to the test; the // lines between that attribute and the test do not. let lines = &v.file.lines; @@ -5023,8 +5049,8 @@ mod tests { fn only_failing_rules_fail_the_check() { let failing: Vec<&str> = Rule::ALL.into_iter().filter(|r| r.fails()).map(Rule::id).collect(); assert_eq!(failing, ["self-compare", "ignore-without-reason", "sleep", "reads-source", "never-run"]); - let mac = "#[cfg(target_os = \"macos\")]\n#[test]\nfn mac() {\n assert_eq!(f(), 1);\n}\n"; - assert!(finish(&lint_file("crates/x/src/tests.rs", mac, &ctx()), 0, 1, "base").is_err(), "never-run fails the check"); + let ios = "#[cfg(target_os = \"ios\")]\n#[test]\nfn ios() {\n assert_eq!(f(), 1);\n}\n"; + assert!(finish(&lint_file("crates/x/src/tests.rs", ios, &ctx()), 0, 1, "base").is_err(), "never-run fails the check"); let weak = "#[test]\nfn weak() {\n assert!(f().is_ok());\n}\n"; let unguarded = "#[test]\nfn all() {\n assert!(f().iter().all(|x| valid(x)));\n}\n"; let skipped = "#[test]\n#[ignore]\nfn skipped() {\n assert_eq!(f(), 1);\n}\n"; @@ -5354,6 +5380,25 @@ mod tests { assert_eq!(only("never-run", case), [(3, "never-run")], "a `;` inside a later attribute"); } + #[test] + fn never_run_lists_tests_that_build_on_macos_or_windows_without_failing() { + let test = |gate: &str| format!("#[cfg({gate})]\n#[test]\nfn t() {{\n assert_eq!(f(), 1);\n}}\n"); + let check = |path: &str, gate: &str| { + let found = lint_file(path, &test(gate), &ctx()); + assert_eq!(found.iter().filter(|h| h.rule == Rule::NeverRun).count(), 1, "{gate} is listed"); + finish(&found, 0, 1, "base") + }; + // A touchpad gesture test that egui can only drive on macOS. + assert!(check("crates/ui-egui/src/tests/quickpenwheel.rs", "target_os = \"macos\"").is_ok(), "macOS"); + // A test of performance counters that only Windows has. + assert!(check("apps/vectorcraft-cli/src/perf.rs", "windows").is_ok(), "Windows"); + assert!(check("crates/x/src/tests.rs", "all(target_os = \"macos\", target_arch = \"aarch64\")").is_ok(), "Apple silicon"); + assert!(check("crates/x/src/tests.rs", "target_os = \"ios\"").is_err(), "no desktop target builds it"); + assert!(check("crates/x/src/tests.rs", "all(windows, unix)").is_err(), "no target builds it"); + let found = lint_file("apps/vectorcraft-cli/src/perf.rs", &test("windows"), &ctx()); + assert!(found[0].note.ends_with("it builds on Windows, so run it there"), "{}", found[0].note); + } + #[test] fn reads_source_spans_reach_a_path_on_a_later_line() { let src = "#[test]\nfn t() {\n let s = fs::read_to_string(\n root.join(\"src/lib.rs\"),\n )\n .unwrap();\n assert!(s.contains(\"x\"));\n}\n"; From 1957da7178822ab028493c34a9b31f412efd1dcd Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 19:54:21 -0800 Subject: [PATCH 097/112] Tests: the menu family list test holds the font scan with a lister the_menu_family_list_now_does_not_wait_for_the_scan held the background font scan with a named pipe named like a font. The font catalog now skips files that are not regular files, so the scan never waited on the pipe: it read the small test folder and could finish before the test called installed_fonts_ready and menu_family_list_now. On a busy CI runner the test then saw the installed fonts and failed with "before the scan ends, only the fonts already loaded". The test now builds its database with a test-only lister that the scan calls before it reads the folder. The lister waits until the test drops a channel sender after the two calls return, and gives up after 10 s so that a list that waits for the scan fails the test instead of hanging it. The pipe, the release thread and the Unix-only gate are removed. --- crates/text/src/fontdb/db.rs | 28 +++++++++++++++++------- crates/text/src/tests/sysfonts.rs | 36 +++++++++++-------------------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/crates/text/src/fontdb/db.rs b/crates/text/src/fontdb/db.rs index f506de34c5..474198cad6 100644 --- a/crates/text/src/fontdb/db.rs +++ b/crates/text/src/fontdb/db.rs @@ -24,14 +24,14 @@ impl FontDb { /// A database holding the bundled fonts, whose system font scan reads `font_dirs` (folders, /// read with their subfolders, and font files) and nothing else. pub fn with_font_dirs(font_dirs: Vec<PathBuf>) -> Self { - // No platform folders, font store or font service. - let catalog = Catalog::new(FontEnv { os: Os::None, ..FontEnv::default() }).with_font_service(false); - // A path that isn't a folder is a font file named by itself, read whatever its name (font - // services keep fonts in files without an extension); one that becomes a folder is read as one. - let (folders, files): (Vec<PathBuf>, Vec<PathBuf>) = font_dirs.into_iter().partition(|p| p.is_dir()); - let catalog = catalog.with_lister(Arc::new(move || files.clone())); - catalog.set_app_dirs(folders); - Self::new(catalog) + Self::new(font_dirs_catalog(font_dirs)) + } + + /// [`FontDb::with_font_dirs`] whose every scan also calls `lister` before it reads a folder, + /// for tests that hold a scan until they let it go on. + #[cfg(test)] + pub(crate) fn with_font_dirs_and_lister(font_dirs: Vec<PathBuf>, lister: craft::font_catalog::Lister) -> Self { + Self::new(font_dirs_catalog(font_dirs).with_lister(lister)) } /// Same scan paths as [`FontDb::global`] (platform lister and font folders), for tests. @@ -418,3 +418,15 @@ impl FontDb { false } } + +/// [`FontDb::with_font_dirs`]'s catalog: it reads `font_dirs` (folders with their subfolders, and +/// font files) and no platform folders, font store or font service. +fn font_dirs_catalog(font_dirs: Vec<PathBuf>) -> Catalog { + let catalog = Catalog::new(FontEnv { os: Os::None, ..FontEnv::default() }).with_font_service(false); + // A path that isn't a folder is a font file named by itself, read whatever its name (font + // services keep fonts in files without an extension); one that becomes a folder is read as one. + let (folders, files): (Vec<PathBuf>, Vec<PathBuf>) = font_dirs.into_iter().partition(|p| p.is_dir()); + let catalog = catalog.with_lister(Arc::new(move || files.clone())); + catalog.set_app_dirs(folders); + catalog +} diff --git a/crates/text/src/tests/sysfonts.rs b/crates/text/src/tests/sysfonts.rs index 66ae287023..bbd5875862 100644 --- a/crates/text/src/tests/sysfonts.rs +++ b/crates/text/src/tests/sysfonts.rs @@ -524,40 +524,28 @@ fn a_background_scan_serves_the_first_lookup() { /// for the scan of the installed fonts: a large library would hold the first frame past the /// first-frame watchdog, and the app would never show its window (#5483). Once the scan ends, the /// list has the installed fonts. -#[cfg(unix)] #[test] fn the_menu_family_list_now_does_not_wait_for_the_scan() { let dir = font_dir("held-scan"); - // A named pipe with a font's name: the scan opens it and waits there until something writes. - let pipe = dir.join("Held.ttf"); - assert!(std::process::Command::new("mkfifo").arg(&pipe).status().unwrap().success()); - let db: &'static FontDb = Box::leak(Box::new(FontDb::with_font_dirs(vec![dir]))); + // The scan calls this lister before it reads the folder, and the lister waits there until the + // test drops `release`, once the calls below have returned. A list that waited for the scan + // would then hold the installed fonts. The lister gives up after 10 s, so such a list fails + // the test instead of hanging it. Later scans find `release` dropped and don't wait. + let (release, held) = std::sync::mpsc::channel::<()>(); + let held = std::sync::Mutex::new(held); + let hold: craft::font_catalog::Lister = Arc::new(move || { + let _ = held.lock().unwrap().recv_timeout(std::time::Duration::from_secs(10)); + Vec::new() + }); + let db: &'static FontDb = Box::leak(Box::new(FontDb::with_font_dirs_and_lister(vec![dir], hold))); let generation = db.generation(); db.scan_in_background(); - // The scan can't end until the pipe is opened for writing, so a list that waited for it would - // hold the installed fonts. This thread lets the scan go on once the calls return, or after 10 s - // if they are still waiting, so that such a test fails instead of hanging. It opens the pipe - // for reading and writing, which doesn't wait for a reader, and repeats that until the scan has - // ended: a single open for writing waits for any reader and lets only the readers already - // waiting go, so the test hung when the scan reached the pipe later, or ran on this thread - // because its own thread didn't start. - let (returned, waiting) = std::sync::mpsc::channel::<()>(); - let release = pipe.clone(); - let guard = std::thread::spawn(move || { - let _ = waiting.recv_timeout(std::time::Duration::from_secs(10)); - while !db.installed_fonts_ready() { - // The pipe is opened and closed with nothing written. - drop(std::fs::OpenOptions::new().read(true).write(true).open(&release).unwrap()); - std::thread::yield_now(); - } - }); let ready = db.installed_fonts_ready(); let listed = db.menu_family_list_now(); - drop(returned); + drop(release); assert!(!ready && !has(&listed, FAMILY), "before the scan ends, only the fonts already loaded"); // Waits for the scan. assert!(has(&db.menu_family_list(), FAMILY)); - guard.join().unwrap(); assert!(db.installed_fonts_ready()); assert_ne!(db.generation(), generation, "a menu built from the short list is built again"); assert!(has(&db.menu_family_list_now(), FAMILY)); From c6c7de257f2b0daa61b63aaf7cb98ba3b687bfcd Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 20:14:00 -0800 Subject: [PATCH 098/112] Dependencies: move the craft-libs pin to craft-libs main 77ade517 craft-libs #4659 (swatch chips that fit a one-column rail) and #4723 have merged, so every craft-libs rev moves from #4659's head edbf2117 to craft-libs main at 77ade517. The egui revisions move to 861d60a6, the ones that craft-libs rev pins; winit stays at 0dfcec0e. Cargo.lock changes only the sources of those packages. --- Cargo.lock | 194 ++++++++++++++++---------------- Cargo.toml | 98 ++++++++-------- apps/vectorcraft-web/Cargo.toml | 2 +- xtask/src/pdf_deps.rs | 2 +- 4 files changed, 148 insertions(+), 148 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ae1e726a80..d0216e2962 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1231,7 +1231,7 @@ dependencies = [ [[package]] name = "craft" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-automation", "craft-behavior", @@ -1272,7 +1272,7 @@ dependencies = [ [[package]] name = "craft-affinity" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "crc32fast", "flate2", @@ -1283,7 +1283,7 @@ dependencies = [ [[package]] name = "craft-appkit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "block2 0.6.2", "objc2 0.6.5", @@ -1295,7 +1295,7 @@ dependencies = [ [[package]] name = "craft-atomic" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "rustix 1.1.6", ] @@ -1303,7 +1303,7 @@ dependencies = [ [[package]] name = "craft-automation" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -1328,7 +1328,7 @@ dependencies = [ [[package]] name = "craft-behavior" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "accesskit", "bitflags 2.13.2", @@ -1346,7 +1346,7 @@ dependencies = [ [[package]] name = "craft-browse" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-docpath", @@ -1364,7 +1364,7 @@ dependencies = [ [[package]] name = "craft-cdr" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "crc32fast", "flate2", @@ -1373,7 +1373,7 @@ dependencies = [ [[package]] name = "craft-cloud-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "egui", ] @@ -1381,7 +1381,7 @@ dependencies = [ [[package]] name = "craft-cms" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "md-5", "rayon", @@ -1390,12 +1390,12 @@ dependencies = [ [[package]] name = "craft-codepage" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" [[package]] name = "craft-color-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-cms", @@ -1415,7 +1415,7 @@ dependencies = [ [[package]] name = "craft-control" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-control-protocol", "craft-platform", @@ -1426,7 +1426,7 @@ dependencies = [ [[package]] name = "craft-control-protocol" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "getrandom 0.3.4", "serde_json", @@ -1436,7 +1436,7 @@ dependencies = [ [[package]] name = "craft-dds" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "rayon", ] @@ -1444,7 +1444,7 @@ dependencies = [ [[package]] name = "craft-dialogs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "block2 0.6.2", "craft-appkit", @@ -1470,7 +1470,7 @@ dependencies = [ [[package]] name = "craft-doc" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "blake3", "craft-ecproj-format", @@ -1486,7 +1486,7 @@ dependencies = [ [[package]] name = "craft-docpath" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "serde", ] @@ -1494,7 +1494,7 @@ dependencies = [ [[package]] name = "craft-draw" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1513,7 +1513,7 @@ dependencies = [ [[package]] name = "craft-dxf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-codepage", "encoding_rs", @@ -1525,7 +1525,7 @@ dependencies = [ [[package]] name = "craft-ecproj-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "serde", "serde_json", @@ -1535,12 +1535,12 @@ dependencies = [ [[package]] name = "craft-eps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "fontique", "harfrust 0.13.3", @@ -1555,7 +1555,7 @@ dependencies = [ [[package]] name = "craft-font-manager" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -1574,7 +1574,7 @@ dependencies = [ [[package]] name = "craft-font-os-windows" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "windows-registry", "windows-sys 0.61.2", @@ -1583,7 +1583,7 @@ dependencies = [ [[package]] name = "craft-font-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "cap-primitives", "craft-atomic", @@ -1606,12 +1606,12 @@ dependencies = [ [[package]] name = "craft-fonts-build" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" [[package]] name = "craft-gif" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "gif", ] @@ -1619,7 +1619,7 @@ dependencies = [ [[package]] name = "craft-gzip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "flate2", ] @@ -1627,7 +1627,7 @@ dependencies = [ [[package]] name = "craft-host" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "bitflags 2.13.2", "craft-i18n", @@ -1640,7 +1640,7 @@ dependencies = [ [[package]] name = "craft-i18n" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "brotli 9.1.3", "brotli-decompressor 6.3.2", @@ -1670,7 +1670,7 @@ dependencies = [ [[package]] name = "craft-image-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-dds", "craft-jpeg", @@ -1697,7 +1697,7 @@ dependencies = [ [[package]] name = "craft-imaging" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1715,7 +1715,7 @@ dependencies = [ [[package]] name = "craft-jpeg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "thiserror 2.0.21", ] @@ -1723,7 +1723,7 @@ dependencies = [ [[package]] name = "craft-jxl" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "brotli-decompressor 5.0.3", "jixel", @@ -1734,7 +1734,7 @@ dependencies = [ [[package]] name = "craft-keymap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-host", "craft-i18n", @@ -1749,7 +1749,7 @@ dependencies = [ [[package]] name = "craft-layers" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-i18n", @@ -1763,7 +1763,7 @@ dependencies = [ [[package]] name = "craft-menu" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-host", @@ -1781,7 +1781,7 @@ dependencies = [ [[package]] name = "craft-metadata" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "brotli-decompressor 6.3.2", "chrono", @@ -1793,7 +1793,7 @@ dependencies = [ [[package]] name = "craft-metafile" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "encoding_rs", "image", @@ -1804,7 +1804,7 @@ dependencies = [ [[package]] name = "craft-mime" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "chrono", "craft-codepage", @@ -1814,7 +1814,7 @@ dependencies = [ [[package]] name = "craft-nightly" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "uds_windows", "winsafe", @@ -1823,7 +1823,7 @@ dependencies = [ [[package]] name = "craft-pages" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-keymap", @@ -1839,7 +1839,7 @@ dependencies = [ [[package]] name = "craft-pcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "flate2", "serde", @@ -1850,7 +1850,7 @@ dependencies = [ [[package]] name = "craft-pdf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "hayro-interpret", "hayro-syntax", @@ -1862,7 +1862,7 @@ dependencies = [ [[package]] name = "craft-platform" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "async-channel", "async-io", @@ -1895,7 +1895,7 @@ dependencies = [ [[package]] name = "craft-plotter" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "kurbo 0.13.1", "thiserror 2.0.21", @@ -1904,7 +1904,7 @@ dependencies = [ [[package]] name = "craft-print" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-host", @@ -1928,7 +1928,7 @@ dependencies = [ [[package]] name = "craft-proof" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "log", "miniz_oxide 0.9.1", @@ -1939,7 +1939,7 @@ dependencies = [ [[package]] name = "craft-ps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-eps", "flate2", @@ -1953,7 +1953,7 @@ dependencies = [ [[package]] name = "craft-psd" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "encoding_rs", "flate2", @@ -1964,7 +1964,7 @@ dependencies = [ [[package]] name = "craft-quit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "dispatch2", "egui", @@ -1977,7 +1977,7 @@ dependencies = [ [[package]] name = "craft-review" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -1996,7 +1996,7 @@ dependencies = [ [[package]] name = "craft-settings" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-atomic", "craft-host", @@ -2013,7 +2013,7 @@ dependencies = [ [[package]] name = "craft-stream-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "fax", "hayro-ccitt", @@ -2024,7 +2024,7 @@ dependencies = [ [[package]] name = "craft-svg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-image-codecs", "craft-xml", @@ -2045,7 +2045,7 @@ dependencies = [ [[package]] name = "craft-table" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-keymap", @@ -2057,7 +2057,7 @@ dependencies = [ [[package]] name = "craft-text" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-font-manager", @@ -2082,7 +2082,7 @@ dependencies = [ [[package]] name = "craft-theme" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "bitflags 2.13.2", "craft-tracked", @@ -2097,7 +2097,7 @@ dependencies = [ [[package]] name = "craft-theme-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-atomic", "craft-behavior", @@ -2112,7 +2112,7 @@ dependencies = [ [[package]] name = "craft-tiff" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "serde", "thiserror 2.0.21", @@ -2122,7 +2122,7 @@ dependencies = [ [[package]] name = "craft-time" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "serde", "thiserror 2.0.21", @@ -2131,7 +2131,7 @@ dependencies = [ [[package]] name = "craft-timeline" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-keymap", @@ -2146,12 +2146,12 @@ dependencies = [ [[package]] name = "craft-tracked" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" [[package]] name = "craft-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-cloud-ui", "craft-ui-canvas", @@ -2165,7 +2165,7 @@ dependencies = [ [[package]] name = "craft-ui-canvas" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -2182,7 +2182,7 @@ dependencies = [ [[package]] name = "craft-ui-contract" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "accesskit", "craft-behavior", @@ -2220,7 +2220,7 @@ dependencies = [ [[package]] name = "craft-ui-macros" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2231,7 +2231,7 @@ dependencies = [ [[package]] name = "craft-ui-panels" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-host", @@ -2249,7 +2249,7 @@ dependencies = [ [[package]] name = "craft-ui-patterns" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-host", @@ -2270,7 +2270,7 @@ dependencies = [ [[package]] name = "craft-ui-shell" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-host", @@ -2291,7 +2291,7 @@ dependencies = [ [[package]] name = "craft-ui-widgets" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-host", @@ -2310,7 +2310,7 @@ dependencies = [ [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "base64 0.22.1", "chrono", @@ -2342,7 +2342,7 @@ dependencies = [ [[package]] name = "craft-vectorcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "flate2", "serde", @@ -2353,7 +2353,7 @@ dependencies = [ [[package]] name = "craft-wayland" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "raw-window-handle", "wayland-backend", @@ -2363,7 +2363,7 @@ dependencies = [ [[package]] name = "craft-web-api" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "js-sys", "serde_json", @@ -2374,7 +2374,7 @@ dependencies = [ [[package]] name = "craft-win32" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "winsafe", ] @@ -2382,7 +2382,7 @@ dependencies = [ [[package]] name = "craft-window" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-appkit", "craft-atomic", @@ -2414,7 +2414,7 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "quick-xml 0.41.0", "serde", @@ -2759,7 +2759,7 @@ checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" [[package]] name = "ecolor" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" +source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6" dependencies = [ "bytemuck", "emath", @@ -2792,7 +2792,7 @@ dependencies = [ [[package]] name = "eframe" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" +source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6" dependencies = [ "ahash", "bytemuck", @@ -2827,7 +2827,7 @@ dependencies = [ [[package]] name = "egui" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" +source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6" dependencies = [ "accesskit", "ahash", @@ -2846,7 +2846,7 @@ dependencies = [ [[package]] name = "egui-wgpu" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" +source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6" dependencies = [ "ahash", "bytemuck", @@ -2865,7 +2865,7 @@ dependencies = [ [[package]] name = "egui-winit" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" +source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6" dependencies = [ "accesskit_winit", "arboard", @@ -2890,7 +2890,7 @@ dependencies = [ [[package]] name = "egui_extras" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" +source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6" dependencies = [ "ahash", "egui", @@ -2904,7 +2904,7 @@ dependencies = [ [[package]] name = "egui_glow" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" +source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6" dependencies = [ "bytemuck", "egui", @@ -2917,7 +2917,7 @@ dependencies = [ [[package]] name = "egui_kittest" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" +source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6" dependencies = [ "dify", "eframe", @@ -2943,7 +2943,7 @@ checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" [[package]] name = "emath" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" +source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6" dependencies = [ "bytemuck", ] @@ -3024,7 +3024,7 @@ dependencies = [ [[package]] name = "epaint" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" +source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6" dependencies = [ "ahash", "bytemuck", @@ -3050,7 +3050,7 @@ dependencies = [ [[package]] name = "epaint_default_fonts" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" +source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6" dependencies = [ "brotli 9.1.3", "brotli-decompressor 6.3.2", @@ -3773,7 +3773,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a" [[package]] name = "hayro-cmap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "brotli 8.0.4", "hayro-postscript", @@ -3782,7 +3782,7 @@ dependencies = [ [[package]] name = "hayro-interpret" version = "0.7.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "bitflags 2.13.2", "hayro-cmap", @@ -3800,7 +3800,7 @@ dependencies = [ [[package]] name = "hayro-jbig2" version = "0.3.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "fearless_simd", "hayro-ccitt", @@ -3818,12 +3818,12 @@ dependencies = [ [[package]] name = "hayro-postscript" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" [[package]] name = "hayro-syntax" version = "0.7.2" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "flate2", "hayro-ccitt", @@ -4806,7 +4806,7 @@ dependencies = [ [[package]] name = "krilla" version = "0.8.2" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "base64 0.22.1", "bumpalo", @@ -4963,7 +4963,7 @@ checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" [[package]] name = "linesweeper" version = "0.5.0" -source = "git+https://github.com/storytold/craft-libs?rev=edbf2117a322c82d672050ca813b95beb835c3e8#edbf2117a322c82d672050ca813b95beb835c3e8" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "arrayvec", "kurbo 0.13.1", diff --git a/Cargo.toml b/Cargo.toml index 71ece379bf..843f9cbb53 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,51 +10,51 @@ license = "MIT OR Apache-2.0" rust-version = "1.95" [workspace.dependencies] -craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8", default-features = false, features = ["interpret", "write"] } -craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6", default-features = false, features = ["interpret", "write"] } +craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # Language packs: the Craft apps' shared font store installs them (#4936). -craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # The `.vectorcraft` envelope: its members, version, embedded images and the data after the JSON. -craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # `.pcraft` documents: their manifest, full-size composite, preview, layer pixels and ICC profile. -craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8", features = ["pcraft-pixels"] } +craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6", features = ["pcraft-pixels"] } # Native Affinity documents (craft-libs#914). -craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # Bounded CDR (v1-v27) and CMX (32-bit) reader (craft-libs#778). -craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # SVG parsing, limits, SVGZ and writer (craft-libs#778). -craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8", features = ["tree"] } -craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6", features = ["tree"] } +craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # EPS container, previews, ASCII85 and DSC comments (craft-libs#778). -craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # DXF tags, reader and writer (craft-libs#778, #926, #927). -craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # WMF, EMF and EMF+ reader (craft-libs#778). -craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8", default-features = false, features = ["read", "write"] } -craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6", default-features = false, features = ["read", "write"] } +craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # The framework facade (`craft::ui`, `craft::settings`, `craft::platform`, ...). No default features: each crate names # the members it imports. -craft = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +craft = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # Below the egui layer, so not through the facade: the colour harmony rules and their settings (craft-color-ui # without its `ui` feature), the colour type they work in, and the craft-fonts tables the text crate's build writes. -craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # Nightly profile isolation, launch protocol, and security fence. -craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } +craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # internal vectorcraft-geom = { path = "crates/geom" } vectorcraft-color = { path = "crates/color" } @@ -194,22 +194,22 @@ lto = "thin" codegen-units = 1 [patch.crates-io] -hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -krilla = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8" } -ecolor = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } -emath = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } -epaint = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } -epaint_default_fonts = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } -egui = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } -egui-winit = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } -egui-wgpu = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } -egui_glow = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } -egui_extras = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } -egui_kittest = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } -eframe = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } +hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +krilla = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +ecolor = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } +emath = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } +epaint = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } +epaint_default_fonts = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } +egui = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } +egui-winit = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } +egui-wgpu = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } +egui_glow = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } +egui_extras = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } +egui_kittest = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } +eframe = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } winit = { git = "https://github.com/storytold/winit.git", rev = "0dfcec0eb62fda5904137a63a6dd0c3d83295f45" } diff --git a/apps/vectorcraft-web/Cargo.toml b/apps/vectorcraft-web/Cargo.toml index ba85754a00..70aae32f73 100644 --- a/apps/vectorcraft-web/Cargo.toml +++ b/apps/vectorcraft-web/Cargo.toml @@ -28,7 +28,7 @@ egui_extras = { workspace = true } # `wgpu` pulls egui-wgpu's defaults: WebGPU plus the WebGL2 fallback. eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit"] } # The page command API (storytold/craft-libs#413): the request plumbing behind window.vectorcraft. -craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "edbf2117a322c82d672050ca813b95beb835c3e8", version = "0.1.0" } +craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6", version = "0.1.0" } wasm-bindgen = "0.2" serde_json = { workspace = true } diff --git a/xtask/src/pdf_deps.rs b/xtask/src/pdf_deps.rs index 4b7e8ebb2f..542a3e8c41 100644 --- a/xtask/src/pdf_deps.rs +++ b/xtask/src/pdf_deps.rs @@ -5,7 +5,7 @@ use std::process::Command; use serde_json::Value; -const REV: &str = "edbf2117a322c82d672050ca813b95beb835c3e8"; +const REV: &str = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6"; const PACKAGES: &[(&str, &str, &str)] = &[ ("craft-pdf", "0.1.0", REV), ("krilla", "0.8.2", REV), From 7f6cfef99cea6e884ff2ed7776c1dd861f3d09d3 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 20:15:32 -0800 Subject: [PATCH 099/112] Tests: graph default markers are checked as squares, plain column height pinned The `sized` helper in the graph tests now also requires the path to be the four corners of its bounds, so a circle with the same 5 by 5 bounds no longer passes as a default square marker. The plain column drawn in place of a design past the budget is checked for its exact 140 point value height instead of a height above 8 points. --- crates/engine/src/cmd/graph/tests.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/cmd/graph/tests.rs b/crates/engine/src/cmd/graph/tests.rs index dad642b1d6..08000b7f1e 100644 --- a/crates/engine/src/cmd/graph/tests.rs +++ b/crates/engine/src/cmd/graph/tests.rs @@ -6726,9 +6726,12 @@ fn designs_and_markers_survive_save_and_open() { assert_eq!(marks.iter().filter(|n| sized(n, 5.0)).count(), 1, "a default square at the one data point"); } -/// Whether `n` is a square `side` points across (a default point marker is 5, a default legend swatch 8). +/// Whether `n` is a square path `side` points across, drawn as the four corners of its bounds (a default point marker +/// is 5, a default legend swatch 8). fn sized(n: &vectorcraft_doc::Node, side: f64) -> bool { - n.geometric_bounds().is_some_and(|b| (b.width() - side).abs() < 1e-6 && (b.height() - side).abs() < 1e-6) + let Some(b) = n.geometric_bounds() else { return false }; + let square = matches!(&n.kind, NodeKind::Path { path, .. } if *path == vectorcraft_geom::shapes::rectangle(b)); + square && (b.width() - side).abs() < 1e-6 && (b.height() - side).abs() < 1e-6 } #[test] @@ -7174,7 +7177,8 @@ fn graph_column_params_are_checked_and_designs_too_big_are_drawn_plain() { assert_eq!(marks.iter().filter(|n| sized(n, 8.0)).count(), 1, "a default square as the legend swatch"); let columns: Vec<_> = marks.iter().filter(|n| !sized(n, 8.0)).collect(); assert_eq!(columns.len(), 1, "one plain column for the one value"); - assert!(columns[0].geometric_bounds().is_some_and(|b| b.height() > 8.0), "the column has the value's height"); + let height = columns[0].geometric_bounds().map(|b| b.height()); + assert!(height.is_some_and(|h| (h - 140.0).abs() < 1e-6), "the column has the value's height: {height:?}"); // Columns of 0 on a value axis from 10,000 to 10,001 run 2,000,000 points from the clamped zero line: a copy each // 0.1 is past the budget too. let far = one_series(&mut s, "column", &[0.0, 0.0]); From c21cc4f3ff80cefbd45056d72dd7c05e3151b53d Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 20:18:48 -0800 Subject: [PATCH 100/112] Tests: engine tests that check every item also check the items exist Engine tests in crates/engine/src/tests that asserted something of every item in a list passed when the list was empty. They now pin the count or the exact value: - keyguide, menucmds, recolor: the guide positions, the smart punctuation counts and the theme picker's colors are compared whole. - overprint, script_text, stylepanel, textedit, typearea: the text is checked first, and character runs must exist; the Graphic Styles test checks the red fill itself, not only some fill. - package, pattern, perspgrid, pixelalign, recolor, swatchcmds, symbollib, xform: the links, stored graph paints, corners, anchors, map rows, group colors, gradient stops and symbol sizes are counted. - rastersettings: the white-background image has the size of the clear one. - textcombos: both paragraphs take the composer and justification. - textedit: a character style range past u32 leaves the text object unchanged. --- crates/engine/src/tests/keyguide.rs | 4 ++-- crates/engine/src/tests/menucmds.rs | 3 ++- crates/engine/src/tests/overprint.rs | 3 ++- crates/engine/src/tests/package.rs | 4 +++- crates/engine/src/tests/pattern.rs | 10 +++++++--- crates/engine/src/tests/perspgrid.rs | 6 ++++-- crates/engine/src/tests/pixelalign.rs | 8 ++++++-- crates/engine/src/tests/rastersettings.rs | 1 + crates/engine/src/tests/recolor.rs | 14 +++++++++----- crates/engine/src/tests/script_text.rs | 10 ++++++++-- crates/engine/src/tests/stylepanel.rs | 7 +++++-- crates/engine/src/tests/swatchcmds.rs | 3 ++- crates/engine/src/tests/symbollib.rs | 1 + crates/engine/src/tests/textcombos.rs | 6 +++++- crates/engine/src/tests/textedit.rs | 16 +++++++++++----- crates/engine/src/tests/typearea.rs | 3 ++- crates/engine/src/tests/xform.rs | 1 + 17 files changed, 71 insertions(+), 29 deletions(-) diff --git a/crates/engine/src/tests/keyguide.rs b/crates/engine/src/tests/keyguide.rs index 327c0b4b24..4be2679bc9 100644 --- a/crates/engine/src/tests/keyguide.rs +++ b/crates/engine/src/tests/keyguide.rs @@ -174,10 +174,10 @@ fn guides_align_to_a_key_object_among_others_and_parallel_ones_to_a_key_guide() s.execute("select.key", &json!({"id": b.0})).unwrap(); s.execute("object.align", &json!({"horizontal": "left"})).unwrap(); assert_eq!(bounds(&s, a).x0, 300.0); - assert!(positions(&s).iter().all(|p| *p == 300.0)); + assert_eq!(positions(&s), [300.0, 300.0], "both guides"); // Aligning to the selection leaves guides alone. s.execute("object.align", &json!({"horizontal": "right", "to": "selection"})).unwrap(); - assert!(positions(&s).iter().all(|p| *p == 300.0)); + assert_eq!(positions(&s), [300.0, 300.0]); // A key guide stays put, and the other vertical guide lines up on it. s.execute("guide.move", &json!({"index": 1, "pos": 700})).unwrap(); s.execute("select.key", &json!({"guide": 1})).unwrap(); diff --git a/crates/engine/src/tests/menucmds.rs b/crates/engine/src/tests/menucmds.rs index b4aad6c7e6..6896802a68 100644 --- a/crates/engine/src/tests/menucmds.rs +++ b/crates/engine/src/tests/menucmds.rs @@ -4113,7 +4113,8 @@ fn smart_punctuation_with_nothing_to_change_records_no_undo_step() { let before = history(&s); let r = s.execute("type.smartPunctuation", &json!({})).unwrap(); assert_eq!(r["changed"], 0, "{id:?}"); - assert!(r["replaced"].as_object().unwrap().values().all(|n| n == 0), "{id:?}: {r}"); + let none = json!({"fiLigatures": 0, "flLigatures": 0, "quotes": 0, "spaces": 0, "dashes": 0, "ellipses": 0, "fractions": 0}); + assert_eq!(r["replaced"], none, "{id:?}: {r}"); assert_eq!(history(&s), before, "{id:?}"); } assert_eq!(plain(&s, t), "“Hi” it’s 1–2 and 3—4…"); diff --git a/crates/engine/src/tests/overprint.rs b/crates/engine/src/tests/overprint.rs index e73825e86f..d7343e0ae5 100644 --- a/crates/engine/src/tests/overprint.rs +++ b/crates/engine/src/tests/overprint.rs @@ -269,7 +269,8 @@ fn overprint_black_covers_type_gradients_spots_and_groups() { s.execute("edit.colors.overprintBlack", &json!({})).unwrap(); let NodeKind::Text(tx) = &node(&s, t).kind else { panic!() }; - assert!(tx.runs.iter().all(|r| r.style.overprint_fill), "type characters, inside the selected group"); + assert_eq!(tx.plain_text(), "Hi"); + assert!(!tx.runs.is_empty() && tx.runs.iter().all(|r| r.style.overprint_fill), "type characters, inside the selected group"); let fill = |s: &Session, id| node(s, id).appearance.fill().unwrap().overprint; assert!(!fill(&s, g), "a gradient with a rich-black stop"); assert!(!fill(&s, spot), "spot blacks need includeSpotBlacks"); diff --git a/crates/engine/src/tests/package.rs b/crates/engine/src/tests/package.rs index f0eeefd810..99aa80e419 100644 --- a/crates/engine/src/tests/package.rs +++ b/crates/engine/src/tests/package.rs @@ -78,7 +78,9 @@ fn two_links_and_a_font_are_collected_and_relinked() { s.doc().unwrap().doc.visit_images(|_, im| paths.push(im.link.clone().unwrap())); paths }; - assert!(link(&s).iter().all(|l| l.path.contains("art"))); + let links = link(&s); + assert_eq!(links.len(), 2, "{links:?}"); + assert!(links.iter().all(|l| l.path.contains("art")), "{links:?}"); // The packaged one opens with the copies, even with the originals gone. std::fs::remove_dir_all(dir.0.join("art")).unwrap(); let r = open(&mut s, &root.join("poster.vectorcraft").to_string_lossy()); diff --git a/crates/engine/src/tests/pattern.rs b/crates/engine/src/tests/pattern.rs index 016b5e6373..b46b412fd6 100644 --- a/crates/engine/src/tests/pattern.rs +++ b/crates/engine/src/tests/pattern.rs @@ -1087,13 +1087,17 @@ fn delete_and_rename_reach_a_graphs_stored_paints() { let mut s = session(); make_dots(&mut s); let g = graph_painted_with(&mut s, "Dots"); + assert_eq!(stored_graph_paints(&s, g).len(), 4, "the series fill and stroke and the value labels' fill and stroke"); s.execute("pattern.options", &json!({"name": "Dots", "newName": "Spots"})).unwrap(); - assert!(stored_graph_paints(&s, g).iter().all(|p| is_pattern(p, "Spots")), "the rename reaches the graph"); + let renamed = stored_graph_paints(&s, g); + assert!(renamed.len() == 4 && renamed.iter().all(|p| is_pattern(p, "Spots")), "the rename reaches the graph: {renamed:?}"); s.execute("edit.undo", &json!({})).unwrap(); - assert!(stored_graph_paints(&s, g).iter().all(|p| is_pattern(p, "Dots"))); + let back = stored_graph_paints(&s, g); + assert!(back.len() == 4 && back.iter().all(|p| is_pattern(p, "Dots")), "{back:?}"); let v = s.execute("pattern.delete", &json!({"name": "Dots"})).unwrap(); assert_eq!(v["unpainted"], 4, "the series fill and stroke and the value labels' fill and stroke"); - assert!(stored_graph_paints(&s, g).iter().all(Paint::is_none)); + let cleared = stored_graph_paints(&s, g); + assert!(cleared.len() == 4 && cleared.iter().all(Paint::is_none), "{cleared:?}"); s.execute("graph.setData", &json!({"id": g.0, "rows": [[2], [4]]})).unwrap(); assert_eq!(pattern_uses(doc(&s), "Dots"), 0, "the redrawn graph holds no paint of the deleted pattern"); } diff --git a/crates/engine/src/tests/perspgrid.rs b/crates/engine/src/tests/perspgrid.rs index b4f8d89ca3..d3a6e22b9e 100644 --- a/crates/engine/src/tests/perspgrid.rs +++ b/crates/engine/src/tests/perspgrid.rs @@ -496,12 +496,14 @@ fn snap_to_grid_lands_drawn_and_moved_art_on_gridlines() { let n = s.doc().unwrap().doc.node(id).unwrap().path_data().unwrap().clone(); n.anchors().map(|(_, _, an)| g.to_plane(Plane::Left, an.p).unwrap()).collect() }; - assert!(corners(&s).iter().all(|q| on_line(q.x) && on_line(q.y)), "{:?}", corners(&s)); + let drawn = corners(&s); + assert!(drawn.len() == 4 && drawn.iter().all(|q| on_line(q.x) && on_line(q.y)), "{drawn:?}"); // Moved a cell and a bit: it lands a whole cell over. let from = g.to_page(Plane::Left, Point::new(3.0 * g.cell, 2.0 * g.cell)).unwrap(); let to = g.to_page(Plane::Left, Point::new(4.0 * g.cell + 2.0, 2.0 * g.cell)).unwrap(); run(&mut s, "perspective.move", json!({"ids": [id.0], "from": [from.x, from.y], "to": [to.x, to.y]})); - assert!(corners(&s).iter().all(|q| on_line(q.x) && on_line(q.y)), "{:?}", corners(&s)); + let moved = corners(&s); + assert!(moved.len() == 4 && moved.iter().all(|q| on_line(q.x) && on_line(q.y)), "{moved:?}"); // Without snapping it moves exactly. let before = corners(&s); run(&mut s, "perspective.move", json!({"ids": [id.0], "from": [from.x, from.y], "to": [to.x, to.y], "snap": false})); diff --git a/crates/engine/src/tests/pixelalign.rs b/crates/engine/src/tests/pixelalign.rs index 00b4cce694..a655002a4d 100644 --- a/crates/engine/src/tests/pixelalign.rs +++ b/crates/engine/src/tests/pixelalign.rs @@ -205,6 +205,7 @@ fn stroke_edits_keep_it_aligned() { assert!(whole(&points(&s, id)), "{:?}", points(&s, id)); s.execute("stroke.set", &json!({"weight": 3})).unwrap(); let pts = points(&s, id); + assert_eq!(pts.len(), 4, "{pts:?}"); assert!(pts.iter().all(|(x, y)| (x - x.floor() - 0.5).abs() < 1e-9 && (y - y.floor() - 0.5).abs() < 1e-9), "{pts:?}"); // Inside alignment puts the stroke within the path, so the anchors go back to whole points. s.execute("stroke.set", &json!({"align": "inside"})).unwrap(); @@ -763,8 +764,10 @@ fn objects_on_path_members_stay_on_the_grid() { // Editing the path places the member again, and it goes back on the grid. let anchors = json!([{"x": 0.6, "y": 120.7}, {"x": 300.6, "y": 120.7}]); s.execute("path.setAnchors", &json!({"id": spine, "subpaths": [{"anchors": anchors, "closed": false}]})).unwrap(); - assert!(whole(&points(&s, a)), "path edited: {:?}", points(&s, a)); - assert!(points(&s, a).iter().all(|(_, y)| *y > 105.0), "followed the path: {:?}", points(&s, a)); + let placed = points(&s, a); + assert_eq!(placed.len(), 4, "{placed:?}"); + assert!(whole(&placed), "path edited: {placed:?}"); + assert!(placed.iter().all(|(_, y)| *y > 105.0), "followed the path: {placed:?}"); } fn align_new(s: &Session) -> bool { @@ -1465,6 +1468,7 @@ fn an_instance_snapped_to_the_grid_moves_its_linked_mask() { assert!(whole(&[(e, f)]) && (e, f) != (e0, f0), "{e} {f}"); let moved: Vec<_> = mask_before.iter().map(|(x, y)| (x + e - e0, y + f - f0)).collect(); let after = mask_points(&s, linked); + assert!(!moved.is_empty() && after.len() == moved.len(), "{after:?} != {moved:?}"); assert!(moved.iter().zip(&after).all(|(a, b)| close(*a, *b)), "{after:?} != {moved:?}"); assert!(whole(&placed_points(&s, unlinked))); assert_eq!(mask_points(&s, unlinked), unlinked_before); diff --git a/crates/engine/src/tests/rastersettings.rs b/crates/engine/src/tests/rastersettings.rs index 664b696fec..6e3ef16476 100644 --- a/crates/engine/src/tests/rastersettings.rs +++ b/crates/engine/src/tests/rastersettings.rs @@ -99,6 +99,7 @@ fn a_white_background_makes_effect_images_opaque() { assert_eq!(clear.get_pixel(0, 0)[3], 0, "transparent by default"); s.execute(C, &json!({"background": "white"})).unwrap(); let white = effect_image(&s.doc().unwrap().doc); + assert_eq!(white.dimensions(), clear.dimensions(), "the same image, on white"); assert!(white.pixels().all(|p| p[3] == 255), "every pixel is opaque"); assert_eq!(white.get_pixel(0, 0).0, [255, 255, 255, 255]); // With a clipping mask, the white stays under the art only. diff --git a/crates/engine/src/tests/recolor.rs b/crates/engine/src/tests/recolor.rs index fe87c1f7a0..278e7e0f3d 100644 --- a/crates/engine/src/tests/recolor.rs +++ b/crates/engine/src/tests/recolor.rs @@ -250,7 +250,8 @@ fn used_colors_give_no_swatch_for_a_stop_that_mixes_its_ink_with_process_inks() assert_eq!(entry("cmyk 0 50 30 0")["swatch"], "Ink", "{r}"); // recolor.colors keeps the swatch it lists. let listed = run(&mut s, "recolor.colors", json!({})); - assert!(listed["colors"].as_array().unwrap().iter().all(|c| c["swatch"] == "Ink"), "{listed}"); + let colors = listed["colors"].as_array().unwrap(); + assert!(!colors.is_empty() && colors.iter().all(|c| c["swatch"] == "Ink"), "{listed}"); } #[test] @@ -446,7 +447,9 @@ fn limit_to_library_snaps_new_colours() { let c = color_value(k).unwrap(); c.to_rgb().iter().all(|v| ((v * 5.0).round() - v * 5.0).abs() < 1e-3) }; - assert!(r["map"].as_array().unwrap().iter().all(|row| web(&row["to"])), "{r}"); + let map = r["map"].as_array().unwrap(); + assert_eq!(map.len(), 2, "a row for each color: {r}"); + assert!(map.iter().all(|row| web(&row["to"])), "{r}"); run(&mut s, "recolor.apply", json!({"map": {"#f01020": "#f01020"}, "limitTo": "Web Safe 216"})); let hexes: Vec<Value> = run(&mut s, "recolor.colors", json!({}))["colors"].as_array().unwrap().iter().map(|c| c["hex"].clone()).collect(); assert!(hexes.contains(&json!("#ff0033")) && !hexes.contains(&json!("#f01020")), "{hexes:?}"); @@ -1333,10 +1336,11 @@ fn document_model_converts_the_colours_of_a_group_too() { g.swatches.iter().filter_map(|w| w.paint.color()).collect() }; // Group-only edit from the rows, and with explicit group colours. + let cmyk = |cs: &[Color]| cs.len() == 1 && cs.iter().all(|c| c.model() == vectorcraft_color::cms::Model::Cmyk); run(&mut s, "recolor.apply", json!({"map": {"cmyk 0 0 0 50": "#ff0000"}, "group": "Theme", "model": "document"})); - assert!(group(&s).iter().all(|c| c.model() == vectorcraft_color::cms::Model::Cmyk), "{:?}", group(&s)); + assert!(cmyk(&group(&s)), "{:?}", group(&s)); run(&mut s, "recolor.apply", json!({"map": [], "group": "Theme", "groupColors": ["#00ff00"], "model": "document"})); - assert!(group(&s).iter().all(|c| c.model() == vectorcraft_color::cms::Model::Cmyk), "{:?}", group(&s)); + assert!(cmyk(&group(&s)), "{:?}", group(&s)); } fn stroke(s: &Session, id: NodeId) -> Color { @@ -1620,7 +1624,7 @@ fn theme_picker_leaves_out_clear_pixels_and_unreadable_images() { let cut = super::menucmds::place_undecodable_png(&mut s); let cb = s.doc().unwrap().doc.node(cut).unwrap().visual_bounds().unwrap(); let r = run(&mut s, "recolor.pickTheme", json!({"picks": [{"rect": [cb.x0, cb.y0, cb.x1, cb.y1]}]})); - assert!(r["colors"].as_array().unwrap().iter().all(|k| k == "rgb 255 0 0"), "the undecodable image adds nothing: {r}"); + assert_eq!(r["colors"], json!(["rgb 255 0 0"]), "the undecodable image adds nothing to the red under it: {r}"); } /// A large image is read through about 65,536 pixels: its palette still holds both halves. diff --git a/crates/engine/src/tests/script_text.rs b/crates/engine/src/tests/script_text.rs index 0a71638c92..2794e929b2 100644 --- a/crates/engine/src/tests/script_text.rs +++ b/crates/engine/src/tests/script_text.rs @@ -260,7 +260,10 @@ fn a_leading_equal_to_the_auto_leading_turns_auto_leading_off() { assert_eq!(out, vec![json!([false, 14.4])]); assert_eq!(undo_steps(&s), before + 1); match &s.active().unwrap().doc.node(id).unwrap().kind { - NodeKind::Text(t) => assert!(t.runs.iter().all(|r| r.style.leading.is_some_and(|l| (l - 14.4).abs() < 1e-9)), "{:?}", t.runs), + NodeKind::Text(t) => { + assert_eq!(t.plain_text(), "abc"); + assert!(!t.runs.is_empty() && t.runs.iter().all(|r| r.style.leading.is_some_and(|l| (l - 14.4).abs() < 1e-9)), "{:?}", t.runs); + } _ => panic!("not text"), } // A fixed leading set to its own value is still no change. @@ -371,7 +374,10 @@ fn turning_auto_leading_off_keeps_each_characters_leading() { assert!(e.contains("autoLeading cannot be turned off"), "{e}"); assert_eq!(undo_steps(&s), before); match &s.active().unwrap().doc.node(id).unwrap().kind { - NodeKind::Text(t) => assert!(t.runs.iter().all(|r| r.style.leading.is_none())), + NodeKind::Text(t) => { + assert_eq!(t.plain_text(), "ab\ncd"); + assert!(!t.runs.is_empty() && t.runs.iter().all(|r| r.style.leading.is_none()), "{:?}", t.runs); + } _ => panic!("not text"), } } diff --git a/crates/engine/src/tests/stylepanel.rs b/crates/engine/src/tests/stylepanel.rs index d414dcbb64..0c2cbeac62 100644 --- a/crates/engine/src/tests/stylepanel.rs +++ b/crates/engine/src/tests/stylepanel.rs @@ -125,9 +125,12 @@ fn override_character_color_clears_the_run_fill() { assert_eq!(run(&mut s, "graphicStyle.setOptions", json!({}))["overrideCharColor"], true); let a = text(&mut s, 100.0); run(&mut s, "paint.setFill", json!({"color": "#ff0000", "ids": [a.0]})); - assert!(runs(&s, a).iter().all(|(f, _)| *f != Paint::None)); + let red = Paint::solid(Color::from_hex("#ff0000").unwrap()); + let painted = runs(&s, a); + assert!(!painted.is_empty() && painted.iter().all(|(f, _)| *f == red), "{painted:?}"); run(&mut s, "graphicStyle.apply", json!({"name": "Blue", "ids": [a.0]})); - assert!(runs(&s, a).iter().all(|(f, st)| *f == Paint::None && *st == Paint::None)); + let styled = runs(&s, a); + assert!(styled.len() == painted.len() && styled.iter().all(|(f, st)| *f == Paint::None && *st == Paint::None), "{styled:?}"); assert_eq!(s.doc().unwrap().doc.node(a).unwrap().appearance.fill_paint(), Paint::solid(Color::from_hex("#0000ff").unwrap())); // Off: they keep it (the style's paint draws over them). assert_eq!(run(&mut s, "graphicStyle.setOptions", json!({"overrideCharColor": false}))["overrideCharColor"], false); diff --git a/crates/engine/src/tests/swatchcmds.rs b/crates/engine/src/tests/swatchcmds.rs index ff02889253..b3d4d075e9 100644 --- a/crates/engine/src/tests/swatchcmds.rs +++ b/crates/engine/src/tests/swatchcmds.rs @@ -722,7 +722,8 @@ fn a_cmyk_document_starts_with_cmyk_swatches_and_stores_new_colours_as_cmyk() { json!({"ids": [a.0], "gradient": {"stops": [{"offset": 0, "color": "#ffffff"}, {"offset": 1, "color": "#0000ff"}]}}), ); let Paint::Gradient(g) = fill(&s, a) else { panic!("a gradient") }; - assert!(g.gradient.stops.iter().all(|st| matches!(st.color, Color::Cmyk { .. }))); + assert_eq!(g.gradient.stops.len(), 2, "{:?}", g.gradient.stops); + assert!(g.gradient.stops.iter().all(|st| matches!(st.color, Color::Cmyk { .. })), "{:?}", g.gradient.stops); // A swatch made from a hex colour is CMYK as well; the document round-trips natively. let name = run(&mut s, "swatch.new", json!({"color": "#00ff00"}))["name"].as_str().unwrap().to_string(); assert_eq!(doc(&s).swatch(&name).and_then(|w| w.paint.color()), Some(managed(Color::rgb(0.0, 1.0, 0.0)))); diff --git a/crates/engine/src/tests/symbollib.rs b/crates/engine/src/tests/symbollib.rs index 19d2333b6e..5b239f27d8 100644 --- a/crates/engine/src/tests/symbollib.rs +++ b/crates/engine/src/tests/symbollib.rs @@ -265,6 +265,7 @@ fn nature_icons_library_places_and_survives_save() { for (i, name) in names.iter().enumerate() { let symbol = &library["symbols"][i]; let size = symbol["size"].as_array().unwrap(); + assert_eq!(size.len(), 2, "{name}: width and height"); assert!(size.iter().all(|n| n.as_f64().is_some_and(|n| n.is_finite() && n > 0.0)), "{name}"); let added = run( &mut s, diff --git a/crates/engine/src/tests/textcombos.rs b/crates/engine/src/tests/textcombos.rs index c0f3ad5ff4..d7a98851e2 100644 --- a/crates/engine/src/tests/textcombos.rs +++ b/crates/engine/src/tests/textcombos.rs @@ -161,7 +161,11 @@ fn auto_height_x_composer() { } s.execute("text.setFormat", &json!({"ids": [id.0], "composer": "singleLine"})).unwrap(); s.execute("text.setStyle", &json!({"id": id.0, "justify": "justifyAll"})).unwrap(); - assert!(text(&s, id).paragraph_styles().iter().all(|p| p.composer == Composer::SingleLine && p.justify == Justify::JustifyAll)); + let t = text(&s, id); + assert_eq!(t.paragraph_count(), 2); + for k in 0..2 { + assert_eq!((t.para_at(k).composer, t.para_at(k).justify), (Composer::SingleLine, Justify::JustifyAll), "paragraph {k}"); + } assert_tight(&s, id, "justified"); } diff --git a/crates/engine/src/tests/textedit.rs b/crates/engine/src/tests/textedit.rs index 96403dcaa0..25324caff6 100644 --- a/crates/engine/src/tests/textedit.rs +++ b/crates/engine/src/tests/textedit.rs @@ -323,7 +323,8 @@ fn optical_set_format_clears_existing_pair_override() { let result = s.execute("text.setFormat", &json!({"ids": [id.0], "kerning": "optical"})).unwrap(); assert_eq!(result["kerning"], "optical"); let t = obj(&s, id); - assert!(t.runs.iter().all(|r| r.style.optical_kerning)); + assert_eq!(t.plain_text(), "III"); + assert!(!t.runs.is_empty() && t.runs.iter().all(|r| r.style.optical_kerning), "{:?}", t.runs); assert!(t.runs.iter().all(|r| r.style.kerning.is_none()), "choosing Optical clears the manual value"); } @@ -488,8 +489,10 @@ fn char_style_range_past_u32_styles_nothing() { let mut s = session(); let id = text(&mut s, "Hello world"); s.execute("charStyle.new", &json!({"name": "Big", "attrs": {"size": 40.0}})).unwrap(); + let before = obj(&s, id); + assert!(!before.runs.is_empty() && before.runs.iter().all(|r| r.style.size == 20.0 && r.style.style_name.is_none()), "{:?}", before.runs); s.execute("charStyle.apply", &json!({"name": "Big", "id": id.0, "start": 1u64 << 32, "end": (1u64 << 32) + 5})).unwrap(); - assert!(obj(&s, id).runs.iter().all(|r| r.style.size == 20.0 && r.style.style_name.is_none()), "{:?}", obj(&s, id).runs); + assert_eq!(obj(&s, id), before, "no character is styled"); } #[test] @@ -2008,7 +2011,8 @@ fn the_eyedropper_styles_the_whole_story_that_select_all_selected() { let r = s.execute("appearance.copyFrom", &json!({"source": source})).unwrap(); assert_eq!(r, json!({"ids": [a.0, b.0]})); for id in [a, b] { - assert!(obj(&s, id).runs.iter().all(|r| (r.style.size - 30.0).abs() < 1e-9), "every character of frame {} takes the size", id.0); + let runs = obj(&s, id).runs; + assert!(!runs.is_empty() && runs.iter().all(|r| (r.style.size - 30.0).abs() < 1e-9), "every character of frame {} takes the size", id.0); } } @@ -2223,7 +2227,8 @@ fn a_type_step_keeps_a_story_that_left_the_edited_frame_selected() { let c = selected_story_moved_into_a_new_frame(&mut s, a, b); // Alt+Right steps the tracking of the selected text, not the kerning at a caret. key(&mut s, ToolKey::Right, Mods { alt: true, ..Mods::default() }); - assert!(obj(&s, c).runs.iter().all(|r| r.style.tracking > 0.0), "every character of the story takes the step"); + let runs = obj(&s, c).runs; + assert!(!runs.is_empty() && runs.iter().all(|r| r.style.tracking > 0.0), "every character of the story takes the step: {runs:?}"); // A key that does nothing leaves it selected as well. key(&mut s, ToolKey::BracketLeft, Mods::default()); assert!(third_frame_highlighted(&mut s)); @@ -2567,6 +2572,7 @@ fn convert_to_text_in_one_frame_leaves_the_other_frames() { let (ta, tb) = (obj(&s, a), obj(&s, b)); assert_eq!(ta.plain_text(), in_a, "the first frame's text is as it was"); assert!(ta.para_at(0).list.is_some(), "the first frame stays a list"); + assert!(tb.paragraph_count() > 1, "{:?}", tb.plain_text()); assert!((0..tb.paragraph_count()).all(|k| tb.para_at(k).list.is_none()), "the edited frame leaves its list"); assert!(tb.plain_text().contains("\u{2022}\t"), "the edited frame holds its bullets as characters"); } @@ -3765,7 +3771,7 @@ fn the_glyph_query_shapes_an_overflowing_character_in_its_paragraph_direction() let boxed = create(&mut s, text, rtl, char_ltr, 30.0); let lay = vectorcraft_text::layout(db, &obj(&s, boxed)); - assert!(lay.glyphs.iter().all(|g| g.byte < 2), "{text:?}: the second paragraph overflows"); + assert!(!lay.glyphs.is_empty() && lay.glyphs.iter().all(|g| g.byte < 2), "{text:?}: only the first paragraph is laid out"); let r = s.execute("text.glyphAlternates", &json!({"id": boxed.0, "start": at})).unwrap(); assert_eq!(r["chosen"], json!(face.glyph_for(drawn)), "{text:?}: the glyph drawn when it fits"); } diff --git a/crates/engine/src/tests/typearea.rs b/crates/engine/src/tests/typearea.rs index 9ada8b7194..7352c99420 100644 --- a/crates/engine/src/tests/typearea.rs +++ b/crates/engine/src/tests/typearea.rs @@ -123,7 +123,8 @@ fn transform_again_after_a_handle_drag_resizes_the_type_area_again() { assert!(near(r.origin(), Point::ZERO) && (r.width() - 640.0 / 3.0).abs() < 1e-6 && (r.height() - 250.0).abs() < 1e-6, "{r:?}"); let t = text(&s, id); assert_eq!(t.xf, Affine::translate((40.0, 40.0)), "the type isn't scaled"); - assert!(t.runs.iter().all(|r| r.style.size == 12.0)); + assert_eq!(t.plain_text(), STORY); + assert!(!t.runs.is_empty() && t.runs.iter().all(|r| r.style.size == 12.0), "{:?}", t.runs); } #[test] diff --git a/crates/engine/src/tests/xform.rs b/crates/engine/src/tests/xform.rs index d455f6ad2f..29d5ccb6ff 100644 --- a/crates/engine/src/tests/xform.rs +++ b/crates/engine/src/tests/xform.rs @@ -1367,6 +1367,7 @@ fn distort_refuses_corners_type_and_symbol_instances_cannot_follow() { let want = [(0.4, 0.0), (0.6, 0.0), (1.0, 1.0), (0.0, 1.0)].map(|(u, v)| Point::new(b.x0 + u * b.width(), b.y0 + v * b.height())); s.execute("object.distort", &json!({ "corners": want.map(|p| [p.x, p.y]) })).unwrap(); let got = drawn_corners(&s, id); + assert_eq!(got.len(), 4, "{got:?}"); assert!(got.iter().zip(want).all(|(g, w)| g.distance(w) < 1e-3), "{got:?} against {want:?}"); } } From e97b699b95b161ebb6811f2f2efdf8b68960094a Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 20:27:27 -0800 Subject: [PATCH 101/112] Tests: folder search tests wait for the walker by handshake, not by sleeping The deadline test and the kept-files test polled the search's progress with a 2 ms sleep until the walker was blocked reading a file, which test-lint rejects. The blocking visitors now send on a channel as their read begins, and the tests wait on that channel instead. --- crates/engine/src/cmd/findfiles/tests.rs | 60 ++++++++++++------------ 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/crates/engine/src/cmd/findfiles/tests.rs b/crates/engine/src/cmd/findfiles/tests.rs index 923054a86f..65a7d12edf 100644 --- a/crates/engine/src/cmd/findfiles/tests.rs +++ b/crates/engine/src/cmd/findfiles/tests.rs @@ -30,19 +30,29 @@ impl Visitor for Names { } } -/// Reads every file, and waits on reading one until its channel sends or closes. -struct Blocked(Mutex<mpsc::Receiver<()>>); +/// Reads every file, says on its second channel that a read began, and waits on reading one until +/// its first channel sends or closes. +struct Blocked(Mutex<mpsc::Receiver<()>>, mpsc::Sender<()>); impl Visitor for Blocked { fn wants(&self, _: &str) -> bool { true } fn items(&self, _: &Path) -> Vec<usize> { + let _ = self.1.send(()); let _ = self.0.lock().unwrap().recv(); vec![] } } +/// A [`Blocked`] visitor with the sender that lets its reads end and the receiver that hears each +/// read begin. +fn blocked() -> (mpsc::Sender<()>, mpsc::Receiver<()>, Arc<dyn Visitor>) { + let (go, wait_for_go) = mpsc::channel(); + let (entered, reading) = mpsc::channel(); + (go, reading, Arc::new(Blocked(Mutex::new(wait_for_go), entered))) +} + /// A test's folder tree, removed with everything in it when dropped, also when the test panics, /// and also when the test locked a folder in it. A removal that fails (a walker still holding a /// file open) is ignored. @@ -316,14 +326,11 @@ fn the_search_ends_at_its_limits_and_when_stopped() { #[test] fn the_search_answers_at_its_deadline_while_a_walker_is_blocked() { let root = tree("blocked", &["f.ttf"]); - let (tx, rx) = mpsc::channel(); + let (tx, reading, visitor) = blocked(); let started = Instant::now(); - let s = begin(root.clone(), rules(&root), Limits::default(), 1, 1, Arc::new(Blocked(Mutex::new(rx)))); + let s = begin(root.clone(), rules(&root), Limits::default(), 1, 1, visitor); // The walker is blocked reading the file. - let until = Instant::now() + WAIT; - while s.progress().read == 0 && Instant::now() < until { - std::thread::sleep(Duration::from_millis(2)); - } + assert!(reading.recv_timeout(WAIT).is_ok(), "the walker reads the file"); assert_eq!((s.progress().state(), s.progress().read), ("searching", 1)); s.expire(); let p = s.progress(); @@ -333,23 +340,21 @@ fn the_search_answers_at_its_deadline_while_a_walker_is_blocked() { assert!(p.seconds <= waited, "{p:?}, {waited} s"); assert_eq!(s.progress().seconds, p.seconds, "the time it ended at stays"); // A limit of no seconds has run out as the search starts; a long one hasn't. - let (_tx0, rx0) = mpsc::channel(); - let none = begin(root.clone(), rules(&root), Limits { seconds: 0.0, ..Limits::default() }, 1, 1, Arc::new(Blocked(Mutex::new(rx0)))); + let (_tx0, _, visitor) = blocked(); + let none = begin(root.clone(), rules(&root), Limits { seconds: 0.0, ..Limits::default() }, 1, 1, visitor); assert_eq!(none.progress().stopped(), Some("time")); - let (tx2, rx2) = mpsc::channel(); - let s2 = begin(root.clone(), rules(&root), Limits::default(), 1, 1, Arc::new(Blocked(Mutex::new(rx2)))); - let until = Instant::now() + WAIT; - while s2.progress().read == 0 && Instant::now() < until { - std::thread::sleep(Duration::from_millis(2)); - } + let (tx2, reading2, visitor) = blocked(); + let s2 = begin(root.clone(), rules(&root), Limits::default(), 1, 1, visitor); + assert!(reading2.recv_timeout(WAIT).is_ok(), "the walker reads the file"); assert_eq!(s2.progress().state(), "searching"); s2.stop(); assert_eq!(s2.progress().stopped(), Some("stop")); drop((tx, tx2)); } -/// Every file is item 0; reading the second file waits until the channel closes. -struct SecondBlocks(Mutex<(usize, mpsc::Receiver<()>)>); +/// Every file is item 0; reading the second file says so on the second channel, then waits until +/// the first channel closes. +struct SecondBlocks(Mutex<(usize, mpsc::Receiver<()>)>, mpsc::Sender<()>); impl Visitor for SecondBlocks { fn wants(&self, _: &str) -> bool { @@ -359,6 +364,7 @@ impl Visitor for SecondBlocks { let mut read = self.0.lock().unwrap(); read.0 += 1; if read.0 == 2 { + let _ = self.1.send(()); let _ = read.1.recv(); } vec![0] @@ -371,11 +377,9 @@ impl Visitor for SecondBlocks { fn files_found_are_kept_as_they_are_read() { let root = tree("kept", &["a.ttf", "b.ttf", "c.ttf"]); let (tx, rx) = mpsc::channel(); - let s = begin(root.clone(), rules(&root), Limits::default(), 1, 2, Arc::new(SecondBlocks(Mutex::new((0, rx))))); - let until = Instant::now() + WAIT; - while s.progress().read < 2 && Instant::now() < until { - std::thread::sleep(Duration::from_millis(2)); - } + let (second, reading_second) = mpsc::channel(); + let s = begin(root.clone(), rules(&root), Limits::default(), 1, 2, Arc::new(SecondBlocks(Mutex::new((0, rx)), second))); + assert!(reading_second.recv_timeout(WAIT).is_ok(), "the walker reads a second file"); let p = s.progress(); assert_eq!((p.state(), p.hits.len()), ("searching", 1), "{p:?}"); s.stop(); @@ -538,16 +542,12 @@ fn system_roots_and_homes_are_told_by_what_they_hold() { fn a_search_starts_with_the_threads_left_and_fails_when_none_is() { static POOL: Pool = Pool::new(3); let root = tree("pool", &["f.ttf"]); - let blocked = || { - let (tx, rx) = mpsc::channel(); - (tx, Arc::new(Blocked(Mutex::new(rx))) as Arc<dyn Visitor>) - }; - let (tx_a, a) = blocked(); - let (tx_b, b) = blocked(); + let (tx_a, _, a) = blocked(); + let (tx_b, _, b) = blocked(); let a = start_in(&POOL, root.clone(), Some(rules(&root)), Limits::default(), 2, 1, a).unwrap(); let b = start_in(&POOL, root.clone(), Some(rules(&root)), Limits::default(), 4, 1, b).unwrap(); assert_eq!(POOL.live(), 3); - let (_, c) = blocked(); + let (_, _, c) = blocked(); let c = start_in(&POOL, root.clone(), Some(rules(&root)), Limits::default(), 1, 1, c); assert_eq!(c.err().as_deref(), Some("the search couldn't start: try again in a moment")); drop((tx_a, tx_b)); From b354c29de042dbecdef919a184b93ae223c0d26a Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 20:31:43 -0800 Subject: [PATCH 102/112] Type: Make Numbers Sequence keeps a seeded order and its doc line names skipped objects A new test runs the same eight objects with seed 11, an end and removeUnused in two fresh sessions and checks that each object gets the same number and the same objects are removed. The progress doc line says that in numbers and placeholder modes objects without a match are skipped before ordering, so they take no number and are never deleted, and that only a run that changes the document makes an undo step. --- .../src/cmd/addons/typetools/numbers/tests.rs | 17 +++++++++++++++++ docs/target-app-parity.md | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/cmd/addons/typetools/numbers/tests.rs b/crates/engine/src/cmd/addons/typetools/numbers/tests.rs index 148ce58423..e7d51d47b4 100644 --- a/crates/engine/src/cmd/addons/typetools/numbers/tests.rs +++ b/crates/engine/src/cmd/addons/typetools/numbers/tests.rs @@ -201,6 +201,23 @@ fn shuffle_with_an_end_can_number_any_object() { assert_eq!(numbered, [true; 6], "every object is numbered for some seed"); } +#[test] +fn the_same_seed_numbers_and_removes_the_same_objects() { + let run = || { + let mut s = session(); + let ids: Vec<NodeId> = (0..8).map(|i| text_at(&mut s, 40.0, 40.0 + 40.0 * f64::from(i), "x")).collect(); + let all = json!(ids.iter().map(|id| id.0).collect::<Vec<_>>()); + let out = s.execute(C, &json!({"ids": all, "shuffle": true, "seed": 11, "end": 4, "removeUnused": true})).unwrap(); + let texts: Vec<Option<String>> = ids.iter().map(|id| s.doc().unwrap().doc.node(*id).map(|_| plain(&s, *id))).collect(); + let removed: Vec<usize> = + out["removed"].as_array().unwrap().iter().map(|r| ids.iter().position(|id| Some(id.0) == r.as_u64()).unwrap()).collect(); + (texts, removed) + }; + let (texts, removed) = run(); + assert_eq!(removed.len(), 4); + assert_eq!(run(), (texts, removed), "seed 11 gives each object the same number and removes the same ones"); +} + fn group_of(s: &mut Session, ids: &[NodeId]) -> NodeId { s.execute("select.set", &json!({"ids": ids.iter().map(|id| id.0).collect::<Vec<_>>()})).unwrap(); s.execute("object.group", &json!({})).unwrap(); diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 5d393da658..05bd550b11 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -3192,7 +3192,7 @@ A VectorCraft addition, not a feature of the reference app (it has no command fo ## Type Tools add-on: Make Numbers Sequence (2026-12-01) -A VectorCraft addition, so no area score moves. Object › Plug-ins › Type Tools › Make Numbers Sequence… numbers the selected type objects from a start value by a step, optionally stopping at an end value, and each number replaces the whole text, every number in it, or every `{%n}` placeholder (#10448). The objects are taken in stacking order, by rows or by columns, or in a seeded random order, with optional leading and trailing zeros, and the objects past the end can be deleted. Locked and hidden type is left alone, a clipping mask is not deleted, threaded type and bad parameters are refused, and the run is one undo step from a dialog with Preview. It is based on Sergey Osokin's MIT-licensed MakeNumbersSequence script. Tests: `cmd::addons::typetools::numbers::tests` in `vectorcraft-engine`, `addons::typetools::numbers::tests` in `vectorcraft-ui-egui` and `command_sweep`. Commands: `docs/mcp.md` › Type Tools add-on. +A VectorCraft addition, so no area score moves. Object › Plug-ins › Type Tools › Make Numbers Sequence… numbers the selected type objects from a start value by a step, optionally stopping at an end value, and each number replaces the whole text, every number in it, or every `{%n}` placeholder (#10448). The objects are taken in stacking order, by rows or by columns, or in a seeded random order, with optional leading and trailing zeros, and the objects past the end can be deleted. When numbers or placeholders are replaced, objects that hold none are skipped before the ordering, so they take no number and are never deleted. Locked and hidden type is left alone, a clipping mask is not deleted, and threaded type and bad parameters are refused. A run that changes the document is one undo step, and a run that changes nothing makes none. The dialog has Preview. It is based on Sergey Osokin's MIT-licensed MakeNumbersSequence script. Tests: `cmd::addons::typetools::numbers::tests` in `vectorcraft-engine`, `addons::typetools::numbers::tests` in `vectorcraft-ui-egui` and `command_sweep`. Commands: `docs/mcp.md` › Type Tools add-on. ## Unit Converter add-on (2026-11-14) From a7e5bcbaba72bb29e4843ead00a1f45019023c4d Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 20:39:46 -0800 Subject: [PATCH 103/112] Dependencies: pin craft-libs at 77ade517 storytold/craft-libs#4634 merged as b942e743. Every craft-libs rev in Cargo.toml, apps/vectorcraft-web/Cargo.toml, Cargo.lock and xtask/src/pdf_deps.rs moves from 965c7bee to craft-libs main at 77ade517, which contains that merge. The egui revs move from 07c20531 to 861d60a6, the revs craft-libs pins at 77ade517. winit stays at 0dfcec0e. --- Cargo.lock | 194 ++++++++++++++++---------------- Cargo.toml | 98 ++++++++-------- apps/vectorcraft-web/Cargo.toml | 2 +- xtask/src/pdf_deps.rs | 2 +- 4 files changed, 148 insertions(+), 148 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a398edf733..d0216e2962 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1231,7 +1231,7 @@ dependencies = [ [[package]] name = "craft" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-automation", "craft-behavior", @@ -1272,7 +1272,7 @@ dependencies = [ [[package]] name = "craft-affinity" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "crc32fast", "flate2", @@ -1283,7 +1283,7 @@ dependencies = [ [[package]] name = "craft-appkit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "block2 0.6.2", "objc2 0.6.5", @@ -1295,7 +1295,7 @@ dependencies = [ [[package]] name = "craft-atomic" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "rustix 1.1.6", ] @@ -1303,7 +1303,7 @@ dependencies = [ [[package]] name = "craft-automation" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -1328,7 +1328,7 @@ dependencies = [ [[package]] name = "craft-behavior" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "accesskit", "bitflags 2.13.2", @@ -1346,7 +1346,7 @@ dependencies = [ [[package]] name = "craft-browse" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-docpath", @@ -1364,7 +1364,7 @@ dependencies = [ [[package]] name = "craft-cdr" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "crc32fast", "flate2", @@ -1373,7 +1373,7 @@ dependencies = [ [[package]] name = "craft-cloud-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "egui", ] @@ -1381,7 +1381,7 @@ dependencies = [ [[package]] name = "craft-cms" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "md-5", "rayon", @@ -1390,12 +1390,12 @@ dependencies = [ [[package]] name = "craft-codepage" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" [[package]] name = "craft-color-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-cms", @@ -1415,7 +1415,7 @@ dependencies = [ [[package]] name = "craft-control" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-control-protocol", "craft-platform", @@ -1426,7 +1426,7 @@ dependencies = [ [[package]] name = "craft-control-protocol" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "getrandom 0.3.4", "serde_json", @@ -1436,7 +1436,7 @@ dependencies = [ [[package]] name = "craft-dds" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "rayon", ] @@ -1444,7 +1444,7 @@ dependencies = [ [[package]] name = "craft-dialogs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "block2 0.6.2", "craft-appkit", @@ -1470,7 +1470,7 @@ dependencies = [ [[package]] name = "craft-doc" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "blake3", "craft-ecproj-format", @@ -1486,7 +1486,7 @@ dependencies = [ [[package]] name = "craft-docpath" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "serde", ] @@ -1494,7 +1494,7 @@ dependencies = [ [[package]] name = "craft-draw" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1513,7 +1513,7 @@ dependencies = [ [[package]] name = "craft-dxf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-codepage", "encoding_rs", @@ -1525,7 +1525,7 @@ dependencies = [ [[package]] name = "craft-ecproj-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "serde", "serde_json", @@ -1535,12 +1535,12 @@ dependencies = [ [[package]] name = "craft-eps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "fontique", "harfrust 0.13.3", @@ -1555,7 +1555,7 @@ dependencies = [ [[package]] name = "craft-font-manager" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -1574,7 +1574,7 @@ dependencies = [ [[package]] name = "craft-font-os-windows" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "windows-registry", "windows-sys 0.61.2", @@ -1583,7 +1583,7 @@ dependencies = [ [[package]] name = "craft-font-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "cap-primitives", "craft-atomic", @@ -1606,12 +1606,12 @@ dependencies = [ [[package]] name = "craft-fonts-build" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" [[package]] name = "craft-gif" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "gif", ] @@ -1619,7 +1619,7 @@ dependencies = [ [[package]] name = "craft-gzip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "flate2", ] @@ -1627,7 +1627,7 @@ dependencies = [ [[package]] name = "craft-host" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "bitflags 2.13.2", "craft-i18n", @@ -1640,7 +1640,7 @@ dependencies = [ [[package]] name = "craft-i18n" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "brotli 9.1.3", "brotli-decompressor 6.3.2", @@ -1670,7 +1670,7 @@ dependencies = [ [[package]] name = "craft-image-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-dds", "craft-jpeg", @@ -1697,7 +1697,7 @@ dependencies = [ [[package]] name = "craft-imaging" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1715,7 +1715,7 @@ dependencies = [ [[package]] name = "craft-jpeg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "thiserror 2.0.21", ] @@ -1723,7 +1723,7 @@ dependencies = [ [[package]] name = "craft-jxl" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "brotli-decompressor 5.0.3", "jixel", @@ -1734,7 +1734,7 @@ dependencies = [ [[package]] name = "craft-keymap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-host", "craft-i18n", @@ -1749,7 +1749,7 @@ dependencies = [ [[package]] name = "craft-layers" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-i18n", @@ -1763,7 +1763,7 @@ dependencies = [ [[package]] name = "craft-menu" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-host", @@ -1781,7 +1781,7 @@ dependencies = [ [[package]] name = "craft-metadata" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "brotli-decompressor 6.3.2", "chrono", @@ -1793,7 +1793,7 @@ dependencies = [ [[package]] name = "craft-metafile" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "encoding_rs", "image", @@ -1804,7 +1804,7 @@ dependencies = [ [[package]] name = "craft-mime" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "chrono", "craft-codepage", @@ -1814,7 +1814,7 @@ dependencies = [ [[package]] name = "craft-nightly" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "uds_windows", "winsafe", @@ -1823,7 +1823,7 @@ dependencies = [ [[package]] name = "craft-pages" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-keymap", @@ -1839,7 +1839,7 @@ dependencies = [ [[package]] name = "craft-pcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "flate2", "serde", @@ -1850,7 +1850,7 @@ dependencies = [ [[package]] name = "craft-pdf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "hayro-interpret", "hayro-syntax", @@ -1862,7 +1862,7 @@ dependencies = [ [[package]] name = "craft-platform" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "async-channel", "async-io", @@ -1895,7 +1895,7 @@ dependencies = [ [[package]] name = "craft-plotter" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "kurbo 0.13.1", "thiserror 2.0.21", @@ -1904,7 +1904,7 @@ dependencies = [ [[package]] name = "craft-print" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-host", @@ -1928,7 +1928,7 @@ dependencies = [ [[package]] name = "craft-proof" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "log", "miniz_oxide 0.9.1", @@ -1939,7 +1939,7 @@ dependencies = [ [[package]] name = "craft-ps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-eps", "flate2", @@ -1953,7 +1953,7 @@ dependencies = [ [[package]] name = "craft-psd" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "encoding_rs", "flate2", @@ -1964,7 +1964,7 @@ dependencies = [ [[package]] name = "craft-quit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "dispatch2", "egui", @@ -1977,7 +1977,7 @@ dependencies = [ [[package]] name = "craft-review" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -1996,7 +1996,7 @@ dependencies = [ [[package]] name = "craft-settings" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-atomic", "craft-host", @@ -2013,7 +2013,7 @@ dependencies = [ [[package]] name = "craft-stream-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "fax", "hayro-ccitt", @@ -2024,7 +2024,7 @@ dependencies = [ [[package]] name = "craft-svg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-image-codecs", "craft-xml", @@ -2045,7 +2045,7 @@ dependencies = [ [[package]] name = "craft-table" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-keymap", @@ -2057,7 +2057,7 @@ dependencies = [ [[package]] name = "craft-text" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-font-manager", @@ -2082,7 +2082,7 @@ dependencies = [ [[package]] name = "craft-theme" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "bitflags 2.13.2", "craft-tracked", @@ -2097,7 +2097,7 @@ dependencies = [ [[package]] name = "craft-theme-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-atomic", "craft-behavior", @@ -2112,7 +2112,7 @@ dependencies = [ [[package]] name = "craft-tiff" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "serde", "thiserror 2.0.21", @@ -2122,7 +2122,7 @@ dependencies = [ [[package]] name = "craft-time" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "serde", "thiserror 2.0.21", @@ -2131,7 +2131,7 @@ dependencies = [ [[package]] name = "craft-timeline" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-keymap", @@ -2146,12 +2146,12 @@ dependencies = [ [[package]] name = "craft-tracked" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" [[package]] name = "craft-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-cloud-ui", "craft-ui-canvas", @@ -2165,7 +2165,7 @@ dependencies = [ [[package]] name = "craft-ui-canvas" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -2182,7 +2182,7 @@ dependencies = [ [[package]] name = "craft-ui-contract" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "accesskit", "craft-behavior", @@ -2220,7 +2220,7 @@ dependencies = [ [[package]] name = "craft-ui-macros" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2231,7 +2231,7 @@ dependencies = [ [[package]] name = "craft-ui-panels" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-host", @@ -2249,7 +2249,7 @@ dependencies = [ [[package]] name = "craft-ui-patterns" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-host", @@ -2270,7 +2270,7 @@ dependencies = [ [[package]] name = "craft-ui-shell" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-host", @@ -2291,7 +2291,7 @@ dependencies = [ [[package]] name = "craft-ui-widgets" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-host", @@ -2310,7 +2310,7 @@ dependencies = [ [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "base64 0.22.1", "chrono", @@ -2342,7 +2342,7 @@ dependencies = [ [[package]] name = "craft-vectorcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "flate2", "serde", @@ -2353,7 +2353,7 @@ dependencies = [ [[package]] name = "craft-wayland" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "raw-window-handle", "wayland-backend", @@ -2363,7 +2363,7 @@ dependencies = [ [[package]] name = "craft-web-api" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "js-sys", "serde_json", @@ -2374,7 +2374,7 @@ dependencies = [ [[package]] name = "craft-win32" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "winsafe", ] @@ -2382,7 +2382,7 @@ dependencies = [ [[package]] name = "craft-window" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-appkit", "craft-atomic", @@ -2414,7 +2414,7 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "quick-xml 0.41.0", "serde", @@ -2759,7 +2759,7 @@ checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" [[package]] name = "ecolor" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" +source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6" dependencies = [ "bytemuck", "emath", @@ -2792,7 +2792,7 @@ dependencies = [ [[package]] name = "eframe" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" +source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6" dependencies = [ "ahash", "bytemuck", @@ -2827,7 +2827,7 @@ dependencies = [ [[package]] name = "egui" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" +source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6" dependencies = [ "accesskit", "ahash", @@ -2846,7 +2846,7 @@ dependencies = [ [[package]] name = "egui-wgpu" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" +source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6" dependencies = [ "ahash", "bytemuck", @@ -2865,7 +2865,7 @@ dependencies = [ [[package]] name = "egui-winit" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" +source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6" dependencies = [ "accesskit_winit", "arboard", @@ -2890,7 +2890,7 @@ dependencies = [ [[package]] name = "egui_extras" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" +source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6" dependencies = [ "ahash", "egui", @@ -2904,7 +2904,7 @@ dependencies = [ [[package]] name = "egui_glow" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" +source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6" dependencies = [ "bytemuck", "egui", @@ -2917,7 +2917,7 @@ dependencies = [ [[package]] name = "egui_kittest" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" +source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6" dependencies = [ "dify", "eframe", @@ -2943,7 +2943,7 @@ checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" [[package]] name = "emath" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" +source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6" dependencies = [ "bytemuck", ] @@ -3024,7 +3024,7 @@ dependencies = [ [[package]] name = "epaint" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" +source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6" dependencies = [ "ahash", "bytemuck", @@ -3050,7 +3050,7 @@ dependencies = [ [[package]] name = "epaint_default_fonts" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" +source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6" dependencies = [ "brotli 9.1.3", "brotli-decompressor 6.3.2", @@ -3773,7 +3773,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a" [[package]] name = "hayro-cmap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "brotli 8.0.4", "hayro-postscript", @@ -3782,7 +3782,7 @@ dependencies = [ [[package]] name = "hayro-interpret" version = "0.7.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "bitflags 2.13.2", "hayro-cmap", @@ -3800,7 +3800,7 @@ dependencies = [ [[package]] name = "hayro-jbig2" version = "0.3.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "fearless_simd", "hayro-ccitt", @@ -3818,12 +3818,12 @@ dependencies = [ [[package]] name = "hayro-postscript" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" [[package]] name = "hayro-syntax" version = "0.7.2" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "flate2", "hayro-ccitt", @@ -4806,7 +4806,7 @@ dependencies = [ [[package]] name = "krilla" version = "0.8.2" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "base64 0.22.1", "bumpalo", @@ -4963,7 +4963,7 @@ checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" [[package]] name = "linesweeper" version = "0.5.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "arrayvec", "kurbo 0.13.1", diff --git a/Cargo.toml b/Cargo.toml index fcc2a1ad8f..843f9cbb53 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,51 +10,51 @@ license = "MIT OR Apache-2.0" rust-version = "1.95" [workspace.dependencies] -craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6", default-features = false, features = ["interpret", "write"] } -craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6", default-features = false, features = ["interpret", "write"] } +craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # Language packs: the Craft apps' shared font store installs them (#4936). -craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # The `.vectorcraft` envelope: its members, version, embedded images and the data after the JSON. -craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # `.pcraft` documents: their manifest, full-size composite, preview, layer pixels and ICC profile. -craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6", features = ["pcraft-pixels"] } +craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6", features = ["pcraft-pixels"] } # Native Affinity documents (craft-libs#914). -craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # Bounded CDR (v1-v27) and CMX (32-bit) reader (craft-libs#778). -craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # SVG parsing, limits, SVGZ and writer (craft-libs#778). -craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6", features = ["tree"] } -craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6", features = ["tree"] } +craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # EPS container, previews, ASCII85 and DSC comments (craft-libs#778). -craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # DXF tags, reader and writer (craft-libs#778, #926, #927). -craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # WMF, EMF and EMF+ reader (craft-libs#778). -craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6", default-features = false, features = ["read", "write"] } -craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6", default-features = false, features = ["read", "write"] } +craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # The framework facade (`craft::ui`, `craft::settings`, `craft::platform`, ...). No default features: each crate names # the members it imports. -craft = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # Below the egui layer, so not through the facade: the colour harmony rules and their settings (craft-color-ui # without its `ui` feature), the colour type they work in, and the craft-fonts tables the text crate's build writes. -craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # Nightly profile isolation, launch protocol, and security fence. -craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # internal vectorcraft-geom = { path = "crates/geom" } vectorcraft-color = { path = "crates/color" } @@ -194,22 +194,22 @@ lto = "thin" codegen-units = 1 [patch.crates-io] -hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -krilla = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -ecolor = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } -emath = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } -epaint = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } -epaint_default_fonts = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } -egui = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } -egui-winit = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } -egui-wgpu = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } -egui_glow = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } -egui_extras = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } -egui_kittest = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } -eframe = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } +hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +krilla = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +ecolor = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } +emath = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } +epaint = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } +epaint_default_fonts = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } +egui = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } +egui-winit = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } +egui-wgpu = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } +egui_glow = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } +egui_extras = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } +egui_kittest = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } +eframe = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } winit = { git = "https://github.com/storytold/winit.git", rev = "0dfcec0eb62fda5904137a63a6dd0c3d83295f45" } diff --git a/apps/vectorcraft-web/Cargo.toml b/apps/vectorcraft-web/Cargo.toml index 824600f90a..70aae32f73 100644 --- a/apps/vectorcraft-web/Cargo.toml +++ b/apps/vectorcraft-web/Cargo.toml @@ -28,7 +28,7 @@ egui_extras = { workspace = true } # `wgpu` pulls egui-wgpu's defaults: WebGPU plus the WebGL2 fallback. eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit"] } # The page command API (storytold/craft-libs#413): the request plumbing behind window.vectorcraft. -craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6", version = "0.1.0" } +craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6", version = "0.1.0" } wasm-bindgen = "0.2" serde_json = { workspace = true } diff --git a/xtask/src/pdf_deps.rs b/xtask/src/pdf_deps.rs index 337ba6325e..542a3e8c41 100644 --- a/xtask/src/pdf_deps.rs +++ b/xtask/src/pdf_deps.rs @@ -5,7 +5,7 @@ use std::process::Command; use serde_json::Value; -const REV: &str = "965c7beeb6076480e016e448bddddcce0a738ff6"; +const REV: &str = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6"; const PACKAGES: &[(&str, &str, &str)] = &[ ("craft-pdf", "0.1.0", REV), ("krilla", "0.8.2", REV), From 70d70ca909b61eb26566f0b7e48bac07b79bbdc1 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 21:09:17 -0800 Subject: [PATCH 104/112] Scripts: width, height and position setters measure after the document comes to the front Setting width, height, left, top or position on an item in a document in the back measured the item before its document was made active. Making a document active measures its type again where it is not measured yet or where a composite font of the same name changed, so the scale ratio or the move distance applied to bounds that no longer held, and the item ended at a different size or place than the one asked for. The measurement now runs inside the edit, after the switch, through a new edit_item_with that edit_item also uses. --- crates/engine/src/script/dom.rs | 56 +++++++++++++++++---------- crates/engine/src/tests/script_dom.rs | 31 +++++++++++++++ 2 files changed, 66 insertions(+), 21 deletions(-) diff --git a/crates/engine/src/script/dom.rs b/crates/engine/src/script/dom.rs index ec258ffae2..b29b037908 100644 --- a/crates/engine/src/script/dom.rs +++ b/crates/engine/src/script/dom.rs @@ -975,9 +975,16 @@ pub(super) fn after_kept_command(h: &Host) { /// selection cannot be put back, the edit is undone too. The points the run read of the item's /// paths stay valid through the change ([`paths::see_all_points`]). fn edit_item(h: &Host, item: Item, id: &str, params: &Value) -> std::result::Result<Data, HostError> { + edit_item_with(h, item, |h| command(h, id, params)) +} + +/// Runs `f` on the item's document as [`edit_item`] runs its command. `f` runs after the document +/// is made active, so bounds it reads take in type that the switch measured again (in the +/// document's own composite fonts, [`Session::set_active`]). +fn edit_item_with<T>(h: &Host, item: Item, f: impl FnOnce(&Host) -> std::result::Result<T, HostError>) -> std::result::Result<T, HostError> { paths::see_all_points(h); let kept = h.dom.editing.replace(Some(item)); - let r = atomically(h, |h| on_doc(h, item.doc.uid, true, |h| command(h, id, params))); + let r = atomically(h, |h| on_doc(h, item.doc.uid, true, f)); h.dom.editing.set(kept); r } @@ -2549,14 +2556,18 @@ fn move_to(h: &Host, a: &[Data], x: Option<f64>, y: Option<f64>) -> Answer { let item = this_item(h, a)?; refuse_protected_edit(h, item)?; selection_ids(h, item.doc, arg(a, 0))?; - let (Some(r), f) = item_rect(h, item, false)? else { return Ok(Data::Undefined) }; - let c = h.dom.coords.get(); - let now = f.to_script(c, Point::new(r.x0, r.y0)); - let to = f.to_document(c, [x.unwrap_or(now[0]), y.unwrap_or(now[1])]); - let (dx, dy) = (to.x - r.x0, to.y - r.y0); - if dx.abs() > 1e-9 || dy.abs() > 1e-9 { - edit_item(h, item, "object.move", &json!({"ids": [item.id.0], "dx": dx, "dy": dy}))?; - } + // Measured once the document is active. + edit_item_with(h, item, |h| { + let (Some(r), f) = item_rect(h, item, false)? else { return Ok(()) }; + let c = h.dom.coords.get(); + let now = f.to_script(c, Point::new(r.x0, r.y0)); + let to = f.to_document(c, [x.unwrap_or(now[0]), y.unwrap_or(now[1])]); + let (dx, dy) = (to.x - r.x0, to.y - r.y0); + if dx.abs() > 1e-9 || dy.abs() > 1e-9 { + command(h, "object.move", &json!({"ids": [item.id.0], "dx": dx, "dy": dy}))?; + } + Ok(()) + })?; Ok(Data::Undefined) } @@ -2590,18 +2601,21 @@ fn resize(h: &Host, a: &[Data], width: bool) -> Answer { } refuse_protected_edit(h, item)?; selection_ids(h, item.doc, arg(a, 0))?; - let (Some(r), _) = item_rect(h, item, false)? else { return Ok(Data::Undefined) }; - let now = if width { r.width() } else { r.height() }; - if now <= 0.0 { - return Err(HostError::Error(format!("the object has no {what} to scale"))); - } - if (now - size).abs() < 1e-9 { - return Ok(Data::Undefined); - } - let pct = size / now * 100.0; - let (sx, sy) = if width { (pct, 100.0) } else { (100.0, pct) }; - let p = json!({"ids": [item.id.0], "sx": sx, "sy": sy, "origin": [r.x0, r.y0], "basis": "page"}); - edit_item(h, item, "object.scale", &p)?; + // Measured once the document is active, so the ratio applies to the bounds the scale works on. + edit_item_with(h, item, |h| { + let (Some(r), _) = item_rect(h, item, false)? else { return Ok(()) }; + let now = if width { r.width() } else { r.height() }; + if now <= 0.0 { + return Err(HostError::Error(format!("the object has no {what} to scale"))); + } + if (now - size).abs() < 1e-9 { + return Ok(()); + } + let pct = size / now * 100.0; + let (sx, sy) = if width { (pct, 100.0) } else { (100.0, pct) }; + command(h, "object.scale", &json!({"ids": [item.id.0], "sx": sx, "sy": sy, "origin": [r.x0, r.y0], "basis": "page"}))?; + Ok(()) + })?; Ok(Data::Undefined) } diff --git a/crates/engine/src/tests/script_dom.rs b/crates/engine/src/tests/script_dom.rs index 74311f240f..f731eef72d 100644 --- a/crates/engine/src/tests/script_dom.rs +++ b/crates/engine/src/tests/script_dom.rs @@ -155,6 +155,37 @@ fn page_item_size_setters_on_a_rotated_object_give_the_page_aligned_size() { assert_eq!(format!("{:?}", s.active().unwrap().doc.node(b)), other, "the other object stays as it was"); } +/// Type in a document in the back that the switch to that document measures again (here: not +/// measured yet) is sized and moved by the bounds measured after the switch. +#[test] +fn page_item_size_and_position_setters_measure_type_in_a_back_document_after_the_switch() { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 400, "height": 300})).unwrap(); + let id = NodeId(s.execute("text.create", &json!({"x": 10, "y": 100, "text": "Wide type here", "size": 40})).unwrap()["id"].as_u64().unwrap()); + let uid = s.active().unwrap().uid; + s.execute("file.new", &json!({"width": 200, "height": 100})).unwrap(); + let front = s.active().unwrap().uid; + let unmeasure = |s: &mut Session| { + let st = s.document_mut(uid).unwrap(); + if let Some(NodeKind::Text(t)) = std::sync::Arc::make_mut(&mut st.doc).node_mut(id).map(|n| &mut n.kind) { + t.cached_bounds = None; + t.cached_baselines.clear(); + } + }; + let mut got = Vec::new(); + for (set, want) in + [("t.width = 150; vc.log(t.width);", 150.0), ("t.height = 90; vc.log(t.height);", 90.0), ("t.top = 200; vc.log(t.top);", 200.0)] + { + unmeasure(&mut s); + let out = log(&mut s, &format!("var t = app.documents[1].pageItems[0]; {set}")); + got.push((set, out[0].as_f64().unwrap(), want)); + } + for (set, got, want) in got { + assert!((got - want).abs() < 1e-6, "{set} read {got}"); + } + assert_eq!(s.active().unwrap().uid, front, "the front document stays in front"); +} + /// `controlBounds` holds a curve's handles, which reach past the curve; for a rectangle it is the /// visible bounds. #[test] From 45bd5bb9675e8f50760b014b38c4bc188a273c83 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 21:19:18 -0800 Subject: [PATCH 105/112] Tests: the plain column drawn for a design past the budget is checked as a rectangle graph_column_params_are_checked_and_designs_too_big_are_drawn_plain checked only the plain column's height, so an ellipse of the same height passed. It now also checks that the column's path is the rectangle of its bounds. --- crates/engine/src/cmd/graph/tests.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/cmd/graph/tests.rs b/crates/engine/src/cmd/graph/tests.rs index 08000b7f1e..b41415ef02 100644 --- a/crates/engine/src/cmd/graph/tests.rs +++ b/crates/engine/src/cmd/graph/tests.rs @@ -7177,8 +7177,11 @@ fn graph_column_params_are_checked_and_designs_too_big_are_drawn_plain() { assert_eq!(marks.iter().filter(|n| sized(n, 8.0)).count(), 1, "a default square as the legend swatch"); let columns: Vec<_> = marks.iter().filter(|n| !sized(n, 8.0)).collect(); assert_eq!(columns.len(), 1, "one plain column for the one value"); - let height = columns[0].geometric_bounds().map(|b| b.height()); + let bounds = columns[0].geometric_bounds(); + let height = bounds.map(|b| b.height()); assert!(height.is_some_and(|h| (h - 140.0).abs() < 1e-6), "the column has the value's height: {height:?}"); + let rectangle = bounds.map(vectorcraft_geom::shapes::rectangle); + assert!(matches!(&columns[0].kind, NodeKind::Path { path, .. } if Some(path) == rectangle.as_ref()), "the plain column is a rectangle"); // Columns of 0 on a value axis from 10,000 to 10,001 run 2,000,000 points from the clamped zero line: a copy each // 0.1 is past the budget too. let far = one_series(&mut s, "column", &[0.0, 0.0]); From 4cb6f8f152ab71560150b90c613268222739b84f Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 22:06:44 -0800 Subject: [PATCH 106/112] Save: checked writes go into the folder that was checked While automation roots or a script's file grants are in force, a save, export or print to a file checked its path and then wrote it by name: the temporary file was created beside the target by name and renamed over it by name. A folder on the path replaced by a link between the check and the rename sent the file outside the allowed folders. vectorcraft_format::write_atomic_checked opens the target's folder once, checks the path that open folder has with the caller's check, and makes the temporary file, the rename, the copy over the file where the folder refuses the rename, and the folder flush through that open folder (openat, renameat, fsync). A folder replaced before it is opened fails the check; one replaced after it is opened does not receive the file. A link put at the final name after the check is replaced, not followed. The replaced file's permissions, group and ACL are copied through the open handles. write_file, write_file_with and write_save_file_with use it while writes are checked, and keep write_atomic_with otherwise. Outside Unix the check runs on the path and the write is unchanged. --- crates/engine/src/cmd/fileio/access.rs | 27 ++- crates/engine/src/file_access.rs | 14 +- crates/format/src/atomic.rs | 291 ++++++++++++++++++++++++- crates/format/src/lib.rs | 2 +- 4 files changed, 316 insertions(+), 18 deletions(-) diff --git a/crates/engine/src/cmd/fileio/access.rs b/crates/engine/src/cmd/fileio/access.rs index 84b8bc1a4f..8691ebb1fb 100644 --- a/crates/engine/src/cmd/fileio/access.rs +++ b/crates/engine/src/cmd/fileio/access.rs @@ -1,5 +1,3 @@ -#[cfg(not(target_arch = "wasm32"))] -use super::write_atomic; use super::{EngineError, Result, Session, Value, bad, json}; // ---------- the file system (none on the web, where commands take and return bytes) ---------- @@ -325,8 +323,25 @@ pub(crate) fn write_file(path: &str, bytes: &[u8]) -> Result<()> { // Work that stops early for a cancel can leave a truncated result: none of it is written. vectorcraft_doc::cancel::check()?; may_write(path)?; - // Never a half-written file: see [`write_atomic`]. - write_atomic(std::path::Path::new(path), bytes).map_err(|e| write_error(path, e)) + // Never a half-written file: see [`vectorcraft_format::write_atomic`]. + write_checked(path, |f| std::io::Write::write_all(f, bytes)).map_err(|e| write_error(path, e)) +} + +/// [`vectorcraft_format::write_atomic_with`] for `path`, which [`may_write`] allowed. While writes +/// are checked ([`crate::file_access::writes_checked`]), the folder that receives the file is +/// checked again as it is opened, and the file goes into that open folder +/// ([`vectorcraft_format::write_atomic_checked`]): a folder on the path that is replaced after the +/// check does not redirect the write. +#[cfg(not(target_arch = "wasm32"))] +fn write_checked(path: &str, fill: impl FnOnce(&mut std::fs::File) -> std::io::Result<()>) -> std::io::Result<()> { + let path = std::path::Path::new(path); + if !crate::file_access::writes_checked() { + return vectorcraft_format::write_atomic_with(path, fill); + } + vectorcraft_format::write_atomic_checked(path, fill, |opened| { + let opened = opened.to_str().ok_or_else(|| std::io::Error::other(format!("{}: path is not valid UTF-8", opened.display())))?; + crate::file_access::check_write_unrecorded(opened).map_err(std::io::Error::other) + }) } /// The error writing `path` failed with: [`EngineError::Cancelled`] for work canceled before the @@ -344,7 +359,7 @@ fn write_error(path: &str, error: std::io::Error) -> EngineError { pub fn write_file_with(path: &str, fill: &mut dyn FnMut(&mut dyn std::io::Write) -> std::io::Result<()>) -> Result<()> { vectorcraft_doc::cancel::check()?; may_write(path)?; - vectorcraft_format::write_atomic_with(std::path::Path::new(path), |f| fill(f)).map_err(|e| write_error(path, e)) + write_checked(path, |f| fill(f)).map_err(|e| write_error(path, e)) } /// The save commands' writer: preserves a filesystem location refusal as a typed error. Other @@ -358,7 +373,7 @@ pub fn write_save_file(path: &str, bytes: &[u8]) -> Result<()> { pub fn write_save_file_with(path: &str, fill: &mut dyn FnMut(&mut dyn std::io::Write) -> std::io::Result<()>) -> Result<()> { vectorcraft_doc::cancel::check()?; may_write(path)?; - vectorcraft_format::write_atomic_with(std::path::Path::new(path), |f| fill(f)).map_err(|e| save_write_error(path, e)) + write_checked(path, |f| fill(f)).map_err(|e| save_write_error(path, e)) } #[cfg(not(target_arch = "wasm32"))] diff --git a/crates/engine/src/file_access.rs b/crates/engine/src/file_access.rs index 7daa75e0ae..bc2acda5e6 100644 --- a/crates/engine/src/file_access.rs +++ b/crates/engine/src/file_access.rs @@ -462,8 +462,7 @@ pub fn is_path_key(key: &str) -> bool { /// May `path` be written here? Always, without roots in force and outside a script's command /// ([`with_script_gate`]). pub fn check_write(path: &str) -> Result<(), String> { - current().map_or(Ok(()), |r| r.check(path, Access::Write))?; - check_gate(path, Access::Write)?; + check_write_unrecorded(path)?; WRITES.with(|w| { if let Some(paths) = w.borrow_mut().as_mut() && !paths.iter().any(|(p, _)| p == path) @@ -474,6 +473,17 @@ pub fn check_write(path: &str) -> Result<(), String> { Ok(()) } +/// [`check_write`] without recording `path` as written. +pub(crate) fn check_write_unrecorded(path: &str) -> Result<(), String> { + current().map_or(Ok(()), |r| r.check(path, Access::Write))?; + check_gate(path, Access::Write) +} + +/// Whether a write here is checked: roots are in force, or a script's command runs. +pub(crate) fn writes_checked() -> bool { + current().is_some() || in_script_command() +} + /// A file's modification time and length; `None` when there is no file at `path`. type Stamp = Option<(Option<std::time::SystemTime>, u64)>; diff --git a/crates/format/src/atomic.rs b/crates/format/src/atomic.rs index f314fcdd15..54a0fe0432 100644 --- a/crates/format/src/atomic.rs +++ b/crates/format/src/atomic.rs @@ -82,6 +82,171 @@ fn create_new(path: &Path) -> io::Result<File> { OpenOptions::new().write(true).create_new(true).open(path) } +/// [`write_atomic_with`] for a `path` the caller has allowed by its name. On Unix the folder that +/// holds the file is opened once, and `allowed` is asked again with the path that open folder has +/// then, joined with the file's name. The temporary file, the replacement, a copy over the file +/// where the folder refuses the replacement, and the folder flush all go through that open folder, +/// and none of them looks its path up again. A folder replaced (or swapped for a link) before it is +/// opened fails `allowed`. A folder replaced after it is opened does not receive the file. A link at +/// the final name is followed once before the folder is opened, as [`write_atomic_with`] follows it; +/// a link put there later is replaced, never followed. Elsewhere this is `allowed(path)` followed by +/// [`write_atomic_with`]. +#[cfg(unix)] +pub fn write_atomic_checked( + path: &Path, + fill: impl FnOnce(&mut File) -> io::Result<()>, + allowed: impl FnOnce(&Path) -> io::Result<()>, +) -> io::Result<()> { + use rustix::fs::{AtFlags, Mode, OFlags}; + let resolved = resolve_link(path)?; + let name = resolved + .file_name() + .ok_or_else(|| io::Error::new(io::ErrorKind::InvalidInput, format!("{}: not a file path", resolved.display())))? + .to_os_string(); + let parent = resolved.parent().filter(|p| !p.as_os_str().is_empty()).unwrap_or_else(|| Path::new(".")); + let dir = rustix::fs::open(parent, OFlags::RDONLY | OFlags::DIRECTORY | OFlags::CLOEXEC, Mode::empty())?; + let target = opened_folder_path(&dir, parent)?.join(&name); + allowed(&target)?; + let old = rustix::fs::statat(&dir, &name, AtFlags::SYMLINK_NOFOLLOW).ok(); + let tmp_name = temp_path(&target)?.file_name().map(std::ffi::OsStr::to_os_string).unwrap_or_default(); + let tmp = target.with_file_name(&tmp_name); + // Replacing a file: owner-only while it is written, as in `write_atomic_with`. + let mode = if old.is_some() { Mode::RUSR | Mode::WUSR } else { Mode::RUSR | Mode::WUSR | Mode::RGRP | Mode::WGRP | Mode::ROTH | Mode::WOTH }; + let new_file = OFlags::WRONLY | OFlags::CREATE | OFlags::EXCL | OFlags::NOFOLLOW | OFlags::CLOEXEC; + let remove_tmp = || { + // Best effort: the temporary file is all there is to clean up. + let _ = rustix::fs::unlinkat(&dir, &tmp_name, AtFlags::empty()); + }; + let synced = + || rustix::fs::fsync(&dir).map_err(|e| io::Error::new(io::Error::from(e).kind(), WrittenError { path: target.clone(), error: e.into() })); + let open_target = |write: bool| -> io::Result<File> { + let flags = if write { OFlags::WRONLY | OFlags::CREATE } else { OFlags::RDONLY }; + Ok(File::from(rustix::fs::openat(&dir, &name, flags | OFlags::NOFOLLOW | OFlags::CLOEXEC, mode)?)) + }; + match rustix::fs::openat(&dir, &tmp_name, new_file, mode).map(File::from) { + Ok(mut f) => { + let filled = fill(&mut f).and_then(|()| sync_file(&f)).and_then(|()| not_cancelled()); + if let Err(e) = filled { + drop(f); + remove_tmp(); + return Err(e); + } + if let Some(old) = &old { + // Best effort, as in `write_atomic_with`. + let _ = keep_permissions_at(&dir, &name, old, &f); + } + drop(f); + let Err(refused) = rustix::fs::renameat(&dir, &tmp_name, &dir, &name) else { return synced() }; + let over = Over { + tmp: &tmp, + old: std::env::temp_dir().join(&tmp_name).with_extension("old"), + open_tmp: &|| { + Ok(File::from(rustix::fs::openat(&dir, &tmp_name, OFlags::RDONLY | OFlags::NOFOLLOW | OFlags::CLOEXEC, Mode::empty())?)) + }, + remove_tmp: &remove_tmp, + open_target: &open_target, + synced: &synced, + }; + write_over_in(&over, refused.into()) + } + // A folder that isn't there, a full volume: nothing can be saved there. + Err(e) if matches!(io::Error::from(e).kind(), io::ErrorKind::NotFound | io::ErrorKind::StorageFull | io::ErrorKind::QuotaExceeded) => { + Err(e.into()) + } + Err(refused) => { + // The folder takes no temporary file: it is written in the system's folder and copied in. + let elsewhere = std::env::temp_dir().join(&tmp_name); + let mut f = create_private(&elsewhere).map_err(|_| io::Error::from(refused))?; + let filled = fill(&mut f).and_then(|()| sync_file(&f)).and_then(|()| not_cancelled()); + drop(f); + let remove = || { + // Best effort: the temporary file is all there is to clean up. + let _ = std::fs::remove_file(&elsewhere); + }; + if let Err(e) = filled { + remove(); + return Err(e); + } + let over = Over { + tmp: &elsewhere, + old: elsewhere.with_extension("old"), + open_tmp: &|| File::open(&elsewhere), + remove_tmp: &remove, + open_target: &open_target, + synced: &synced, + }; + write_over_in(&over, refused.into()) + } + } +} + +/// See the Unix version. +#[cfg(not(unix))] +pub fn write_atomic_checked( + path: &Path, + fill: impl FnOnce(&mut File) -> io::Result<()>, + allowed: impl FnOnce(&Path) -> io::Result<()>, +) -> io::Result<()> { + allowed(path)?; + write_atomic_with(path, fill) +} + +/// The path folder `dir` has now, which `parent` named when it was opened: `parent` with its links +/// followed, when that is still the folder `dir` holds (the same device and inode). A folder +/// replaced in between is an error. +#[cfg(unix)] +fn opened_folder_path(dir: &std::os::fd::OwnedFd, parent: &Path) -> io::Result<PathBuf> { + let real = std::fs::canonicalize(parent)?; + let (open, now) = (rustix::fs::fstat(dir)?, rustix::fs::stat(&real)?); + if (open.st_dev, open.st_ino) != (now.st_dev, now.st_ino) { + return Err(io::Error::new(io::ErrorKind::PermissionDenied, format!("{}: the folder changed while it was opened", parent.display()))); + } + Ok(real) +} + +/// [`keep_permissions`] for the temporary file `tmp`, about to replace `name` in folder `dir`, whose +/// file had the status `old`. A name that does not hold a plain file has none to keep. +#[cfg(unix)] +fn keep_permissions_at(dir: &std::os::fd::OwnedFd, name: &std::ffi::OsStr, old: &rustix::fs::Stat, tmp: &File) -> io::Result<()> { + use rustix::fs::{FileType, Mode}; + if FileType::from_raw_mode(old.st_mode) != FileType::RegularFile { + return Ok(()); + } + let mut mode = Mode::from_raw_mode(old.st_mode); + let gid = rustix::fs::Gid::from_raw(old.st_gid); + let kept_group = rustix::fs::fstat(tmp).is_ok_and(|t| t.st_gid == old.st_gid) || rustix::fs::fchown(tmp, None, Some(gid)).is_ok(); + if !kept_group || !keep_acl_at(dir, name, tmp) { + mode.remove(Mode::RWXG | Mode::RWXO); + } + rustix::fs::fchmod(tmp, mode).map_err(io::Error::from) +} + +/// [`keep_acl`] for `name` in folder `dir`, opened without following a link and without waiting on +/// a pipe put in its place. +#[cfg(target_os = "linux")] +fn keep_acl_at(dir: &std::os::fd::OwnedFd, name: &std::ffi::OsStr, tmp: &File) -> bool { + use rustix::fs::{Mode, OFlags}; + use rustix::io::Errno; + const ACL: &str = "system.posix_acl_access"; + let Ok(target) = rustix::fs::openat(dir, name, OFlags::RDONLY | OFlags::NOFOLLOW | OFlags::NONBLOCK | OFlags::CLOEXEC, Mode::empty()) else { + return false; + }; + let mut buf = vec![0u8; 64 << 10]; + match rustix::fs::fgetxattr(&target, ACL, &mut buf[..]) { + Ok(n) => buf.get(..n).is_some_and(|acl| rustix::fs::fsetxattr(tmp, ACL, acl, rustix::fs::XattrFlags::empty()).is_ok()), + Err(e) if e == Errno::NODATA => match rustix::fs::fremovexattr(tmp, ACL) { + Ok(()) => true, + Err(e) => e == Errno::NODATA || e == Errno::NOTSUP, + }, + Err(e) => e == Errno::NOTSUP, + } +} + +#[cfg(all(unix, not(target_os = "linux")))] +fn keep_acl_at(_: &std::os::fd::OwnedFd, _: &std::ffi::OsStr, _: &File) -> bool { + true +} + /// [`write_atomic_with`], with `create` making the temporary file beside the target and `rename` /// moving it over the target. fn write_atomic_stepping( @@ -130,16 +295,49 @@ fn write_atomic_stepping( /// the copy into `target` fails it is damaged: `tmp` and the copy of the old content stay and the /// error says where they are. fn write_over(tmp: &Path, target: &Path, refused: io::Error) -> io::Result<()> { - let opened = File::open(tmp).and_then(|from| Ok((from, OpenOptions::new().write(true).create(true).truncate(false).open(target)?))); + let over = Over { + tmp, + old: tmp.with_extension("old"), + open_tmp: &|| File::open(tmp), + remove_tmp: &|| { + let _ = std::fs::remove_file(tmp); + }, + open_target: &|write| if write { OpenOptions::new().write(true).create(true).truncate(false).open(target) } else { File::open(target) }, + synced: &|| sync_written_parent(target), + }; + write_over_in(&over, refused) +} + +/// How [`write_over_in`] reaches its files: by their paths, or through a folder opened once +/// ([`write_atomic_checked`]). +struct Over<'a> { + /// The temporary file, as error messages name it. + tmp: &'a Path, + /// Where the file as it was is copied aside. + old: PathBuf, + open_tmp: &'a dyn Fn() -> io::Result<File>, + /// Best effort. + remove_tmp: &'a dyn Fn(), + /// The target for writing (created when missing, not truncated) when `true`, for reading when + /// `false`. + open_target: &'a dyn Fn(bool) -> io::Result<File>, + /// The target's folder flushed, after the target is written. + synced: &'a dyn Fn() -> io::Result<()>, +} + +/// [`write_over`] through `over`. +fn write_over_in(over: &Over<'_>, refused: io::Error) -> io::Result<()> { + let tmp = over.tmp; + let opened = (over.open_tmp)().and_then(|from| Ok((from, (over.open_target)(true)?))); let Ok((mut from, mut to)) = opened else { // Best effort: the temporary file is all there is to clean up. - let _ = std::fs::remove_file(tmp); + (over.remove_tmp)(); return Err(refused); }; // Nothing to keep of a file that is new or empty. - let old = to.metadata().map_or(true, |m| m.len() > 0).then(|| tmp.with_extension("old")); + let old = to.metadata().map_or(true, |m| m.len() > 0).then(|| over.old.clone()); if let Some(old) = &old - && let Err(e) = keep_old(target, old) + && let Err(e) = (over.open_target)(false).and_then(|mut target| keep_old(&mut target, old)) { // Best effort: a partial copy is of no use. let _ = std::fs::remove_file(old); @@ -152,11 +350,11 @@ fn write_over(tmp: &Path, target: &Path, refused: io::Error) -> io::Result<()> { match (copied, old) { (Ok(()), old) => { // Best effort: the file is saved, so the copies are no longer needed. - let _ = std::fs::remove_file(tmp); + (over.remove_tmp)(); if let Some(old) = old { let _ = std::fs::remove_file(old); } - sync_written_parent(target) + (over.synced)() } (Err(e), Some(old)) => Err(io::Error::new( e.kind(), @@ -166,10 +364,10 @@ fn write_over(tmp: &Path, target: &Path, refused: io::Error) -> io::Result<()> { } } -/// A flushed copy of `target` as it is, at `old` (for its owner only). -fn keep_old(target: &Path, old: &Path) -> io::Result<()> { +/// A flushed copy of what `target` holds, at `old` (for its owner only). +fn keep_old(target: &mut File, old: &Path) -> io::Result<()> { let mut to = create_private(old)?; - io::copy(&mut File::open(target)?, &mut to)?; + io::copy(target, &mut to)?; sync_file(&to) } @@ -466,6 +664,81 @@ mod tests { true } + /// A folder `root/inside` and a folder `outside` beside `root`, by their real paths, and a check + /// that allows paths under `root` only. + #[cfg(unix)] + fn checked_folders(name: &str) -> (PathBuf, PathBuf, PathBuf) { + let d = std::fs::canonicalize(dir(name)).unwrap(); + let (root, outside) = (d.join("root"), d.join("outside")); + std::fs::create_dir_all(root.join("inside")).unwrap(); + std::fs::create_dir_all(&outside).unwrap(); + (d, root, outside) + } + + #[cfg(unix)] + fn under(root: &Path) -> impl FnOnce(&Path) -> io::Result<()> + '_ { + move |p: &Path| if p.starts_with(root) { Ok(()) } else { Err(io::Error::other(format!("{} is outside", p.display()))) } + } + + /// A folder on the path that is a link to a folder outside when the write starts fails the check + /// made on the folder that is opened, and nothing is written outside. + #[cfg(unix)] + #[test] + fn a_checked_write_refuses_a_folder_replaced_before_it_is_opened() { + let (d, root, outside) = checked_folders("checked-before"); + std::fs::remove_dir(root.join("inside")).unwrap(); + std::os::unix::fs::symlink(&outside, root.join("inside")).unwrap(); + let r = write_atomic_checked(&root.join("inside/doc.txt"), |f| f.write_all(b"new"), under(&root)); + assert!(r.as_ref().is_err_and(|e| e.to_string().contains("is outside")), "{r:?}"); + assert!(std::fs::read_dir(&outside).unwrap().next().is_none(), "nothing is left outside"); + let _ = std::fs::remove_dir_all(d); + } + + /// A folder on the path replaced by a link to a folder outside after it is checked and opened + /// does not redirect the write: the file goes into the folder that was opened. + #[cfg(unix)] + #[test] + fn a_checked_write_stays_in_the_folder_it_opened() { + let (d, root, outside) = checked_folders("checked-after"); + let check = under(&root); + let r = write_atomic_checked( + &root.join("inside/doc.txt"), + |f| f.write_all(b"new"), + |p| { + check(p)?; + std::fs::rename(root.join("inside"), root.join("moved"))?; + std::os::unix::fs::symlink(&outside, root.join("inside")) + }, + ); + r.unwrap(); + assert!(!outside.join("doc.txt").exists(), "the write followed the replaced folder"); + assert_eq!(std::fs::read(root.join("moved/doc.txt")).unwrap(), b"new"); + let _ = std::fs::remove_dir_all(d); + } + + /// A link put at the file's name after the check is replaced by the file, not followed. + #[cfg(unix)] + #[test] + fn a_checked_write_replaces_a_link_put_at_its_name() { + let (d, root, outside) = checked_folders("checked-link"); + std::fs::write(outside.join("other.txt"), b"keep").unwrap(); + let path = root.join("inside/doc.txt"); + let check = under(&root); + write_atomic_checked( + &path, + |f| f.write_all(b"new"), + |p| { + check(p)?; + std::os::unix::fs::symlink(outside.join("other.txt"), &path) + }, + ) + .unwrap(); + assert_eq!(std::fs::read(outside.join("other.txt")).unwrap(), b"keep"); + assert!(std::fs::symlink_metadata(&path).unwrap().is_file()); + assert_eq!(std::fs::read(&path).unwrap(), b"new"); + let _ = std::fs::remove_dir_all(d); + } + /// The other files in `d` besides `keep`. fn leftovers(d: &Path, keep: &str) -> Vec<String> { std::fs::read_dir(d).unwrap().map(|e| e.unwrap().file_name().to_string_lossy().to_string()).filter(|n| n != keep).collect() diff --git a/crates/format/src/lib.rs b/crates/format/src/lib.rs index 654f0ac065..9975527f78 100644 --- a/crates/format/src/lib.rs +++ b/crates/format/src/lib.rs @@ -58,7 +58,7 @@ use vectorcraft_doc::{Document, ImageBlob}; #[cfg(all(unix, not(target_arch = "wasm32")))] pub use atomic::sync_parent; #[cfg(not(target_arch = "wasm32"))] -pub use atomic::{keep_permissions, read_only_location, sync_file, write_atomic, write_atomic_with, write_new_with}; +pub use atomic::{keep_permissions, read_only_location, sync_file, write_atomic, write_atomic_checked, write_atomic_with, write_new_with}; use craft_gzip::Gz; pub use craft_vectorcraft_format::base64::{decode as base64_decode, decoded_len as base64_decoded_len, encode as base64_encode}; use craft_vectorcraft_format::stream::{FileHeader, Indent, KeyScan, write_file_json}; From 46dbb1fb285b4d96b86c9846ba1751e6ea5ff21d Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 22:41:20 -0800 Subject: [PATCH 107/112] Tests: script save tests remove their folders when an assertion fails folder() in tests/script_save_open.rs returned a PathBuf, and each test removed its folder only on its last line, so a failed assertion or a panicking script left the folder in the system's temporary folder. It now returns a Workspace guard, as tests/script_print.rs does, which removes the folder when it is dropped and clears read-only flags first when the first removal fails (Windows does not delete a read-only file). a_script_gate_does_not_write_over_a_read_only_file in file_access.rs made its file writable again and removed its folder only after its last assertion; a guard now does both when the test ends. --- crates/engine/src/file_access.rs | 42 +++++++++++-- crates/engine/src/tests/script_save_open.rs | 68 ++++++++++++++++++++- 2 files changed, 103 insertions(+), 7 deletions(-) diff --git a/crates/engine/src/file_access.rs b/crates/engine/src/file_access.rs index 7daa75e0ae..87b2823d90 100644 --- a/crates/engine/src/file_access.rs +++ b/crates/engine/src/file_access.rs @@ -1216,16 +1216,48 @@ mod tests { let document_write = || with_script_gate(documents.clone(), || check_write(&kept).is_ok()); assert_eq!(check(&kept), (true, true)); assert!(document_write(), "an open document's file is written"); + let _cleanup = ReadOnlyFixture { file: out.clone(), folder: base.clone() }; let mut perms = std::fs::metadata(&out).unwrap().permissions(); perms.set_readonly(true); - std::fs::set_permissions(&out, perms.clone()).unwrap(); + std::fs::set_permissions(&out, perms).unwrap(); assert_eq!(check(&kept), (false, true), "a read-only file is read but not written"); assert!(check(&fresh).0, "a new file next to it is written"); assert!(!document_write(), "also when it is an open document's file"); - #[allow(clippy::permissions_set_readonly_false)] - perms.set_readonly(false); - std::fs::set_permissions(&out, perms).unwrap(); - let _ = std::fs::remove_dir_all(base); + } + + /// Makes `file` writable again and removes `folder` when the test ends, a failed assertion + /// included: Windows does not delete a read-only file. + struct ReadOnlyFixture { + file: PathBuf, + folder: PathBuf, + } + + impl Drop for ReadOnlyFixture { + fn drop(&mut self) { + if let Ok(meta) = std::fs::metadata(&self.file) { + let mut perms = meta.permissions(); + #[allow(clippy::permissions_set_readonly_false)] + perms.set_readonly(false); + let _ = std::fs::set_permissions(&self.file, perms); + } + let _ = std::fs::remove_dir_all(&self.folder); + } + } + + #[test] + fn a_read_only_fixture_is_removed_when_its_test_fails() { + let (base, _) = folders("read-only-fixture"); + let file = base.join("out/locked.svg"); + std::fs::write(&file, "<svg/>").unwrap(); + let failed = std::panic::catch_unwind(|| { + let _cleanup = ReadOnlyFixture { file: file.clone(), folder: base.clone() }; + let mut perms = std::fs::metadata(&file).unwrap().permissions(); + perms.set_readonly(true); + std::fs::set_permissions(&file, perms).unwrap(); + panic!("a failed assertion"); + }); + assert!(failed.is_err()); + assert!(!base.exists(), "{} is left", base.display()); } #[test] diff --git a/crates/engine/src/tests/script_save_open.rs b/crates/engine/src/tests/script_save_open.rs index 12db366846..c56fc4098a 100644 --- a/crates/engine/src/tests/script_save_open.rs +++ b/crates/engine/src/tests/script_save_open.rs @@ -10,13 +10,77 @@ use crate::*; const DENIED: &str = "Script file access denied"; +/// A test's folder, removed when the test ends, a failed assertion included. A read-only file in +/// it, which Windows does not delete, is made writable first when the first removal fails. +struct Workspace(PathBuf); + +impl std::ops::Deref for Workspace { + type Target = Path; + + fn deref(&self) -> &Path { + &self.0 + } +} + +impl AsRef<Path> for Workspace { + fn as_ref(&self) -> &Path { + &self.0 + } +} + +impl Drop for Workspace { + fn drop(&mut self) { + if std::fs::remove_dir_all(&self.0).is_err() { + make_writable(&self.0); + let _ = std::fs::remove_dir_all(&self.0); + } + } +} + +/// Clears the read-only flag of every file and folder in `path`, `path` included. Links are not +/// followed. +fn make_writable(path: &Path) { + let Ok(meta) = std::fs::symlink_metadata(path) else { return }; + if meta.file_type().is_symlink() { + return; + } + let mut perms = meta.permissions(); + if perms.readonly() { + #[allow(clippy::permissions_set_readonly_false)] + perms.set_readonly(false); + let _ = std::fs::set_permissions(path, perms); + } + if meta.is_dir() { + for entry in std::fs::read_dir(path).into_iter().flatten().flatten() { + make_writable(&entry.path()); + } + } +} + /// A fresh folder for test `name`, by its real path, with `main` for the script. -fn folder(name: &str) -> PathBuf { +fn folder(name: &str) -> Workspace { let base = std::env::temp_dir().join(format!("vc-script-save-{name}-{}", std::process::id())); let _ = std::fs::remove_dir_all(&base); std::fs::create_dir_all(base.join("main")).unwrap(); std::fs::create_dir_all(base.join("outside")).unwrap(); - std::fs::canonicalize(&base).unwrap() + Workspace(std::fs::canonicalize(&base).unwrap()) +} + +/// A test that fails leaves no folder behind, also when it made a file in it read-only. +#[test] +fn a_failed_test_leaves_no_folder() { + let base = folder("failed"); + let path = base.to_path_buf(); + let failed = std::panic::catch_unwind(std::panic::AssertUnwindSafe(move || { + let locked = base.join("main/locked.txt"); + std::fs::write(&locked, b"x").unwrap(); + let mut perms = std::fs::metadata(&locked).unwrap().permissions(); + perms.set_readonly(true); + std::fs::set_permissions(&locked, perms).unwrap(); + panic!("a failed assertion"); + })); + assert!(failed.is_err()); + assert!(!path.exists(), "{} is left", path.display()); } /// A session whose scripts keep their data folders in `base/settings/Script Data`. From 81c9588b2683353ced97bb4fe0f0a183dc0d9701 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 22:54:36 -0800 Subject: [PATCH 108/112] Tests: read-only gate test sets up its cleanup before the first assertion a_script_gate_does_not_write_over_a_read_only_file created its ReadOnlyFixture guard after two assertions, so a failure in either left the test folder behind. The guard is now created right after the file path is made, before the file is written. --- crates/engine/src/file_access.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/engine/src/file_access.rs b/crates/engine/src/file_access.rs index 87b2823d90..64a87119ff 100644 --- a/crates/engine/src/file_access.rs +++ b/crates/engine/src/file_access.rs @@ -1200,6 +1200,7 @@ mod tests { fn a_script_gate_does_not_write_over_a_read_only_file() { let (base, _) = folders("gate-read-only"); let out = base.join("out/kept.svg"); + let _cleanup = ReadOnlyFixture { file: out.clone(), folder: base.clone() }; std::fs::write(&out, "<svg/>").unwrap(); let gate = ScriptGate { read: ScriptScope::default(), @@ -1216,7 +1217,6 @@ mod tests { let document_write = || with_script_gate(documents.clone(), || check_write(&kept).is_ok()); assert_eq!(check(&kept), (true, true)); assert!(document_write(), "an open document's file is written"); - let _cleanup = ReadOnlyFixture { file: out.clone(), folder: base.clone() }; let mut perms = std::fs::metadata(&out).unwrap().permissions(); perms.set_readonly(true); std::fs::set_permissions(&out, perms).unwrap(); From 0a66352e8c7f1bb5f69ea61fb6cfedf1e61a1a72 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 23:19:55 -0800 Subject: [PATCH 109/112] JavaScript: a failed host class install adds none of its classes Realm::define_host_classes registered each class, and defined its global constructor, before it checked the next one. A batch whose second class named an unknown parent or a member twice failed with the first class already installed, so a retry failed with "defined twice". A failed instance did the same, and could leave an object scripts held with a class the realm no longer had. Every class's name, parent and members are now checked before any class is added, so a child must still follow its parent in the batch. A failure after that point removes the classes added, puts back each global the call replaced and the class of each object an instance moved to a new class. The replaced globals stay rooted until the call ends, so a collection during the call does not free them. --- crates/js/src/host_classes.rs | 135 ++++++++++++++++++++++++++++++---- crates/js/src/host_tests.rs | 66 +++++++++++++++++ crates/js/src/realm.rs | 1 + 3 files changed, 187 insertions(+), 15 deletions(-) diff --git a/crates/js/src/host_classes.rs b/crates/js/src/host_classes.rs index cbbc5a5adb..d03f0157b2 100644 --- a/crates/js/src/host_classes.rs +++ b/crates/js/src/host_classes.rs @@ -421,15 +421,127 @@ impl Interp { } } -/// Adds `classes` and the global objects `instances`, each made from the [`host_ref`] given. +/// Adds `classes` and the global objects `instances`, each made from the [`host_ref`] given. Every +/// class's name, parent and members are checked before any class is added, and a failure part way +/// through removes the classes and globals this call added, so a failed call leaves the realm as it +/// was. pub(crate) fn install(i: &mut Interp, classes: Vec<HostClass>, instances: Vec<(String, Data)>) -> JsResult<()> { + let members = match checked_members(&i.host_classes, &classes) { + Ok(m) => m, + Err(message) => return Err(i.throw(ErrorType::Type, &message)), + }; + let mark = i.temp_roots.len(); + let mut undo = Undo { classes: i.host_classes.len(), globals: Vec::new(), objects: Vec::new() }; + let r = install_checked(i, classes, members, instances, &mut undo); + if r.is_err() { + undo.roll_back(i); + } + i.temp_roots.truncate(mark); + r +} + +/// What [`install`] puts back when it fails part way. +struct Undo { + /// How many classes the realm had before the call. + classes: usize, + /// Each global the call defined, with the property it replaced, in the order defined. The + /// replaced values stay in the interpreter's temporary roots until [`install`] returns, so a + /// collection during the call does not free them. + globals: Vec<(Key, Option<Prop>)>, + /// The class and prototype of the object made for each family and handle before the call. An + /// instance of the call can give such an object one of the call's classes. + objects: Vec<(MadeKey, u32, Option<ObjId>)>, +} + +impl Undo { + fn define_global(&mut self, i: &mut Interp, name: &str, prop: Prop) -> JsResult<()> { + let global = i.global; + let k = key(name); + let was = i.object(global)?.props.get(&k).cloned(); + match &was { + Some(Prop::Data { value, .. }) => i.temp_roots.push(value.clone()), + Some(Prop::Accessor { get, set, .. }) => i.temp_roots.extend(get.iter().chain(set).map(|&f| Value::Object(f))), + None => {} + } + i.define(global, k.clone(), prop)?; + self.globals.push((k, was)); + Ok(()) + } + + fn roll_back(self, i: &mut Interp) { + let global = i.global; + for (k, was) in self.globals.into_iter().rev() { + let Ok(o) = i.object_mut(global) else { break }; + match was { + Some(prop) => { + o.props.insert(k, prop); + } + None => { + o.props.remove(&k); + i.heap.bytes = i.heap.bytes.saturating_sub(crate::interp::binding_bytes(k.len())); + } + } + } + for (made, class, proto) in self.objects { + let Some(&id) = i.host_objects.get(&made) else { continue }; + if is_made(&i.heap, &i.host_classes, id, &made) + && let Ok(o) = i.object_mut(id) + && let Class::Host(h) = &mut o.class + { + h.class = class; + o.proto = proto; + } + } + i.host_classes.truncate(self.classes); + forget_collected(&mut i.host_objects, &i.heap, &i.host_classes); + } +} + +/// The members of each of `classes` as `reflect` lists them ([`reflected_members`]), once every +/// class has a name that neither `existing` nor an earlier class of `classes` has, and a parent +/// that one of them has. → the error's message for the first class that does not. +fn checked_members(existing: &[Entry], classes: &[HostClass]) -> Result<Vec<Rc<[Reflected]>>, String> { + let mut names: HashSet<&str> = existing.iter().map(|e| &*e.name).collect(); + let mut out = Vec::with_capacity(classes.len()); for class in classes { - install_class(i, class)?; + if names.contains(class.name.as_str()) { + return Err(format!("the host class {} is defined twice", class.name)); + } + if let Some(p) = &class.parent + && !names.contains(p.as_str()) + { + return Err(format!("the host class {p} is not defined")); + } + out.push(reflected_members(class)?); + names.insert(&class.name); + } + Ok(out) +} + +/// [`install`] once [`checked_members`] has passed, recording in `undo` what it changes. +fn install_checked( + i: &mut Interp, + classes: Vec<HostClass>, + members: Vec<Rc<[Reflected]>>, + instances: Vec<(String, Data)>, + undo: &mut Undo, +) -> JsResult<()> { + for (class, members) in classes.into_iter().zip(members) { + install_class(i, class, members, undo)?; + } + if !instances.is_empty() { + for (made, &id) in &i.host_objects { + if is_made(&i.heap, &i.host_classes, id, made) + && let Ok(o) = i.object(id) + && let Class::Host(h) = &o.class + { + undo.objects.push((made.clone(), h.class, o.proto)); + } + } } for (name, d) in instances { let v = i.write_hosted(d)?; - let global = i.global; - i.define(global, key(&name), Prop::Data { value: v, flags: 0 })?; + undo.define_global(i, &name, Prop::Data { value: v, flags: 0 })?; } Ok(()) } @@ -450,22 +562,16 @@ pub(crate) fn install_globals(i: &mut Interp, globals: Vec<(String, HostFunction Ok(()) } -fn install_class(i: &mut Interp, class: HostClass) -> JsResult<()> { - if i.host_classes.iter().any(|e| *e.name == *class.name) { - return Err(i.throw(ErrorType::Type, &format!("the host class {} is defined twice", class.name))); - } +/// Adds `class`, which [`checked_members`] passed with `members`. +fn install_class(i: &mut Interp, class: HostClass, members: Rc<[Reflected]>, undo: &mut Undo) -> JsResult<()> { let own = u32::try_from(i.host_classes.len()).unwrap_or(u32::MAX); let (parent, family, parent_class) = match &class.parent { None => (i.intrinsics.object_proto, own, None), Some(p) => match i.host_classes.iter().enumerate().find(|(_, e)| *e.name == **p) { Some((n, e)) => (e.proto, e.family, u32::try_from(n).ok()), - None => return Err(i.throw(ErrorType::Type, &format!("the host class {p} is not defined"))), + None => return Err(Abrupt::Internal(format!("the host class {p} was checked but is not defined"))), }, }; - let members = match reflected_members(&class) { - Ok(m) => m, - Err(message) => return Err(i.throw(ErrorType::Type, &message)), - }; let proto = i.heap.alloc_object(Object::new(Class::Ordinary, Some(parent))); let mark = i.temp_roots.len(); i.temp_roots.push(Value::Object(proto)); @@ -486,8 +592,7 @@ fn install_class(i: &mut Interp, class: HostClass) -> JsResult<()> { unavailable: Rc::new(names(unavailable)), members, }); - let global = i.global; - i.define(global, key(&class.name), Prop::Data { value: Value::Object(ctor), flags: crate::heap::HIDDEN }) + undo.define_global(i, &class.name, Prop::Data { value: Value::Object(ctor), flags: crate::heap::HIDDEN }) } /// The members of `class` as `reflect` lists them, each with its [`HostClass::info`] entry. → the diff --git a/crates/js/src/host_tests.rs b/crates/js/src/host_tests.rs index 40a29ba77d..194a199b19 100644 --- a/crates/js/src/host_tests.rs +++ b/crates/js/src/host_tests.rs @@ -1035,6 +1035,72 @@ fn a_member_a_class_declares_unavailable_is_not_its_own_when_its_parent_has_it() assert_eq!(finish(&mut r, 1_000_000).0.unwrap(), JsValue::String("false,false,true".into())); } +/// A class named `name` with the parent `parent` and one read-only member `size`. +fn sized_class(name: &str, parent: Option<&str>) -> HostClass { + let value: HostFunction = Rc::new(|_| Ok(Data::Number(1.0))); + HostClass { + name: name.into(), + parent: parent.map(Into::into), + members: vec![("size".to_string(), HostMember::Get(value))], + info: Vec::new(), + index: None, + construct: None, + } +} + +#[test] +fn a_rejected_class_leaves_the_earlier_classes_of_its_call_undefined() { + let doubled = || { + let mut c = sized_class("Bad", None); + c.members.push(c.members[0].clone()); + c + }; + for (bad, message) in [(sized_class("Bad", Some("Missing")), "Missing is not defined"), (doubled(), "names the member size twice")] { + let mut r = realm(1_000_000); + let e = r.define_host_classes(vec![sized_class("First", None), bad], vec![("first".into(), host_ref("First", &[1.0]))]).unwrap_err(); + assert!(e.message.contains(message), "{}", e.message); + assert_eq!(r.run("[typeof First, typeof first, typeof Bad].join()").unwrap(), JsValue::String("undefined,undefined,undefined".into())); + r.define_host_classes(vec![sized_class("First", None)], vec![("first".into(), host_ref("First", &[1.0]))]).unwrap(); + assert_eq!(r.run("first.size").unwrap(), JsValue::Number(1.0)); + } +} + +#[test] +fn a_child_class_may_follow_its_parent_in_the_same_call_but_not_precede_it() { + let mut r = realm(1_000_000); + let e = r.define_host_classes(vec![sized_class("Leaf", Some("Base")), sized_class("Base", None)], Vec::new()).unwrap_err(); + assert!(e.message.contains("Base is not defined"), "{}", e.message); + assert_eq!(r.run("typeof Leaf + typeof Base").unwrap(), JsValue::String("undefinedundefined".into())); + r.define_host_classes(vec![sized_class("Base", None), sized_class("Leaf", Some("Base"))], vec![("it".into(), host_ref("Leaf", &[1.0]))]).unwrap(); + assert_eq!(r.run("it instanceof Base && it.size === 1").unwrap(), JsValue::Bool(true)); +} + +#[test] +fn a_failed_instance_removes_the_classes_and_globals_of_its_call_and_restores_held_objects() { + let mut r = realm(1_000_000); + r.define_host_classes(vec![sized_class("Base", None)], vec![("held".into(), host_ref("Base", &[1.0]))]).unwrap(); + r.run("var keep = 'kept'").unwrap(); + let instances = vec![("keep".into(), host_ref("Leaf", &[1.0])), ("other".into(), host_ref("Missing", &[2.0]))]; + let e = r.define_host_classes(vec![sized_class("Leaf", Some("Base"))], instances).unwrap_err(); + assert!(e.message.contains("unknown class Missing"), "{}", e.message); + let source = "[keep, typeof Leaf, typeof other, held.constructor === Base, held.hasOwnProperty('size'), held.size].join()"; + assert_eq!(r.run(source).unwrap(), JsValue::String("kept,undefined,undefined,true,true,1".into())); +} + +#[test] +fn a_failed_call_restores_a_replaced_global_that_a_collection_in_the_call_would_free() { + let mut r = realm(1_000_000); + r.define_host_classes(vec![sized_class("Base", None)], Vec::new()).unwrap(); + r.run("var keep = { sentinel: 1 }").unwrap(); + let instances = + vec![("keep".into(), host_ref("Base", &[1.0])), ("next".into(), host_ref("Base", &[2.0])), ("other".into(), host_ref("Missing", &[3.0]))]; + crate::interp::COLLECT_ON_RESERVE.with(|c| c.set(true)); + let e = r.define_host_classes(Vec::new(), instances); + crate::interp::COLLECT_ON_RESERVE.with(|c| c.set(false)); + assert!(e.unwrap_err().message.contains("unknown class Missing")); + assert_eq!(r.run("[keep.sentinel, typeof next].join()").unwrap(), JsValue::String("1,undefined".into())); +} + #[test] fn assigning_a_name_a_prototype_has_does_not_call_the_indexer() { let mut r = realm(1_000_000); diff --git a/crates/js/src/realm.rs b/crates/js/src/realm.rs index 822477780f..088b155a24 100644 --- a/crates/js/src/realm.rs +++ b/crates/js/src/realm.rs @@ -753,6 +753,7 @@ impl Realm { /// prototype holds its members, and the global objects `instances`, each made from the /// [`crate::host_ref`] given. Prototypes and constructors are frozen; the instances cannot be /// replaced. A heap too small for them ends with the error the realm's next run would give. + /// A call that fails adds none of its classes or instances, and can be made again. pub fn define_host_classes(&mut self, classes: Vec<crate::HostClass>, instances: Vec<(String, crate::Data)>) -> Result<(), RunError> { match crate::host_classes::install(&mut self.interp, classes, instances) { Ok(()) => Ok(()), From 6cf914589051de064adb3997cb8bbee3742cc79d Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 23:24:20 -0800 Subject: [PATCH 110/112] Save: checked writes check the open folder's path as it is The second check of a checked write passed the open folder's path as text and looked it up again. A path that was not valid UTF-8 was refused, and a folder on that path replaced by a link into an allowed folder between the two lookups could let a place outside pass. check_write_real compares the open folder's real path with the write roots and the script's grants as it is, without looking it up again. - The folder is opened with O_PATH on Linux, Android and FreeBSD, so a folder that can be written and searched but not listed takes the file. The folder flush opens it for reading, and an error there still reports the completed write. - The replaced file's permissions are read after the new content is written, as write_atomic_with reads them, so permissions taken away meanwhile stay taken away. Its ACL is read only from the same file. - A folder that changed while it was opened is no longer reported as a read-only location. - Errors name the kept temporary file where its folder is now, after the folder moved. - A file already at the name the old content is copied to is left as it is: only a copy this save made and could not finish is removed. --- crates/engine/src/cmd/fileio/access.rs | 48 ++++- crates/engine/src/file_access.rs | 100 ++++++++--- crates/format/src/atomic.rs | 231 +++++++++++++++++++++---- 3 files changed, 318 insertions(+), 61 deletions(-) diff --git a/crates/engine/src/cmd/fileio/access.rs b/crates/engine/src/cmd/fileio/access.rs index 8691ebb1fb..0edfc53c54 100644 --- a/crates/engine/src/cmd/fileio/access.rs +++ b/crates/engine/src/cmd/fileio/access.rs @@ -339,8 +339,13 @@ fn write_checked(path: &str, fill: impl FnOnce(&mut std::fs::File) -> std::io::R return vectorcraft_format::write_atomic_with(path, fill); } vectorcraft_format::write_atomic_checked(path, fill, |opened| { - let opened = opened.to_str().ok_or_else(|| std::io::Error::other(format!("{}: path is not valid UTF-8", opened.display())))?; - crate::file_access::check_write_unrecorded(opened).map_err(std::io::Error::other) + // On Unix `opened` is the open folder's real path with the file's name: compared as it is, + // without looking the folder up again. Elsewhere it is `path` itself. + #[cfg(unix)] + let checked = crate::file_access::check_write_real(opened); + #[cfg(not(unix))] + let checked = crate::file_access::check_write_unrecorded(&opened.to_string_lossy()); + checked.map_err(std::io::Error::other) }) } @@ -766,4 +771,43 @@ mod tests { assert_eq!(naming_in_error(EngineError::Other(raw.clone()), &file).to_string(), raw); let _ = std::fs::remove_dir_all(base); } + + /// The second check of a checked write compares the open folder's real path as it is: a folder + /// on that path replaced afterwards by a link into the write root does not make a place outside + /// the root pass. + #[cfg(unix)] + #[test] + fn a_checked_write_compares_the_open_folder_without_looking_it_up_again() { + let base = std::fs::canonicalize(std::env::temp_dir()).unwrap().join(format!("vc-access-real-{}", std::process::id())); + let _ = std::fs::remove_dir_all(&base); + let (root, out) = (base.join("root"), base.join("out")); + std::fs::create_dir_all(&root).unwrap(); + std::fs::create_dir_all(out.join("x")).unwrap(); + let real = out.join("x/doc.svg"); + std::fs::remove_dir(out.join("x")).unwrap(); + std::os::unix::fs::symlink(&root, out.join("x")).unwrap(); + let roots = AutomationRoots::new(&[], &[root.as_path()]).unwrap(); + assert!(confine(roots.as_ref(), || crate::file_access::check_write_unrecorded(&real.to_string_lossy())).is_ok(), "looked up, it passes"); + let checked = confine(roots.as_ref(), || crate::file_access::check_write_real(&real)); + assert!(checked.is_err_and(|e| e.contains("outside the write root"))); + let _ = std::fs::remove_dir_all(base); + } + + /// A checked write through a link to a folder whose name is not valid UTF-8, inside the write + /// root, is saved. + #[cfg(target_os = "linux")] + #[test] + fn a_checked_write_saves_into_a_folder_whose_name_is_not_text() { + use std::os::unix::ffi::OsStrExt; + let base = std::fs::canonicalize(std::env::temp_dir()).unwrap().join(format!("vc-access-bytes-{}", std::process::id())); + let _ = std::fs::remove_dir_all(&base); + let bytes = base.join(std::ffi::OsStr::from_bytes(b"folder-\xff")); + std::fs::create_dir_all(&bytes).unwrap(); + std::os::unix::fs::symlink(&bytes, base.join("text")).unwrap(); + let roots = AutomationRoots::new(&[], &[base.as_path()]).unwrap(); + let path = base.join("text/doc.svg").to_string_lossy().into_owned(); + confine(roots.as_ref(), || write_file(&path, b"new")).unwrap(); + assert_eq!(std::fs::read(bytes.join("doc.svg")).unwrap(), b"new"); + let _ = std::fs::remove_dir_all(base); + } } diff --git a/crates/engine/src/file_access.rs b/crates/engine/src/file_access.rs index bc2acda5e6..d705682dcb 100644 --- a/crates/engine/src/file_access.rs +++ b/crates/engine/src/file_access.rs @@ -100,16 +100,9 @@ impl AutomationRoots { /// May the file or folder at `path` be read (or written)? It must lie inside one of the roots /// of that kind. `Err` says why not. pub fn check(&self, path: &str, access: Access) -> Result<(), String> { - let roots = match access { - Access::Read => &self.read, - Access::Write => &self.write, - }; - // The messages are spelled out whole, as the translation catalogs match them. + let roots = self.of(access); if roots.is_empty() { - return match access { - Access::Read => Err(format!("automation filesystem access is not granted: read authority is absent: {path}")), - Access::Write => Err(format!("automation filesystem access is not granted: write authority is absent: {path}")), - }; + return Err(refused(roots, path, access)); } // Resolving a path on another computer connects to it: unless a root is on a network // share, such a path is refused by its name before anything is looked up. @@ -120,12 +113,22 @@ impl AutomationRoots { return Ok(()); } } - let shown: Vec<String> = roots.iter().map(|r| r.shown.display().to_string()).collect(); - match (shown.as_slice(), access) { - ([root], Access::Read) => Err(format!("automation path rejected: outside the read root {root}: {path}")), - ([root], Access::Write) => Err(format!("automation path rejected: outside the write root {root}: {path}")), - (_, Access::Read) => Err(format!("automation path rejected: outside the read roots {roots}: {path}", roots = shown.join(", "))), - (_, Access::Write) => Err(format!("automation path rejected: outside the write roots {roots}: {path}", roots = shown.join(", "))), + Err(refused(roots, path, access)) + } + + /// [`AutomationRoots::check`] for `real`, a path whose links have been followed already: it is + /// compared with the roots as it is, and not looked up again. + #[cfg(unix)] + pub(crate) fn check_real(&self, real: &Path, access: Access) -> Result<(), String> { + let roots = self.of(access); + if roots.iter().any(|r| inside(real, &r.resolved)) { Ok(()) } else { Err(refused(roots, &real.display().to_string(), access)) } + } + + /// The roots of the kind `access`. + fn of(&self, access: Access) -> &[Root] { + match access { + Access::Read => &self.read, + Access::Write => &self.write, } } @@ -157,6 +160,24 @@ impl AutomationRoots { } } +/// Why `path` is refused `access` under `roots`, the roots of that kind. +fn refused(roots: &[Root], path: &str, access: Access) -> String { + // The messages are spelled out whole, as the translation catalogs match them. + if roots.is_empty() { + return match access { + Access::Read => format!("automation filesystem access is not granted: read authority is absent: {path}"), + Access::Write => format!("automation filesystem access is not granted: write authority is absent: {path}"), + }; + } + let shown: Vec<String> = roots.iter().map(|r| r.shown.display().to_string()).collect(); + match (shown.as_slice(), access) { + ([root], Access::Read) => format!("automation path rejected: outside the read root {root}: {path}"), + ([root], Access::Write) => format!("automation path rejected: outside the write root {root}: {path}"), + (_, Access::Read) => format!("automation path rejected: outside the read roots {roots}: {path}", roots = shown.join(", ")), + (_, Access::Write) => format!("automation path rejected: outside the write roots {roots}: {path}", roots = shown.join(", ")), + } +} + /// Where the roots are in force on a thread ([`confine`], [`unconfined`]). #[derive(Clone, Debug)] enum Scope { @@ -371,18 +392,34 @@ impl ScriptGate { also.check(path, access)?; } let real = if ScriptScope::refused_by_name(Path::new(path)) { None } else { resolve(path).ok() }; - let allowed = real.is_some_and(|real| { - let scoped = match access { - Access::Read => self.read.allows(&real) || self.write.allows(&real), - Access::Write => self.write.allows(&real), - }; - // A read-only file is not written over, also where a rename could replace it. - let read_only = matches!(access, Access::Write) && std::fs::metadata(&real).is_ok_and(|m| m.is_file() && m.permissions().readonly()); - let held = matches!(access, Access::Write) && self.held.contains(&real); - let linked = matches!(access, Access::Read) && self.linked.has(&real) && !self.read.keeps_out(&real); - !read_only && !held && (scoped || self.documents.iter().any(|d| resolve(d).is_ok_and(|d| d == real)) || linked) - }); - if allowed { Ok(()) } else { Err(format!("Script file access denied: {path}")) } + if real.is_some_and(|real| self.allows_real(&real, access)) { Ok(()) } else { Err(format!("Script file access denied: {path}")) } + } + + /// [`ScriptGate::check`] for `real`, a path whose links have been followed already: it is + /// compared as it is, and not looked up again. + #[cfg(unix)] + pub(crate) fn check_real(&self, real: &Path, access: Access) -> Result<(), String> { + if let Some(also) = &self.also { + also.check_real(real, access)?; + } + if !ScriptScope::refused_by_name(real) && self.allows_real(real, access) { + Ok(()) + } else { + Err(format!("Script file access denied: {}", real.display())) + } + } + + /// May the place at the real path `real` be read (or written) through this gate alone? + fn allows_real(&self, real: &Path, access: Access) -> bool { + let scoped = match access { + Access::Read => self.read.allows(real) || self.write.allows(real), + Access::Write => self.write.allows(real), + }; + // A read-only file is not written over, also where a rename could replace it. + let read_only = matches!(access, Access::Write) && std::fs::metadata(real).is_ok_and(|m| m.is_file() && m.permissions().readonly()); + let held = matches!(access, Access::Write) && self.held.iter().any(|h| h == real); + let linked = matches!(access, Access::Read) && self.linked.has(real) && !self.read.keeps_out(real); + !read_only && !held && (scoped || self.documents.iter().any(|d| resolve(d).is_ok_and(|d| d == real)) || linked) } } @@ -479,6 +516,15 @@ pub(crate) fn check_write_unrecorded(path: &str) -> Result<(), String> { check_gate(path, Access::Write) } +/// [`check_write_unrecorded`] for `real`, the path of a file in a folder whose links have been +/// followed already (the folder a checked write has opened): it is compared as it is, so the folder +/// is not looked up again by its path. +#[cfg(unix)] +pub(crate) fn check_write_real(real: &Path) -> Result<(), String> { + current().map_or(Ok(()), |r| r.check_real(real, Access::Write))?; + GATE.with(|g| g.borrow().clone()).map_or(Ok(()), |g| g.check_real(real, Access::Write)) +} + /// Whether a write here is checked: roots are in force, or a script's command runs. pub(crate) fn writes_checked() -> bool { current().is_some() || in_script_command() diff --git a/crates/format/src/atomic.rs b/crates/format/src/atomic.rs index 54a0fe0432..34d980071d 100644 --- a/crates/format/src/atomic.rs +++ b/crates/format/src/atomic.rs @@ -104,21 +104,28 @@ pub fn write_atomic_checked( .ok_or_else(|| io::Error::new(io::ErrorKind::InvalidInput, format!("{}: not a file path", resolved.display())))? .to_os_string(); let parent = resolved.parent().filter(|p| !p.as_os_str().is_empty()).unwrap_or_else(|| Path::new(".")); - let dir = rustix::fs::open(parent, OFlags::RDONLY | OFlags::DIRECTORY | OFlags::CLOEXEC, Mode::empty())?; - let target = opened_folder_path(&dir, parent)?.join(&name); + let dir = open_folder(parent)?; + let real = opened_folder_path(&dir, parent)?; + let target = real.join(&name); allowed(&target)?; - let old = rustix::fs::statat(&dir, &name, AtFlags::SYMLINK_NOFOLLOW).ok(); + // Only whether a file is there: its permissions are read again once it is about to be replaced. + let replacing = rustix::fs::statat(&dir, &name, AtFlags::SYMLINK_NOFOLLOW).is_ok(); let tmp_name = temp_path(&target)?.file_name().map(std::ffi::OsStr::to_os_string).unwrap_or_default(); - let tmp = target.with_file_name(&tmp_name); // Replacing a file: owner-only while it is written, as in `write_atomic_with`. - let mode = if old.is_some() { Mode::RUSR | Mode::WUSR } else { Mode::RUSR | Mode::WUSR | Mode::RGRP | Mode::WGRP | Mode::ROTH | Mode::WOTH }; + let mode = if replacing { Mode::RUSR | Mode::WUSR } else { Mode::RUSR | Mode::WUSR | Mode::RGRP | Mode::WGRP | Mode::ROTH | Mode::WOTH }; let new_file = OFlags::WRONLY | OFlags::CREATE | OFlags::EXCL | OFlags::NOFOLLOW | OFlags::CLOEXEC; let remove_tmp = || { // Best effort: the temporary file is all there is to clean up. let _ = rustix::fs::unlinkat(&dir, &tmp_name, AtFlags::empty()); }; - let synced = - || rustix::fs::fsync(&dir).map_err(|e| io::Error::new(io::Error::from(e).kind(), WrittenError { path: target.clone(), error: e.into() })); + // The folder may have moved since it was opened: messages name it where it is now. + let now = |file: &std::ffi::OsStr| folder_now(&dir, &real).join(file); + let synced = || { + // Opened for reading here: the folder handle above may allow name lookups only. + let flushed = + rustix::fs::openat(&dir, ".", OFlags::RDONLY | OFlags::DIRECTORY | OFlags::CLOEXEC, Mode::empty()).and_then(|d| rustix::fs::fsync(&d)); + flushed.map_err(|e| io::Error::new(io::Error::from(e).kind(), WrittenError { path: now(&name), error: e.into() })) + }; let open_target = |write: bool| -> io::Result<File> { let flags = if write { OFlags::WRONLY | OFlags::CREATE } else { OFlags::RDONLY }; Ok(File::from(rustix::fs::openat(&dir, &name, flags | OFlags::NOFOLLOW | OFlags::CLOEXEC, mode)?)) @@ -131,14 +138,21 @@ pub fn write_atomic_checked( remove_tmp(); return Err(e); } - if let Some(old) = &old { - // Best effort, as in `write_atomic_with`. - let _ = keep_permissions_at(&dir, &name, old, &f); + // The file's permissions as they are now, after `fill`, as in `write_atomic_with`: a + // change made to them meanwhile is kept. Best effort; a file that can't be looked at + // leaves the replacement owner-only. + if let Ok(old) = rustix::fs::statat(&dir, &name, AtFlags::SYMLINK_NOFOLLOW) { + let _ = keep_permissions_at(&dir, &name, &old, &f); } drop(f); - let Err(refused) = rustix::fs::renameat(&dir, &tmp_name, &dir, &name) else { return synced() }; + #[cfg(test)] + let refuse = RENAME_REFUSED.with(std::cell::Cell::get); + #[cfg(not(test))] + let refuse = false; + let renamed = if refuse { Err(rustix::io::Errno::ACCESS) } else { rustix::fs::renameat(&dir, &tmp_name, &dir, &name) }; + let Err(refused) = renamed else { return synced() }; let over = Over { - tmp: &tmp, + tmp: &|| now(&tmp_name), old: std::env::temp_dir().join(&tmp_name).with_extension("old"), open_tmp: &|| { Ok(File::from(rustix::fs::openat(&dir, &tmp_name, OFlags::RDONLY | OFlags::NOFOLLOW | OFlags::CLOEXEC, Mode::empty())?)) @@ -168,7 +182,7 @@ pub fn write_atomic_checked( return Err(e); } let over = Over { - tmp: &elsewhere, + tmp: &|| elsewhere.clone(), old: elsewhere.with_extension("old"), open_tmp: &|| File::open(&elsewhere), remove_tmp: &remove, @@ -199,13 +213,47 @@ fn opened_folder_path(dir: &std::os::fd::OwnedFd, parent: &Path) -> io::Result<P let real = std::fs::canonicalize(parent)?; let (open, now) = (rustix::fs::fstat(dir)?, rustix::fs::stat(&real)?); if (open.st_dev, open.st_ino) != (now.st_dev, now.st_ino) { - return Err(io::Error::new(io::ErrorKind::PermissionDenied, format!("{}: the folder changed while it was opened", parent.display()))); + // Not a permission the file system refused: [`read_only_location`] does not take it for one. + return Err(io::Error::other(format!("{}: the folder changed while it was opened", parent.display()))); } Ok(real) } +/// The folder at `parent`, opened for looking names up in it. On Linux, Android and FreeBSD that +/// is `O_PATH`, which needs no permission to list the folder, so a folder that can be written and +/// searched but not listed still takes the file. +#[cfg(unix)] +fn open_folder(parent: &Path) -> io::Result<std::os::fd::OwnedFd> { + use rustix::fs::{Mode, OFlags}; + #[cfg(any(target_os = "linux", target_os = "android", target_os = "freebsd"))] + let access = OFlags::PATH; + #[cfg(not(any(target_os = "linux", target_os = "android", target_os = "freebsd")))] + let access = OFlags::RDONLY; + Ok(rustix::fs::open(parent, access | OFlags::DIRECTORY | OFlags::CLOEXEC, Mode::empty())?) +} + +/// The path the open folder `dir` has now, which may differ from `opened`, its real path when it +/// was opened, after it moved. `opened` where the system does not say. +#[cfg(unix)] +fn folder_now(dir: &std::os::fd::OwnedFd, opened: &Path) -> PathBuf { + #[cfg(any(target_os = "linux", target_os = "android"))] + if let Ok(now) = std::fs::read_link(format!("/proc/self/fd/{}", std::os::fd::AsRawFd::as_raw_fd(dir))) + && now.is_absolute() + { + return now; + } + #[cfg(target_vendor = "apple")] + if let Ok(now) = rustix::fs::getpath(dir) { + return PathBuf::from(<std::ffi::OsString as std::os::unix::ffi::OsStringExt>::from_vec(now.into_bytes())); + } + let _ = dir; + opened.to_path_buf() +} + /// [`keep_permissions`] for the temporary file `tmp`, about to replace `name` in folder `dir`, whose -/// file had the status `old`. A name that does not hold a plain file has none to keep. +/// file has the status `old`. A name that does not hold a plain file has none to keep. The ACL is +/// read only from that same file (the same device and inode); when it can't be, the replacement +/// keeps no group or other permissions. #[cfg(unix)] fn keep_permissions_at(dir: &std::os::fd::OwnedFd, name: &std::ffi::OsStr, old: &rustix::fs::Stat, tmp: &File) -> io::Result<()> { use rustix::fs::{FileType, Mode}; @@ -215,22 +263,25 @@ fn keep_permissions_at(dir: &std::os::fd::OwnedFd, name: &std::ffi::OsStr, old: let mut mode = Mode::from_raw_mode(old.st_mode); let gid = rustix::fs::Gid::from_raw(old.st_gid); let kept_group = rustix::fs::fstat(tmp).is_ok_and(|t| t.st_gid == old.st_gid) || rustix::fs::fchown(tmp, None, Some(gid)).is_ok(); - if !kept_group || !keep_acl_at(dir, name, tmp) { + if !kept_group || !keep_acl_at(dir, name, old, tmp) { mode.remove(Mode::RWXG | Mode::RWXO); } rustix::fs::fchmod(tmp, mode).map_err(io::Error::from) } /// [`keep_acl`] for `name` in folder `dir`, opened without following a link and without waiting on -/// a pipe put in its place. +/// a pipe put in its place, when it is still the file with the status `old`. #[cfg(target_os = "linux")] -fn keep_acl_at(dir: &std::os::fd::OwnedFd, name: &std::ffi::OsStr, tmp: &File) -> bool { +fn keep_acl_at(dir: &std::os::fd::OwnedFd, name: &std::ffi::OsStr, old: &rustix::fs::Stat, tmp: &File) -> bool { use rustix::fs::{Mode, OFlags}; use rustix::io::Errno; const ACL: &str = "system.posix_acl_access"; let Ok(target) = rustix::fs::openat(dir, name, OFlags::RDONLY | OFlags::NOFOLLOW | OFlags::NONBLOCK | OFlags::CLOEXEC, Mode::empty()) else { return false; }; + if !rustix::fs::fstat(&target).is_ok_and(|t| (t.st_dev, t.st_ino) == (old.st_dev, old.st_ino)) { + return false; + } let mut buf = vec![0u8; 64 << 10]; match rustix::fs::fgetxattr(&target, ACL, &mut buf[..]) { Ok(n) => buf.get(..n).is_some_and(|acl| rustix::fs::fsetxattr(tmp, ACL, acl, rustix::fs::XattrFlags::empty()).is_ok()), @@ -243,7 +294,7 @@ fn keep_acl_at(dir: &std::os::fd::OwnedFd, name: &std::ffi::OsStr, tmp: &File) - } #[cfg(all(unix, not(target_os = "linux")))] -fn keep_acl_at(_: &std::os::fd::OwnedFd, _: &std::ffi::OsStr, _: &File) -> bool { +fn keep_acl_at(_: &std::os::fd::OwnedFd, _: &std::ffi::OsStr, _: &rustix::fs::Stat, _: &File) -> bool { true } @@ -296,7 +347,7 @@ fn write_atomic_stepping( /// error says where they are. fn write_over(tmp: &Path, target: &Path, refused: io::Error) -> io::Result<()> { let over = Over { - tmp, + tmp: &|| tmp.to_path_buf(), old: tmp.with_extension("old"), open_tmp: &|| File::open(tmp), remove_tmp: &|| { @@ -311,8 +362,8 @@ fn write_over(tmp: &Path, target: &Path, refused: io::Error) -> io::Result<()> { /// How [`write_over_in`] reaches its files: by their paths, or through a folder opened once /// ([`write_atomic_checked`]). struct Over<'a> { - /// The temporary file, as error messages name it. - tmp: &'a Path, + /// Where the temporary file is when an error message names it (its folder may have moved). + tmp: &'a dyn Fn() -> PathBuf, /// Where the file as it was is copied aside. old: PathBuf, open_tmp: &'a dyn Fn() -> io::Result<File>, @@ -327,7 +378,6 @@ struct Over<'a> { /// [`write_over`] through `over`. fn write_over_in(over: &Over<'_>, refused: io::Error) -> io::Result<()> { - let tmp = over.tmp; let opened = (over.open_tmp)().and_then(|from| Ok((from, (over.open_target)(true)?))); let Ok((mut from, mut to)) = opened else { // Best effort: the temporary file is all there is to clean up. @@ -339,10 +389,10 @@ fn write_over_in(over: &Over<'_>, refused: io::Error) -> io::Result<()> { if let Some(old) = &old && let Err(e) = (over.open_target)(false).and_then(|mut target| keep_old(&mut target, old)) { - // Best effort: a partial copy is of no use. - let _ = std::fs::remove_file(old); - let why = - format!("{refused}, and the file can't be copied aside before it is overwritten ({e}); the new content is kept in {}", tmp.display()); + let why = format!( + "{refused}, and the file can't be copied aside before it is overwritten ({e}); the new content is kept in {}", + (over.tmp)().display() + ); return Err(io::Error::new(refused.kind(), RecoveryError(why))); } let copied = to.set_len(0).and_then(|()| io::copy(&mut from, &mut to)).and_then(|_| sync_file(&to)); @@ -358,17 +408,23 @@ fn write_over_in(over: &Over<'_>, refused: io::Error) -> io::Result<()> { } (Err(e), Some(old)) => Err(io::Error::new( e.kind(), - RecoveryError(format!("{e} (the new content is kept in {}, the file as it was in {})", tmp.display(), old.display())), + RecoveryError(format!("{e} (the new content is kept in {}, the file as it was in {})", (over.tmp)().display(), old.display())), )), - (Err(e), None) => Err(io::Error::new(e.kind(), RecoveryError(format!("{e} (the new content is kept in {})", tmp.display())))), + (Err(e), None) => Err(io::Error::new(e.kind(), RecoveryError(format!("{e} (the new content is kept in {})", (over.tmp)().display())))), } } -/// A flushed copy of what `target` holds, at `old` (for its owner only). +/// A flushed copy of what `target` holds, at `old` (for its owner only). A copy this call made and +/// could not finish is removed; a file already at `old` is left as it is. fn keep_old(target: &mut File, old: &Path) -> io::Result<()> { let mut to = create_private(old)?; - io::copy(target, &mut to)?; - sync_file(&to) + let copied = io::copy(target, &mut to).and_then(|_| sync_file(&to)); + if copied.is_err() { + drop(to); + // Best effort: a partial copy is of no use. + let _ = std::fs::remove_file(old); + } + copied } /// A new file for its owner only (Unix): the system's temporary folder is shared. @@ -523,6 +579,9 @@ thread_local! { static FLUSHES_LEFT: std::cell::Cell<Option<u32>> = const { std::cell::Cell::new(None) }; /// Tests: how many plain `fsync` fallbacks were made on this thread. static PLAIN_FSYNCS: std::cell::Cell<u32> = const { std::cell::Cell::new(0) }; + /// Tests: [`write_atomic_checked`]'s folder refuses the rename. + #[cfg(unix)] + static RENAME_REFUSED: std::cell::Cell<bool> = const { std::cell::Cell::new(false) }; } /// A symbolic link keeps pointing at its file: write the file it names. @@ -739,6 +798,87 @@ mod tests { let _ = std::fs::remove_dir_all(d); } + /// Permissions taken away from the file while the new content is written stay taken away. + #[cfg(unix)] + #[test] + fn a_checked_write_keeps_permissions_changed_while_it_fills() { + use std::os::unix::fs::PermissionsExt; + let (d, root, _) = checked_folders("checked-mode"); + let path = root.join("inside/doc.txt"); + std::fs::write(&path, b"old").unwrap(); + std::fs::set_permissions(&path, std::fs::Permissions::from_mode(0o644)).unwrap(); + let fill = |f: &mut File| { + std::fs::set_permissions(&path, std::fs::Permissions::from_mode(0o600))?; + f.write_all(b"new") + }; + write_atomic_checked(&path, fill, under(&root)).unwrap(); + assert_eq!(std::fs::metadata(&path).unwrap().permissions().mode() & 0o777, 0o600); + assert_eq!(std::fs::read(&path).unwrap(), b"new"); + let _ = std::fs::remove_dir_all(d); + } + + /// A folder that changed between being opened and being looked up by its path is not reported + /// as a read-only location. + #[cfg(unix)] + #[test] + fn a_changed_folder_is_not_a_read_only_location() { + let (d, root, outside) = checked_folders("checked-identity"); + let opened = open_folder(&root.join("inside")).unwrap(); + let e = opened_folder_path(&opened, &outside).unwrap_err(); + assert!(e.to_string().contains("the folder changed while it was opened"), "{e}"); + assert!(!read_only_location(&e), "{e:?}"); + let _ = std::fs::remove_dir_all(d); + } + + /// A checked write whose folder moved after it was opened, refused the rename, and failed to + /// copy into the file: the error names the temporary file where it is now. + #[cfg(unix)] + #[test] + fn a_checked_write_names_the_kept_file_where_its_folder_moved() { + let (d, root, _) = checked_folders("checked-moved"); + std::fs::write(root.join("inside/doc.txt"), b"original").unwrap(); + let check = under(&root); + let r = write_atomic_checked( + &root.join("inside/doc.txt"), + |f| f.write_all(b"new"), + |p| { + check(p)?; + std::fs::rename(root.join("inside"), root.join("moved"))?; + RENAME_REFUSED.with(|c| c.set(true)); + // The temporary file's flush and the copy of the old content work, the next doesn't. + FLUSHES_LEFT.with(|c| c.set(Some(2))); + Ok(()) + }, + ); + RENAME_REFUSED.with(|c| c.set(false)); + FLUSHES_LEFT.with(|c| c.set(None)); + let message = r.unwrap_err().to_string(); + let kept: Vec<_> = + std::fs::read_dir(root.join("moved")).unwrap().map(|e| e.unwrap().path()).filter(|p| p.extension().is_some_and(|x| x == "tmp")).collect(); + let [kept] = kept.as_slice() else { panic!("one temporary file: {kept:?}") }; + let kept = std::fs::canonicalize(kept).unwrap(); + assert!(message.contains(&kept.display().to_string()), "{message}"); + assert_eq!(std::fs::read(&kept).unwrap(), b"new"); + let _ = std::fs::remove_dir_all(d); + } + + /// A folder that can be written and searched but not listed takes the file. (The permission + /// does not hold for root, which can list any folder.) + #[cfg(target_os = "linux")] + #[test] + fn a_checked_write_saves_into_a_folder_that_cannot_be_listed() { + use std::os::unix::fs::PermissionsExt; + let (d, root, _) = checked_folders("checked-search-only"); + let folder = root.join("inside"); + std::fs::set_permissions(&folder, std::fs::Permissions::from_mode(0o300)).unwrap(); + let r = write_atomic_checked(&folder.join("doc.txt"), |f| f.write_all(b"new"), under(&root)); + std::fs::set_permissions(&folder, std::fs::Permissions::from_mode(0o755)).unwrap(); + // The folder flush needs it opened for reading: the file is written, and the error says so. + assert!(r.as_ref().map_or_else(|e| e.get_ref().is_some_and(|e| e.is::<WrittenError>()), |()| true), "{r:?}"); + assert_eq!(std::fs::read(folder.join("doc.txt")).unwrap(), b"new"); + let _ = std::fs::remove_dir_all(d); + } + /// The other files in `d` besides `keep`. fn leftovers(d: &Path, keep: &str) -> Vec<String> { std::fs::read_dir(d).unwrap().map(|e| e.unwrap().file_name().to_string_lossy().to_string()).filter(|n| n != keep).collect() @@ -995,6 +1135,33 @@ mod tests { let _ = std::fs::remove_dir_all(&d); } + /// A refused rename where a file is already at the name the old content would be copied to: + /// that file is left as it is, and the temporary file with the new content stays. + #[test] + fn a_refused_rename_leaves_a_file_already_at_the_backup_name() { + let d = dir("no-rename-backup-taken"); + let path = d.join("doc.vectorcraft"); + std::fs::write(&path, b"original").unwrap(); + let r = write_atomic_stepping( + &path, + |f| f.write_all(b"new"), + create_new, + |tmp, _| { + std::fs::write(tmp.with_extension("old"), b"an earlier copy")?; + denied() + }, + ); + let message = r.unwrap_err().to_string(); + let mut left = leftovers(&d, "doc.vectorcraft"); + left.sort(); + let [old, tmp] = left.as_slice() else { panic!("the earlier copy and the new content: {left:?}") }; + assert!(message.contains(tmp.as_str()), "{message}"); + assert_eq!(std::fs::read(d.join(old)).unwrap(), b"an earlier copy"); + assert_eq!(std::fs::read(d.join(tmp)).unwrap(), b"new"); + assert_eq!(std::fs::read(&path).unwrap(), b"original"); + let _ = std::fs::remove_dir_all(&d); + } + /// A refused rename where the old content can't be copied aside (here: no flush works): the /// file is left as it was, the temporary file with the whole new content stays and the error /// names it. From 8c6ce6d5c996170fb05a2435a8d6a5ec09f6eefa Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 1 Dec 2026 23:53:39 -0800 Subject: [PATCH 111/112] Tests: read-only fixture test checks it caught its own panic The test caught any panic from its closure, so a failed set_permissions would also pass it while the file was still writable. It now asserts the file is read-only before its panic and checks the caught payload is that panic's message. --- crates/engine/src/file_access.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/file_access.rs b/crates/engine/src/file_access.rs index 64a87119ff..d0270e8171 100644 --- a/crates/engine/src/file_access.rs +++ b/crates/engine/src/file_access.rs @@ -1254,9 +1254,11 @@ mod tests { let mut perms = std::fs::metadata(&file).unwrap().permissions(); perms.set_readonly(true); std::fs::set_permissions(&file, perms).unwrap(); + assert!(std::fs::metadata(&file).unwrap().permissions().readonly(), "the fixture is read-only"); panic!("a failed assertion"); }); - assert!(failed.is_err()); + let payload = failed.err().unwrap_or_else(|| panic!("the closure did not panic")); + assert_eq!(payload.downcast_ref::<&str>(), Some(&"a failed assertion"), "the test's own panic, not a setup failure"); assert!(!base.exists(), "{} is left", base.display()); } From 0c8fd2021b52beb819f83784f316c63ae8b27d5f Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Wed, 2 Dec 2026 00:25:05 -0800 Subject: [PATCH 112/112] Save: checked writes keep the file's backup, ACL and grant name - A path written as a folder (`draft.svg/`, `draft.svg/.`) is refused instead of saving `draft.svg`. - The second check uses the name the file is stored under, so on a volume that ignores letter case a grant for `Report.svg` allows a save to `report.svg`. - Where the rename is refused, the copy of the old content is made beside the temporary file through the open folder, and in the system's temporary folder only when the folder takes no new file. - The copy of the old content is read from the file that is then overwritten: when another file is at the name by then, nothing is overwritten and the new content stays in the temporary file. - On Apple platforms the folder is opened with `O_SEARCH`, so a folder that can be written and searched but not listed takes the file. - On Linux the replaced file's ACL is read through an `O_PATH` handle, so a file its owner can write but not read keeps its ACL. - The moved-folder test expects the original folder in the message on FreeBSD, which does not report where an open folder is now. --- crates/format/src/atomic.rs | 286 +++++++++++++++++++++++++++++++----- 1 file changed, 249 insertions(+), 37 deletions(-) diff --git a/crates/format/src/atomic.rs b/crates/format/src/atomic.rs index 34d980071d..d759ff6d9f 100644 --- a/crates/format/src/atomic.rs +++ b/crates/format/src/atomic.rs @@ -98,6 +98,12 @@ pub fn write_atomic_checked( allowed: impl FnOnce(&Path) -> io::Result<()>, ) -> io::Result<()> { use rustix::fs::{AtFlags, Mode, OFlags}; + // A path written as a folder (`draft.svg/`, `draft.svg/.`) is not a file path: `file_name` + // would drop the slash and save `draft.svg`. + let spelled = std::os::unix::ffi::OsStrExt::as_bytes(path.as_os_str()); + if spelled.ends_with(b"/") || spelled.ends_with(b"/.") || spelled == b"." { + return Err(io::Error::new(io::ErrorKind::InvalidInput, format!("{}: not a file path", path.display()))); + } let resolved = resolve_link(path)?; let name = resolved .file_name() @@ -106,7 +112,7 @@ pub fn write_atomic_checked( let parent = resolved.parent().filter(|p| !p.as_os_str().is_empty()).unwrap_or_else(|| Path::new(".")); let dir = open_folder(parent)?; let real = opened_folder_path(&dir, parent)?; - let target = real.join(&name); + let target = real.join(stored_name(&dir, &real, &name)); allowed(&target)?; // Only whether a file is there: its permissions are read again once it is about to be replaced. let replacing = rustix::fs::statat(&dir, &name, AtFlags::SYMLINK_NOFOLLOW).is_ok(); @@ -151,9 +157,33 @@ pub fn write_atomic_checked( let refuse = false; let renamed = if refuse { Err(rustix::io::Errno::ACCESS) } else { rustix::fs::renameat(&dir, &tmp_name, &dir, &name) }; let Err(refused) = renamed else { return synced() }; + // The file as it was is copied beside the temporary file, through the open folder, or + // to the system's folder where the open folder takes no new file. + let old_name = Path::new(&tmp_name).with_extension("old").into_os_string(); + let old_elsewhere = std::env::temp_dir().join(&old_name); + let old_in_folder = std::cell::Cell::new(true); let over = Over { tmp: &|| now(&tmp_name), - old: std::env::temp_dir().join(&tmp_name).with_extension("old"), + create_old: &|| match rustix::fs::openat(&dir, &old_name, new_file, Mode::RUSR | Mode::WUSR) { + Ok(f) => { + old_in_folder.set(true); + Ok(File::from(f)) + } + Err(e) if e == rustix::io::Errno::EXIST => Err(e.into()), + Err(_) => { + old_in_folder.set(false); + create_private(&old_elsewhere) + } + }, + old: &|| if old_in_folder.get() { now(&old_name) } else { old_elsewhere.clone() }, + remove_old: &|| { + // Best effort: an unfinished copy is of no use. + if old_in_folder.get() { + let _ = rustix::fs::unlinkat(&dir, &old_name, AtFlags::empty()); + } else { + let _ = std::fs::remove_file(&old_elsewhere); + } + }, open_tmp: &|| { Ok(File::from(rustix::fs::openat(&dir, &tmp_name, OFlags::RDONLY | OFlags::NOFOLLOW | OFlags::CLOEXEC, Mode::empty())?)) }, @@ -181,9 +211,14 @@ pub fn write_atomic_checked( remove(); return Err(e); } + let old = elsewhere.with_extension("old"); let over = Over { tmp: &|| elsewhere.clone(), - old: elsewhere.with_extension("old"), + create_old: &|| create_private(&old), + old: &|| old.clone(), + remove_old: &|| { + let _ = std::fs::remove_file(&old); + }, open_tmp: &|| File::open(&elsewhere), remove_tmp: &remove, open_target: &open_target, @@ -219,14 +254,40 @@ fn opened_folder_path(dir: &std::os::fd::OwnedFd, parent: &Path) -> io::Result<P Ok(real) } +/// The name the entry `name` in the open folder `dir`, whose real path is `real`, is stored under. +/// On a volume that ignores letter case, `report.svg` can be stored as `Report.svg`, the name a +/// grant for that file was given. `name` itself when nothing is there, or when the entry the path +/// leads to is not the one in `dir` (the same device and inode, links not followed). +#[cfg(unix)] +fn stored_name(dir: &std::os::fd::OwnedFd, real: &Path, name: &std::ffi::OsStr) -> std::ffi::OsString { + use rustix::fs::AtFlags; + let Ok(here) = rustix::fs::statat(dir, name, AtFlags::SYMLINK_NOFOLLOW) else { return name.to_os_string() }; + let Ok(stored) = std::fs::canonicalize(real.join(name)) else { return name.to_os_string() }; + let same = stored.parent() == Some(real) && rustix::fs::lstat(&stored).is_ok_and(|s| (s.st_dev, s.st_ino) == (here.st_dev, here.st_ino)); + match stored.file_name() { + Some(stored) if same => stored.to_os_string(), + _ => name.to_os_string(), + } +} + /// The folder at `parent`, opened for looking names up in it. On Linux, Android and FreeBSD that -/// is `O_PATH`, which needs no permission to list the folder, so a folder that can be written and -/// searched but not listed still takes the file. +/// is `O_PATH`, and on Apple platforms `O_SEARCH`: neither needs permission to list the folder, so +/// a folder that can be written and searched but not listed still takes the file. Where the system +/// refuses `O_SEARCH`, the folder is opened for reading. #[cfg(unix)] fn open_folder(parent: &Path) -> io::Result<std::os::fd::OwnedFd> { use rustix::fs::{Mode, OFlags}; #[cfg(any(target_os = "linux", target_os = "android", target_os = "freebsd"))] let access = OFlags::PATH; + #[cfg(target_vendor = "apple")] + { + // `O_EXEC`, which with `O_DIRECTORY` is `O_SEARCH` (<sys/fcntl.h>). + let search = OFlags::from_bits_retain(0x4000_0000); + match rustix::fs::open(parent, search | OFlags::DIRECTORY | OFlags::CLOEXEC, Mode::empty()) { + Err(e) if e == rustix::io::Errno::INVAL => {} + opened => return Ok(opened?), + } + } #[cfg(not(any(target_os = "linux", target_os = "android", target_os = "freebsd")))] let access = OFlags::RDONLY; Ok(rustix::fs::open(parent, access | OFlags::DIRECTORY | OFlags::CLOEXEC, Mode::empty())?) @@ -269,21 +330,23 @@ fn keep_permissions_at(dir: &std::os::fd::OwnedFd, name: &std::ffi::OsStr, old: rustix::fs::fchmod(tmp, mode).map_err(io::Error::from) } -/// [`keep_acl`] for `name` in folder `dir`, opened without following a link and without waiting on -/// a pipe put in its place, when it is still the file with the status `old`. +/// [`keep_acl`] for `name` in folder `dir`, when it is still the file with the status `old`. The +/// file is opened with `O_PATH` without following a link, which needs no permission to read it, and +/// its ACL is read through `/proc/self/fd`, which names that open file. #[cfg(target_os = "linux")] fn keep_acl_at(dir: &std::os::fd::OwnedFd, name: &std::ffi::OsStr, old: &rustix::fs::Stat, tmp: &File) -> bool { use rustix::fs::{Mode, OFlags}; use rustix::io::Errno; const ACL: &str = "system.posix_acl_access"; - let Ok(target) = rustix::fs::openat(dir, name, OFlags::RDONLY | OFlags::NOFOLLOW | OFlags::NONBLOCK | OFlags::CLOEXEC, Mode::empty()) else { + let Ok(target) = rustix::fs::openat(dir, name, OFlags::PATH | OFlags::NOFOLLOW | OFlags::CLOEXEC, Mode::empty()) else { return false; }; if !rustix::fs::fstat(&target).is_ok_and(|t| (t.st_dev, t.st_ino) == (old.st_dev, old.st_ino)) { return false; } + let opened = format!("/proc/self/fd/{}", std::os::fd::AsRawFd::as_raw_fd(&target)); let mut buf = vec![0u8; 64 << 10]; - match rustix::fs::fgetxattr(&target, ACL, &mut buf[..]) { + match rustix::fs::getxattr(opened.as_str(), ACL, &mut buf[..]) { Ok(n) => buf.get(..n).is_some_and(|acl| rustix::fs::fsetxattr(tmp, ACL, acl, rustix::fs::XattrFlags::empty()).is_ok()), Err(e) if e == Errno::NODATA => match rustix::fs::fremovexattr(tmp, ACL) { Ok(()) => true, @@ -346,9 +409,14 @@ fn write_atomic_stepping( /// the copy into `target` fails it is damaged: `tmp` and the copy of the old content stay and the /// error says where they are. fn write_over(tmp: &Path, target: &Path, refused: io::Error) -> io::Result<()> { + let old = tmp.with_extension("old"); let over = Over { tmp: &|| tmp.to_path_buf(), - old: tmp.with_extension("old"), + create_old: &|| create_private(&old), + old: &|| old.clone(), + remove_old: &|| { + let _ = std::fs::remove_file(&old); + }, open_tmp: &|| File::open(tmp), remove_tmp: &|| { let _ = std::fs::remove_file(tmp); @@ -364,8 +432,12 @@ fn write_over(tmp: &Path, target: &Path, refused: io::Error) -> io::Result<()> { struct Over<'a> { /// Where the temporary file is when an error message names it (its folder may have moved). tmp: &'a dyn Fn() -> PathBuf, - /// Where the file as it was is copied aside. - old: PathBuf, + /// A new file, for its owner only and never replacing one, that the file as it was is copied to. + create_old: &'a dyn Fn() -> io::Result<File>, + /// Where the file `create_old` made is when an error message names it. + old: &'a dyn Fn() -> PathBuf, + /// Best effort: removes the file `create_old` made. + remove_old: &'a dyn Fn(), open_tmp: &'a dyn Fn() -> io::Result<File>, /// Best effort. remove_tmp: &'a dyn Fn(), @@ -384,10 +456,16 @@ fn write_over_in(over: &Over<'_>, refused: io::Error) -> io::Result<()> { (over.remove_tmp)(); return Err(refused); }; - // Nothing to keep of a file that is new or empty. - let old = to.metadata().map_or(true, |m| m.len() > 0).then(|| over.old.clone()); - if let Some(old) = &old - && let Err(e) = (over.open_target)(false).and_then(|mut target| keep_old(&mut target, old)) + // Nothing to keep of a file that is new or empty. The copy is read from the file `to` writes + // into: one put at its name meanwhile is not copied in its place. + let kept = to.metadata().map_or(true, |m| m.len() > 0); + if kept + && let Err(e) = (over.open_target)(false).and_then(|mut target| { + if !same_file(&target, &to) { + return Err(io::Error::other("the file was replaced while it was opened")); + } + keep_old(&mut target, over) + }) { let why = format!( "{refused}, and the file can't be copied aside before it is overwritten ({e}); the new content is kept in {}", @@ -397,36 +475,50 @@ fn write_over_in(over: &Over<'_>, refused: io::Error) -> io::Result<()> { } let copied = to.set_len(0).and_then(|()| io::copy(&mut from, &mut to)).and_then(|_| sync_file(&to)); drop((from, to)); - match (copied, old) { - (Ok(()), old) => { + match (copied, kept) { + (Ok(()), kept) => { // Best effort: the file is saved, so the copies are no longer needed. (over.remove_tmp)(); - if let Some(old) = old { - let _ = std::fs::remove_file(old); + if kept { + (over.remove_old)(); } (over.synced)() } - (Err(e), Some(old)) => Err(io::Error::new( + (Err(e), true) => Err(io::Error::new( e.kind(), - RecoveryError(format!("{e} (the new content is kept in {}, the file as it was in {})", (over.tmp)().display(), old.display())), + RecoveryError(format!("{e} (the new content is kept in {}, the file as it was in {})", (over.tmp)().display(), (over.old)().display())), )), - (Err(e), None) => Err(io::Error::new(e.kind(), RecoveryError(format!("{e} (the new content is kept in {})", (over.tmp)().display())))), + (Err(e), false) => Err(io::Error::new(e.kind(), RecoveryError(format!("{e} (the new content is kept in {})", (over.tmp)().display())))), } } -/// A flushed copy of what `target` holds, at `old` (for its owner only). A copy this call made and -/// could not finish is removed; a file already at `old` is left as it is. -fn keep_old(target: &mut File, old: &Path) -> io::Result<()> { - let mut to = create_private(old)?; +/// A flushed copy of what `target` holds, in the file `over.create_old` makes. A copy this call made +/// and could not finish is removed; a file already at that name is left as it is. +fn keep_old(target: &mut File, over: &Over<'_>) -> io::Result<()> { + let mut to = (over.create_old)()?; let copied = io::copy(target, &mut to).and_then(|_| sync_file(&to)); if copied.is_err() { drop(to); - // Best effort: a partial copy is of no use. - let _ = std::fs::remove_file(old); + (over.remove_old)(); } copied } +/// Whether `a` and `b` are open on the same file (the same device and inode). Always `true` off +/// Unix. +fn same_file(a: &File, b: &File) -> bool { + #[cfg(unix)] + { + use std::os::unix::fs::MetadataExt; + matches!((a.metadata(), b.metadata()), (Ok(a), Ok(b)) if (a.dev(), a.ino()) == (b.dev(), b.ino())) + } + #[cfg(not(unix))] + { + let _ = (a, b); + true + } +} + /// A new file for its owner only (Unix): the system's temporary folder is shared. fn create_private(path: &Path) -> io::Result<File> { let mut options = OpenOptions::new(); @@ -831,7 +923,9 @@ mod tests { } /// A checked write whose folder moved after it was opened, refused the rename, and failed to - /// copy into the file: the error names the temporary file where it is now. + /// copy into the file: the temporary file and the copy of the old content stay in that folder, + /// and the error names them where they are now. (FreeBSD does not say where an open folder is + /// now: there the error names them where the folder was opened.) #[cfg(unix)] #[test] fn a_checked_write_names_the_kept_file_where_its_folder_moved() { @@ -853,18 +947,136 @@ mod tests { RENAME_REFUSED.with(|c| c.set(false)); FLUSHES_LEFT.with(|c| c.set(None)); let message = r.unwrap_err().to_string(); - let kept: Vec<_> = - std::fs::read_dir(root.join("moved")).unwrap().map(|e| e.unwrap().path()).filter(|p| p.extension().is_some_and(|x| x == "tmp")).collect(); - let [kept] = kept.as_slice() else { panic!("one temporary file: {kept:?}") }; - let kept = std::fs::canonicalize(kept).unwrap(); - assert!(message.contains(&kept.display().to_string()), "{message}"); - assert_eq!(std::fs::read(&kept).unwrap(), b"new"); + let kept = |ext: &str| -> PathBuf { + let found: Vec<_> = std::fs::read_dir(root.join("moved")) + .unwrap() + .map(|e| e.unwrap().path()) + .filter(|p| p.extension().is_some_and(|x| x == ext)) + .collect(); + let [kept] = found.as_slice() else { panic!("one .{ext} file: {found:?}") }; + std::fs::canonicalize(kept).unwrap() + }; + let (tmp, old) = (kept("tmp"), kept("old")); + assert_eq!((std::fs::read(&tmp).unwrap(), std::fs::read(&old).unwrap()), (b"new".to_vec(), b"original".to_vec())); + let named_in = + if cfg!(any(target_os = "linux", target_os = "android", target_vendor = "apple")) { root.join("moved") } else { root.join("inside") }; + for file in [&tmp, &old] { + let named = named_in.join(file.file_name().unwrap()); + assert!(message.contains(&named.display().to_string()), "{} in {message}", named.display()); + } + let _ = std::fs::remove_dir_all(d); + } + + /// A refused rename copies the old content through the file handle it then overwrites: when a + /// different file is at the name by the time it is opened for reading, nothing is overwritten and + /// the new content stays in the temporary file. + #[cfg(unix)] + #[test] + fn a_refused_rename_copies_aside_the_file_it_overwrites() { + let d = dir("no-rename-swapped"); + let (path, other, tmp) = (d.join("doc.txt"), d.join("other.txt"), d.join("doc.tmp")); + std::fs::write(&path, b"original").unwrap(); + std::fs::write(&other, b"someone else's").unwrap(); + std::fs::write(&tmp, b"new").unwrap(); + let old = d.join("doc.old"); + let over = Over { + tmp: &|| tmp.clone(), + create_old: &|| create_private(&old), + old: &|| old.clone(), + remove_old: &|| { + let _ = std::fs::remove_file(&old); + }, + open_tmp: &|| File::open(&tmp), + remove_tmp: &|| { + let _ = std::fs::remove_file(&tmp); + }, + open_target: &|write| if write { OpenOptions::new().write(true).open(&path) } else { File::open(&other) }, + synced: &|| Ok(()), + }; + let e = write_over_in(&over, denied::<()>().unwrap_err()).unwrap_err(); + assert!(e.to_string().contains("the file was replaced while it was opened"), "{e}"); + assert_eq!(std::fs::read(&path).unwrap(), b"original"); + assert_eq!(std::fs::read(&tmp).unwrap(), b"new"); + assert!(!old.exists()); + let _ = std::fs::remove_dir_all(d); + } + + /// A path written as a folder is refused, and no file is made under the name before the slash. + #[cfg(unix)] + #[test] + fn a_checked_write_refuses_a_path_written_as_a_folder() { + let (d, root, _) = checked_folders("checked-slash"); + for spelled in ["inside/draft.svg/", "inside/draft.svg/."] { + let r = write_atomic_checked(&root.join(spelled), |f| f.write_all(b"new"), under(&root)); + assert_eq!(r.map_err(|e| e.kind()), Err(io::ErrorKind::InvalidInput), "{spelled}"); + } + assert!(!root.join("inside/draft.svg").exists()); + write_atomic_checked(&root.join("inside/draft.svg"), |f| f.write_all(b"new"), under(&root)).unwrap(); + assert_eq!(std::fs::read(root.join("inside/draft.svg")).unwrap(), b"new"); + let _ = std::fs::remove_dir_all(d); + } + + /// On a volume that ignores letter case, a write to `report.txt` where `Report.txt` is stored + /// is checked as `Report.txt`, the name a grant for the file has. (Skipped where the volume keeps + /// letter case apart.) + #[cfg(unix)] + #[test] + fn a_checked_write_checks_the_stored_name_of_the_file() { + let (d, root, _) = checked_folders("checked-case"); + let stored = root.join("inside/Report.txt"); + std::fs::write(&stored, b"old").unwrap(); + if !root.join("inside/report.txt").exists() { + let _ = std::fs::remove_dir_all(d); + return; + } + let exact = |p: &Path| if p == stored { Ok(()) } else { Err(io::Error::other(format!("{} is not granted", p.display()))) }; + write_atomic_checked(&root.join("inside/report.txt"), |f| f.write_all(b"new"), exact).unwrap(); + assert_eq!(std::fs::read(&stored).unwrap(), b"new"); + let _ = std::fs::remove_dir_all(d); + } + + /// A replaced file that its owner may write but not read keeps the ACL that lets someone else + /// read it. (Skipped on a file system without ACLs, and for root, which can read any file.) + #[cfg(target_os = "linux")] + #[test] + fn a_checked_write_keeps_the_acl_of_a_file_its_owner_cannot_read() { + use std::os::unix::fs::PermissionsExt; + const ACL: &str = "system.posix_acl_access"; + let (d, root, _) = checked_folders("checked-acl-write-only"); + let path = root.join("inside/doc.txt"); + std::fs::write(&path, b"old").unwrap(); + // u::-w-, u:nobody:r--, g::---, m::r--, o::--- + let mut acl = 2u32.to_le_bytes().to_vec(); + for (tag, perm, id) in [(0x01u16, 2u16, u32::MAX), (0x02, 4, 65534), (0x04, 0, u32::MAX), (0x10, 4, u32::MAX), (0x20, 0, u32::MAX)] { + acl.extend(tag.to_le_bytes()); + acl.extend(perm.to_le_bytes()); + acl.extend(id.to_le_bytes()); + } + match rustix::fs::setxattr(&path, ACL, &acl, rustix::fs::XattrFlags::empty()) { + Ok(()) => {} + Err(e) if e == rustix::io::Errno::NOTSUP => { + let _ = std::fs::remove_dir_all(d); + return; + } + Err(e) => panic!("setting the ACL: {e}"), + } + if File::open(&path).is_ok() { + // Root reads any file. + let _ = std::fs::remove_dir_all(d); + return; + } + write_atomic_checked(&path, |f| f.write_all(b"new"), under(&root)).unwrap(); + let mut buf = vec![0u8; 4096]; + let n = rustix::fs::getxattr(&path, ACL, &mut buf[..]).unwrap(); + assert_eq!(buf.get(..n).unwrap(), acl.as_slice(), "the ACL is kept"); + std::fs::set_permissions(&path, std::fs::Permissions::from_mode(0o600)).unwrap(); + assert_eq!(std::fs::read(&path).unwrap(), b"new"); let _ = std::fs::remove_dir_all(d); } /// A folder that can be written and searched but not listed takes the file. (The permission /// does not hold for root, which can list any folder.) - #[cfg(target_os = "linux")] + #[cfg(any(target_os = "linux", target_vendor = "apple"))] #[test] fn a_checked_write_saves_into_a_folder_that_cannot_be_listed() { use std::os::unix::fs::PermissionsExt;