Merge pull request #3477 from dotCooCoo/fix/story-fixture-texture-delta

ui-contract: Fixture::frame_clipped_shapes clears the texture changes it does not render
This commit is contained in:
BFlat
2026-11-26 09:55:29 +07:00
committed by GitHub
3 changed files with 21 additions and 1 deletions
+3 -1
View File
@@ -525,7 +525,9 @@ impl Fixture {
self.frames.record_paint();
self.frame(Vec::new());
let mut out = Vec::new();
let Some(paint) = self.frames.take_paint() else { return out };
let Some(mut paint) = self.frames.take_paint() else { return out };
// Only the shapes are asked for: the texture changes since the first recorded frame go unrendered.
paint.textures_delta.clear();
for clipped in paint.shapes {
let mut shapes = Vec::new();
fixture::flatten(clipped.shape, &mut shapes);
+1
View File
@@ -18,6 +18,7 @@ pub(crate) mod popup_surface;
pub(crate) mod rails;
pub(crate) mod sections;
pub(crate) mod story_shapes;
craft_ui::registry!();
+17
View File
@@ -0,0 +1,17 @@
//! A fixture returns the clipped shapes of a frame that uploads textures.
use craft_ui::testing::{Fixture, Registry, trial};
/// Menu, rail and tile stories; the first frame of each uploads textures, the font atlas among them.
const STORIES: [&str; 6] =
["tool_rail_marked_in_a_closed_group", "edit_menu", "menu", "menu_taller_than_the_window", "menu_with_companion", "tile_actions"];
#[trial]
fn the_first_frame_of_a_story_returns_its_clipped_shapes() {
let registry = Registry::of(&[craft_ui::testing::register, craft_ui_widgets::testing::register]);
for name in STORIES {
let entry = registry.stories().iter().find(|entry| entry.story.name == name).unwrap_or_else(|| panic!("story {name}"));
let shapes = Fixture::story(&entry.story).frame_clipped_shapes();
assert!(!shapes.is_empty(), "{name}: the frame paints the story");
}
}