extract bumpedSlotSize for direct test coverage (T-111)

Pulled the slot-relative sign flip out of `_DragResizeHandleState._bump`
into a top-level `bumpedSlotSize` helper so the direction logic (the
bug-prone half) gets unit tests without piping through the keyboard
focus machinery. Adds a slot-label assertion for the context-panel
branch.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-05-18 09:45:47 +02:00
co-authored by Claude
parent 5d1237501c
commit 9249b1511d
2 changed files with 57 additions and 6 deletions
+15 -6
View File
@@ -119,15 +119,10 @@ class _DragResizeHandleState extends State<DragResizeHandle> {
};
}
/// Apply a raw delta in the natural axis direction. The drag handler
/// inverts the sign for context-panel because its handle sits on the
/// left edge of the right-anchored slot; arrow keys follow the same
/// convention so right-arrow always moves the boundary rightward.
void _bump(double rawDelta) {
final current = widget.arrangement.sizeOf(widget.slot);
if (current == null) return;
final delta = widget.slot == Slots.contextPanel ? -rawDelta : rawDelta;
widget.arrangement.setSize(widget.slot, current + delta);
widget.arrangement.setSize(widget.slot, bumpedSlotSize(slot: widget.slot, current: current, rawDelta: rawDelta));
}
void _onDown(PointerDownEvent e) {
@@ -154,3 +149,17 @@ class _BumpIntent extends Intent {
const _BumpIntent(this.delta);
final double delta;
}
/// Apply a raw delta in the natural axis direction. Drag and arrow
/// keys both call this so the keyboard mirrors the drag: positive
/// delta = right/down. Context-panel sits on the right edge of the
/// app, so we flip the sign there — right-arrow should *shrink* it,
/// matching how dragging the left-edge handle rightward works.
double bumpedSlotSize({
required SlotId slot,
required double current,
required double rawDelta,
}) {
final delta = slot == Slots.contextPanel ? -rawDelta : rawDelta;
return current + delta;
}