mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-17 05:35:52 +00:00
Merge pull request #8000 from dotCooCoo/fix/transform-copies-raster-effects-rows
Effects: each copy of a fill's or stroke's Transform effect carries the raster effect listed before it
This commit is contained in:
@@ -278,6 +278,30 @@ fn each_copys_shadow_expands_as_the_canvas_draws_it() {
|
||||
assert_eq!(diff, 0, "{diff} pixels differ");
|
||||
}
|
||||
|
||||
/// Each copy of a fill's own Transform effect, and each copy of its object's Transform effect,
|
||||
/// draws the fill's drop shadow under itself, scaled with it, and Expand Appearance keeps those
|
||||
/// shadows: the copy (10..50 across, 90..130 down) has its own shadow 40 pt to its right.
|
||||
#[test]
|
||||
fn each_copys_fill_shadow_expands_as_the_canvas_draws_it() {
|
||||
let shadow = json!({"x": 20, "y": 0, "blur": 0, "opacity": 100, "mode": "normal", "color": "#00ff00"});
|
||||
let copies = json!({"scaleH": 200, "scaleV": 200, "moveV": 80, "copies": 1});
|
||||
for own in [true, false] {
|
||||
let mut s = session();
|
||||
run(&mut s, "shape.rectangle", json!({"x": 20, "y": 20, "width": 20, "height": 20}));
|
||||
run(&mut s, "paint.setFill", json!({"color": "#ff0000"}));
|
||||
run(&mut s, "paint.setStroke", json!({"none": true}));
|
||||
run(&mut s, "effect.apply", json!({"effect": "stylize.dropShadow", "params": shadow, "item": 0}));
|
||||
let item = if own { json!(0) } else { json!(null) };
|
||||
run(&mut s, "effect.apply", json!({"effect": "distort.transform", "params": copies, "item": item}));
|
||||
let before = render(&s);
|
||||
assert_eq!(before.pixel(80, 110), [0, 255, 0, 255], "own {own}: the copy's shadow");
|
||||
run(&mut s, "effect.expandAppearance", json!({}));
|
||||
let after = render(&s);
|
||||
let diff = differing(&before, &after, 64);
|
||||
assert_eq!(diff, 0, "own {own}: {diff} pixels differ");
|
||||
}
|
||||
}
|
||||
|
||||
/// Each copy of type's Transform effect draws the drop shadow listed before the effect under
|
||||
/// itself, scaled with it, and Expand Appearance keeps those shadows: the type's copy, scaled 200 %
|
||||
/// and moved 80 pt down, has its shadow 40 pt to the right of its letters rather than the type's
|
||||
|
||||
Reference in New Issue
Block a user