diff --git a/crates/algo/src/relight.rs b/crates/algo/src/relight.rs index d36454d238..efa96684e8 100644 --- a/crates/algo/src/relight.rs +++ b/crates/algo/src/relight.rs @@ -532,9 +532,21 @@ mod tests { assert!(read_radius(sigma(25.0, bounds)) > 97); let area = output_area(&p, s.content_bounds(), bounds, None); let full = apply_tiled(&s, &p, area, bounds, None, 4096, None); - let tiled = apply_tiled(&s, &p, area, bounds, None, 128, None); - let inner = Rect::new(0, 0, size, size); - let d = max_diff(&full.read_region(inner), &tiled.read_region(inner)); + // Keep every tile that contributes checked pixels, including each edge tile's + // original rectangle and halo. The remaining tiles lie wholly outside the canvas. + let tile = 128; + let tile_start = |pixel: i32, origin: i32| origin + (pixel - origin).div_euclid(tile) * tile; + let visible_tiles = Rect::new( + tile_start(bounds.x0, area.x0), + tile_start(bounds.y0, area.y0), + tile_start(bounds.x1 - 1, area.x0) + tile, + tile_start(bounds.y1 - 1, area.y0) + tile, + ) + .intersect(&area); + let tiled = apply_tiled(&s, &p, visible_tiles, bounds, None, tile, None); + let center = size / 2; + assert!(max_diff(&full.pixel(center, center), &s.pixel(center, center)) > 1e-4, "the full frame must be relit"); + let d = max_diff(&full.read_region(bounds), &tiled.read_region(bounds)); assert!(d <= 1e-4, "tile seam {d}"); }