mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-30 10:14:46 +01:00
Scripts: the blendingMode test catches each refused value in the script
Each invalid assignment is now caught inside the script, and the mode is read right after it, so a setter that changed the mode before throwing fails the test instead of being hidden by the run's rollback.
This commit is contained in:
1 parent
32f1b14ab4
commit
6370632522
1 file changed
+12
-1
@@ -306,8 +306,19 @@ fn blending_mode_reads_and_sets_the_objects_blend_mode() {
|
||||
for value in
|
||||
["'BlendModes.SCREEN '", "'MULTIPLY'", "'Multiply'", "'BlendModes.multiply'", "'BlendModes.NOPE'", "5", "null", "ZOrderMethod.BRINGTOFRONT"]
|
||||
{
|
||||
let e = failure(&mut s, &format!("app.activeDocument.pageItems[1].blendingMode = {value};"));
|
||||
// The error is caught in the script, so the run does not roll back and the mode read right
|
||||
// after it is the one the setter left.
|
||||
let out = log(
|
||||
&mut s,
|
||||
&format!(
|
||||
"var i = app.activeDocument.pageItems[1], e = '';\
|
||||
try {{ i.blendingMode = {value}; }} catch (x) {{ e = String(x); }}\
|
||||
vc.log(e); vc.log(i.blendingMode);"
|
||||
),
|
||||
);
|
||||
let e = out[0].as_str().unwrap_or_default();
|
||||
assert!(e.contains("blendingMode needs a BlendModes value"), "{value}: {e}");
|
||||
assert_eq!(out[1], json!("BlendModes.COLORBLEND"), "{value}");
|
||||
assert_eq!((blend(&s, a), undo_steps(&s)), (before, steps), "{value}");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user