Allow float luma roundoff in the mask control

This commit is contained in:
yoriswind committed 2026-12-01 03:13:30 -08:00
1 parent 099df3d4be
commit d458f5acbb
1 file changed
+3 -1
@@ -67,7 +67,9 @@ fn outside_the_rgb_mask_depths_darker_color_still_keeps_the_darker_backdrop() {
("gray", 16, json!("mask")),
] {
let normal = gradient_row(seeded_surface(mode, depth, &target), &target, "normal");
assert_eq!(normal[39], 1.0, "{mode} {depth}-bit {target}");
// Float mask luma can be one representable step below white. Integer storage rounds it.
let white_tolerance = if depth == 32 { 4.0 * f32::EPSILON } else { 0.0 };
assert!((normal[39] - 1.0).abs() <= white_tolerance, "{mode} {depth}-bit {target}: {}", normal[39]);
let row = gradient_row(seeded_surface(mode, depth, &target), &target, BlendMode::DarkerColor.label());
assert!((row[39] - MASK_LEVEL).abs() < 1.0 / 65535.0, "{mode} {depth}-bit {target}");
}