Tests: expect scale to follow the rotated bounding box

A stretch of a turned star along its own box keeps it a parametric shape;
the page-axes stretch that skews it now passes basis "page". The no-op
transform test expects the scale's journal entry to carry its basis.
This commit is contained in:
dotCooCoo
2026-11-13 10:54:42 -08:00
parent 78889ce8af
commit b1c9783e40
2 changed files with 12 additions and 2 deletions
@@ -385,8 +385,13 @@ fn an_anchor_edit_makes_it_a_plain_path_and_transforms_keep_it_editable() {
s.execute("addon.pathtools.shape.set", &json!({"id": id.0, "count": 6})).unwrap();
assert_eq!((path(&s, id).anchor_count(), steps(&s)), (12, n + 1));
assert!((shape_of(&s, id).unwrap().rotation + 30.0).abs() < 1e-6, "the turn stays");
// Stretched across its own axes (it is turned): skewed, so no longer.
// Stretched along its turned bounding box: still the shape, wider along its own axis.
s.execute("object.scale", &json!({"sx": 150, "sy": 100, "origin": [220, 140]})).unwrap();
let r = shape_of(&s, id).unwrap();
assert!((r.width - 300.0).abs() < 1e-6 && (r.height - 200.0).abs() < 1e-6 && (r.rotation + 30.0).abs() < 1e-6, "{r:?}");
s.execute("edit.undo", &json!({})).unwrap();
// Stretched across the page's axes (it is turned): skewed, so no longer.
s.execute("object.scale", &json!({"sx": 150, "sy": 100, "origin": [220, 140], "basis": "page"})).unwrap();
assert_eq!(shape_of(&s, id), None);
s.execute("edit.undo", &json!({})).unwrap();
assert!(shape_of(&s, id).is_some(), "undo brings it back");
+6 -1
View File
@@ -1271,7 +1271,12 @@ fn a_transform_that_moves_nothing_records_no_undo_step() {
for (id, p) in calls {
assert_eq!(s.execute(id, &p).unwrap(), json!({"ids": [a.0]}), "{id} {p}");
assert_eq!(history(&s), before, "{id} {p}");
assert_eq!(s.journal.last().unwrap(), &(id.to_string(), p));
// The journal adds the frame a scale acted in, so a replay acts in the same one.
let mut recorded = p;
if id == "object.scale" {
recorded["basis"] = json!("box");
}
assert_eq!(s.journal.last().unwrap(), &(id.to_string(), recorded));
}
assert_eq!(
s.doc().unwrap().last_transform,