Brushes: tests expect the first brush of a repeated name

With repeated names numbered when a brush library is read, a stroke that
names a repeated brush draws the first brush of that name, and a later
brush of the name is read as "Name 2". Three tests built a library with a
repeated name and expected the later brush:

- Document Info lists a name two stored brushes share with the first
  brush's type (art), not the last one's.
- The two render memory tests add their own `Dots` scatter brush beside
  the default library's `Dots`. They now remove the default `Dots` first,
  so the stroke draws their brush.
- The .ai writer test that leaves out a Pattern brush "X" gets the
  Calligraphic brush after it back as "X 2", the name it had in the
  document.
This commit is contained in:
dotCooCoo
2026-11-13 11:23:40 -08:00
parent 711d7163f8
commit b6e3e96db3
3 changed files with 11 additions and 6 deletions
+4
View File
@@ -931,6 +931,8 @@ fn brush_art_draws_edits_of_the_symbols_and_patterns_it_shows() {
painted.transform(Affine::translate((0.0, 8.0)), true);
let scatter = Node::group(d.alloc_id(), vec![Arc::new(instance), Arc::new(painted)]);
let mut lib = vectorcraft_brush::library(&d);
// The default library has its own `Dots`, which a stroke would draw with first.
lib.retain(|b| b.name != "Dots");
lib.push(Brush { name: "Dots".into(), kind: BrushKind::Scatter(Scatter { art: scatter, spacing: (150.0, 150.0), ..Default::default() }) });
vectorcraft_brush::store(&mut d, &lib);
let mut ap = vectorcraft_doc::Appearance::basic(Paint::None, Paint::solid(Color::BLACK), 1.0);
@@ -997,6 +999,8 @@ fn brush_art_draws_renamed_symbols_and_patterns_it_shows() {
painted.transform(Affine::translate((0.0, 8.0)), true);
let scatter = Node::group(d.alloc_id(), vec![Arc::new(instance), Arc::new(painted)]);
let mut lib = vectorcraft_brush::library(&d);
// The default library has its own `Dots`, which a stroke would draw with first.
lib.retain(|b| b.name != "Dots");
lib.push(Brush { name: "Dots".into(), kind: BrushKind::Scatter(Scatter { art: scatter, spacing: (150.0, 150.0), ..Default::default() }) });
vectorcraft_brush::store(&mut d, &lib);
let mut ap = vectorcraft_doc::Appearance::basic(Paint::None, Paint::solid(Color::BLACK), 1.0);