diff --git a/crates/engine/tests/it/three_d_light_color.rs b/crates/engine/tests/it/three_d_light_color.rs index 40752a2fce..be06539537 100644 --- a/crates/engine/tests/it/three_d_light_color.rs +++ b/crates/engine/tests/it/three_d_light_color.rs @@ -719,7 +719,9 @@ fn alpha_against_supersampled(d: &Document) -> (usize, usize, u8, usize, Vec 10_000, "{name} {of}: {measured} pixels inside"); + // The 3x comparison passes when an opacity is lost or doubled at both scales, so the + // surface's alpha is also checked against the value it should have. + // With 60% gradient stops, each face takes the stops' opacity, so where the front and + // back of the body overlap the alpha is 1 - 0.4 * 0.4 of 255. + let alpha = render(&d).pixel(150, 200)[3]; + let expected = if name.ends_with("fill at 60%") { + 150..=156 + } else if name.ends_with("gradient at 60%") { + 211..=217 + } else { + 255..=255 + }; + if !expected.contains(&alpha) { + failures.push(format!("{name} {of}: surface alpha {alpha}, expected {expected:?}")); + } if off > 0 || past > 0 { failures.push(format!("{name} {of}: of {measured} pixels, {off} off (at most {worst}), {past} past the outline: {first:?}")); }