mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-03 06:31:42 +01:00
The #7583 tests still used the old Action tuple/list API, so photocraft-engine lib tests no longer compiled on main. Build them with ActionStep and ActionList::actions, like the other action tests. #9833 releases a clipped group copied without its base (Photoshop, #9736). The older #10538 artboard-join test still expected that clip to stick when the destination board already had a layer; expect it to be released instead. Signed-off-by: Fred Apps <[email protected]> Signed-off-by: FredApps <[email protected]>
This commit is contained in:
1 parent
5718a98c1f
commit
955cf65ae2
2 files changed
+10
-9
No files matched your search
@@ -699,7 +699,7 @@ mod tests {
|
||||
fn record_conditional(width: u32, height: u32) -> (Session, usize) {
|
||||
let mut s = Session::new();
|
||||
s.execute("file.new", json!({"width": width, "height": height})).unwrap();
|
||||
s.actions.list.push(Action::new("Tall", vec![("layer.new.layer".into(), json!({"name": "Tall"}))]));
|
||||
s.actions.list.push(Action::new("Tall", vec![ActionStep::new("layer.new.layer", json!({"name": "Tall"}))])).unwrap();
|
||||
let layers = s.active().unwrap().doc.walk().len();
|
||||
s.execute("actions.record", json!({"name": "Parent"})).unwrap();
|
||||
s.execute("actions.conditional", json!({"if": "portrait", "then": "Tall", "else": null})).unwrap();
|
||||
@@ -707,14 +707,14 @@ mod tests {
|
||||
(s, layers)
|
||||
}
|
||||
|
||||
fn parent_steps(s: &Session) -> Vec<(String, Value)> {
|
||||
s.actions.list.iter().find(|a| a.name == "Parent").unwrap().steps.clone()
|
||||
fn parent_steps(s: &Session) -> Vec<ActionStep> {
|
||||
s.actions.list.actions().iter().find(|a| a.name == "Parent").unwrap().steps.clone()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn recording_a_conditional_keeps_the_step_when_no_branch_runs() {
|
||||
let (mut s, layers) = record_conditional(8, 4);
|
||||
let expected = vec![("actions.conditional".to_string(), json!({"if": "portrait", "then": "Tall", "else": null}))];
|
||||
let expected = vec![ActionStep::new("actions.conditional", json!({"if": "portrait", "then": "Tall", "else": null}))];
|
||||
assert_eq!(parent_steps(&s), expected);
|
||||
assert_eq!(s.active().unwrap().doc.walk().len(), layers, "the false predicate runs no branch");
|
||||
s.execute("file.new", json!({"width": 4, "height": 8})).unwrap();
|
||||
@@ -729,7 +729,7 @@ mod tests {
|
||||
#[test]
|
||||
fn recording_a_conditional_keeps_the_predicate_when_a_branch_runs() {
|
||||
let (s, layers) = record_conditional(4, 8);
|
||||
let expected = vec![("actions.conditional".to_string(), json!({"if": "portrait", "then": "Tall", "else": null}))];
|
||||
let expected = vec![ActionStep::new("actions.conditional", json!({"if": "portrait", "then": "Tall", "else": null}))];
|
||||
assert_eq!(parent_steps(&s), expected, "no nested actions.play is recorded");
|
||||
assert_eq!(s.active().unwrap().doc.walk().len(), layers + 1, "the true predicate runs Tall");
|
||||
}
|
||||
|
||||
@@ -1926,9 +1926,10 @@ fn paste_onto_a_smaller_artboard_keeps_the_offset_and_the_board_clips_the_rest()
|
||||
assert!(!(px(315, 35)[0] > 0.99 && px(315, 35)[1] < 0.01), "clipped past S's edge");
|
||||
}
|
||||
|
||||
/// A pasted layer that joins a board keeps its own clipping while the board already holds a layer
|
||||
/// it can clip to, and drops it on an empty board (#10538 review): a clipped group copied whole
|
||||
/// from board A and pasted onto smaller boards S (holding a layer) and E (empty).
|
||||
/// A clipped group copied without its base is released, including when it joins a board that
|
||||
/// already holds a layer (#9736, #9833): Copy drops the clip so the paste does not attach to
|
||||
/// whatever it lands on. #10538 used to keep the clip when the destination board already had a
|
||||
/// layer; that no longer applies once the base is left behind.
|
||||
#[test]
|
||||
fn a_clipped_paste_joining_a_board_stays_clipped_only_over_a_layer() {
|
||||
let (mut s, red, a, _b) = two_boards();
|
||||
@@ -1958,7 +1959,7 @@ fn a_clipped_paste_joining_a_board_stays_clipped_only_over_a_layer() {
|
||||
let id = st.active_layer.unwrap();
|
||||
(st.doc.artboard_of(id), st.doc.layer(id).unwrap().clipped)
|
||||
};
|
||||
assert_eq!(paste_on(&mut s, sb), (Some(sb), true), "S holds a layer to clip to");
|
||||
assert_eq!(paste_on(&mut s, sb), (Some(sb), false), "released even though S holds a layer");
|
||||
assert_eq!(paste_on(&mut s, eb), (Some(eb), false), "E is empty");
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user