Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

test(gpu): split Dissolve parity cases and exercise adjustment masking

Nigel Ihza Firdausy7e1c21e9a866
diff --git a/crates/gpu/tests/parity.rs b/crates/gpu/tests/parity.rs
index 3f69affa1..ac2c04ee1 100644
--- a/crates/gpu/tests/parity.rs
+++ b/crates/gpu/tests/parity.rs
@@ -2620,17 +2620,23 @@ fn pass_through_clipping_base_with_an_adjustment() {
}
-/// Dissolve must use document-coordinate binary coverage on both renderers.
+/// An adjustment has no standalone source alpha: its opacity and mask gate binary coverage.
#[test]
-fn dissolve_specialized_paths_match_cpu() {
+fn dissolve_adjustment_matches_cpu() {
let Some(mut g) = gpu() else { return };
let mut d = base_doc(64, 48);
let mut adjustment = Layer::new("invert", LayerContent::Adjustment(Adjustment::Invert));
adjustment.blend = BlendMode::Dissolve;
adjustment.opacity = 0.5;
+ adjustment.mask = Some(mask(Rect::new(0, 0, 32, 48), 31, 0.0));
d.layers.push(adjustment);
- check(&mut g, &d, "dissolve adjustment");
+ check(&mut g, &d, "dissolve adjustment + mask");
+}
+/// Clipped pixels still use document-positioned noise, without changing the base alpha.
+#[test]
+fn dissolve_clipped_layer_matches_cpu() {
+ let Some(mut g) = gpu() else { return };
let mut d = base_doc(64, 48);
let mut clipped = Layer::new("clipped", LayerContent::Fill(Fill::Solid(Color::BLACK)));
clipped.clipped = true;
@@ -2638,7 +2644,12 @@ fn dissolve_specialized_paths_match_cpu() {
clipped.opacity = 0.5;
d.layers.push(clipped);
check(&mut g, &d, "dissolve clipped");
+}
+/// Layer opacity gates the completed effects stack, instead of fading its pixels.
+#[test]
+fn dissolve_effects_stack_matches_cpu() {
+ let Some(mut g) = gpu() else { return };
let mut d = base_doc(64, 48);
let mut styled = Layer::new("styled", LayerContent::Fill(Fill::Solid(Color::BLACK)));
styled.blend = BlendMode::Dissolve;