Commit Graph
244 Commits
Author SHA1 Message Date
dotCooCoo 9c11c47f75 Doc tests: unsafe code is denied in doc tests too
Rustdoc builds each doc test as its own crate, without the workspace's
`unsafe_code = "deny"` and without a library's `#![forbid(unsafe_code)]`,
so a doc test holding an `unsafe` block passed `cargo test --doc`.

- Every library root now carries `#![doc(test(attr(forbid(unsafe_code))))]`,
  or `deny` in cad, eps and metafile, which rely on the workspace lint.
- `cargo xtask layers` reports a library whose doc tests are missing the
  attribute, or use `deny` where the library forbids unsafe code.
- AGENTS.md names the rule next to the `unsafe` allowlist.
2026-12-03 09:51:28 -08:00
dotCooCoo d29d2d03da Tests: harmony labels and DXF miles and kilometers
- rules_parse_by_id_and_label reads a few shown labels back through
  parse(label(h)). The labels are written in vectorcraft-color and the
  ids come from craft-libs, so a label that drifts from its id no longer
  parses.
- units_choose_the_default_scale covers $INSUNITS 3 (miles) and
  7 (kilometers), which have no unit of their own and read as
  millimeters at their scale.
2026-12-02 21:00:46 -08:00
.CooCoo 2b67583bf0 Merge pull request #10516 from dotCooCoo/test/svg-pdf-eps-pass
Tests: SVG, PDF and EPS tests check what they claim, and a gradient without stops exports as one that pads
2026-12-01 18:24:21 -08:00
dotCooCoo 52d08f0f9c 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.
2026-12-01 17:38:19 -08:00
dotCooCoo c58415b307 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.
2026-12-01 17:24:39 -08:00
dotCooCoo 6ea1132e5c Tests: tighten loose bounds in color and text tests
Five assertions accepted wrong results:

- Freeform: a point split half way along a Catmull-Rom segment must be
  at x = 43.75, not anywhere between the two ends.
- Diamond gradient pixels: the center is exactly white and the corners
  exactly black, instead of a bound that accepted white scaled to 220.
- Ruby: the default reading is half the base size (ratio 0.5), where
  the old bound accepted 70%.
- Caret Up/Down: the caret lands on the stop nearest the column, where
  the old 12 pt tolerance accepted a neighboring stop.
- Hyphenation defaults: a frozen hash of line breaks is replaced with
  explicit breaks ("The lan-" / "guage", "The gar-" / "den") and hyphen
  flags for both composers, ragged and justified.

Each new assertion fails when the behavior it checks is broken.
2026-12-01 02:27:00 -08:00
dotCooCoo 288c14310d Merge main into feat/color-wheel-copy-color-as 2026-11-28 21:39:07 -08:00
dotCooCoo f9496f6c59 Merge main into feat/color-wheel-copy-color-as 2026-11-28 19:54:43 -08:00
dotCooCoo 1ad8134791 Merge main into feat/color-wheel-contrast-lines 2026-11-28 19:38:37 -08:00
dotCooCoo 97316b5ce0 Merge main into feat/color-wheel-hex-alpha-css 2026-11-28 08:20:14 -08:00
dotCooCoo c72b9c8f7a Color: with_active keeps the working settings on its thread too
cms::with_active put its settings in place of the active settings on
its thread, but cms::working() still read the process-wide working
settings. Code inside with_active could therefore read active settings
from one context and working settings from another, and a set_active
on another thread changed the working half while the scope ran.

Inside with_active, working() now gives the working settings of the
context it was given: the ones for_document put a document's profiles
in place of, else that context itself. use_document_profiles and
for_document still read the process working settings, because they
install or keep process-wide contexts. Outside with_active nothing
changes. The app calls with_active only with for_document contexts
(canvas panes and the color mode change on open), whose working
settings are the process ones, so the app reads the same working
settings as before.
2026-11-27 19:56:23 -08:00
BFlat 06390d163b Merge pull request #7632 from dotCooCoo/feat/color-wheel-oklch-sliders-v2
Color Wheel: OKLCH Sliders give exact black and white, describe the document's RGB space and drop a remembered pick after an undo step
2026-11-27 05:18:50 +07:00
BFlat 478432c8b0 Merge pull request #8346 from dotCooCoo/feat/fogra51-52-cmyk-v2
Color: FOGRA51 and FOGRA52 CMYK working spaces computed from Fogra's data
2026-11-27 00:53:58 +07:00
dotCooCoo d9b119a371 Color Wheel: a channel just below sRGB counts as outside it
The gamut test allowed 1e-4 beyond 0..1, so OKLCH colors such as L 0.01, C 0.01,
H 0 were clipped at their own chroma and not reported as lowered, and the C track
marked the wrong maximum. The allowance is now 1e-5, above the 1.7e-6 matrix
round-trip error of sRGB boundary colors.
2026-11-26 00:18:32 -08:00
dotCooCoo ac256df28e Merge main into feat/color-wheel-copy-color-as 2026-11-25 19:42:58 -08:00
dotCooCoo 0d5d6d34f3 Merge main into feat/color-wheel-oklch-sliders-v2 2026-11-25 19:27:00 -08:00
FredApps ae70a8f174 Resolve main documentation conflict in History row menu PR #8845 2026-11-26 03:27:16 +01:00
dotCooCoo 1d6f0340e2 Merge main into feat/color-wheel-contrast
The contrast row, its menu rows and its tests move to the craft UI framework,
as main's Color Wheel panel now uses it:

- The row is a Row with a Swatch named Background (a color well whose value is
  the background's hex value) and Text for the ratio and the AA and AAA
  results, each with the WCAG minimums as its tooltip.
- Show Contrast, Contrast For and Contrast Background are rows of the panel
  menu's items (ui.colorWheel.contrast, contrastFor.<id>,
  contrastBackground.below and contrastBackground.current), after Show
  Opacity. Current Color is gray, and its row answers an error, while the
  active proxy has no solid color.
- The kept background and ratio answer are fields of WheelUi instead of panel
  state. The answer's key also holds whether the Live Paint Bucket paints,
  which changes the proxies' paint without a document revision.
- The row's tests run in the panel's Fixture by accessible name; the drag test
  runs an interaction whose previews set the fill, as the Show Document Colors
  drag test does.
- The settings lists in the params text, docs/mcp.md and the tests take both
  opacity and the contrast keys.
2026-11-25 16:36:08 -08:00
ruchirguitar c766f2f450 History panel: add snapshot-safe row context menus and keyboard access 2026-11-26 04:54:14 +05:30
dotCooCoo 5ca10060b3 Merge main into feat/color-wheel-oklch-sliders-v2 2026-11-25 13:58:13 -08:00
dotCooCoo 2293eaf838 Merge main into feat/color-wheel-contrast-lines 2026-11-25 13:40:51 -08:00
dotCooCoo c27619310a Merge main into feat/fogra51-52-cmyk-v2 2026-11-25 10:19:57 -08:00
dotCooCoo 947401e7ef Merge feat/color-wheel-hex-alpha-css into feat/color-wheel-copy-color-as 2026-11-24 20:02:33 -08:00
dotCooCoo d285d8b9a4 Merge main into feat/color-wheel-hex-alpha-css 2026-11-24 18:05:18 -08:00
BFlat 6f37bd839c VectorCraft on the craft UI framework (#8800)
VectorCraft's UI moves onto the shared craft UI framework in storytold/craft-libs (`next`; the framework side is storytold/craft-libs#2809), as PhotoCraft's did. The app keeps its engine, document model, file formats, commands and automation; its windows, panels, bars, dialogs and canvas are now built and driven by the framework: shell, docking and panels, hosted dialogs, keyboard, focus, IME and pointer routing, and theme tokens.

About 264,000 lines of VectorCraft's own egui UI code are removed and about 154,000 added. craft-libs is pinned at bf62d509f (in `next`), the egui fork at f5025284.

Tests that drove the old UI were rewritten against the port where only their premise changed, with their assertions kept. The UI tests still failing at merge, and their follow-ups, are listed in the pull request.
2026-11-24 08:25:24 +07:00
dotCooCoo d26ae6f344 Color Wheel: contrast lines follow a widening band, show for a fill of None and hide under Alt
- The contrast lines count a narrow band's crossings among a cell's
  crossings where no band on the next line joins it, so a band that
  widens past the samples is no longer cut across.
- The lines show where a pick passes when the fill or stroke is None or
  a pattern (`contrast_pick_backdrop`), and are hidden while Alt sends
  a pick to the other proxy.
- The Background chip shows the background the ratio uses, so a pinned
  100 % K shows as black with a rich black Appearance of Black.
- `color.contrast` with "below" is an error when a blend mode other
  than Normal mixes the color with art that is not one color where its
  level reads it; a blend inside an isolating group over such art still
  answers.
- `wcag::closest_passing`, `color.contrast`'s params text and
  docs/mcp.md say that a nearer passing color can be missed when the
  passing lightnesses fall in more than one stretch, that a null fix
  shows no chip, and that a null `contrastBackground` sets Behind
  Selection.
- The wide-gamut contrast test restores the color settings through
  `restored_settings()`.
2026-11-22 08:16:39 -08:00
dotCooCoo 767c0798a9 Color Wheel: a contrast fix keeps the largest chroma sRGB shows at its lightness
The fix search lowered an out-of-gamut chroma by bisection, which stops
at the first gamut boundary. Near blue the chromas sRGB holds at one
lightness come in two stretches, so a blue that needed a little more
contrast lost much of its chroma (blue on #B8B8B8 got a fix of chroma
0.25 against blue's 0.31). The search now uses oklab::from_oklch, which
takes the largest chroma below the asked one that fits.
2026-11-21 00:57:36 -08:00
dotCooCoo b3bcdcbb07 Merge feat/color-wheel-oklch-sliders-v2 into feat/color-wheel-copy-color-as
Brings in #7632's exact black and white at the OKLCH lightness endpoints, the color.convert docs on the chroma that fit, and the panel menu items that run ui.colorWheel. Show Opacity and Show Hex Field run ui.colorWheel the same way.
2026-11-20 15:50:59 -08:00
dotCooCoo 673124e8f5 Merge feat/color-wheel-contrast into feat/color-wheel-contrast-lines 2026-11-20 14:21:50 -08:00
dotCooCoo a7ab3b782e Merge main into feat/fogra51-52-cmyk-v2 2026-11-20 05:42:42 -08:00
dotCooCoo 4b7f7d441e Merge feat/color-wheel-hex-alpha-css into feat/color-wheel-copy-color-as 2026-11-19 19:08:15 -08:00
dotCooCoo 97599b5a50 Color: color.parse says it reads a subset of CSS without calc()
The help, the color module docs and docs/mcp.md state that a function's
arguments are literal numbers, percentages, angles and none, and that
calc(), var(), color-mix(), other nested functions, named colors and the
other color functions and spaces are errors.
2026-11-19 18:32:24 -08:00
dotCooCoo e72b5f9d10 Merge main into feat/color-wheel-hex-alpha-css 2026-11-19 16:58:56 -08:00
dotCooCoo 4aa133a285 Merge main into feat/color-wheel-contrast 2026-11-19 16:36:02 -08:00
dotCooCoo 0cb9626d42 Merge main into feat/color-wheel-oklch-sliders-v2 2026-11-19 16:20:20 -08:00
dotCooCoo 58600cd38c Merge main into feat/color-wheel-copy-color-as 2026-11-19 14:09:20 -08:00
dotCooCoo cd91729d9d Merge main into feat/color-wheel-hex-alpha-css 2026-11-19 11:40:32 -08:00
dotCooCoo 7aba419863 Merge main into feat/color-wheel-copy-color-as 2026-11-19 11:36:57 -08:00
dotCooCoo 00322ad70f Color Wheel: OKLCH lightness endpoints give exact black and white
from_oklch returns exactly black at lightness 0 and exactly white at
lightness 1, as CSS Color 4 specifies, and reports a positive chroma
there as lowered. The gamut tolerance no longer leaves a positive red
channel at L=0.

The command text and docs say a color outside sRGB takes the largest
chroma that fits at or below the one asked for, that color.convert
measures the stored color's display sRGB, and that a null key keeps its
value. The saved-settings test also checks that an unknown slider value
keeps the saved view.
2026-11-19 11:27:47 -08:00
dotCooCoo 5d489b511a Merge main into feat/color-wheel-contrast 2026-11-19 11:17:08 -08:00
Codex 75813b3be8 fix: preserve palette color conversion and localization keys 2026-11-19 13:53:34 -05:00
Dylan M. Taylor 7d44f644e8 color: use shared craft-cms palette codecs with localized errors 2026-11-19 13:52:36 -05:00
bflatastic eee6f40a92 Merge remote-tracking branch 'origin/main' into fix/8044 2026-11-19 23:39:16 +07:00
dotCooCoo c6411da1be Merge main into feat/color-wheel-copy-color-as 2026-11-19 08:03:49 -08:00
dotCooCoo 36ee552867 Merge main into feat/color-wheel-hex-alpha-css 2026-11-19 07:03:07 -08:00
dotCooCoo d056974654 Merge main into feat/color-wheel-contrast 2026-11-19 06:46:07 -08:00
BFlat 16756500bf Merge pull request #8700 from dotCooCoo/fix/print-perceptual-paper-plateau
Print: a Perceptual gradient keeps the ink below across a paper-white stretch
2026-11-19 21:33:06 +07:00
dotCooCoo 88cac70e8b Color Wheel: find the largest OKLCH chroma on every stretch of the ray
The chromas sRGB holds along a ray of fixed lightness and hue can come
in several stretches, and the search looked past the first one only
near a primary color's hue. Near black the gamut slack opens stretches
at other hues: at L 0.02 and H 242 degrees the ray fits up to about
0.022 but the search stopped near 0.012, so the chroma tick sat too low
and a pick past the gamut lost more chroma than it had to.

Each linear sRGB channel is a cubic in the chroma, so the search now
takes the chromas where a channel meets a gamut bound, between each
cubic's turning points, and keeps the largest one that fits. A test
compares the result with a scan of the ray at 720 lightness and hue
pairs.
2026-11-19 06:23:20 -08:00
dotCooCoo 1c841c481e Merge main into feat/color-wheel-contrast 2026-11-19 05:22:26 -08:00
dotCooCoo 6f619e1bbf Merge main into feat/color-wheel-copy-color-as 2026-11-19 05:21:19 -08:00