test sweep: cover ui/ widget-level helpers (T-91)

Adds test/terminal/ui/ui_widget_test.dart — 14 widget tests
covering the lib/src/terminal/src/ui/ helpers that need a Flutter
widget tree (CustomKeyboardListener, KeyboardVisibilty,
InfiniteScrollView, TerminalScrollGestureHandler).

Files reaching ~100% (the 4 missing lines in infinite_scroll_view
sit in the render-object's `position` setter, only triggered when
Scrollable feeds a different ViewportOffset between rebuilds —
not reachable through normal widget plumbing without internal
access):

- scroll_handler.dart: 0 / unmeasured → 39/39 (100%) — main-buffer
  passthrough vs. alt-buffer interception, mouse-mode forwarding
  vs. simulateScroll fallback, simulateScroll=false drop, alt-flip
  + didUpdateWidget rebinding, onPointerDown tracking the cursor
  for the next scroll event.
- infinite_scroll_view.dart: 0 / unmeasured → 36/40 (90%) — onScroll
  fires on viewport position change, callback identity update via
  updateRenderObject.
- keyboard_listener.dart: 7/12 → 12/12 (100%) — character-key
  fallthrough into onInsert when onKeyEvent returns ignored,
  short-circuit to onKeyEvent's "handled" return, no-op on a key
  with no character.
- keyboard_visibility.dart: 18/19 → 19/19 (100%) — show + hide
  callbacks paired against view-insets transitions; no fire on
  same-inset metrics events.

Coverage delta:
- Total project: 68.80% → 69.12%; coverage_floor bumped 68 → 69.

Tests use a `_host()` helper that wraps the widget under test in
Directionality + MediaQuery + Center + a sized SizedBox. The
TerminalScrollGestureHandler tests use ColoredBox as the child
because Listener.onPointerSignal needs a hit-testable render
object below it, and SizedBox.expand alone doesn't paint anything.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-05-08 12:40:03 +02:00
co-authored by Claude
parent ecf8ee56af
commit e966836886
3 changed files with 497 additions and 108 deletions
+107 -107
View File
@@ -1,5 +1,5 @@
{
"exported_at": "2026-05-08T09:28:17Z",
"exported_at": "2026-05-08T10:40:03Z",
"decisions": [
{
"id": "D-1",
@@ -9,7 +9,7 @@
"status": "active",
"date": "2026-04-20",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-3",
@@ -19,7 +19,7 @@
"status": "active",
"date": "2026-04-20",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-4",
@@ -29,7 +29,7 @@
"status": "active",
"date": "2026-04-20",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-5",
@@ -39,7 +39,7 @@
"status": "active",
"date": "2026-04-20",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-6",
@@ -49,7 +49,7 @@
"status": "active",
"date": "2026-04-20",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-7",
@@ -59,7 +59,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-8",
@@ -69,7 +69,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-9",
@@ -79,7 +79,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-10",
@@ -89,7 +89,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-11",
@@ -99,7 +99,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-12",
@@ -109,7 +109,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-13",
@@ -119,7 +119,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-14",
@@ -129,7 +129,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-15",
@@ -139,7 +139,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/extensions.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-16",
@@ -149,7 +149,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/extensions.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-17",
@@ -159,7 +159,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/extensions.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-18",
@@ -169,7 +169,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/extensions.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-19",
@@ -179,7 +179,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/extensions.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-20",
@@ -189,7 +189,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/accessibility.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-21",
@@ -199,7 +199,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/accessibility.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-22",
@@ -209,7 +209,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/accessibility.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-23",
@@ -219,7 +219,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/testing.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-24",
@@ -229,7 +229,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/testing.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-25",
@@ -239,7 +239,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/testing.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-26",
@@ -249,7 +249,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/testing.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-27",
@@ -259,7 +259,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/testing.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-28",
@@ -269,7 +269,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/testing.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-29",
@@ -279,7 +279,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/testing.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-30",
@@ -289,7 +289,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/testing.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-31",
@@ -299,7 +299,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/tooling.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-32",
@@ -309,7 +309,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/tooling.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-33",
@@ -319,7 +319,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/tooling.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-34",
@@ -329,7 +329,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/process.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-35",
@@ -339,7 +339,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/process.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-36",
@@ -349,7 +349,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/process.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-37",
@@ -359,7 +359,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/process.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-38",
@@ -369,7 +369,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/process.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-39",
@@ -379,7 +379,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/process.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-40",
@@ -389,7 +389,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/process.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-41",
@@ -399,7 +399,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-42",
@@ -409,7 +409,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/tooling.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-43",
@@ -419,7 +419,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-44",
@@ -429,7 +429,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-45",
@@ -439,7 +439,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-46",
@@ -449,7 +449,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/extensions.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-47",
@@ -459,7 +459,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-48",
@@ -469,7 +469,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-49",
@@ -479,7 +479,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-50",
@@ -489,7 +489,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-51",
@@ -499,7 +499,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-52",
@@ -509,7 +509,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-53",
@@ -519,7 +519,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-54",
@@ -529,7 +529,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-55",
@@ -539,7 +539,7 @@
"status": "active",
"date": "2026-04-23",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-56",
@@ -549,7 +549,7 @@
"status": "active",
"date": "2026-04-23",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-57",
@@ -559,7 +559,7 @@
"status": "active",
"date": "2026-04-23",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-58",
@@ -569,7 +569,7 @@
"status": "active",
"date": "2026-04-23",
"file_path": "decisions/tooling.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-59",
@@ -579,7 +579,7 @@
"status": "active",
"date": "2026-04-25",
"file_path": "decisions/tooling.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-60",
@@ -589,7 +589,7 @@
"status": "active",
"date": "2026-04-26",
"file_path": "decisions/tooling.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-61",
@@ -599,7 +599,7 @@
"status": "active",
"date": "2026-04-26",
"file_path": "decisions/tooling.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-62",
@@ -609,7 +609,7 @@
"status": "active",
"date": "2026-04-26",
"file_path": "decisions/tooling.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-63",
@@ -619,7 +619,7 @@
"status": "active",
"date": "2026-04-26",
"file_path": "decisions/tooling.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-64",
@@ -629,7 +629,7 @@
"status": "active",
"date": "2026-05-03",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-65",
@@ -639,7 +639,7 @@
"status": "active",
"date": "2026-04-26",
"file_path": "decisions/tooling.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "D-66",
@@ -649,7 +649,7 @@
"status": "active",
"date": "2026-05-06",
"file_path": "decisions/testing.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "Q-1",
@@ -658,7 +658,7 @@
"title": "Authorisation granularity on the IPC socket",
"status": "open",
"file_path": "decisions/questions-architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "Q-2",
@@ -667,7 +667,7 @@
"title": "Back-pressure on event streams",
"status": "open",
"file_path": "decisions/questions-architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "Q-3",
@@ -676,7 +676,7 @@
"title": "Event persistence + audit/undo",
"status": "open",
"file_path": "decisions/questions-architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "Q-4",
@@ -685,7 +685,7 @@
"title": "`.canvas` schema compatibility with Obsidian",
"status": "open",
"file_path": "decisions/questions-architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "Q-5",
@@ -694,7 +694,7 @@
"title": "IPC wire-format stability + `schema_version:`",
"status": "open",
"file_path": "decisions/questions-architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "Q-6",
@@ -703,7 +703,7 @@
"title": "Window chrome — native frame vs frameless custom",
"status": "resolved",
"file_path": "decisions/questions-architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "Q-7",
@@ -712,7 +712,7 @@
"title": "macOS app bundle signing / notarisation",
"status": "open",
"file_path": "decisions/questions-architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "Q-8",
@@ -721,7 +721,7 @@
"title": "Extension API shape — widgets, subcommands, both?",
"status": "open",
"file_path": "decisions/questions-extensions.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "Q-9",
@@ -730,7 +730,7 @@
"title": "Lua runtime vendoring",
"status": "open",
"file_path": "decisions/questions-extensions.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "Q-10",
@@ -739,7 +739,7 @@
"title": "Extension manifest `schema_version:`",
"status": "open",
"file_path": "decisions/questions-extensions.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "Q-11",
@@ -748,7 +748,7 @@
"title": "Coverage gates — hard thresholds vs soft reporting",
"status": "open",
"file_path": "decisions/questions-testing.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "Q-12",
@@ -757,7 +757,7 @@
"title": "Screen-reader automation (axe-core via Playwright)",
"status": "open",
"file_path": "decisions/questions-testing.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "Q-13",
@@ -766,7 +766,7 @@
"title": "Web production-mode a11y",
"status": "open",
"file_path": "decisions/questions-accessibility.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "Q-14",
@@ -775,7 +775,7 @@
"title": "i18n plurals / gender / date-format tooling",
"status": "open",
"file_path": "decisions/questions-accessibility.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "Q-15",
@@ -784,7 +784,7 @@
"title": "Editor tab — full LSP vs tree-sitter-only highlight",
"status": "open",
"file_path": "decisions/questions-process.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "Q-16",
@@ -793,7 +793,7 @@
"title": "`tree-sitter-dart` grammar maintenance",
"status": "open",
"file_path": "decisions/questions-process.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "Q-17",
@@ -802,7 +802,7 @@
"title": "Icon set growth",
"status": "open",
"file_path": "decisions/questions-process.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "Q-18",
@@ -811,7 +811,7 @@
"title": "Theme hot-reload in release builds",
"status": "open",
"file_path": "decisions/questions-process.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "Q-19",
@@ -820,7 +820,7 @@
"title": "(withdrawn)",
"status": "resolved",
"file_path": "decisions/questions-process.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "Q-20",
@@ -829,7 +829,7 @@
"title": "Kernel DB service — namespaced SQL access?",
"status": "open",
"file_path": "decisions/questions-process.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "Q-21",
@@ -838,7 +838,7 @@
"title": "Pql absorbs planning vs keeps separate",
"status": "open",
"file_path": "decisions/questions-architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "Q-22",
@@ -847,7 +847,7 @@
"title": "Ticket persistence strategy",
"status": "open",
"file_path": "decisions/questions-architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "Q-23",
@@ -856,7 +856,7 @@
"title": "SSH-remote development — run clide against a remote workspace",
"status": "open",
"file_path": "decisions/questions-architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "Q-25",
@@ -865,7 +865,7 @@
"title": "Body text face — mono everywhere vs Josefin Sans UI + mono code",
"status": "open",
"file_path": "decisions/questions-architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "Q-26",
@@ -874,7 +874,7 @@
"title": "Small screen layout (\u003c 1000px)",
"status": "open",
"file_path": "decisions/questions-architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "Q-27",
@@ -883,7 +883,7 @@
"title": "Two-editor split",
"status": "open",
"file_path": "decisions/questions-architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "Q-28",
@@ -892,7 +892,7 @@
"title": "Terminal strip scope — shell only or logs/errors/tests",
"status": "open",
"file_path": "decisions/questions-architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "Q-29",
@@ -901,7 +901,7 @@
"title": "Branch picker location",
"status": "open",
"file_path": "decisions/questions-architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "Q-30",
@@ -910,7 +910,7 @@
"title": "Focus behavior when editor is dirty and viewer is peeked",
"status": "open",
"file_path": "decisions/questions-architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "Q-31",
@@ -919,7 +919,7 @@
"title": "XWayland fallback for frameless — proper Wayland protocol needed",
"status": "open",
"file_path": "decisions/questions-architecture.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "R-2",
@@ -929,7 +929,7 @@
"status": "active",
"date": "2026-04-20",
"file_path": "decisions/rejected.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "R-3",
@@ -939,7 +939,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/rejected.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "R-4",
@@ -949,7 +949,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/rejected.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "R-5",
@@ -959,7 +959,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/rejected.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "R-6",
@@ -969,7 +969,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/rejected.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "R-7",
@@ -979,7 +979,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/rejected.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "R-8",
@@ -989,7 +989,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/rejected.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "R-9",
@@ -999,7 +999,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/rejected.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "R-10",
@@ -1009,7 +1009,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/rejected.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "R-11",
@@ -1019,7 +1019,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/rejected.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
},
{
"id": "R-12",
@@ -1029,7 +1029,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/rejected.md",
"synced_at": "2026-05-08 09:27:22"
"synced_at": "2026-05-08 10:39:22"
}
],
"decision_refs": [
+1 -1
View File
@@ -18,7 +18,7 @@ repository: https://github.com/postmeridiem/clide
# Pre-push line-coverage floor. Ratchets up only — see D-66.
# Reading: `awk -F: '/^coverage_floor:/ {gsub(/ /,"",$2); print $2}' pubspec.yaml`.
coverage_floor: 68
coverage_floor: 69
# Project metadata (was project.yaml, folded in per D-056).
# version: above is the single source of truth. The Makefile reads
+389
View File
@@ -0,0 +1,389 @@
/// Widget tests for `lib/src/terminal/src/ui/` widget-level helpers
/// (CustomKeyboardListener, KeyboardVisibilty, InfiniteScrollView,
/// TerminalScrollGestureHandler).
library;
import 'package:clide/src/terminal/src/core/buffer/cell_offset.dart';
import 'package:clide/src/terminal/src/core/mouse/mode.dart';
import 'package:clide/src/terminal/src/terminal.dart';
import 'package:clide/src/terminal/src/ui/infinite_scroll_view.dart';
import 'package:clide/src/terminal/src/ui/keyboard_listener.dart';
import 'package:clide/src/terminal/src/ui/keyboard_visibility.dart';
import 'package:clide/src/terminal/src/ui/scroll_handler.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
Widget _host(Widget child, {double width = 400, double height = 200}) {
return Directionality(
textDirection: TextDirection.ltr,
child: MediaQuery(
data: const MediaQueryData(),
child: Center(
child: SizedBox(width: width, height: height, child: child),
),
),
);
}
void main() {
group('CustomKeyboardListener', () {
testWidgets('falls through to onInsert when onKeyEvent returns ignored and a character is present', (tester) async {
final inserts = <String>[];
final composings = <String?>[];
final focus = FocusNode();
addTearDown(focus.dispose);
await tester.pumpWidget(_host(
CustomKeyboardListener(
focusNode: focus,
autofocus: true,
onInsert: inserts.add,
onComposing: composings.add,
onKeyEvent: (_, __) => KeyEventResult.ignored,
child: const ColoredBox(color: Color(0xFF000000), child: SizedBox.expand()),
),
));
await tester.pump();
// A character key with non-empty `character` triggers the insert path.
await tester.sendKeyEvent(LogicalKeyboardKey.keyA, character: 'a');
await tester.pump();
expect(inserts, contains('a'));
});
testWidgets('does not call onInsert when onKeyEvent returns handled', (tester) async {
final inserts = <String>[];
final focus = FocusNode();
addTearDown(focus.dispose);
await tester.pumpWidget(_host(
CustomKeyboardListener(
focusNode: focus,
autofocus: true,
onInsert: inserts.add,
onComposing: (_) {},
onKeyEvent: (_, __) => KeyEventResult.handled,
child: const ColoredBox(color: Color(0xFF000000), child: SizedBox.expand()),
),
));
await tester.pump();
await tester.sendKeyEvent(LogicalKeyboardKey.keyA, character: 'a');
await tester.pump();
expect(inserts, isEmpty);
});
testWidgets('does not call onInsert when the key event has no character', (tester) async {
final inserts = <String>[];
final focus = FocusNode();
addTearDown(focus.dispose);
await tester.pumpWidget(_host(
CustomKeyboardListener(
focusNode: focus,
autofocus: true,
onInsert: inserts.add,
onComposing: (_) {},
onKeyEvent: (_, __) => KeyEventResult.ignored,
child: const ColoredBox(color: Color(0xFF000000), child: SizedBox.expand()),
),
));
await tester.pump();
// ArrowUp has no `character` — ignored result + no character means
// _onKeyEvent returns ignored without firing onInsert.
await tester.sendKeyEvent(LogicalKeyboardKey.arrowUp);
await tester.pump();
expect(inserts, isEmpty);
});
});
group('KeyboardVisibilty', () {
testWidgets('fires onKeyboardShow when bottom inset goes positive, onKeyboardHide when it returns to 0', (tester) async {
var shows = 0;
var hides = 0;
await tester.pumpWidget(_host(
KeyboardVisibilty(
onKeyboardShow: () => shows++,
onKeyboardHide: () => hides++,
child: const ColoredBox(color: Color(0xFF000000), child: SizedBox.expand()),
),
));
await tester.pump();
// Simulate keyboard appearance.
tester.view.viewInsets = const FakeViewPadding(bottom: 200, left: 0, right: 0, top: 0);
tester.binding.handleMetricsChanged();
await tester.pump();
expect(shows, 1);
expect(hides, 0);
// Simulate keyboard dismissal.
tester.view.resetViewInsets();
tester.binding.handleMetricsChanged();
await tester.pump();
expect(hides, 1);
});
testWidgets('repeated metrics events with the same bottom inset fire callbacks only when the inset changes', (tester) async {
var shows = 0;
await tester.pumpWidget(_host(
KeyboardVisibilty(
onKeyboardShow: () => shows++,
child: const ColoredBox(color: Color(0xFF000000), child: SizedBox.expand()),
),
));
await tester.pump();
tester.view.viewInsets = const FakeViewPadding(bottom: 200, left: 0, right: 0, top: 0);
tester.binding.handleMetricsChanged();
await tester.pump();
// Fire metrics again with the same inset — should not trigger again.
tester.binding.handleMetricsChanged();
await tester.pump();
expect(shows, 1);
addTearDown(tester.view.resetViewInsets);
});
});
group('InfiniteScrollView', () {
testWidgets('reports a scroll offset to onScroll when the viewport position moves', (tester) async {
final offsets = <double>[];
await tester.pumpWidget(_host(
InfiniteScrollView(
onScroll: offsets.add,
child: const SizedBox(width: 400, height: 1000),
),
));
await tester.pump();
// Drive the underlying ViewportOffset by sending a scroll event into
// the Scrollable.
final scrollable = find.byType(Scrollable);
await tester.drag(scrollable, const Offset(0, -100));
await tester.pumpAndSettle();
expect(offsets, isNotEmpty);
});
testWidgets('updates render object when onScroll callback identity changes', (tester) async {
var firstCalls = 0;
var secondCalls = 0;
Widget build(void Function(double) cb) => _host(
InfiniteScrollView(
onScroll: cb,
child: const SizedBox(width: 400, height: 1000),
),
);
await tester.pumpWidget(build((_) => firstCalls++));
await tester.pump();
await tester.drag(find.byType(Scrollable), const Offset(0, -50));
await tester.pumpAndSettle();
final firstCount = firstCalls;
expect(firstCount, isPositive);
// Swap callback identity — render object's onScroll setter must update.
await tester.pumpWidget(build((_) => secondCalls++));
await tester.pump();
await tester.drag(find.byType(Scrollable), const Offset(0, -50));
await tester.pumpAndSettle();
expect(secondCalls, isPositive);
expect(firstCalls, firstCount); // first stops firing after swap
});
});
group('TerminalScrollGestureHandler', () {
testWidgets('main-buffer mode passes through without intercepting scroll', (tester) async {
final terminal = Terminal(maxLines: 100);
final handlerCalls = <Offset>[];
await tester.pumpWidget(_host(
TerminalScrollGestureHandler(
terminal: terminal,
getCellOffset: (offset) {
handlerCalls.add(offset);
return const CellOffset(0, 0);
},
getLineHeight: () => 14.0,
child: const ColoredBox(color: Color(0xFF000000), child: SizedBox.expand()),
),
));
await tester.pump();
// Main-buffer mode → the handler returns the child directly, no
// Listener around it. Sending a scroll event reaches nothing.
final pos = tester.getCenter(find.byType(TerminalScrollGestureHandler));
final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
await mouse.addPointer(location: pos);
await tester.sendEventToBinding(PointerScrollEvent(
position: pos,
scrollDelta: const Offset(0, 100),
));
await tester.pump();
expect(handlerCalls, isEmpty);
});
testWidgets('alt-buffer mode intercepts scroll; falls back to keyInput when terminal does not handle the mouse event', (tester) async {
final outputs = <String>[];
final terminal = Terminal(maxLines: 100, onOutput: outputs.add);
terminal.useAltBuffer();
// No mouse mode set on the terminal — mouseInput will return false,
// so the simulateScroll fallback kicks in (sends arrow keys).
await tester.pumpWidget(_host(
TerminalScrollGestureHandler(
terminal: terminal,
getCellOffset: (_) => const CellOffset(0, 0),
getLineHeight: () => 14.0,
child: const ColoredBox(color: Color(0xFF000000), child: SizedBox.expand()),
),
));
await tester.pump();
// Confirm the Listener is in the tree (isAltBuffer recognised on
// initial build).
expect(find.byType(Listener), findsOneWidget);
final pos = tester.getCenter(find.byType(TerminalScrollGestureHandler));
final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
await mouse.addPointer(location: pos);
await tester.sendEventToBinding(PointerScrollEvent(
position: pos,
scrollDelta: const Offset(0, 100),
));
await tester.pump();
// Falls back to TerminalKey.arrowDown via simulateScroll path → emits
// an escape via the default keytab.
expect(outputs, isNotEmpty);
});
testWidgets('alt-buffer mode + active mouse mode forwards as a real mouse event (no key fallback)', (tester) async {
final outputs = <String>[];
final terminal = Terminal(maxLines: 100, onOutput: outputs.add);
terminal.useAltBuffer();
// Activate a mouse mode so terminal.mouseInput consumes wheel events.
terminal.setMouseMode(MouseMode.upDownScroll);
await tester.pumpWidget(_host(
TerminalScrollGestureHandler(
terminal: terminal,
getCellOffset: (_) => const CellOffset(0, 0),
getLineHeight: () => 14.0,
child: const ColoredBox(color: Color(0xFF000000), child: SizedBox.expand()),
),
));
await tester.pump();
final pos = tester.getCenter(find.byType(TerminalScrollGestureHandler));
final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
await mouse.addPointer(location: pos);
await tester.sendEventToBinding(PointerScrollEvent(
position: pos,
scrollDelta: const Offset(0, 100),
));
await tester.pump();
// Mouse-mode active → mouseInput consumes; output is the mouse-report
// escape, not a PgDown / arrow.
expect(outputs, isNotEmpty);
});
testWidgets('alt-buffer mode with simulateScroll=false drops scrolls when the terminal does not consume them', (tester) async {
final outputs = <String>[];
final terminal = Terminal(maxLines: 100, onOutput: outputs.add);
terminal.useAltBuffer();
await tester.pumpWidget(_host(
TerminalScrollGestureHandler(
terminal: terminal,
getCellOffset: (_) => const CellOffset(0, 0),
getLineHeight: () => 14.0,
simulateScroll: false,
child: const ColoredBox(color: Color(0xFF000000), child: SizedBox.expand()),
),
));
await tester.pump();
final pos = tester.getCenter(find.byType(TerminalScrollGestureHandler));
final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
await mouse.addPointer(location: pos);
await tester.sendEventToBinding(PointerScrollEvent(
position: pos,
scrollDelta: const Offset(0, 100),
));
await tester.pump();
// Terminal didn't consume + simulateScroll false → no output at all.
expect(outputs, isEmpty);
});
testWidgets('switching the terminal into alt buffer flips the handler from passthrough to intercepting', (tester) async {
final terminal = Terminal(maxLines: 100);
await tester.pumpWidget(_host(
TerminalScrollGestureHandler(
terminal: terminal,
getCellOffset: (_) => const CellOffset(0, 0),
getLineHeight: () => 14.0,
child: const ColoredBox(color: Color(0xFF000000), child: SizedBox.expand()),
),
));
await tester.pump();
// Initially main-buffer → no Listener wrapping.
expect(find.byType(Listener), findsNothing);
terminal.useAltBuffer();
terminal.write(''); // notifyListeners via parser.write
await tester.pump();
// Alt-buffer → Listener wraps the child.
expect(find.byType(Listener), findsOneWidget);
});
testWidgets('alt-buffer Listener tracks pointer-down location for scroll-event positioning', (tester) async {
// Covers the onPointerDown handler that captures _lastPointerPosition
// for use by the next scroll event.
final outputs = <String>[];
final terminal = Terminal(maxLines: 100, onOutput: outputs.add)..useAltBuffer();
final cellOffsets = <Offset>[];
await tester.pumpWidget(_host(
TerminalScrollGestureHandler(
terminal: terminal,
getCellOffset: (offset) {
cellOffsets.add(offset);
return const CellOffset(0, 0);
},
getLineHeight: () => 14.0,
child: const ColoredBox(
color: Color(0xFF000000),
child: SizedBox.expand(),
),
),
));
await tester.pump();
final pos = tester.getCenter(find.byType(TerminalScrollGestureHandler));
// Press first — that triggers onPointerDown which records the
// position into _lastPointerPosition.
final mouse = await tester.startGesture(pos, kind: PointerDeviceKind.mouse);
// Now scroll — getCellOffset is called with _lastPointerPosition.
await tester.sendEventToBinding(PointerScrollEvent(
position: pos,
scrollDelta: const Offset(0, 100),
));
await tester.pump();
await mouse.up();
await tester.pumpAndSettle();
expect(cellOffsets, isNotEmpty);
});
testWidgets('didUpdateWidget rebinds listeners when the terminal instance changes', (tester) async {
final t1 = Terminal(maxLines: 100);
final t2 = Terminal(maxLines: 100)..useAltBuffer();
Widget build(Terminal t) => _host(
TerminalScrollGestureHandler(
terminal: t,
getCellOffset: (_) => const CellOffset(0, 0),
getLineHeight: () => 14.0,
child: const ColoredBox(color: Color(0xFF000000), child: SizedBox.expand()),
),
);
await tester.pumpWidget(build(t1));
await tester.pump();
await tester.pumpWidget(build(t2));
await tester.pump();
// The Listener should now be present because t2 is in alt-buffer.
expect(find.byType(Listener), findsOneWidget);
});
});
}