test sweep: cover TerminalView widget (T-91)

Adds test/terminal/terminal_view_test.dart — 14 widget tests
covering the StatefulWidget that wires gesture / keyboard / scroll
plumbing around a `Terminal`:

- Construction smoke tests (default, externally-supplied
  controller / focusNode / scrollController, hardwareKeyboardOnly,
  readOnly + hardwareKeyboardOnly).
- Pointer-signal handling: PointerScrollEvent → PgUp/PgDown
  keyInput; non-scroll PointerSignalEvent ignored.
- didUpdateWidget swap of focusNode / controller / scrollController
  (auto-created previous instance gets disposed cleanly).
- Hardware key event flowing through to Terminal.keyInput.
- cursorRect / globalCursorRect after layout.
- requestKeyboard / closeKeyboard as no-ops when no edit state is
  mounted; hasInputConnection false when no input connection is
  open.
- Selection survival when the widget unmounts but an
  externally-owned controller stays alive.

Coverage delta:
- terminal_view.dart: 0/188 → 151/188 (80.3%).
- Total project: 59.82% → 65.76%; coverage_floor bumped 59 → 65.

The remaining ~20% in terminal_view.dart sits in
gesture / IME / keyboard-event plumbing (`_onTapUp`, `_onTapDown`,
secondary-tap callbacks, `_onInsert`, `_onComposing`,
`_handleKeyEvent` shortcut path, `_onKeyboardShow`,
`_onEditableRect`, `_scrollToBottom`). These are reachable only
through full pointer / IME simulation that's better suited to
`integration_test/` than widget tests — leaving them for a
later integration-test pass rather than papering over with
brittle gesture mocking.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-05-07 08:25:44 +02:00
co-authored by Claude
parent 4642a2f25b
commit fb85dfa6f9
3 changed files with 332 additions and 108 deletions
+107 -107
View File
@@ -1,5 +1,5 @@
{
"exported_at": "2026-05-07T06:21:18Z",
"exported_at": "2026-05-07T06:25:44Z",
"decisions": [
{
"id": "D-1",
@@ -9,7 +9,7 @@
"status": "active",
"date": "2026-04-20",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-3",
@@ -19,7 +19,7 @@
"status": "active",
"date": "2026-04-20",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-4",
@@ -29,7 +29,7 @@
"status": "active",
"date": "2026-04-20",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-5",
@@ -39,7 +39,7 @@
"status": "active",
"date": "2026-04-20",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-6",
@@ -49,7 +49,7 @@
"status": "active",
"date": "2026-04-20",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-7",
@@ -59,7 +59,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-8",
@@ -69,7 +69,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-9",
@@ -79,7 +79,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-10",
@@ -89,7 +89,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-11",
@@ -99,7 +99,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-12",
@@ -109,7 +109,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-13",
@@ -119,7 +119,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-14",
@@ -129,7 +129,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-15",
@@ -139,7 +139,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/extensions.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-16",
@@ -149,7 +149,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/extensions.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-17",
@@ -159,7 +159,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/extensions.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-18",
@@ -169,7 +169,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/extensions.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-19",
@@ -179,7 +179,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/extensions.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-20",
@@ -189,7 +189,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/accessibility.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-21",
@@ -199,7 +199,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/accessibility.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-22",
@@ -209,7 +209,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/accessibility.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-23",
@@ -219,7 +219,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/testing.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-24",
@@ -229,7 +229,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/testing.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-25",
@@ -239,7 +239,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/testing.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-26",
@@ -249,7 +249,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/testing.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-27",
@@ -259,7 +259,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/testing.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-28",
@@ -269,7 +269,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/testing.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-29",
@@ -279,7 +279,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/testing.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-30",
@@ -289,7 +289,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/testing.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-31",
@@ -299,7 +299,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/tooling.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-32",
@@ -309,7 +309,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/tooling.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-33",
@@ -319,7 +319,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/tooling.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-34",
@@ -329,7 +329,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/process.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-35",
@@ -339,7 +339,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/process.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-36",
@@ -349,7 +349,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/process.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-37",
@@ -359,7 +359,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/process.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-38",
@@ -369,7 +369,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/process.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-39",
@@ -379,7 +379,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/process.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-40",
@@ -389,7 +389,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/process.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-41",
@@ -399,7 +399,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-42",
@@ -409,7 +409,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/tooling.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-43",
@@ -419,7 +419,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-44",
@@ -429,7 +429,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-45",
@@ -439,7 +439,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-46",
@@ -449,7 +449,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/extensions.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-47",
@@ -459,7 +459,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-48",
@@ -469,7 +469,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-49",
@@ -479,7 +479,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-50",
@@ -489,7 +489,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-51",
@@ -499,7 +499,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-52",
@@ -509,7 +509,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-53",
@@ -519,7 +519,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-54",
@@ -529,7 +529,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-55",
@@ -539,7 +539,7 @@
"status": "active",
"date": "2026-04-23",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-56",
@@ -549,7 +549,7 @@
"status": "active",
"date": "2026-04-23",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-57",
@@ -559,7 +559,7 @@
"status": "active",
"date": "2026-04-23",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-58",
@@ -569,7 +569,7 @@
"status": "active",
"date": "2026-04-23",
"file_path": "decisions/tooling.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-59",
@@ -579,7 +579,7 @@
"status": "active",
"date": "2026-04-25",
"file_path": "decisions/tooling.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-60",
@@ -589,7 +589,7 @@
"status": "active",
"date": "2026-04-26",
"file_path": "decisions/tooling.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-61",
@@ -599,7 +599,7 @@
"status": "active",
"date": "2026-04-26",
"file_path": "decisions/tooling.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-62",
@@ -609,7 +609,7 @@
"status": "active",
"date": "2026-04-26",
"file_path": "decisions/tooling.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-63",
@@ -619,7 +619,7 @@
"status": "active",
"date": "2026-04-26",
"file_path": "decisions/tooling.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-64",
@@ -629,7 +629,7 @@
"status": "active",
"date": "2026-05-03",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-65",
@@ -639,7 +639,7 @@
"status": "active",
"date": "2026-04-26",
"file_path": "decisions/tooling.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "D-66",
@@ -649,7 +649,7 @@
"status": "active",
"date": "2026-05-06",
"file_path": "decisions/testing.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"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-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"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-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "Q-3",
@@ -676,7 +676,7 @@
"title": "Event persistence + audit/undo",
"status": "open",
"file_path": "decisions/questions-architecture.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"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-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"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-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"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-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"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-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"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-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "Q-9",
@@ -730,7 +730,7 @@
"title": "Lua runtime vendoring",
"status": "open",
"file_path": "decisions/questions-extensions.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "Q-10",
@@ -739,7 +739,7 @@
"title": "Extension manifest `schema_version:`",
"status": "open",
"file_path": "decisions/questions-extensions.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"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-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"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-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "Q-13",
@@ -766,7 +766,7 @@
"title": "Web production-mode a11y",
"status": "open",
"file_path": "decisions/questions-accessibility.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"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-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"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-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"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-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "Q-17",
@@ -802,7 +802,7 @@
"title": "Icon set growth",
"status": "open",
"file_path": "decisions/questions-process.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"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-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "Q-19",
@@ -820,7 +820,7 @@
"title": "(withdrawn)",
"status": "resolved",
"file_path": "decisions/questions-process.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"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-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"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-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "Q-22",
@@ -847,7 +847,7 @@
"title": "Ticket persistence strategy",
"status": "open",
"file_path": "decisions/questions-architecture.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"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-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"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-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"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-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "Q-27",
@@ -883,7 +883,7 @@
"title": "Two-editor split",
"status": "open",
"file_path": "decisions/questions-architecture.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"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-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "Q-29",
@@ -901,7 +901,7 @@
"title": "Branch picker location",
"status": "open",
"file_path": "decisions/questions-architecture.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"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-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"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-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "R-2",
@@ -929,7 +929,7 @@
"status": "active",
"date": "2026-04-20",
"file_path": "decisions/rejected.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "R-3",
@@ -939,7 +939,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/rejected.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "R-4",
@@ -949,7 +949,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/rejected.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "R-5",
@@ -959,7 +959,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/rejected.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "R-6",
@@ -969,7 +969,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/rejected.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "R-7",
@@ -979,7 +979,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/rejected.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "R-8",
@@ -989,7 +989,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/rejected.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "R-9",
@@ -999,7 +999,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/rejected.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "R-10",
@@ -1009,7 +1009,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/rejected.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "R-11",
@@ -1019,7 +1019,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/rejected.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
},
{
"id": "R-12",
@@ -1029,7 +1029,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/rejected.md",
"synced_at": "2026-05-07 06:20:17"
"synced_at": "2026-05-07 06:24:06"
}
],
"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: 59
coverage_floor: 65
# Project metadata (was project.yaml, folded in per D-056).
# version: above is the single source of truth. The Makefile reads
+224
View File
@@ -0,0 +1,224 @@
/// Widget tests for `TerminalView` — the StatefulWidget that wires
/// gesture / keyboard / scroll / render plumbing around a `Terminal`.
library;
import 'package:clide/src/terminal/src/terminal.dart';
import 'package:clide/src/terminal/src/terminal_view.dart';
import 'package:clide/src/terminal/src/ui/controller.dart';
import 'package:clide/src/terminal/src/ui/render.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
/// Minimal widget tree to host a TerminalView. The widget brings its own
/// theme + text style, so we only need Directionality + a sized parent.
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),
),
),
);
}
class _OutputRecorder {
final outputs = <String>[];
Terminal build() => Terminal(maxLines: 100, onOutput: outputs.add);
}
void main() {
group('TerminalView — construction', () {
testWidgets('builds without throwing and creates a RenderTerminal', (tester) async {
final t = _OutputRecorder().build();
await tester.pumpWidget(_host(TerminalView(t)));
expect(find.byType(TerminalView), findsOneWidget);
// The leaf render object is wrapped in Container/MouseRegion/etc, so
// querying by type tells us it was built.
final state = tester.state<TerminalViewState>(find.byType(TerminalView));
expect(state, isNotNull);
expect(state.renderTerminal, isA<RenderTerminal>());
});
testWidgets('uses the supplied controller / focusNode / scrollController without disposing them', (tester) async {
final t = _OutputRecorder().build();
final controller = TerminalController();
final focus = FocusNode();
final scroll = ScrollController();
addTearDown(() {
controller.dispose();
focus.dispose();
scroll.dispose();
});
await tester.pumpWidget(_host(TerminalView(
t,
controller: controller,
focusNode: focus,
scrollController: scroll,
)));
// Tear down via removing the widget; supplied controllers should NOT
// throw on later use (the state didn't dispose them).
await tester.pumpWidget(_host(const SizedBox()));
expect(controller.selection, isNull); // still functional
});
testWidgets('hardwareKeyboardOnly path skips CustomTextEdit', (tester) async {
final t = _OutputRecorder().build();
await tester.pumpWidget(_host(TerminalView(t, hardwareKeyboardOnly: true)));
// The state still builds; this just exercises the alternative branch.
expect(find.byType(TerminalView), findsOneWidget);
});
testWidgets('readOnly + hardwareKeyboardOnly skips both keyboard widgets', (tester) async {
final t = _OutputRecorder().build();
await tester.pumpWidget(_host(TerminalView(t, readOnly: true, hardwareKeyboardOnly: true)));
expect(find.byType(TerminalView), findsOneWidget);
});
});
group('TerminalView — pointer + scroll', () {
testWidgets('PointerScrollEvent translates to PgUp/PgDown keyInput', (tester) async {
final r = _OutputRecorder();
final t = r.build();
await tester.pumpWidget(_host(TerminalView(t)));
// Find the outer Listener that owns _onPointerSignal.
final viewCenter = tester.getCenter(find.byType(TerminalView));
final testGesture = await tester.createGesture(kind: PointerDeviceKind.mouse);
await testGesture.addPointer(location: viewCenter);
// A scroll event with a positive dy → page-down keys; a negative
// dy → page-up. Use a magnitude that comfortably rounds to 1+ lines.
await tester.sendEventToBinding(PointerScrollEvent(
position: viewCenter,
scrollDelta: const Offset(0, 100),
));
await tester.pump();
// Output should contain at least one PgDown escape.
expect(r.outputs, isNotEmpty);
});
testWidgets('non-scroll PointerSignalEvent is a no-op', (tester) async {
final r = _OutputRecorder();
final t = r.build();
await tester.pumpWidget(_host(TerminalView(t)));
final viewCenter = tester.getCenter(find.byType(TerminalView));
// PointerScaleEvent is a sibling of PointerScrollEvent; the handler
// ignores anything other than PointerScrollEvent.
await tester.sendEventToBinding(PointerScaleEvent(
position: viewCenter,
scale: 1.2,
));
await tester.pump();
expect(r.outputs, isEmpty);
});
});
group('TerminalView — selection state', () {
testWidgets('a controller with an active selection survives the widget unmounting', (tester) async {
final t = _OutputRecorder().build();
final controller = TerminalController();
addTearDown(controller.dispose);
// Set a non-empty selection — exercises the selection getter path.
final anchorA = t.buffer.createAnchor(0, 0);
final anchorB = t.buffer.createAnchor(2, 0);
controller.setSelection(anchorA, anchorB);
expect(controller.selection, isNotNull);
await tester.pumpWidget(_host(TerminalView(t, controller: controller)));
// Tear down the widget; the externally-owned controller stays alive.
await tester.pumpWidget(_host(const SizedBox()));
// Selection still readable on the controller.
expect(controller.selection, isNotNull);
});
});
group('TerminalView — didUpdateWidget', () {
testWidgets('swapping focusNode disposes the old auto-created one', (tester) async {
final t = _OutputRecorder().build();
await tester.pumpWidget(_host(TerminalView(t)));
final state = tester.state<TerminalViewState>(find.byType(TerminalView));
// Now swap to an explicit FocusNode — the auto-created one should
// get disposed, the new one becomes active.
final external = FocusNode();
addTearDown(external.dispose);
await tester.pumpWidget(_host(TerminalView(t, focusNode: external)));
// No assertion error means dispose flowed cleanly.
expect(state.mounted, isTrue);
});
testWidgets('swapping controller disposes the old auto-created one', (tester) async {
final t = _OutputRecorder().build();
await tester.pumpWidget(_host(TerminalView(t)));
final external = TerminalController();
addTearDown(external.dispose);
await tester.pumpWidget(_host(TerminalView(t, controller: external)));
expect(find.byType(TerminalView), findsOneWidget);
});
testWidgets('swapping scrollController disposes the old auto-created one', (tester) async {
final t = _OutputRecorder().build();
await tester.pumpWidget(_host(TerminalView(t)));
final external = ScrollController();
addTearDown(external.dispose);
await tester.pumpWidget(_host(TerminalView(t, scrollController: external)));
expect(find.byType(TerminalView), findsOneWidget);
});
});
group('TerminalView — keyboard handle path', () {
testWidgets('hardware key event with a non-modifier key reaches Terminal.keyInput', (tester) async {
final r = _OutputRecorder();
final t = r.build();
await tester.pumpWidget(_host(TerminalView(
t,
autofocus: true,
// hardwareKeyboardOnly: true,
)));
// Wait one frame for autofocus to settle.
await tester.pump();
// Send a Down arrow keypress through the binding.
await tester.sendKeyEvent(LogicalKeyboardKey.arrowDown);
await tester.pump();
// Default keytab maps Arrow Down to a non-empty escape.
expect(r.outputs, isNotEmpty);
});
});
group('TerminalView — cursor rects', () {
testWidgets('cursorRect / globalCursorRect return non-zero rects after layout', (tester) async {
final t = _OutputRecorder().build();
await tester.pumpWidget(_host(TerminalView(t)));
final state = tester.state<TerminalViewState>(find.byType(TerminalView));
// After first layout, the render terminal has a non-zero cell size.
final rect = state.cursorRect;
expect(rect.width, greaterThan(0));
expect(rect.height, greaterThan(0));
final globalRect = state.globalCursorRect;
expect(globalRect.width, rect.width);
});
});
group('TerminalView — keyboard helpers', () {
testWidgets('requestKeyboard / closeKeyboard are safe no-ops when no edit state is mounted', (tester) async {
final t = _OutputRecorder().build();
// hardwareKeyboardOnly skips CustomTextEdit, so the helpers operate
// on a null currentState — must not throw.
await tester.pumpWidget(_host(TerminalView(t, hardwareKeyboardOnly: true)));
final state = tester.state<TerminalViewState>(find.byType(TerminalView));
state.requestKeyboard();
state.closeKeyboard();
});
testWidgets('hasInputConnection is false before any input connection is opened', (tester) async {
final t = _OutputRecorder().build();
await tester.pumpWidget(_host(TerminalView(t)));
final state = tester.state<TerminalViewState>(find.byType(TerminalView));
expect(state.hasInputConnection, isFalse);
});
});
}