@native-sdk/cli 0.9.1 → 0.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/build/app.zig +26 -9
  2. package/build.zig +124 -1
  3. package/package.json +9 -9
  4. package/packages/core/package-lock.json +2 -2
  5. package/packages/core/package.json +1 -1
  6. package/packages/core/sdk/core.ts +3 -1
  7. package/packages/core/sdk/events.d.ts +7 -0
  8. package/packages/core/sdk/events.ts +26 -5
  9. package/packages/core/sdk/text.d.ts +4 -0
  10. package/packages/core/sdk/text.ts +51 -0
  11. package/packages/core/src/checker.ts +58 -1
  12. package/packages/core/src/contract.ts +5 -4
  13. package/packages/core/src/devhost_journal.mjs +2 -2
  14. package/packages/core/src/diagnostics.ts +2 -2
  15. package/packages/core/src/service_contract.ts +10 -0
  16. package/packages/core/src/typed_ast.ts +9 -7
  17. package/packages/core/src/types.ts +28 -8
  18. package/skill-data/automation/SKILL.md +4 -3
  19. package/skill-data/native-ui/SKILL.md +10 -8
  20. package/skill-data/ts-core/SKILL.md +8 -5
  21. package/src/app_runner/root.zig +301 -12
  22. package/src/app_runner/ts_core_main.zig +6 -4
  23. package/src/app_runner/window_placement.zig +63 -0
  24. package/src/automation/protocol.zig +5 -1
  25. package/src/automation/snapshot.zig +119 -0
  26. package/src/embed/app_exports.zig +2 -1
  27. package/src/embed/conversions.zig +1 -0
  28. package/src/embed/host.zig +10 -3
  29. package/src/embed/root.zig +1 -0
  30. package/src/embed/tests.zig +13 -1
  31. package/src/embed/types.zig +2 -0
  32. package/src/embed/ui_host.zig +26 -2
  33. package/src/platform/android/NativeSdkActivity.java +49 -4
  34. package/src/platform/android/android_host.c +3 -3
  35. package/src/platform/android/native_sdk_app.h +1 -1
  36. package/src/platform/ios/apple_image_fit.h +38 -0
  37. package/src/platform/ios/files.zig +1 -0
  38. package/src/platform/ios/native_sdk_app.h +1 -1
  39. package/src/platform/ios/uikit_host.m +28 -5
  40. package/src/platform/linux/cef_host.cpp +10 -2
  41. package/src/platform/linux/gtk_host.c +43 -10
  42. package/src/platform/linux/gtk_host.h +3 -3
  43. package/src/platform/linux/root.zig +22 -7
  44. package/src/platform/macos/appkit_host.h +7 -4
  45. package/src/platform/macos/appkit_host.m +271 -52
  46. package/src/platform/macos/cef_host.mm +132 -34
  47. package/src/platform/macos/image_fit_test.m +44 -0
  48. package/src/platform/macos/root.zig +222 -14
  49. package/src/platform/null_platform.zig +17 -3
  50. package/src/platform/null_platform_tests.zig +58 -4
  51. package/src/platform/root.zig +2 -0
  52. package/src/platform/types.zig +69 -19
  53. package/src/platform/windows/root.zig +22 -7
  54. package/src/platform/windows/webview2_host.cpp +31 -6
  55. package/src/primitives/app_manifest/root.zig +3 -0
  56. package/src/primitives/app_manifest/tests.zig +24 -0
  57. package/src/primitives/app_manifest/types.zig +13 -0
  58. package/src/primitives/app_manifest/validation.zig +24 -0
  59. package/src/primitives/canvas/a11y_audit.zig +9 -7
  60. package/src/primitives/canvas/a11y_audit_tests.zig +24 -0
  61. package/src/primitives/canvas/events.zig +129 -1
  62. package/src/primitives/canvas/layout_audit.zig +6 -6
  63. package/src/primitives/canvas/markdown.zig +4 -0
  64. package/src/primitives/canvas/markdown_tests.zig +1 -0
  65. package/src/primitives/canvas/png.zig +138 -0
  66. package/src/primitives/canvas/root.zig +14 -2
  67. package/src/primitives/canvas/text_interaction.zig +23 -0
  68. package/src/primitives/canvas/text_span_tests.zig +5 -3
  69. package/src/primitives/canvas/text_spans.zig +2 -0
  70. package/src/primitives/canvas/text_tests.zig +65 -0
  71. package/src/primitives/canvas/ui.zig +66 -10
  72. package/src/primitives/canvas/ui_markup.zig +40 -13
  73. package/src/primitives/canvas/ui_markup_binary.zig +8 -6
  74. package/src/primitives/canvas/ui_markup_binary_tests.zig +14 -4
  75. package/src/primitives/canvas/ui_markup_compiled.zig +5 -1
  76. package/src/primitives/canvas/ui_markup_compiled_tests.zig +55 -0
  77. package/src/primitives/canvas/ui_markup_reflect.zig +6 -5
  78. package/src/primitives/canvas/ui_markup_tests.zig +11 -2
  79. package/src/primitives/canvas/ui_markup_view.zig +8 -2
  80. package/src/primitives/canvas/ui_markup_view_tests.zig +67 -6
  81. package/src/primitives/canvas/ui_schema.zig +17 -13
  82. package/src/primitives/canvas/ui_tests.zig +84 -0
  83. package/src/primitives/canvas/widget_access.zig +3 -3
  84. package/src/primitives/canvas/widget_anchored_tests.zig +106 -0
  85. package/src/primitives/canvas/widget_builtin_tests.zig +593 -32
  86. package/src/primitives/canvas/widget_invalidation.zig +33 -6
  87. package/src/primitives/canvas/widget_layout.zig +333 -126
  88. package/src/primitives/canvas/widget_layout_tests.zig +169 -0
  89. package/src/primitives/canvas/widget_metrics.zig +7 -8
  90. package/src/primitives/canvas/widget_render.zig +76 -44
  91. package/src/primitives/canvas/widget_render_controls.zig +110 -32
  92. package/src/primitives/canvas/widget_render_style.zig +58 -18
  93. package/src/primitives/canvas/widget_render_surfaces.zig +45 -14
  94. package/src/primitives/canvas/widget_routing.zig +40 -34
  95. package/src/primitives/canvas/widget_runtime.zig +11 -2
  96. package/src/primitives/canvas/widget_runtime_tests.zig +10 -14
  97. package/src/primitives/canvas/widget_semantics.zig +8 -3
  98. package/src/primitives/canvas/widget_semantics_tests.zig +6 -2
  99. package/src/primitives/canvas/widget_tree.zig +99 -5
  100. package/src/primitives/canvas/widgets.zig +20 -7
  101. package/src/root.zig +3 -0
  102. package/src/runtime/api.zig +6 -0
  103. package/src/runtime/automation_snapshot.zig +4 -0
  104. package/src/runtime/automation_widget_dispatch.zig +48 -6
  105. package/src/runtime/builtin_bridge.zig +5 -2
  106. package/src/runtime/canvas_frame_packet_tests.zig +22 -13
  107. package/src/runtime/canvas_image_tests.zig +146 -2
  108. package/src/runtime/canvas_images.zig +35 -16
  109. package/src/runtime/canvas_limits.zig +13 -3
  110. package/src/runtime/canvas_widget_accessibility_tests.zig +279 -4
  111. package/src/runtime/canvas_widget_anchored_tests.zig +54 -0
  112. package/src/runtime/canvas_widget_control_tests.zig +33 -1
  113. package/src/runtime/canvas_widget_events.zig +151 -26
  114. package/src/runtime/canvas_widget_floating_tests.zig +48 -0
  115. package/src/runtime/canvas_widget_runtime.zig +322 -102
  116. package/src/runtime/canvas_widget_scroll_driver_tests.zig +34 -0
  117. package/src/runtime/canvas_widget_scroll_drivers.zig +12 -10
  118. package/src/runtime/canvas_widget_scroll_tests.zig +193 -2
  119. package/src/runtime/canvas_widget_semantics_tests.zig +337 -3
  120. package/src/runtime/canvas_widget_split_tree_tests.zig +55 -0
  121. package/src/runtime/canvas_widget_state.zig +33 -7
  122. package/src/runtime/canvas_widget_text_tests.zig +124 -0
  123. package/src/runtime/core.zig +16 -0
  124. package/src/runtime/effects.zig +14 -14
  125. package/src/runtime/effects_image_tests.zig +91 -0
  126. package/src/runtime/gpu_surface_events.zig +25 -2
  127. package/src/runtime/native_command_event_tests.zig +29 -0
  128. package/src/runtime/root.zig +2 -0
  129. package/src/runtime/session_journal.zig +21 -2
  130. package/src/runtime/session_replay.zig +13 -8
  131. package/src/runtime/session_tests.zig +111 -4
  132. package/src/runtime/shell_layout_tests.zig +12 -0
  133. package/src/runtime/ts_core_host_tests.zig +47 -0
  134. package/src/runtime/ts_ui_app.zig +164 -1
  135. package/src/runtime/ui_app.zig +100 -21
  136. package/src/runtime/ui_app_tests.zig +351 -32
  137. package/src/runtime/ui_app_window_tests.zig +13 -1
  138. package/src/runtime/view.zig +3 -0
  139. package/src/runtime/view_widget_control.zig +18 -0
  140. package/src/runtime/view_widget_scroll.zig +112 -18
  141. package/src/runtime/view_widget_text.zig +1 -1
  142. package/src/runtime/view_widget_tree.zig +110 -13
  143. package/src/runtime/widget_bridge.zig +2 -0
  144. package/src/runtime/window_command_bridge_tests.zig +86 -0
  145. package/src/runtime/window_storage.zig +16 -1
  146. package/src/runtime/window_views.zig +1 -0
  147. package/src/tooling/ios.zig +3 -0
  148. package/src/tooling/manifest.zig +90 -2
  149. package/src/tooling/package.zig +67 -2
  150. package/src/tooling/raw_manifest.zig +10 -0
  151. package/src/tooling/templates.zig +128 -18
  152. package/src/tooling/verbs.zig +1 -0
  153. package/src/tooling/web_engine.zig +1 -1
  154. package/tools/corewire/emit.zig +31 -12
  155. package/tools/corewire/emit_facade.zig +57 -2
  156. package/tools/corewire/shim_rt.zig +20 -0
@@ -651,6 +651,61 @@ test "tree arrow navigation reveals and focuses rows below a scroll viewport" {
651
651
  try std.testing.expect(scrolled.findById(10).?.widget.value > 0);
652
652
  }
653
653
 
654
+ test "radio-group arrow navigation reveals selects and focuses an offscreen nested radio" {
655
+ const harness = try TestHarness().create(std.testing.allocator, .{});
656
+ defer harness.destroy(std.testing.allocator);
657
+ harness.null_platform.gpu_surfaces = true;
658
+ var app_state: ObservingApp = .{};
659
+ const app = app_state.app();
660
+ try harness.start(app);
661
+
662
+ _ = try harness.runtime.createView(.{
663
+ .window_id = 1,
664
+ .label = "canvas",
665
+ .kind = .gpu_surface,
666
+ .frame = geometry.RectF.init(0, 0, 240, 64),
667
+ });
668
+
669
+ const radios = [_]canvas.Widget{
670
+ .{ .id = 31, .kind = .radio, .frame = geometry.RectF.init(0, 0, 0, 28), .text = "One", .state = .{ .selected = true } },
671
+ .{ .id = 32, .kind = .radio, .frame = geometry.RectF.init(0, 0, 0, 28), .text = "Two" },
672
+ .{ .id = 33, .kind = .radio, .frame = geometry.RectF.init(0, 0, 0, 28), .text = "Three" },
673
+ .{ .id = 34, .kind = .radio, .frame = geometry.RectF.init(0, 0, 0, 28), .text = "Four" },
674
+ };
675
+ const nested = [_]canvas.Widget{.{
676
+ .kind = .column,
677
+ .layout = .{ .gap = 2 },
678
+ .children = &radios,
679
+ }};
680
+ const group = canvas.Widget{
681
+ .id = 30,
682
+ .kind = .radio_group,
683
+ .frame = geometry.RectF.init(0, 0, 0, 118),
684
+ .children = &nested,
685
+ };
686
+ const root = canvas.Widget{ .id = 20, .kind = .scroll_view, .children = &.{group} };
687
+ var nodes: [10]canvas.WidgetLayoutNode = undefined;
688
+ const layout = try canvas.layoutWidgetTree(root, geometry.RectF.init(0, 0, 240, 64), &nodes);
689
+ _ = try harness.runtime.setCanvasWidgetLayout(1, "canvas", layout);
690
+ const view = &harness.runtime.views[0];
691
+ view.canvas_widget_focused_id = 31;
692
+
693
+ try harness.runtime.dispatchPlatformEvent(app, .{ .gpu_surface_input = .{ .window_id = 1, .label = "canvas", .kind = .key_down, .key = "arrowdown" } });
694
+ try harness.runtime.dispatchPlatformEvent(app, .{ .gpu_surface_input = .{ .window_id = 1, .label = "canvas", .kind = .key_down, .key = "arrowdown" } });
695
+ try harness.runtime.dispatchPlatformEvent(app, .{ .gpu_surface_input = .{ .window_id = 1, .label = "canvas", .kind = .key_down, .key = "arrowdown" } });
696
+
697
+ try std.testing.expectEqual(@as(canvas.ObjectId, 34), view.canvas_widget_focused_id);
698
+ try std.testing.expectEqual(@as(canvas.ObjectId, 34), app_state.last_keyboard_target_id);
699
+ try std.testing.expect(app_state.last_keyboard_focus_moved);
700
+ const scrolled = try harness.runtime.canvasWidgetLayout(1, "canvas");
701
+ const viewport = scrolled.findById(20).?.frame.normalized();
702
+ const focused = scrolled.findById(34).?.frame.normalized();
703
+ try std.testing.expect(focused.y >= viewport.y);
704
+ try std.testing.expect(focused.maxY() <= viewport.maxY());
705
+ try std.testing.expect(!scrolled.findById(31).?.widget.state.selected);
706
+ try std.testing.expect(scrolled.findById(34).?.widget.state.selected);
707
+ }
708
+
654
709
  test "list arrow navigation reveals and focuses rows below a scroll viewport" {
655
710
  const harness = try TestHarness().create(std.testing.allocator, .{});
656
711
  defer harness.destroy(std.testing.allocator);
@@ -13,6 +13,7 @@ const runtime_canvas_widget_display = @import("canvas_widget_display.zig");
13
13
  const runtime_view = @import("view.zig");
14
14
  const runtime_canvas_widget_events = @import("canvas_widget_events.zig");
15
15
  const runtime_automation_widget_dispatch = @import("automation_widget_dispatch.zig");
16
+ const runtime_gpu_surface_events = @import("gpu_surface_events.zig");
16
17
  const widget_bridge = @import("widget_bridge.zig");
17
18
 
18
19
  const validateViewLabel = validation.validateViewLabel;
@@ -119,7 +120,7 @@ pub fn RuntimeCanvasWidgetState(comptime Runtime: type) type {
119
120
  // the OS scroller's overscrolled offset instead of clamping it
120
121
  // and force-pushing the clamp into the live bounce (visible
121
122
  // jitter). Non-driver platforms clamp exactly as before.
122
- canvas_widget_runtime.clampCanvasWidgetLayoutScrollOffsets(reconciled_nodes[0..reconciled_layout.nodes.len], null);
123
+ try canvas_widget_runtime.clampCanvasWidgetLayoutScrollOffsetsAfterReconcile(reconciled_nodes[0..reconciled_layout.nodes.len], null, reconciled_layout.root_bounds, tokens);
123
124
  // Runtime-owned tooltip visibility normalizes BEFORE the
124
125
  // diff: the retained tree carries the intent machine's
125
126
  // hidden stamps on anchored tooltips while the source
@@ -203,11 +204,20 @@ pub fn RuntimeCanvasWidgetState(comptime Runtime: type) type {
203
204
  if (render_state_changed) CanvasWidgetEventMethods(Runtime).invalidateForCanvasWidgetRenderStateDirty(self, index, render_state_dirty);
204
205
  const layout_dirty = invalidations.len > 0 or render_state_changed;
205
206
  if (autofocus_target) |autofocus_id| {
206
- // The same focus write every other focus source performs
207
- // (view focus + focused/visible ids + invalidation);
208
- // widgets that are not focusable ignore the request.
209
- if (self.views[index].widgetLayoutTree().focusTargetById(autofocus_id) != null) {
210
- try AutomationWidgetMethods(Runtime).focusAutomationCanvasWidget(self, index, autofocus_id);
207
+ // Autofocus is programmatic, not pointer hit testing: admit a
208
+ // logically focusable target even while a scroll ancestor
209
+ // clips it, then let the shared automation/keyboard reveal
210
+ // seam scroll, reconcile, and re-verify before focus lands.
211
+ // A disabled/hidden/fixed-clipped target still consumes the
212
+ // source edge; holding autofocus true never retries or steals.
213
+ const retained_layout = self.views[index].widgetLayoutTree();
214
+ if (canvas_widget_runtime.canvasWidgetLayoutNodeIndexById(retained_layout, autofocus_id)) |autofocus_index| {
215
+ if (canvas_widget_runtime.canvasWidgetLogicalFocusTarget(retained_layout, autofocus_index) != null) {
216
+ AutomationWidgetMethods(Runtime).focusAutomationCanvasWidget(self, index, autofocus_id) catch |err| switch (err) {
217
+ error.InvalidCommand => {},
218
+ else => return err,
219
+ };
220
+ }
211
221
  }
212
222
  }
213
223
  self.frame_profile.end(.reconcile, reconcile_begin);
@@ -330,11 +340,27 @@ pub fn RuntimeCanvasWidgetState(comptime Runtime: type) type {
330
340
  .set_composition => try AutomationWidgetMethods(Runtime).composeAutomationCanvasWidgetText(self, app, index, action.id, .ime_set_composition, action.text),
331
341
  .commit_composition => try AutomationWidgetMethods(Runtime).composeAutomationCanvasWidgetText(self, app, index, action.id, .ime_commit_composition, ""),
332
342
  .cancel_composition => try AutomationWidgetMethods(Runtime).composeAutomationCanvasWidgetText(self, app, index, action.id, .ime_cancel_composition, ""),
333
- .select => try AutomationWidgetMethods(Runtime).selectAutomationCanvasWidget(self, index, action.id),
343
+ .select => {
344
+ const node_index = self.views[index].canvasWidgetNodeIndexById(action.id) orelse return error.InvalidCommand;
345
+ if (self.views[index].widget_layout_nodes[node_index].widget.kind == .radio) {
346
+ // Radio selection is activation, not an echo-only
347
+ // retained-state write: drive the same Space path
348
+ // as keyboard and pointer input so a documented
349
+ // `on_change` handler updates the app model too.
350
+ try AutomationWidgetMethods(Runtime).dispatchAutomationWidgetKey(self, app, index, action.id, "space");
351
+ } else {
352
+ try AutomationWidgetMethods(Runtime).selectAutomationCanvasWidget(self, index, action.id);
353
+ }
354
+ },
334
355
  .drag => try AutomationWidgetMethods(Runtime).dispatchAutomationCanvasWidgetDrag(self, app, index, action.id, action.text),
335
356
  .drop_files => try AutomationWidgetMethods(Runtime).dispatchAutomationCanvasWidgetFileDrop(self, app, index, action.id, action.text),
336
357
  .dismiss => try AutomationWidgetMethods(Runtime).dismissAutomationCanvasWidget(self, app, index, action.id),
337
358
  }
359
+ // A direct focus action can reveal an offscreen target without
360
+ // passing through the GPU input dispatcher. Deliver the pending
361
+ // scroll observation in this semantic-action transaction too,
362
+ // rather than leaving it parked until unrelated future input.
363
+ try runtime_gpu_surface_events.RuntimeGpuSurfaceEvents(Runtime).dispatchPendingCanvasWidgetScrollEvents(self, app, index);
338
364
  // Key-driven action routes above dispatch real input events
339
365
  // whose refresh batches defer the platform publish; the AX
340
366
  // client reads the tree next, so force-flush here too.
@@ -1401,6 +1401,57 @@ test "single-line history replay restores exact retained bytes" {
1401
1401
  try std.testing.expect(harness.runtime.views[0].canvasWidgetTextHistoryAvailability(2).can_redo);
1402
1402
  }
1403
1403
 
1404
+ test "macOS Command Backspace treats model-provided newlines as single-line presentation bytes" {
1405
+ if (comptime builtin.os.tag != .macos) return error.SkipZigTest;
1406
+
1407
+ const TestApp = struct {
1408
+ fn app(self: *@This()) App {
1409
+ return .{ .context = self, .name = "gpu-widget-input-command-backspace-raw-newline", .source = platform.WebViewSource.html("<h1>Hello</h1>") };
1410
+ }
1411
+ };
1412
+
1413
+ const harness = try TestHarness().create(std.testing.allocator, .{});
1414
+ defer harness.destroy(std.testing.allocator);
1415
+ harness.null_platform.gpu_surfaces = true;
1416
+ var app_state: TestApp = .{};
1417
+ const app = app_state.app();
1418
+ try harness.start(app);
1419
+ _ = try harness.runtime.createView(.{
1420
+ .window_id = 1,
1421
+ .label = "canvas",
1422
+ .kind = .gpu_surface,
1423
+ .frame = geometry.RectF.init(0, 0, 240, 100),
1424
+ });
1425
+
1426
+ var nodes: [2]canvas.WidgetLayoutNode = undefined;
1427
+ const layout = try canvas.layoutWidgetTree(.{ .kind = .stack, .children = &.{canvas.Widget{
1428
+ .id = 2,
1429
+ .kind = .input,
1430
+ .frame = geometry.RectF.init(12, 16, 180, 32),
1431
+ .text = "one\ntwo",
1432
+ .text_selection = canvas.TextSelection.collapsed(7),
1433
+ }} }, geometry.RectF.init(0, 0, 240, 100), &nodes);
1434
+ _ = try harness.runtime.setCanvasWidgetLayout(1, "canvas", layout);
1435
+ harness.runtime.views[0].focused = true;
1436
+ harness.runtime.views[0].canvas_widget_focused_id = 2;
1437
+
1438
+ try harness.runtime.dispatchPlatformEvent(app, .{ .gpu_surface_input = .{
1439
+ .window_id = 1,
1440
+ .label = "canvas",
1441
+ .kind = .key_down,
1442
+ .key = "backspace",
1443
+ .modifiers = .{ .command = true, .shift = true },
1444
+ } });
1445
+
1446
+ var retained = try harness.runtime.canvasWidgetLayout(1, "canvas");
1447
+ try std.testing.expectEqualStrings("", retained.nodes[1].widget.text);
1448
+ try std.testing.expectEqualDeep(canvas.TextSelection.collapsed(0), retained.nodes[1].widget.text_selection.?);
1449
+ try dispatchTextareaHistoryShortcut(harness, app, false);
1450
+ retained = try harness.runtime.canvasWidgetLayout(1, "canvas");
1451
+ try std.testing.expectEqualStrings("one\ntwo", retained.nodes[1].widget.text);
1452
+ try std.testing.expectEqualDeep(canvas.TextSelection.collapsed(7), retained.nodes[1].widget.text_selection.?);
1453
+ }
1454
+
1404
1455
  test "textarea history replays newly completed CRLF atomically" {
1405
1456
  const TestApp = struct {
1406
1457
  fn app(self: *@This()) App {
@@ -1838,6 +1889,79 @@ test "canvas textareas undo and redo keyboard edits" {
1838
1889
  try std.testing.expectEqualStrings("external!", retained.nodes[1].widget.text);
1839
1890
  }
1840
1891
 
1892
+ test "macOS Command Backspace deletes to line start in every editable text kind and undoes as one step" {
1893
+ if (comptime builtin.os.tag != .macos) return error.SkipZigTest;
1894
+
1895
+ const TestApp = struct {
1896
+ fn app(self: *@This()) App {
1897
+ return .{ .context = self, .name = "gpu-widget-command-backspace", .source = platform.WebViewSource.html("<h1>Hello</h1>") };
1898
+ }
1899
+ };
1900
+
1901
+ const harness = try TestHarness().create(std.testing.allocator, .{});
1902
+ defer harness.destroy(std.testing.allocator);
1903
+ harness.null_platform.gpu_surfaces = true;
1904
+ var app_state: TestApp = .{};
1905
+ const app = app_state.app();
1906
+ try harness.start(app);
1907
+ _ = try harness.runtime.createView(.{
1908
+ .window_id = 1,
1909
+ .label = "canvas",
1910
+ .kind = .gpu_surface,
1911
+ .frame = geometry.RectF.init(0, 0, 520, 280),
1912
+ });
1913
+
1914
+ const kinds = [_]canvas.WidgetKind{ .input, .text_field, .search_field, .combobox, .textarea };
1915
+ var children: [kinds.len]canvas.Widget = undefined;
1916
+ for (&children, kinds, 0..) |*child, kind, index| {
1917
+ child.* = .{
1918
+ .id = @intCast(index + 2),
1919
+ .kind = kind,
1920
+ .frame = geometry.RectF.init(12, @floatFromInt(12 + index * 46), 260, 36),
1921
+ .text = if (kind == .textarea) "first\nsecond line" else "second line",
1922
+ .text_selection = canvas.TextSelection.collapsed(if (kind == .textarea) 12 else 6),
1923
+ .semantics = .{ .label = "Editor" },
1924
+ };
1925
+ }
1926
+ var nodes: [kinds.len + 1]canvas.WidgetLayoutNode = undefined;
1927
+ const layout = try canvas.layoutWidgetTree(
1928
+ .{ .kind = .stack, .children = &children },
1929
+ geometry.RectF.init(0, 0, 520, 280),
1930
+ &nodes,
1931
+ );
1932
+ _ = try harness.runtime.setCanvasWidgetLayout(1, "canvas", layout);
1933
+
1934
+ for (kinds, 0..) |kind, index| {
1935
+ const id: canvas.ObjectId = @intCast(index + 2);
1936
+ harness.runtime.views[0].focused = true;
1937
+ harness.runtime.views[0].canvas_widget_focused_id = id;
1938
+ try harness.runtime.dispatchPlatformEvent(app, .{ .gpu_surface_input = .{
1939
+ .window_id = 1,
1940
+ .label = "canvas",
1941
+ .kind = .key_down,
1942
+ .key = "backspace",
1943
+ .modifiers = .{ .command = true },
1944
+ } });
1945
+
1946
+ var retained = try harness.runtime.canvasWidgetLayout(1, "canvas");
1947
+ const edited = retained.findById(id).?.widget;
1948
+ try std.testing.expectEqualStrings(if (kind == .textarea) "first\n line" else " line", edited.text);
1949
+ try std.testing.expectEqualDeep(canvas.TextSelection.collapsed(if (kind == .textarea) 6 else 0), edited.text_selection.?);
1950
+
1951
+ try dispatchTextareaHistoryShortcut(harness, app, false);
1952
+ retained = try harness.runtime.canvasWidgetLayout(1, "canvas");
1953
+ const undone = retained.findById(id).?.widget;
1954
+ try std.testing.expectEqualStrings(if (kind == .textarea) "first\nsecond line" else "second line", undone.text);
1955
+ try std.testing.expectEqualDeep(canvas.TextSelection.collapsed(if (kind == .textarea) 12 else 6), undone.text_selection.?);
1956
+
1957
+ try dispatchTextareaHistoryShortcut(harness, app, true);
1958
+ retained = try harness.runtime.canvasWidgetLayout(1, "canvas");
1959
+ const redone = retained.findById(id).?.widget;
1960
+ try std.testing.expectEqualStrings(if (kind == .textarea) "first\n line" else " line", redone.text);
1961
+ try std.testing.expectEqualDeep(canvas.TextSelection.collapsed(if (kind == .textarea) 6 else 0), redone.text_selection.?);
1962
+ }
1963
+ }
1964
+
1841
1965
  test "compound editor history reroutes every continuation after controlled rebuilds" {
1842
1966
  const TestApp = struct {
1843
1967
  replay_count: usize = 0,
@@ -39,6 +39,7 @@ const bridge = @import("../bridge/root.zig");
39
39
  const extensions = @import("../extensions/root.zig");
40
40
  const app_manifest = @import("app_manifest");
41
41
  const platform = @import("../platform/root.zig");
42
+ const window_state = @import("../window_state/root.zig");
42
43
  const runtime_effects = @import("effects.zig");
43
44
  const runtime_record_store = @import("record_store.zig");
44
45
  const runtime_relational_store = @import("relational_store.zig");
@@ -198,6 +199,10 @@ pub const Runtime = struct {
198
199
  /// frees, the `deinit` frees) goes through this field, never
199
200
  /// through `options.allocator`.
200
201
  owned_allocator: std.mem.Allocator,
202
+ /// Registered-image budget captured at init. Decode, registration,
203
+ /// replay validation, slot reuse, and deinit all observe this one
204
+ /// app-fixed limit even if public `options` is later mutated.
205
+ max_image_pixel_bytes: usize = canvas_limits.max_registered_canvas_image_pixel_bytes,
201
206
  surface: platform.Surface,
202
207
  appearance: platform.Appearance = .{},
203
208
  windows: [platform.max_windows]RuntimeWindow = undefined,
@@ -253,6 +258,11 @@ pub const Runtime = struct {
253
258
  video_height: u64 = 0,
254
259
  shell_layouts: [platform.max_windows]RuntimeShellLayout = undefined,
255
260
  shell_layout_count: usize = 0,
261
+ /// Reused by runtime-created window restoration. `Store.loadWindow`
262
+ /// needs the whole bounded state file plus decoded-string scratch; keep
263
+ /// that 64-KiB workspace on the already heap-owned Runtime instead of
264
+ /// placing it on the event-loop stack for every secondary-window create.
265
+ window_state_read_scratch: [window_state.max_serialized_bytes]u8 = undefined,
256
266
  next_window_id: platform.WindowId = 2,
257
267
  next_view_id: platform.ViewId = 1,
258
268
  invalidated: bool = true,
@@ -499,10 +509,16 @@ pub const Runtime = struct {
499
509
  }
500
510
  }
501
511
  self.options = options;
512
+ if (options.max_image_pixel_bytes < canvas_limits.max_registered_canvas_image_pixel_bytes or
513
+ options.max_image_pixel_bytes > canvas_limits.max_registered_canvas_image_pixel_bytes_ceiling)
514
+ {
515
+ @panic("max_image_pixel_bytes must be between 1 MiB and 8 MiB; declare app.zon .images.max_image_pixel_bytes within that range");
516
+ }
502
517
  // Freeze the ownership allocator now (see the field doc):
503
518
  // `options` stays publicly mutable, but the identity that owns
504
519
  // on-demand storage must not move under live allocations.
505
520
  self.owned_allocator = options.allocator;
521
+ self.max_image_pixel_bytes = options.max_image_pixel_bytes;
506
522
  self.surface = options.platform.surface();
507
523
  // The profile rings exceed the small-default copy bound above;
508
524
  // assign explicitly so the disabled state is never undefined.
@@ -977,17 +977,16 @@ pub fn imageCachePartialPath(buffer: []u8, cache_path: []const u8, generation: u
977
977
  /// `.rejected` image result Msg.
978
978
  pub const max_effect_image_path_bytes: usize = max_effect_file_path_bytes;
979
979
 
980
- /// Maximum ENCODED source bytes one `loadImage` accepts — from a local
981
- /// file, the URL cache, or the network alike. Sized past the decoded
982
- /// pixel bound (`canvas_limits.max_registered_canvas_image_pixel_bytes`)
983
- /// by the same 1/4 margin the decode scratch carries: an encoded stream
984
- /// larger than that cannot decode inside the registered-image budget on
985
- /// any host, so hauling more bytes would only defer the same
986
- /// `.too_large` answer. Unlike fetch bodies there is no truncated
987
- /// delivery — a cut image can never decode, so over-bound sources fail
988
- /// whole with `.too_large`, never arrive clipped.
989
- pub const max_effect_image_bytes: usize = canvas_limits.max_registered_canvas_image_pixel_bytes +
990
- canvas_limits.max_registered_canvas_image_pixel_bytes / 4;
980
+ /// Maximum ENCODED source bytes one `loadImage` accepts — independent of
981
+ /// the decoded-pixel target now that codecs decode-to-fit. Eight MiB covers
982
+ /// typical phone JPEG/HEIC photos while keeping costs fixed and loud: every
983
+ /// in-flight load owns a transient `bound + 1` fetch/read buffer, recorded
984
+ /// source bytes grow the session blob store, and URL cache entries may reach
985
+ /// this size. Unlike fetch bodies there is no truncated delivery — a cut
986
+ /// image can never decode, so over-bound sources fail whole with
987
+ /// `.too_large`. The bound stays flat when an app raises its pixel budget.
988
+ pub const max_effect_image_source_bytes: usize = 8 * 1024 * 1024;
989
+ pub const max_effect_image_bytes: usize = max_effect_image_source_bytes;
991
990
 
992
991
  /// Bytes of an image effect result's content address in the session
993
992
  /// journal: the first half of the source bytes' SHA-256, the
@@ -1031,9 +1030,10 @@ pub const EffectImageOutcome = enum(u8) {
1031
1030
  http_status,
1032
1031
  /// `cancel(id)` ended the load before its result was delivered.
1033
1032
  cancelled,
1034
- /// The source bytes exceed `max_effect_image_bytes`, or the decoded
1035
- /// pixels exceed the registered-image slot bound
1036
- /// (`error.ImageTooLarge`) — one budget class either way.
1033
+ /// The source bytes exceed `max_effect_image_source_bytes`. A conforming
1034
+ /// codec fits decoded pixels to the app's registered-image budget;
1035
+ /// `error.ImageTooLarge` is retained only as a defensive codec-contract
1036
+ /// violation and maps here too.
1037
1037
  too_large,
1038
1038
  /// The host has no image codec (`error.UnsupportedService`), or no
1039
1039
  /// image registry is bound to this channel.
@@ -294,6 +294,97 @@ test "fake executor records the whole load request shape and feeds bytes through
294
294
  try std.testing.expectEqual(@as(usize, 1), h.app_state.effects.pendingImageLoadCount());
295
295
  }
296
296
 
297
+ test "photo-scale feed decodes to fit and reports registered geometry" {
298
+ var h = try Harness.create();
299
+ defer h.destroy();
300
+ h.app_state.effects.executor = .fake;
301
+ test_path = "assets/photo.png";
302
+ try h.app_state.dispatch(&h.harness.runtime, 1, .start);
303
+
304
+ const width: usize = 640;
305
+ const height: usize = 480;
306
+ const pixels = try std.testing.allocator.alloc(u8, width * height * 4);
307
+ defer std.testing.allocator.free(pixels);
308
+ var index: usize = 0;
309
+ while (index < pixels.len) : (index += 4) pixels[index..][0..4].* = .{ 24, 88, 176, 255 };
310
+ const encoded_len = try canvas.png.encodedRgba8ByteLen(width, height);
311
+ const encoded_buffer = try std.testing.allocator.alloc(u8, encoded_len);
312
+ defer std.testing.allocator.free(encoded_buffer);
313
+ var writer = std.Io.Writer.fixed(encoded_buffer);
314
+ try canvas.png.writeRgba8(&writer, width, height, pixels);
315
+
316
+ try h.app_state.effects.feedImageBytes(image_id, writer.buffered());
317
+ try h.drainWakes();
318
+ const result = h.app_state.model.last.?;
319
+ try std.testing.expectEqual(effects_mod.EffectImageOutcome.loaded, result.outcome);
320
+ try std.testing.expectEqual(@as(usize, 591), result.width);
321
+ try std.testing.expectEqual(@as(usize, 443), result.height);
322
+ try std.testing.expect(result.width * result.height * 4 <= h.harness.runtime.max_image_pixel_bytes);
323
+ try std.testing.expectApproxEqAbs(@as(f64, 4.0 / 3.0), @as(f64, @floatFromInt(result.width)) / @as(f64, @floatFromInt(result.height)), 0.01);
324
+ const registered = h.harness.runtime.registeredCanvasImage(image_id).?;
325
+ try std.testing.expectEqual(result.width, registered.width);
326
+ try std.testing.expectEqual(result.height, registered.height);
327
+ try std.testing.expectEqualSlices(u8, &[_]u8{ 24, 88, 176, 255 }, h.harness.runtime.registeredCanvasImages()[0].pixels[0..4]);
328
+ }
329
+
330
+ test "raised image budget loads a 1080p source without downscaling" {
331
+ const harness = try core.TestHarness().create(std.testing.allocator, .{ .size = geometry.SizeF.init(400, 300) });
332
+ defer harness.destroy(std.testing.allocator);
333
+ harness.null_platform.gpu_surfaces = true;
334
+ harness.null_platform.image_decode = true;
335
+ core.Runtime.initAt(&harness.runtime, .{
336
+ .platform = harness.null_platform.platform(),
337
+ .trace_sink = harness.trace_sink.sink(),
338
+ .max_image_pixel_bytes = canvas_limits.max_registered_canvas_image_pixel_bytes_ceiling,
339
+ .environ = std.testing.environ,
340
+ });
341
+ harness.runtime.dispatch_error_policy = .propagate;
342
+
343
+ const app_state = try std.testing.allocator.create(ImageApp);
344
+ defer std.testing.allocator.destroy(app_state);
345
+ app_state.* = ImageApp.init(std.heap.page_allocator, .{}, .{
346
+ .name = "effects-image-raised-budget",
347
+ .scene = image_scene,
348
+ .canvas_label = canvas_label,
349
+ .update_fx = imageUpdate,
350
+ .view = imageView,
351
+ });
352
+ defer app_state.deinit();
353
+ app_state.effects.executor = .fake;
354
+ const app = app_state.app();
355
+ try harness.start(app);
356
+ try harness.runtime.dispatchPlatformEvent(app, .{ .gpu_surface_frame = .{
357
+ .label = canvas_label,
358
+ .size = geometry.SizeF.init(400, 300),
359
+ .scale_factor = 1,
360
+ .frame_index = 1,
361
+ .timestamp_ns = 1_000_000,
362
+ .nonblank = true,
363
+ } });
364
+
365
+ test_path = "assets/wallpaper.png";
366
+ try app_state.dispatch(&harness.runtime, 1, .start);
367
+ const width: usize = 1920;
368
+ const height: usize = 1080;
369
+ const pixels = try std.testing.allocator.alloc(u8, width * height * 4);
370
+ defer std.testing.allocator.free(pixels);
371
+ @memset(pixels, 0x6D);
372
+ const encoded_len = try canvas.png.encodedRgba8ByteLen(width, height);
373
+ try std.testing.expect(encoded_len <= effects_mod.max_effect_image_source_bytes);
374
+ const encoded = try std.testing.allocator.alloc(u8, encoded_len);
375
+ defer std.testing.allocator.free(encoded);
376
+ var writer = std.Io.Writer.fixed(encoded);
377
+ try canvas.png.writeRgba8(&writer, width, height, pixels);
378
+ try app_state.effects.feedImageBytes(image_id, writer.buffered());
379
+ try harness.runtime.dispatchPlatformEvent(app, .wake);
380
+
381
+ const result = app_state.model.last.?;
382
+ try std.testing.expectEqual(effects_mod.EffectImageOutcome.loaded, result.outcome);
383
+ try std.testing.expectEqual(width, result.width);
384
+ try std.testing.expectEqual(height, result.height);
385
+ try std.testing.expectEqual(width, harness.runtime.registeredCanvasImage(image_id).?.width);
386
+ }
387
+
297
388
  test "undecodable and oversized feeds fail with the registry's own classes" {
298
389
  var h = try Harness.create();
299
390
  defer h.destroy();
@@ -9,6 +9,7 @@ const runtime_canvas_widget_context_menu = @import("canvas_widget_context_menu.z
9
9
  const runtime_canvas_widget_display = @import("canvas_widget_display.zig");
10
10
  const runtime_canvas_widget_events = @import("canvas_widget_events.zig");
11
11
  const runtime_canvas_widget_scroll_drivers = @import("canvas_widget_scroll_drivers.zig");
12
+ const canvas_widget_runtime = @import("canvas_widget_runtime.zig");
12
13
 
13
14
  const canvasWidgetInputBatchesDisplayListRefresh = canvas_frame_helpers.canvasWidgetInputBatchesDisplayListRefresh;
14
15
  const gpuSurfaceFrameEventFromGpuFrame = canvas_frame_helpers.gpuSurfaceFrameEventFromGpuFrame;
@@ -361,7 +362,7 @@ pub fn RuntimeGpuSurfaceEvents(comptime Runtime: type) type {
361
362
  // activation (checkbox/toggle state), not only app Msgs and
362
363
  // commands. Geometry controls applied their live resize on
363
364
  // move; a terminal drag owes no release mutation.
364
- if (!widget_drag_terminal) try CanvasWidgetEventMethods().updateCanvasWidgetControlFromPointer(self, pointer_event.*);
365
+ if (!widget_drag_terminal) try CanvasWidgetEventMethods().updateCanvasWidgetControlFromPointer(self, pointer_event);
365
366
  try CanvasWidgetEventMethods().updateCanvasWidgetInteractionFromPointer(self, pointer_event.*);
366
367
  // The text pass may stamp a caret/selection or clear
367
368
  // edit onto the event for the app dispatch below.
@@ -448,6 +449,28 @@ pub fn RuntimeGpuSurfaceEvents(comptime Runtime: type) type {
448
449
  // from "an arrow landed here in place".
449
450
  if (widget_keyboard_event) |*keyboard_event| {
450
451
  keyboard_event.keyboard.focus_moved = widget_focus_moved;
452
+ // Nearest-radio-group navigation owns its key even when
453
+ // Home/End names the current edge or a one-member group
454
+ // wraps in place. Selection is a separate stamp: a real
455
+ // focus move selects the landed radio, and an in-place
456
+ // move selects only an unchecked current radio. Bare
457
+ // radios preserve their legacy focus-only spatial
458
+ // behavior, and Tab entry never synthesizes a selection.
459
+ const view_index = runtimeFindViewIndex(self, input_event.window_id, input_event.label).?;
460
+ const layout = self.views[view_index].widgetLayoutTree();
461
+ const radio_group_navigation = navigation: {
462
+ const target = keyboard_event.target orelse break :navigation false;
463
+ if (target.kind != .radio) break :navigation false;
464
+ if (canvas_widget_runtime.canvasWidgetRadioGroupScopeIndex(layout, target.index) == null) break :navigation false;
465
+ break :navigation canvas_widget_runtime.canvasWidgetGroupFocusEdgeFromInput(input_event) != null or
466
+ canvas_widget_runtime.canvasWidgetSpatialFocusDirection(input_event) != null;
467
+ };
468
+ keyboard_event.keyboard.radio_group_navigation = radio_group_navigation;
469
+ if (radio_group_navigation) {
470
+ const target = keyboard_event.target.?;
471
+ keyboard_event.keyboard.radio_group_selection = widget_focus_moved or
472
+ !canvas_widget_runtime.canvasWidgetSelectableSelected(layout.nodes[target.index].widget);
473
+ }
451
474
  }
452
475
  // Clipboard shortcuts resolve against the raw input (copy has
453
476
  // no routed target when a static text selection is live) and
@@ -471,7 +494,7 @@ pub fn RuntimeGpuSurfaceEvents(comptime Runtime: type) type {
471
494
  // armed/shown tooltip before the control mutation and
472
495
  // app dispatch observe the input.
473
496
  try CanvasWidgetEventMethods().updateCanvasTooltipIntentForKeyboardActivation(self, keyboard_event.*);
474
- try CanvasWidgetEventMethods().updateCanvasWidgetControlFromKeyboard(self, keyboard_event.*);
497
+ try CanvasWidgetEventMethods().updateCanvasWidgetControlFromKeyboard(self, keyboard_event);
475
498
  try CanvasWidgetEventMethods().updateCanvasWidgetTextFromKeyboard(self, keyboard_event);
476
499
  }
477
500
  // An IME sequence belongs to whoever it STARTED over: a
@@ -253,6 +253,35 @@ test "runtime dispatches menu command events" {
253
253
  try std.testing.expectEqual(@as(platform.WindowId, 1), app_state.last_window_id);
254
254
  }
255
255
 
256
+ test "automation snapshot exposes configured app menus" {
257
+ const items = [_]platform.MenuItem{
258
+ .{ .label = "Refresh", .command = "app.refresh" },
259
+ .{ .label = "Disabled", .command = "app.disabled", .enabled = false },
260
+ .{ .separator = true },
261
+ };
262
+ const menus = [_]platform.Menu{
263
+ .{ .title = "View", .items = &items },
264
+ };
265
+ const harness = try TestHarness().create(std.testing.allocator, .{});
266
+ defer harness.destroy(std.testing.allocator);
267
+ harness.runtime.options.menus = &menus;
268
+ const snapshot = harness.runtime.automationSnapshot("Menus");
269
+ try std.testing.expectEqual(@as(usize, 1), snapshot.menus.len);
270
+ try std.testing.expectEqualStrings("View", snapshot.menus[0].title);
271
+ try std.testing.expectEqual(@as(usize, 3), snapshot.menus[0].items.len);
272
+ try std.testing.expectEqualStrings("app.refresh", snapshot.menus[0].items[0].command);
273
+ try std.testing.expect(!snapshot.menus[0].items[1].enabled);
274
+ try std.testing.expect(snapshot.menus[0].items[2].separator);
275
+
276
+ var buffer: [2048]u8 = undefined;
277
+ var writer = std.Io.Writer.fixed(&buffer);
278
+ try automation.snapshot.writeText(snapshot, &writer);
279
+ const text = writer.buffered();
280
+ try std.testing.expect(std.mem.indexOf(u8, text, "app-menu title=\"View\" items=3\n") != null);
281
+ try std.testing.expect(std.mem.indexOf(u8, text, " app-menu-item label=\"Refresh\" command=\"app.refresh\" enabled=true checked=false key=\"\"") != null);
282
+ try std.testing.expect(std.mem.indexOf(u8, text, " app-menu-item separator\n") != null);
283
+ }
284
+
256
285
  test "runtime dispatches tray item commands" {
257
286
  const TestApp = struct {
258
287
  command_count: u32 = 0,
@@ -143,6 +143,7 @@ pub const EffectImageOutcome = runtime_effects.EffectImageOutcome;
143
143
  pub const imageCachePath = runtime_effects.imageCachePath;
144
144
  pub const max_effect_image_path_bytes = runtime_effects.max_effect_image_path_bytes;
145
145
  pub const max_effect_image_bytes = runtime_effects.max_effect_image_bytes;
146
+ pub const max_effect_image_source_bytes = runtime_effects.max_effect_image_source_bytes;
146
147
  pub const effect_image_blob_hash_len = runtime_effects.effect_image_blob_hash_len;
147
148
  pub const EffectChannelEvent = runtime_effects.EffectChannelEvent;
148
149
  pub const EffectChannelEventKind = runtime_effects.EffectChannelEventKind;
@@ -246,6 +247,7 @@ const runtime_canvas_images = @import("canvas_images.zig");
246
247
  pub const RegisteredCanvasImage = runtime_canvas_images.RegisteredCanvasImage;
247
248
  pub const max_registered_canvas_images = runtime_canvas_images.max_registered_canvas_images;
248
249
  pub const max_registered_canvas_image_pixel_bytes = runtime_canvas_images.max_registered_canvas_image_pixel_bytes;
250
+ pub const max_registered_canvas_image_pixel_bytes_ceiling = runtime_canvas_images.max_registered_canvas_image_pixel_bytes_ceiling;
249
251
 
250
252
  // The media-surface producer channel (media_surface.zig): the handle
251
253
  // type `Runtime.acquireMediaSurfaceProducer` returns rides the public
@@ -133,8 +133,12 @@ pub const format_fingerprint: u64 = layout_fingerprint.hash(formatLayoutDescript
133
133
  /// out-of-window audio record as journal damage — an older recording
134
134
  /// could journal a wider value the old feed paths accepted, which
135
135
  /// would now be misreported as damage instead of refusing as a
136
- /// different generation.
137
- pub const format_semantic_epoch: u32 = 5;
136
+ /// different generation. Epoch 6: macOS Command+Backspace gained its
137
+ /// platform text-editor meaning (delete to field start in single-line
138
+ /// editors, or hard line start in textareas). The raw gpu-surface key record
139
+ /// is byte-identical, but replay now derives a text edit where older builds
140
+ /// derived none.
141
+ pub const format_semantic_epoch: u32 = 6;
138
142
 
139
143
  /// The canonical description `format_fingerprint` hashes: everything
140
144
  /// that defines the on-disk record layout. Reflection covers the record
@@ -1611,6 +1615,21 @@ test "event codec round-trips every payload variant" {
1611
1615
  try testing.expect(decoded.gpu_surface_input.modifiers.control);
1612
1616
  try testing.expectEqual(@as(f32, 0), decoded.gpu_surface_input.scale);
1613
1617
  }
1618
+ {
1619
+ // Command+Backspace journals as the raw platform key chord; replay
1620
+ // re-derives the semantic delete_to_start/delete_to_line_start edit
1621
+ // from the focused widget kind.
1622
+ const decoded = try roundTripEvent(.{ .gpu_surface_input = .{
1623
+ .label = "editor-canvas",
1624
+ .kind = .key_down,
1625
+ .key = "backspace",
1626
+ .modifiers = .{ .primary = true, .command = true },
1627
+ } });
1628
+ try testing.expectEqualStrings("backspace", decoded.gpu_surface_input.key);
1629
+ try testing.expect(decoded.gpu_surface_input.modifiers.primary);
1630
+ try testing.expect(decoded.gpu_surface_input.modifiers.command);
1631
+ try testing.expect(!decoded.gpu_surface_input.modifiers.control);
1632
+ }
1614
1633
  {
1615
1634
  // v5: pinch records carry the magnification delta and the
1616
1635
  // gesture kinds appended at codes 12-14.