Reject group transparency before modifying the selection

This commit is contained in:
yoriswind committed 2026-11-01 13:12:39 -08:00
1 parent 8aed34d540
commit 0aac40105e
2 files changed
+7

No files matched your search

@@ -171,6 +171,7 @@ fn ref_planes(doc: &Document, layer: Option<LayerId>, active: Option<LayerId>, r
.map(|p| p[3])
.collect(),
],
LayerContent::Group(_) => return Err(EngineError::Other("group transparency sources are not supported".into())),
// Adjustment and fill layers cover the whole canvas.
_ => vec![vec![1.0; area.width() as usize * area.height() as usize]],
},
@@ -420,6 +420,12 @@ fn group_transparency_sources_fail_without_changing_selection() {
assert_eq!(s.active().unwrap().revision, revision);
assert_eq!(s.active().unwrap().history.past_len(), history);
assert_eq!(saved(&action).descriptor, Some(descriptor));
// The group's explicit mask remains a valid source.
s.execute("layer.layerMask.revealSelection", json!({"layer":group.0})).unwrap();
s.execute("select.deselect", json!({})).unwrap();
s.execute("select.loadSelection", json!({"channel":"mask","layer":params["layer"]})).unwrap();
assert_eq!(s.active().unwrap().doc.selection.as_ref().unwrap().read_region(Rect::from_xywh(0, 0, 2, 1)), vec![1.0, 0.0]);
}
}