fix(editor-ui): variables-panel wheel scroll + preset toggle test

Two failures surfaced once the casement build blocker cleared and the
`cargo test --workspace` step finally ran on v0.8.0-new:

- wheel_over_panel_scrolls_rows_and_clamps: `over_topmost_panel` ran
  first in apply_wheel and lists the variables panel, so a wheel over
  the panel was swallowed (returned true) WITHOUT ever reaching
  try_scroll_variables_panel — rows never advanced. Move the variables
  scroll handler ahead of the topmost-panel guard; it already swallows
  the wheel over its own rect, so the canvas-zoom guard still holds.

- variables_panel_preset_button_toggles_menu: the second press used a
  +58 y-offset that lands in the open dropdown's SaveCurrent row, which
  intentionally focuses the name input and keeps the popover open (TS
  parity, see anchor_press_does_not_double_toggle). Re-press the button
  itself (+22) so the test exercises the toggle it is named for.

op-host-native lib: 296 passed / 0 failed.
This commit is contained in:
Fini 2026-06-13 21:07:24 +08:00
parent 4dee479c6b
commit aa25cc2a7e
2 changed files with 15 additions and 5 deletions

View file

@ -254,6 +254,15 @@ impl WidgetHostNative {
viewport_width: f32,
viewport_height: f32,
) -> bool {
// Floating VariablesPanel owns the wheel over its rect — run this
// BEFORE `over_topmost_panel`, which also lists the variables panel
// and would otherwise swallow the event WITHOUT scrolling (its rows
// never advanced because the topmost-panel guard returned first).
// `try_scroll_variables_panel` swallows the wheel when over the
// panel, so the "don't zoom the canvas beneath" guarantee holds.
if self.try_scroll_variables_panel(x, y, delta_y, viewport_width, viewport_height) {
return true;
}
// Any top-most floating panel (Design-MD / Component-Browser)
// owns the wheel before lower layers — a scroll over them
// never reaches the modal / Git panel / canvas.
@ -288,10 +297,6 @@ impl WidgetHostNative {
if self.try_scroll_chat_checklist(x, y, delta_y, viewport_width, viewport_height) {
return true;
}
// Floating VariablesPanel owns the wheel over its rect.
if self.try_scroll_variables_panel(x, y, delta_y, viewport_width, viewport_height) {
return true;
}
// Agent-settings modal owns wheel.
if self.editor_state.editor_ui.agent_settings_open {
use op_editor_ui::widgets::agent_settings_panel::AgentSettingsPanel;

View file

@ -528,6 +528,7 @@ fn variables_panel_preset_button_toggles_menu() {
host.editor_state_mut().editor_ui.variables_panel_open = true;
let rect = host.variables_panel_rect(VIEWPORT_W, VIEWPORT_H).unwrap();
// Press the preset button (in the header, ~22 px down) — opens the menu.
assert!(host.apply_press(
rect.origin.x + 82.0,
rect.origin.y + 22.0,
@ -536,9 +537,13 @@ fn variables_panel_preset_button_toggles_menu() {
));
assert!(host.editor_state().editor_ui.variables_preset_menu_open);
// Press the SAME button again — toggles the menu closed. (A press at
// +58 would land in the open dropdown's SaveCurrent row, which focuses
// the name input and intentionally keeps the popover open — see
// `anchor_press_does_not_double_toggle` for the canonical toggle path.)
assert!(host.apply_press(
rect.origin.x + 82.0,
rect.origin.y + 58.0,
rect.origin.y + 22.0,
VIEWPORT_W,
VIEWPORT_H
));