From 83759c0e9496eea3e82e5a0adfb7012281f056b7 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 14 Oct 2026 21:48:35 -0700 Subject: [PATCH] Render tests: two moved raster tests no longer run alongside the tests that add fonts The key of a raster made for content that shows a symbol includes the font generation, and since c348b384 (#1723) the key for content painted with a pattern includes it too. FontDb::add_font increases that generation, and the six tests in tests_fontchange.rs call it. Two tests in fx.rs draw such content and count the rasters moved between frames: moved_rasters_need_the_same_content_and_effects and a_moved_group_draws_the_shadow_of_the_instance_art_in_it_while_interacting. Neither held fonts_steady(). When a font test added a font between their frames, the renderer made the raster again and the test counted 0 rasters moved instead of 1. Under CPU load on Windows, with the font tests in the same process, the first test failed in 12 of 100 runs and the second failed in 36 of 70. Both tests now hold fonts_steady(). translucent_blended_and_shadowed_type_redraws_when_its_font_becomes_available added its font without the font lock that fonts_steady() holds shared, and it now takes adding_fonts(), as the other five font tests do. With the change, the first test passed in all 200 runs and the second passed in all 120 runs under the same load. --- crates/render/src/fx.rs | 3 +++ crates/render/src/tests_fontchange.rs | 1 + 2 files changed, 4 insertions(+) diff --git a/crates/render/src/fx.rs b/crates/render/src/fx.rs index 0999d8127..4299b77a3 100644 --- a/crates/render/src/fx.rs +++ b/crates/render/src/fx.rs @@ -1514,6 +1514,7 @@ mod tests { use vectorcraft_geom::{Affine, Rect, shapes}; use super::{Drawn, PIXEL_BUDGET, filter_region}; + use crate::tests_fontchange::fonts_steady; use crate::{RenderOptions, Rendered, Renderer}; /// #1706: the raster a shadow or glow is filtered in stays within the pixel budget however @@ -1886,6 +1887,7 @@ mod tests { /// shadow is made from the instance's art, which the renderer measures the group's content by. #[test] fn a_moved_group_draws_the_shadow_of_the_instance_art_in_it_while_interacting() { + let _fonts = fonts_steady(); let mut base = Document::new(100.0, 100.0); let orange = Appearance::basic(Paint::solid(Color::rgb(0.9, 0.4, 0.1)), Paint::None, 0.0); let art = Node::path(base.alloc_id(), shapes::rectangle(Rect::new(100.0, 100.0, 130.0, 126.0)), orange); @@ -1929,6 +1931,7 @@ mod tests { /// again. A shadow keeps its raster under a new fill color. #[test] fn moved_rasters_need_the_same_content_and_effects() { + let _fonts = fonts_steady(); let (view, still) = (Affine::scale(2.0), RenderOptions { background: Some([255, 255, 255, 255]), ..Default::default() }); let live = RenderOptions { interacting: true, ..still.clone() }; // `before` drawn, then `after` while interacting: the rasters drawn moved, and whether the diff --git a/crates/render/src/tests_fontchange.rs b/crates/render/src/tests_fontchange.rs index 74dba9f66..8732e7ad3 100644 --- a/crates/render/src/tests_fontchange.rs +++ b/crates/render/src/tests_fontchange.rs @@ -87,6 +87,7 @@ fn type_with_raster_effects_redraws_when_its_font_becomes_available() { /// available: the glyph geometry kept for it is laid out again. #[test] fn translucent_blended_and_shadowed_type_redraws_when_its_font_becomes_available() { + let _adding = adding_fonts(); const FAMILY: &str = "Blended Serif4"; let mut d = Document::new(300.0, 150.0); let l = d.layers[0].id;