graphic design tool
git clone https://git.lucas.co/cce-designer.git
fix: settle the dropdown animation in the popover z-order test
The test force-opened the params dropdown with a direct `open = true` write
and then collected the display list, expecting the popover's option text. It
had stopped finding it: the dropdown grows into its menu on a wall-clock
animation, and every geometry reader (popover_rect, draw_popover, the engine's
occlusion clamp) deliberately reads `anim_snap` — a per-frame snapshot — so
that the animated rect is stable within a frame. A direct field write skips
`begin_open`, leaving the snapshot at 0, so `draw_popover` bailed on a
zero-extent menu and emitted no rows at all.
Ticking the widget folds the progress into the snapshot. Since the direct
write also left `anim_start` unset, `anim_progress_now` reports 1.0, so this
lands fully open immediately rather than waiting out the 0.14s animation.
Not a product regression — the app opens dropdowns through events, which
settle on every route. The assertions the test was written for (option text
after widget labels, popover background between them) both hold once the menu
actually has extent.
Co-Authored-By: Claude <[email protected]>
src/main.rs | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/main.rs b/src/main.rs
index 9fc03cd..adb1a4f 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -993,6 +993,14 @@ mod tests {
.next()
.expect("Main's params include a dropdown (Open)");
dropdown.open = true;
+ // The popover expands on a wall-clock animation, and every geometry
+ // reader uses `anim_snap`, a snapshot refreshed only on tick/event —
+ // so writing `open` directly leaves the snapshot at 0 and the menu
+ // draws with zero extent. Ticking folds the progress in; because the
+ // direct write left `anim_start` unset, that lands fully open at once
+ // instead of waiting out the animation.
+ let mut tick_ctx = cce_ui::context::UiContext::new();
+ cce_ui::widget::WidgetHost::tick(dropdown, 0.0, &mut tick_ctx);
}
let list = state.collect_display_list();