mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-25 05:52:09 +00:00
Brushes: check Vector Packs tinting and the applied brush
The Vector Packs test now renders each brush with a teal stroke and checks that every generated path is filled with that color, and after each brush.addFromLibrary call it checks that the line's stroke uses the brush. The black-stroke render still checks that each mark repeats along the path. G5's Missing entry in docs/gaps.md now counts thirteen built-in brush libraries, matching the Done entry.
This commit is contained in:
@@ -214,11 +214,29 @@ fn vector_packs_marks_are_editable_and_survive_a_saved_library() {
|
||||
assert!(art_paths(&sc.art).len() >= 2, "{} has no editable vector mark", b.name);
|
||||
let pieces = vectorcraft_brush::stroke_pieces(&lib.doc, b, &line_to(180.0), &black_stroke());
|
||||
assert!(pieces.len() >= 3, "{} does not repeat along a path", b.name);
|
||||
// The black marks take a non-black stroke color as their fill.
|
||||
let teal = vectorcraft_color::Color::rgb(0.1, 0.6, 0.5);
|
||||
let stroke = vectorcraft_doc::StrokeLayer::new(vectorcraft_color::Paint::solid(teal), 1.0);
|
||||
let mut fills = vec![];
|
||||
for piece in vectorcraft_brush::stroke_pieces(&lib.doc, b, &line_to(180.0), &stroke) {
|
||||
piece.walk(&mut |c| {
|
||||
if c.path_data().is_some() {
|
||||
fills.push(c.appearance.fill().map(|f| f.paint.clone()));
|
||||
}
|
||||
});
|
||||
}
|
||||
assert!(!fills.is_empty(), "{} draws no paths", b.name);
|
||||
for fill in fills {
|
||||
let Some(vectorcraft_color::Paint::Solid { color, .. }) = fill else { panic!("{} draws a path without a solid fill: {fill:?}", b.name) };
|
||||
let (got, want) = (color.to_rgb(), teal.to_rgb());
|
||||
assert!(got.iter().zip(want).all(|(g, w)| (g - w).abs() < 1e-3), "{} fills {got:?}, not the stroke color {want:?}", b.name);
|
||||
}
|
||||
let before = undo_len(&s);
|
||||
let added = run(&mut s, "brush.addFromLibrary", json!({"library": "vector-packs", "name": b.name, "apply": true, "ids": [line]}));
|
||||
assert_eq!(strs(&added["added"]), [b.name.as_str()]);
|
||||
assert_eq!(added["applied"], json!([line]));
|
||||
assert_eq!(undo_len(&s), before + 1);
|
||||
assert_eq!(doc(&s).node(NodeId(line)).unwrap().appearance.stroke().unwrap().brush.as_deref(), Some(b.name.as_str()));
|
||||
}
|
||||
let saved = run(&mut s, "brush.saveLibrary", json!({"names": names}));
|
||||
let bytes = vectorcraft_format::base64_decode(saved["dataBase64"].as_str().unwrap()).unwrap();
|
||||
|
||||
+1
-1
@@ -714,7 +714,7 @@ macOS cursor delivery (#2292) is narrowed to a native host adapter using the exi
|
||||
Fine Grain, Canvas Weave, Burlap Sack, Cracked Glaze, Mosaic Floor, Quilted Squares, Leaded Glass and Damp Paper,
|
||||
painted with the texture effects; User Defined; Other Library…; `graphicStyle.libraries`,
|
||||
`graphicStyle.addFromLibrary`).
|
||||
- **Missing:** more built-in brush libraries beyond the eleven shipped (and further graphic-style libraries beyond the eleven shipped, and further symbol libraries beyond Basic
|
||||
- **Missing:** more built-in brush libraries beyond the thirteen shipped (and further graphic-style libraries beyond the eleven shipped, and further symbol libraries beyond Basic
|
||||
Shapes, UI Frames, Map Markers, Inventory Icons, Skill Icons and Weather Icons; original, generated in code, never Adobe's); dynamic symbols' `.ai` read and write.
|
||||
- **Estimate:** 3–13 h (estimated).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user