@native-sdk/cli 0.5.1 → 0.5.2
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.
- package/package.json +9 -9
- package/packages/core/package-lock.json +2 -2
- package/packages/core/package.json +1 -1
- package/skill-data/native-ui/SKILL.md +2 -2
- package/src/platform/types.zig +9 -0
- package/src/primitives/canvas/root.zig +1 -0
- package/src/primitives/canvas/tokens.zig +170 -7
- package/src/primitives/canvas/ui.zig +27 -5
- package/src/primitives/canvas/ui_markup.zig +27 -4
- package/src/primitives/canvas/ui_markup_compiled.zig +9 -1
- package/src/primitives/canvas/ui_markup_compiled_tests.zig +127 -0
- package/src/primitives/canvas/ui_markup_tests.zig +47 -0
- package/src/primitives/canvas/ui_markup_view.zig +10 -1
- package/src/primitives/canvas/ui_markup_view_tests.zig +78 -0
- package/src/primitives/canvas/ui_schema.zig +15 -1
- package/src/primitives/canvas/ui_schema_tests.zig +5 -4
- package/src/primitives/canvas/widget_builtin_tests.zig +130 -0
- package/src/primitives/canvas/widget_layout.zig +4 -1
- package/src/primitives/canvas/widget_layout_tests.zig +82 -0
- package/src/primitives/canvas/widget_tree.zig +14 -2
- package/src/primitives/canvas/widgets.zig +12 -0
- package/src/runtime/automation_widget_dispatch.zig +95 -28
- package/src/runtime/canvas_frame.zig +15 -0
- package/src/runtime/canvas_widget_anchored_tests.zig +253 -65
- package/src/runtime/canvas_widget_context_menu.zig +3 -2
- package/src/runtime/canvas_widget_events.zig +1271 -3
- package/src/runtime/canvas_widget_floating_tests.zig +2801 -0
- package/src/runtime/canvas_widget_scroll_drivers.zig +1 -1
- package/src/runtime/canvas_widget_state.zig +82 -5
- package/src/runtime/core.zig +14 -0
- package/src/runtime/flow.zig +24 -1
- package/src/runtime/gpu_surface_events.zig +44 -5
- package/src/runtime/session_journal.zig +25 -13
- package/src/runtime/session_record.zig +166 -0
- package/src/runtime/session_tests.zig +453 -0
- package/src/runtime/ui_app.zig +6 -1
- package/src/runtime/ui_app_tests.zig +460 -0
- package/src/runtime/view.zig +86 -0
- package/src/runtime/view_widget_text.zig +18 -1
- package/src/runtime/view_widget_tree.zig +339 -20
- package/src/runtime/widget_bridge.zig +26 -0
- package/src/runtime/window_storage.zig +61 -15
- package/src/runtime/window_view_runtime.zig +13 -0
- package/src/runtime/window_views.zig +6 -0
|
@@ -128,7 +128,7 @@ pub fn RuntimeCanvasWidgetScrollDrivers(comptime Runtime: type) type {
|
|
|
128
128
|
const dirty = try self.views[index].applyCanvasWidgetScrollDriverOffset(node_index, event.offset_y) orelse return;
|
|
129
129
|
|
|
130
130
|
const previous_cursor = self.views[index].canvas_widget_cursor;
|
|
131
|
-
self
|
|
131
|
+
try CanvasWidgetEventMethods().reconcileCanvasWidgetRenderStateAfterScrollWithTooltipIntent(self, index, null);
|
|
132
132
|
if (previous_cursor != self.views[index].canvas_widget_cursor) {
|
|
133
133
|
try CanvasWidgetEventMethods().syncCanvasWidgetCursorForView(self, index);
|
|
134
134
|
}
|
|
@@ -25,6 +25,7 @@ const CanvasWidgetTextReconcileEntry = canvas_widget_runtime.CanvasWidgetTextRec
|
|
|
25
25
|
const canvasWidgetLayoutTreeWithRuntimeReconcileState = canvas_widget_runtime.canvasWidgetLayoutTreeWithRuntimeReconcileState;
|
|
26
26
|
const canvasWidgetEditableTextKind = canvas_widget_runtime.canvasWidgetEditableTextKind;
|
|
27
27
|
const canvasWidgetAccessibilityActionSupported = widget_bridge.canvasWidgetAccessibilityActionSupported;
|
|
28
|
+
const platformWidgetAccessibilityActionKindFromCanvas = widget_bridge.platformWidgetAccessibilityActionKindFromCanvas;
|
|
28
29
|
const canvasWidgetBooleanSelected = canvas_widget_runtime.canvasWidgetBooleanSelected;
|
|
29
30
|
|
|
30
31
|
pub fn RuntimeCanvasWidgetState(comptime Runtime: type) type {
|
|
@@ -95,6 +96,40 @@ pub fn RuntimeCanvasWidgetState(comptime Runtime: type) type {
|
|
|
95
96
|
// and force-pushing the clamp into the live bounce (visible
|
|
96
97
|
// jitter). Non-driver platforms clamp exactly as before.
|
|
97
98
|
canvas_widget_runtime.clampCanvasWidgetLayoutScrollOffsets(reconciled_nodes[0..reconciled_layout.nodes.len], null);
|
|
99
|
+
// Runtime-owned tooltip visibility normalizes BEFORE the
|
|
100
|
+
// diff: the retained tree carries the intent machine's
|
|
101
|
+
// hidden stamps on anchored tooltips while the source
|
|
102
|
+
// declares authored visibility, so diffing them as-is
|
|
103
|
+
// reported a spurious visibility invalidation (a dirty
|
|
104
|
+
// repaint region for chrome that never changed) on EVERY
|
|
105
|
+
// rebuild containing a hidden anchored tooltip. The stamp
|
|
106
|
+
// uses the prune VERDICT against the reconciled tree — the
|
|
107
|
+
// shown id adoption will actually keep — WITHOUT mutating
|
|
108
|
+
// the live intent registers yet: everything between here
|
|
109
|
+
// and a retained tree is fallible (`diffWithTokens` can
|
|
110
|
+
// overflow its invalidation scratch, and
|
|
111
|
+
// `copyWidgetLayoutTree` rejects node/anchored-surface
|
|
112
|
+
// limits and every retained-pool budget before it resets
|
|
113
|
+
// the pools), and a register prune applied ahead of a
|
|
114
|
+
// failure left the OLD tree stamped visible with cleared
|
|
115
|
+
// registers — a tooltip no transition could ever hide
|
|
116
|
+
// again. The register mutation lands inside
|
|
117
|
+
// `copyWidgetLayoutTree`'s own prune, after the fallible
|
|
118
|
+
// steps succeed, where it applies this same verdict; an
|
|
119
|
+
// unchanged rebuild still diffs clean, a SHOWN tooltip
|
|
120
|
+
// stays visibly shown across the rebuild (no hide-then-show
|
|
121
|
+
// frame pair), and a rebuild that breaks the shown binding
|
|
122
|
+
// still diffs the hide honestly.
|
|
123
|
+
const prospective_shown_tooltip_id = self.views[index].canvasTooltipShownIdSurvivingLayout(reconciled_layout);
|
|
124
|
+
// Pre-adoption tooltip bindings for the standing hover and
|
|
125
|
+
// keyboard focus-visible owners, captured while the OLD
|
|
126
|
+
// tree is still retained (the copy below replaces it): the
|
|
127
|
+
// adoption reconcile at the bottom compares them against
|
|
128
|
+
// the adopted tree to catch a tooltip mounted/replaced/
|
|
129
|
+
// rekeyed beneath a stable owner — a change neither the
|
|
130
|
+
// hover re-hit-test nor the register prune can see.
|
|
131
|
+
const adoption_tooltip_bindings = CanvasWidgetEventMethods(Runtime).captureCanvasTooltipAdoptionBindings(self, index);
|
|
132
|
+
self.views[index].applyCanvasTooltipVisibilityToNodesForShownId(reconciled_nodes[0..reconciled_layout.nodes.len], prospective_shown_tooltip_id);
|
|
98
133
|
const invalidations = try canvas.WidgetLayoutTree.diffWithTokens(previous_layout, reconciled_layout, tokens, &self.canvas_widget_invalidations_scratch);
|
|
99
134
|
const previous_render_state = self.views[index].canvasWidgetRenderState();
|
|
100
135
|
const next_render_state = CanvasWidgetEventMethods(Runtime).canvasWidgetRenderStateAfterLayout(previous_render_state, reconciled_layout);
|
|
@@ -151,6 +186,16 @@ pub fn RuntimeCanvasWidgetState(comptime Runtime: type) type {
|
|
|
151
186
|
// the user was looking at, and the tween walks it to the
|
|
152
187
|
// declared pose one presented frame at a time.
|
|
153
188
|
try applyCanvasWidgetDisclosureTweenPlan(self, index, disclosure_plan);
|
|
189
|
+
// Re-hit-test the stationary pointer against the ADOPTED
|
|
190
|
+
// tree, after every pose restore above settles the frames
|
|
191
|
+
// the user actually sees and BEFORE the display refresh
|
|
192
|
+
// publishes them: the prune at the top validates only
|
|
193
|
+
// tooltip/owner identity and hover survives by ID, so a
|
|
194
|
+
// rebuild that MOVES a same-ID trigger away from (or
|
|
195
|
+
// under) the stationary pointer must step hover ownership
|
|
196
|
+
// and the tooltip intent machine exactly like the
|
|
197
|
+
// point-blind scroll paths do.
|
|
198
|
+
try CanvasWidgetEventMethods(Runtime).reconcileCanvasWidgetInteractionAfterLayoutAdoption(self, index, adoption_tooltip_bindings);
|
|
154
199
|
const requested_frame = try CanvasWidgetDisplayMethods(Runtime).refreshCanvasWidgetDisplayListIfOwned(self, index);
|
|
155
200
|
if ((layout_dirty or widget_revision_changed) and !requested_frame) try CanvasFrameMethods(Runtime).requestCanvasFrameForView(self, index);
|
|
156
201
|
return self.views[index].info();
|
|
@@ -187,6 +232,38 @@ pub fn RuntimeCanvasWidgetState(comptime Runtime: type) type {
|
|
|
187
232
|
const actions = AutomationWidgetMethods(Runtime).canvasWidgetActionsForId(self, index, action.id) orelse return error.InvalidCommand;
|
|
188
233
|
if (!canvasWidgetAccessibilityActionSupported(actions, action.action)) return error.InvalidCommand;
|
|
189
234
|
|
|
235
|
+
// Session recording, outer-wins on BOTH entry surfaces: the
|
|
236
|
+
// platform AX path arrives with its journaled tag-23 event
|
|
237
|
+
// already on the recorder's staging stack (flow.zig staged
|
|
238
|
+
// it), but the DIRECT verb surfaces (an embed host's
|
|
239
|
+
// `widgetAction`, automation `widget_action` commands) reach
|
|
240
|
+
// here with no platform event at all. Their verbs journal
|
|
241
|
+
// only UNTARGETED children routed by focus, while the focus
|
|
242
|
+
// write itself (`focusAutomationCanvasWidget`) is a direct
|
|
243
|
+
// unjournaled state change — so a fresh replay delivered the
|
|
244
|
+
// children against whatever focus the session happened to
|
|
245
|
+
// hold and a first-in-session composition landed nowhere.
|
|
246
|
+
// Stage the same synthetic `widget_accessibility_action`
|
|
247
|
+
// record the platform path carries: its suppression window
|
|
248
|
+
// keeps the children out of the journal and replay re-runs
|
|
249
|
+
// this whole dispatch — focus included — through the tag-23
|
|
250
|
+
// arm in flow.zig. When the platform event IS already staged,
|
|
251
|
+
// this nested stage lands inside its suppression window as a
|
|
252
|
+
// never-written placeholder, so no double record; the commit
|
|
253
|
+
// below pops it symmetrically. Effect results drained during
|
|
254
|
+
// the verb still write through ahead of the record, and
|
|
255
|
+
// event_count/checkpoint ordinals only ever see the one
|
|
256
|
+
// surviving record (checkpoints fire at staging depth 0).
|
|
257
|
+
if (self.options.session_recorder) |recorder| recorder.stageEvent(.{ .widget_accessibility_action = .{
|
|
258
|
+
.window_id = window_id,
|
|
259
|
+
.label = label,
|
|
260
|
+
.id = action.id,
|
|
261
|
+
.action = platformWidgetAccessibilityActionKindFromCanvas(action.action),
|
|
262
|
+
.text = action.text,
|
|
263
|
+
.selection = if (action.selection) |selection| .{ .start = selection.anchor, .end = selection.focus } else null,
|
|
264
|
+
} });
|
|
265
|
+
defer if (self.options.session_recorder) |recorder| recorder.commitEvent();
|
|
266
|
+
|
|
190
267
|
// Every assistive action rides the SAME machinery the
|
|
191
268
|
// automation widget verbs use — the key-driven activation for
|
|
192
269
|
// press/toggle/increment/decrement (quiet-list-row ring
|
|
@@ -209,10 +286,10 @@ pub fn RuntimeCanvasWidgetState(comptime Runtime: type) type {
|
|
|
209
286
|
.increment => try AutomationWidgetMethods(Runtime).dispatchAutomationWidgetKey(self, app, index, action.id, self.views[index].canvasWidgetStepKey(action.id, .increment)),
|
|
210
287
|
.decrement => try AutomationWidgetMethods(Runtime).dispatchAutomationWidgetKey(self, app, index, action.id, self.views[index].canvasWidgetStepKey(action.id, .decrement)),
|
|
211
288
|
.set_text => try AutomationWidgetMethods(Runtime).setAutomationCanvasWidgetText(self, app, index, action.id, action.text),
|
|
212
|
-
.set_selection => try AutomationWidgetMethods(Runtime).editAutomationCanvasWidgetText(self, index, action.id, .{ .set_selection = action.selection orelse return error.InvalidCommand }),
|
|
213
|
-
.set_composition => try AutomationWidgetMethods(Runtime).
|
|
214
|
-
.commit_composition => try AutomationWidgetMethods(Runtime).
|
|
215
|
-
.cancel_composition => try AutomationWidgetMethods(Runtime).
|
|
289
|
+
.set_selection => try AutomationWidgetMethods(Runtime).editAutomationCanvasWidgetText(self, app, index, action.id, .{ .set_selection = action.selection orelse return error.InvalidCommand }),
|
|
290
|
+
.set_composition => try AutomationWidgetMethods(Runtime).composeAutomationCanvasWidgetText(self, app, index, action.id, .ime_set_composition, action.text),
|
|
291
|
+
.commit_composition => try AutomationWidgetMethods(Runtime).composeAutomationCanvasWidgetText(self, app, index, action.id, .ime_commit_composition, ""),
|
|
292
|
+
.cancel_composition => try AutomationWidgetMethods(Runtime).composeAutomationCanvasWidgetText(self, app, index, action.id, .ime_cancel_composition, ""),
|
|
216
293
|
.select => try AutomationWidgetMethods(Runtime).selectAutomationCanvasWidget(self, index, action.id),
|
|
217
294
|
.drag => try AutomationWidgetMethods(Runtime).dispatchAutomationCanvasWidgetDrag(self, app, index, action.id, action.text),
|
|
218
295
|
.drop_files => try AutomationWidgetMethods(Runtime).dispatchAutomationCanvasWidgetFileDrop(self, app, index, action.id, action.text),
|
|
@@ -233,7 +310,7 @@ pub fn RuntimeCanvasWidgetState(comptime Runtime: type) type {
|
|
|
233
310
|
|
|
234
311
|
const dirty = try self.views[index].stepCanvasWidgetKineticScroll(dt_ms) orelse return self.views[index].info();
|
|
235
312
|
const previous_cursor = self.views[index].canvas_widget_cursor;
|
|
236
|
-
self
|
|
313
|
+
try CanvasWidgetEventMethods(Runtime).reconcileCanvasWidgetRenderStateAfterScrollWithTooltipIntent(self, index, null);
|
|
237
314
|
if (previous_cursor != self.views[index].canvas_widget_cursor) try CanvasWidgetEventMethods(Runtime).syncCanvasWidgetCursorForView(self, index);
|
|
238
315
|
try CanvasWidgetEventMethods(Runtime).invalidateForCanvasWidgetDirty(self, index, dirty);
|
|
239
316
|
_ = try CanvasWidgetDisplayMethods(Runtime).refreshCanvasWidgetDisplayListIfOwned(self, index);
|
package/src/runtime/core.zig
CHANGED
|
@@ -222,6 +222,18 @@ pub const Runtime = struct {
|
|
|
222
222
|
next_window_id: platform.WindowId = 2,
|
|
223
223
|
next_view_id: platform.ViewId = 1,
|
|
224
224
|
invalidated: bool = true,
|
|
225
|
+
/// Whether the platform currently reports the app ACTIVE (frontmost
|
|
226
|
+
/// on macOS — the state the `.app_activated`/`.app_deactivated`
|
|
227
|
+
/// lifecycle events flip). Stamped in the dispatch loop from those
|
|
228
|
+
/// journaled events, so replay reproduces it deterministically.
|
|
229
|
+
/// Defaults true: a launching app is treated as active until the
|
|
230
|
+
/// platform says otherwise, because some hosts deliver input before
|
|
231
|
+
/// the first activation event and suppressing intent until one
|
|
232
|
+
/// arrived would deaden hover on hosts that never send it. The
|
|
233
|
+
/// tooltip intent machine consults this: an INACTIVE app reveals
|
|
234
|
+
/// and arms nothing — including a rebuild the app performs from its
|
|
235
|
+
/// own deactivation callback.
|
|
236
|
+
app_active: bool = true,
|
|
225
237
|
/// Whether the app's stop hook (`App.stop`) has been delivered.
|
|
226
238
|
/// Normally the platform's `.app_shutdown` event delivers it; the
|
|
227
239
|
/// run loop's exit path checks this flag and delivers a missed stop
|
|
@@ -743,6 +755,7 @@ pub const Runtime = struct {
|
|
|
743
755
|
const refreshCanvasWidgetDisplayList = CanvasWidgetDisplayMethods.refreshCanvasWidgetDisplayList;
|
|
744
756
|
|
|
745
757
|
const CanvasWidgetEventMethods = runtime_canvas_widget_events.RuntimeCanvasWidgetEvents(Runtime);
|
|
758
|
+
pub const advanceCanvasTooltipIntentForFrame = CanvasWidgetEventMethods.advanceCanvasTooltipIntentForFrame;
|
|
746
759
|
pub const routeCanvasWidgetPointerInput = CanvasWidgetEventMethods.routeCanvasWidgetPointerInput;
|
|
747
760
|
pub const routeCanvasWidgetKeyboardInput = CanvasWidgetEventMethods.routeCanvasWidgetKeyboardInput;
|
|
748
761
|
pub const routeCanvasWidgetTextInput = CanvasWidgetEventMethods.routeCanvasWidgetTextInput;
|
|
@@ -791,6 +804,7 @@ pub const Runtime = struct {
|
|
|
791
804
|
const selectAutomationCanvasWidget = AutomationWidgetMethods.selectAutomationCanvasWidget;
|
|
792
805
|
const setAutomationCanvasWidgetText = AutomationWidgetMethods.setAutomationCanvasWidgetText;
|
|
793
806
|
const editAutomationCanvasWidgetText = AutomationWidgetMethods.editAutomationCanvasWidgetText;
|
|
807
|
+
const composeAutomationCanvasWidgetText = AutomationWidgetMethods.composeAutomationCanvasWidgetText;
|
|
794
808
|
const dispatchAutomationCanvasWidgetDrag = AutomationWidgetMethods.dispatchAutomationCanvasWidgetDrag;
|
|
795
809
|
const dispatchAutomationCanvasWidgetFileDrop = AutomationWidgetMethods.dispatchAutomationCanvasWidgetFileDrop;
|
|
796
810
|
};
|
package/src/runtime/flow.zig
CHANGED
|
@@ -12,6 +12,7 @@ const launch_timing = @import("launch_timing.zig");
|
|
|
12
12
|
const runtime_clock = @import("clock.zig");
|
|
13
13
|
const shell_layout = @import("shell_layout.zig");
|
|
14
14
|
const runtime_builtin_bridge = @import("builtin_bridge.zig");
|
|
15
|
+
const runtime_canvas_widget_events = @import("canvas_widget_events.zig");
|
|
15
16
|
const runtime_canvas_widget_context_menu = @import("canvas_widget_context_menu.zig");
|
|
16
17
|
const runtime_canvas_widget_scroll_drivers = @import("canvas_widget_scroll_drivers.zig");
|
|
17
18
|
const runtime_gpu_surface_events = @import("gpu_surface_events.zig");
|
|
@@ -76,6 +77,10 @@ pub fn RuntimeFlow(comptime Runtime: type) type {
|
|
|
76
77
|
return runtime_canvas_widget_context_menu.RuntimeCanvasWidgetContextMenu(Runtime);
|
|
77
78
|
}
|
|
78
79
|
|
|
80
|
+
fn CanvasWidgetEventMethods() type {
|
|
81
|
+
return runtime_canvas_widget_events.RuntimeCanvasWidgetEvents(Runtime);
|
|
82
|
+
}
|
|
83
|
+
|
|
79
84
|
fn AutomationWidgetMethods() type {
|
|
80
85
|
return runtime_automation_widget_dispatch.RuntimeAutomationWidgetDispatch(Runtime);
|
|
81
86
|
}
|
|
@@ -226,10 +231,25 @@ pub fn RuntimeFlow(comptime Runtime: type) type {
|
|
|
226
231
|
log(self, "app.start", "app started", &.{trace.string("app", app.name)});
|
|
227
232
|
},
|
|
228
233
|
.app_activated => {
|
|
234
|
+
self.app_active = true;
|
|
229
235
|
try dispatchEvent(self, app, .{ .lifecycle = .activate });
|
|
230
236
|
emitAppLifecycleEvent(self, "app:activate") catch |err| log(self, "app.activate.emit_failed", @errorName(err), &.{});
|
|
231
237
|
},
|
|
232
238
|
.app_deactivated => {
|
|
239
|
+
// The app-active register flips FIRST — before the
|
|
240
|
+
// tooltip reset and before the app hears the
|
|
241
|
+
// lifecycle event — so a model that rebuilds FROM
|
|
242
|
+
// its deactivation callback adopts under a runtime
|
|
243
|
+
// that already knows the app is inactive: the
|
|
244
|
+
// adoption arm's reveal/arm paths are gated on this
|
|
245
|
+
// register and stay silent.
|
|
246
|
+
self.app_active = false;
|
|
247
|
+
// Deactivation drops every tooltip conversation in
|
|
248
|
+
// every window (see the seam's own rationale) BEFORE
|
|
249
|
+
// the app hears the lifecycle event, so a model that
|
|
250
|
+
// rebuilds on deactivate adopts against clean
|
|
251
|
+
// tooltip state instead of a stale shown slot.
|
|
252
|
+
try CanvasWidgetEventMethods().resetCanvasTooltipIntentForAppDeactivation(self);
|
|
233
253
|
try dispatchEvent(self, app, .{ .lifecycle = .deactivate });
|
|
234
254
|
emitAppLifecycleEvent(self, "app:deactivate") catch |err| log(self, "app.deactivate.emit_failed", @errorName(err), &.{});
|
|
235
255
|
},
|
|
@@ -305,7 +325,10 @@ pub fn RuntimeFlow(comptime Runtime: type) type {
|
|
|
305
325
|
}
|
|
306
326
|
},
|
|
307
327
|
.window_focused => |window_id| {
|
|
308
|
-
|
|
328
|
+
// setFocusedIndex is the window-key seam: the
|
|
329
|
+
// window LOSING key here also drops its views'
|
|
330
|
+
// tooltip conversations there.
|
|
331
|
+
if (WindowViewMethods().findWindowIndexById(self, window_id)) |index| try WindowViewMethods().setFocusedIndex(self, index);
|
|
309
332
|
self.invalidated = true;
|
|
310
333
|
},
|
|
311
334
|
.frame_requested => try frame(self, app),
|
|
@@ -61,6 +61,10 @@ pub fn RuntimeGpuSurfaceEvents(comptime Runtime: type) type {
|
|
|
61
61
|
// so accordion reveals replay frame for frame exactly
|
|
62
62
|
// like split fractions do.
|
|
63
63
|
try self.advanceCanvasWidgetDisclosureTweenForFrame(index, frame_event.timestamp_ns);
|
|
64
|
+
// The anchored-tooltip hover-intent delay fires on the
|
|
65
|
+
// same recorded clock: a dwell past the delay shows its
|
|
66
|
+
// tooltip on a deterministic frame, replayed exactly.
|
|
67
|
+
try self.advanceCanvasTooltipIntentForFrame(index, frame_event.timestamp_ns);
|
|
64
68
|
try dispatchPendingCanvasWidgetScrollEvents(self, app, index);
|
|
65
69
|
// A settling tween notes its ONE split-resize event with
|
|
66
70
|
// no input in flight; drain it here so the controlled
|
|
@@ -180,6 +184,16 @@ pub fn RuntimeGpuSurfaceEvents(comptime Runtime: type) type {
|
|
|
180
184
|
if (runtimeFindViewIndex(self, input_event.window_id, input_event.label)) |index| {
|
|
181
185
|
self.views[index].recordGpuSurfaceInputTimestamp(input_event.timestamp_ns);
|
|
182
186
|
}
|
|
187
|
+
// The whole consumed stream still feeds the tooltip
|
|
188
|
+
// intent choke point: every pointer-carrying event
|
|
189
|
+
// updates the stored position (a later point-blind
|
|
190
|
+
// reconcile must hit-test where the pointer really is),
|
|
191
|
+
// the secondary down resets the machine before the menu
|
|
192
|
+
// presents ("pointer-down dismisses" holds for EVERY
|
|
193
|
+
// button — no tooltip floats behind or over the native
|
|
194
|
+
// menu), and a consumed cancel is still the pointer
|
|
195
|
+
// leaving the view.
|
|
196
|
+
try CanvasWidgetEventMethods().reconcileCanvasTooltipIntentForConsumedPointerInput(self, input_event);
|
|
183
197
|
if (input_event.kind == .pointer_down) {
|
|
184
198
|
try setFocusedView(self, input_event.window_id, input_event.label);
|
|
185
199
|
self.invalidated = true;
|
|
@@ -244,7 +258,17 @@ pub fn RuntimeGpuSurfaceEvents(comptime Runtime: type) type {
|
|
|
244
258
|
// click on the native titlebar. Dismissal above still ran:
|
|
245
259
|
// clicking the header closes an open surface first.
|
|
246
260
|
window_drag_started = try CanvasWidgetEventMethods().startCanvasWidgetWindowDragFromPointer(self, input_event, pointer_event.*);
|
|
247
|
-
if (
|
|
261
|
+
if (window_drag_started) {
|
|
262
|
+
// The drag consumed the down, but "pointer-down
|
|
263
|
+
// dismisses" still holds — and the down still
|
|
264
|
+
// carried a position the intent machine must
|
|
265
|
+
// record: the OS owning the pointer from here must
|
|
266
|
+
// not strand an armed or shown tooltip (the
|
|
267
|
+
// matching up may never arrive), and a later
|
|
268
|
+
// point-blind reconcile must hit-test where the
|
|
269
|
+
// pointer really went down.
|
|
270
|
+
try CanvasWidgetEventMethods().reconcileCanvasTooltipIntentForConsumedPointerInput(self, input_event);
|
|
271
|
+
} else {
|
|
248
272
|
try CanvasWidgetEventMethods().updateCanvasWidgetControlFromPointer(self, pointer_event.*);
|
|
249
273
|
try CanvasWidgetEventMethods().updateCanvasWidgetInteractionFromPointer(self, pointer_event.*);
|
|
250
274
|
// The text pass may stamp a clear edit onto the
|
|
@@ -297,11 +321,19 @@ pub fn RuntimeGpuSurfaceEvents(comptime Runtime: type) type {
|
|
|
297
321
|
&clipboard_paste_buffer,
|
|
298
322
|
);
|
|
299
323
|
}
|
|
300
|
-
|
|
301
|
-
|
|
324
|
+
// The text pass stamps the edit it derived and applied onto
|
|
325
|
+
// the event (Escape's clear included), so the app dispatch
|
|
326
|
+
// below hears exactly the edit the retained editor performed.
|
|
327
|
+
if (widget_keyboard_event) |*keyboard_event| {
|
|
328
|
+
// Keyboard activation counts as a press for tooltips:
|
|
329
|
+
// Space/Enter on the focused trigger dismisses its
|
|
330
|
+
// armed/shown tooltip before the control mutation and
|
|
331
|
+
// app dispatch observe the input.
|
|
332
|
+
try CanvasWidgetEventMethods().updateCanvasTooltipIntentForKeyboardActivation(self, keyboard_event.*);
|
|
333
|
+
try CanvasWidgetEventMethods().updateCanvasWidgetControlFromKeyboard(self, keyboard_event.*);
|
|
302
334
|
try CanvasWidgetEventMethods().updateCanvasWidgetTextFromKeyboard(self, keyboard_event);
|
|
303
335
|
}
|
|
304
|
-
|
|
336
|
+
var widget_text_input_event = if (widget_surface_dismissed)
|
|
305
337
|
null
|
|
306
338
|
else
|
|
307
339
|
CanvasWidgetEventMethods().routeCanvasWidgetTextInput(self, input_event, &self.widget_event_route_entries) catch |err| switch (err) {
|
|
@@ -311,7 +343,7 @@ pub fn RuntimeGpuSurfaceEvents(comptime Runtime: type) type {
|
|
|
311
343
|
=> null,
|
|
312
344
|
else => return err,
|
|
313
345
|
};
|
|
314
|
-
if (widget_text_input_event)
|
|
346
|
+
if (widget_text_input_event) |*text_input_event| {
|
|
315
347
|
try CanvasWidgetEventMethods().updateCanvasWidgetTextFromKeyboard(self, text_input_event);
|
|
316
348
|
}
|
|
317
349
|
// The refresh batch stays open across the app dispatches
|
|
@@ -609,11 +641,18 @@ fn setFocusedView(self: anytype, window_id: platform.WindowId, label: []const u8
|
|
|
609
641
|
for (self.views[0..self.view_count], 0..) |*view, view_index| {
|
|
610
642
|
if (view.window_id != window_id) continue;
|
|
611
643
|
const previous_state = view.canvasWidgetRenderState();
|
|
644
|
+
const was_focused = view.focused;
|
|
612
645
|
view.focused = std.mem.eql(u8, view.label, label);
|
|
613
646
|
const next_state = view.canvasWidgetRenderState();
|
|
614
647
|
if (!runtime_canvas_widget_events.RuntimeCanvasWidgetEvents(@TypeOf(self.*)).canvasWidgetRenderStatesEqual(previous_state, next_state)) {
|
|
615
648
|
try runtime_canvas_widget_events.RuntimeCanvasWidgetEvents(@TypeOf(self.*)).invalidateForCanvasWidgetRenderStateChange(self, view_index, previous_state, next_state);
|
|
616
649
|
}
|
|
650
|
+
// A view losing focus drops its tooltip state and re-stamps
|
|
651
|
+
// hidden — input landing in a sibling view must not leave the
|
|
652
|
+
// blurred view's tooltip floating.
|
|
653
|
+
if (was_focused and !view.focused) {
|
|
654
|
+
try runtime_canvas_widget_events.RuntimeCanvasWidgetEvents(@TypeOf(self.*)).resetCanvasTooltipIntentForViewBlur(self, view_index);
|
|
655
|
+
}
|
|
617
656
|
}
|
|
618
657
|
for (self.webviews[0..self.webview_count]) |*webview| {
|
|
619
658
|
if (webview.window_id == window_id) webview.focused = std.mem.eql(u8, webview.label, label);
|
|
@@ -44,16 +44,17 @@
|
|
|
44
44
|
//! reordering any journaled enum is a format break: bump
|
|
45
45
|
//! `format_version` when one moves.
|
|
46
46
|
//!
|
|
47
|
-
//! Coverage note: automation driving
|
|
48
|
-
//!
|
|
49
|
-
//!
|
|
50
|
-
//!
|
|
51
|
-
//!
|
|
52
|
-
//!
|
|
53
|
-
//!
|
|
54
|
-
//!
|
|
55
|
-
//!
|
|
56
|
-
//!
|
|
47
|
+
//! Coverage note: automation driving is fully journaled. Verbs that
|
|
48
|
+
//! synthesize PLATFORM events (widget-click/hold/context-press/drag/
|
|
49
|
+
//! wheel/key, resize, menu-command, shortcut, tray-action) journal
|
|
50
|
+
//! those events; every widget-action verb — including the direct-
|
|
51
|
+
//! surface ones (focus, select, set_selection, set_text, and the
|
|
52
|
+
//! composition edits) — journals as the outer-wins
|
|
53
|
+
//! `widget_accessibility_action` record its dispatch stages, with the
|
|
54
|
+
//! events it synthesizes inside suppressed as that record's children.
|
|
55
|
+
//! Replaying the action record re-runs the verb through the same
|
|
56
|
+
//! dispatch, so recorded sessions may drive text and selection through
|
|
57
|
+
//! any verb.
|
|
57
58
|
|
|
58
59
|
const std = @import("std");
|
|
59
60
|
const geometry = @import("geometry");
|
|
@@ -70,8 +71,12 @@ pub const magic = "NSDKSJNL";
|
|
|
70
71
|
/// enum orders bumps this; readers refuse other versions loudly rather
|
|
71
72
|
/// than misreading yesterday's shape. v2 added the stream `buffering`
|
|
72
73
|
/// flag to audio event and audio effect records; v3 added the spectrum
|
|
73
|
-
/// band bytes to both (and the `.spectrum` audio kind)
|
|
74
|
-
|
|
74
|
+
/// band bytes to both (and the `.spectrum` audio kind); v4 added the
|
|
75
|
+
/// composition verbs (`set_composition`/`commit_composition`/
|
|
76
|
+
/// `cancel_composition`, codes 11-13) to the accessibility-action
|
|
77
|
+
/// record's verb enum — a v3 reader hitting one of those codes would
|
|
78
|
+
/// have reported the file corrupt instead of refusing the skew.
|
|
79
|
+
pub const format_version: u32 = 4;
|
|
75
80
|
|
|
76
81
|
// ------------------------------------------------------------- budgets
|
|
77
82
|
//
|
|
@@ -1067,7 +1072,7 @@ pub const Reader = struct {
|
|
|
1067
1072
|
pub fn describeError(err: JournalError) []const u8 {
|
|
1068
1073
|
return switch (err) {
|
|
1069
1074
|
error.JournalBadMagic => "not a session journal (bad magic) - record one with NATIVE_SDK_SESSION_RECORD=<path>",
|
|
1070
|
-
error.JournalUnsupportedVersion => "journal format version differs from this build - re-record the session with the same build that replays it",
|
|
1075
|
+
error.JournalUnsupportedVersion => std.fmt.comptimePrint("journal format version differs from the v{d} this build reads and writes - re-record the session with the same build that replays it", .{format_version}),
|
|
1071
1076
|
error.JournalTruncated => "journal ends mid-record (the recording was cut off) - re-record, and keep the app running until it exits cleanly",
|
|
1072
1077
|
error.JournalCorrupt => "journal payload does not decode (damaged or hand-edited bytes)",
|
|
1073
1078
|
error.JournalRecordOverBudget => "journal claims a record beyond max_session_record_bytes - the file is damaged or hostile",
|
|
@@ -1435,6 +1440,13 @@ test "reader refuses bad magic and version skew" {
|
|
|
1435
1440
|
@memcpy(skewed[0..len], buffer[0..len]);
|
|
1436
1441
|
std.mem.writeInt(u32, skewed[magic.len..][0..4], format_version + 1, .little);
|
|
1437
1442
|
try testing.expectError(error.JournalUnsupportedVersion, Reader.init(skewed[0..len]));
|
|
1443
|
+
// Older journals are refused the same way — and, symmetrically, a
|
|
1444
|
+
// reader built before a version bump refuses a NEWER journal at the
|
|
1445
|
+
// preamble instead of reporting an unknown payload code as
|
|
1446
|
+
// corruption (the v4 bump's reason: v3 readers would have called a
|
|
1447
|
+
// journaled composition verb code corrupt).
|
|
1448
|
+
std.mem.writeInt(u32, skewed[magic.len..][0..4], format_version - 1, .little);
|
|
1449
|
+
try testing.expectError(error.JournalUnsupportedVersion, Reader.init(skewed[0..len]));
|
|
1438
1450
|
}
|
|
1439
1451
|
|
|
1440
1452
|
test "reader fails loudly on truncation at every boundary" {
|
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
//! BEFORE the event record — the ordering replay depends on (feed the
|
|
7
7
|
//! stub executor, then dispatch). Nested dispatches (automation commands
|
|
8
8
|
//! inside `frame_requested`) commit innermost-first for the same reason.
|
|
9
|
+
//! One exception: events nested inside a dispatched accessibility
|
|
10
|
+
//! action are suppressed — replaying the action re-derives them, so the
|
|
11
|
+
//! outer record is the whole representation (see `stageEvent`).
|
|
9
12
|
//!
|
|
10
13
|
//! Recording must never take the app down: any failure — a sink write
|
|
11
14
|
//! error, an over-budget event, a journal past its size budget — flips
|
|
@@ -46,7 +49,14 @@ pub const SessionRecorder = struct {
|
|
|
46
49
|
/// checkpoint follows each published frame.
|
|
47
50
|
last_checkpoint_frame: u64 = 0,
|
|
48
51
|
depth: usize = 0,
|
|
52
|
+
/// Staging-stack depth of the `widget_accessibility_action` event
|
|
53
|
+
/// currently being dispatched, if any. While set, nested
|
|
54
|
+
/// stage/commit pairs are suppressed: the outer action record is the
|
|
55
|
+
/// journal's WHOLE representation of the interaction (see
|
|
56
|
+
/// `stageEvent`).
|
|
57
|
+
suppress_owner_depth: ?usize = null,
|
|
49
58
|
staged_lens: [journal.max_session_event_depth]usize = [_]usize{0} ** journal.max_session_event_depth,
|
|
59
|
+
staged_suppressed: [journal.max_session_event_depth]bool = [_]bool{false} ** journal.max_session_event_depth,
|
|
50
60
|
staged: [journal.max_session_event_depth][journal.max_session_event_bytes]u8 = undefined,
|
|
51
61
|
/// Encode scratch for effect payloads (up to a whole file read).
|
|
52
62
|
effect_buffer: [journal.max_session_record_bytes]u8 = undefined,
|
|
@@ -72,15 +82,55 @@ pub const SessionRecorder = struct {
|
|
|
72
82
|
/// Serialize `event` into the staging stack. Effect results drained
|
|
73
83
|
/// during its dispatch write directly to the stream; `commitEvent`
|
|
74
84
|
/// then appends the event record after them.
|
|
85
|
+
///
|
|
86
|
+
/// Accessibility actions journal OUTER-WINS: a dispatched
|
|
87
|
+
/// `widget_accessibility_action` synthesizes real platform events
|
|
88
|
+
/// (a press dispatches its Enter key, set_text a select-all plus a
|
|
89
|
+
/// text input, composition its ime inputs) through the same choke
|
|
90
|
+
/// point, so recording both the action and its children would make
|
|
91
|
+
/// replay dispatch the children twice — once from their own records,
|
|
92
|
+
/// then again when replaying the action re-runs the verb. The outer
|
|
93
|
+
/// record wins because the children are deterministic derivations of
|
|
94
|
+
/// the action against runtime state replay has already rebuilt, and
|
|
95
|
+
/// because it keeps the ASSISTIVE semantics visible in the journal
|
|
96
|
+
/// ("press on widget 12", not an anonymous key event). While the
|
|
97
|
+
/// action sits on the staging stack, nested stage/commit pairs are
|
|
98
|
+
/// therefore suppressed — staged as placeholders so commit pairing
|
|
99
|
+
/// stays balanced, never written, never counted (`event_count` must
|
|
100
|
+
/// keep matching the records a replay reader will actually see;
|
|
101
|
+
/// checkpoints fire only at depth 0, so no ordinal can land inside
|
|
102
|
+
/// the suppressed window). Effect results are NOT suppressed: they
|
|
103
|
+
/// write directly to the stream and still precede the action record,
|
|
104
|
+
/// exactly the feed-then-dispatch order replay depends on. BOTH
|
|
105
|
+
/// entry surfaces stage the action record: the platform AX event
|
|
106
|
+
/// path stages it at the dispatch choke point, and the direct verb
|
|
107
|
+
/// surfaces (an embed host's `widgetAction`, automation
|
|
108
|
+
/// `widget_action` commands) stage a synthetic one inside
|
|
109
|
+
/// `dispatchCanvasWidgetAccessibilityAction` — without it, their
|
|
110
|
+
/// journaled children were untargeted inputs routed by focus while
|
|
111
|
+
/// the verb's focus write stayed unjournaled, so a fresh replay
|
|
112
|
+
/// delivered them against the wrong editor. A second accessibility
|
|
113
|
+
/// action staged while one is already on the stack (the direct
|
|
114
|
+
/// dispatch reached through a staged platform AX event) is just a
|
|
115
|
+
/// suppressed placeholder: the outermost action owns the window and
|
|
116
|
+
/// the journal keeps exactly one record.
|
|
75
117
|
pub fn stageEvent(self: *SessionRecorder, event: platform.Event) void {
|
|
76
118
|
if (!self.began or self.failed or self.finished) return;
|
|
77
119
|
if (self.depth >= journal.max_session_event_depth) {
|
|
78
120
|
return self.fail("dispatch nesting exceeded max_session_event_depth - this is a runtime bug, not a session shape");
|
|
79
121
|
}
|
|
122
|
+
if (self.suppress_owner_depth != null) {
|
|
123
|
+
self.staged_suppressed[self.depth] = true;
|
|
124
|
+
self.staged_lens[self.depth] = 0;
|
|
125
|
+
self.depth += 1;
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
80
128
|
const encoded = journal.encodeEvent(event, &self.staged[self.depth]) catch {
|
|
81
129
|
return self.fail("a platform event exceeded max_session_event_bytes");
|
|
82
130
|
};
|
|
83
131
|
self.staged_lens[self.depth] = encoded.len;
|
|
132
|
+
self.staged_suppressed[self.depth] = false;
|
|
133
|
+
if (event == .widget_accessibility_action) self.suppress_owner_depth = self.depth;
|
|
84
134
|
self.depth += 1;
|
|
85
135
|
}
|
|
86
136
|
|
|
@@ -90,6 +140,10 @@ pub const SessionRecorder = struct {
|
|
|
90
140
|
if (!self.began or self.failed or self.finished) return;
|
|
91
141
|
if (self.depth == 0) return;
|
|
92
142
|
self.depth -= 1;
|
|
143
|
+
if (self.staged_suppressed[self.depth]) return;
|
|
144
|
+
if (self.suppress_owner_depth) |owner_depth| {
|
|
145
|
+
if (owner_depth == self.depth) self.suppress_owner_depth = null;
|
|
146
|
+
}
|
|
93
147
|
self.writeRecord(.event, self.staged[self.depth][0..self.staged_lens[self.depth]]);
|
|
94
148
|
if (!self.failed) self.event_count += 1;
|
|
95
149
|
}
|
|
@@ -294,6 +348,118 @@ test "recorder commits nested events innermost-first" {
|
|
|
294
348
|
try testing.expect(outer.event == .frame_requested);
|
|
295
349
|
}
|
|
296
350
|
|
|
351
|
+
test "accessibility actions suppress their synthesized children in the journal" {
|
|
352
|
+
var buffer_sink = BufferSink{};
|
|
353
|
+
const recorder = try testing.allocator.create(SessionRecorder);
|
|
354
|
+
defer testing.allocator.destroy(recorder);
|
|
355
|
+
recorder.* = SessionRecorder.init(buffer_sink.sink());
|
|
356
|
+
recorder.begin(.{ .platform_name = "test", .app_name = "demo" });
|
|
357
|
+
|
|
358
|
+
// An AX press dispatches its synthesized Enter key through the same
|
|
359
|
+
// choke point: the nested event must not land — replaying the action
|
|
360
|
+
// re-derives it — but an effect result drained during the dispatch
|
|
361
|
+
// still writes through, ahead of the action record.
|
|
362
|
+
recorder.stageEvent(.{ .widget_accessibility_action = .{
|
|
363
|
+
.window_id = 1,
|
|
364
|
+
.label = "canvas",
|
|
365
|
+
.id = 7,
|
|
366
|
+
.action = .press,
|
|
367
|
+
} });
|
|
368
|
+
recorder.stageEvent(.{ .gpu_surface_input = .{
|
|
369
|
+
.window_id = 1,
|
|
370
|
+
.label = "canvas",
|
|
371
|
+
.kind = .key_down,
|
|
372
|
+
.key = "enter",
|
|
373
|
+
} });
|
|
374
|
+
recorder.recordEffect(.{ .kind = .line, .key = 3, .payload = "drained" });
|
|
375
|
+
recorder.commitEvent();
|
|
376
|
+
recorder.commitEvent();
|
|
377
|
+
// Suppression ends with the action: a later top-level input records.
|
|
378
|
+
recorder.stageEvent(.{ .gpu_surface_input = .{
|
|
379
|
+
.window_id = 1,
|
|
380
|
+
.label = "canvas",
|
|
381
|
+
.kind = .key_down,
|
|
382
|
+
.key = "tab",
|
|
383
|
+
} });
|
|
384
|
+
recorder.commitEvent();
|
|
385
|
+
recorder.recordCheckpoint(1, 0xbeef);
|
|
386
|
+
recorder.finish();
|
|
387
|
+
try testing.expect(!recorder.failed);
|
|
388
|
+
|
|
389
|
+
var reader = try journal.Reader.init(buffer_sink.bytes());
|
|
390
|
+
_ = (try reader.next()).?; // header
|
|
391
|
+
const effect = (try reader.next()).?;
|
|
392
|
+
try testing.expectEqualStrings("drained", effect.effect.payload);
|
|
393
|
+
const action = (try reader.next()).?;
|
|
394
|
+
try testing.expectEqual(platform.WidgetAccessibilityActionKind.press, action.event.widget_accessibility_action.action);
|
|
395
|
+
const key = (try reader.next()).?;
|
|
396
|
+
try testing.expectEqualStrings("tab", key.event.gpu_surface_input.key);
|
|
397
|
+
// The checkpoint ordinal and end counts see only the two surviving
|
|
398
|
+
// events — coherent with what a replay reader will process.
|
|
399
|
+
const checkpoint = (try reader.next()).?;
|
|
400
|
+
try testing.expectEqual(@as(u64, 2), checkpoint.checkpoint.event_ordinal);
|
|
401
|
+
const end = (try reader.next()).?;
|
|
402
|
+
try testing.expectEqual(@as(u64, 2), end.end.event_count);
|
|
403
|
+
try testing.expectEqual(@as(u64, 1), end.end.effect_count);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
test "a nested accessibility action stays a suppressed placeholder" {
|
|
407
|
+
var buffer_sink = BufferSink{};
|
|
408
|
+
const recorder = try testing.allocator.create(SessionRecorder);
|
|
409
|
+
defer testing.allocator.destroy(recorder);
|
|
410
|
+
recorder.* = SessionRecorder.init(buffer_sink.sink());
|
|
411
|
+
recorder.begin(.{ .platform_name = "test", .app_name = "demo" });
|
|
412
|
+
|
|
413
|
+
// The platform AX event path stages tag 23 at the dispatch choke
|
|
414
|
+
// point, then `dispatchCanvasWidgetAccessibilityAction` stages its
|
|
415
|
+
// synthetic copy of the same action: the inner stage must ride the
|
|
416
|
+
// suppression window as a placeholder (one journal record, the
|
|
417
|
+
// outer one), and suppression must survive the inner commit so the
|
|
418
|
+
// verb's children staged AFTER it stay suppressed too.
|
|
419
|
+
recorder.stageEvent(.{ .widget_accessibility_action = .{
|
|
420
|
+
.window_id = 1,
|
|
421
|
+
.label = "canvas",
|
|
422
|
+
.id = 7,
|
|
423
|
+
.action = .set_text,
|
|
424
|
+
.text = "outer",
|
|
425
|
+
} });
|
|
426
|
+
recorder.stageEvent(.{ .widget_accessibility_action = .{
|
|
427
|
+
.window_id = 1,
|
|
428
|
+
.label = "canvas",
|
|
429
|
+
.id = 7,
|
|
430
|
+
.action = .set_text,
|
|
431
|
+
.text = "synthetic",
|
|
432
|
+
} });
|
|
433
|
+
recorder.stageEvent(.{ .gpu_surface_input = .{
|
|
434
|
+
.window_id = 1,
|
|
435
|
+
.label = "canvas",
|
|
436
|
+
.kind = .text_input,
|
|
437
|
+
.text = "outer",
|
|
438
|
+
} });
|
|
439
|
+
recorder.commitEvent();
|
|
440
|
+
recorder.commitEvent();
|
|
441
|
+
recorder.commitEvent();
|
|
442
|
+
// The window closed with the outer action: a later input records.
|
|
443
|
+
recorder.stageEvent(.{ .gpu_surface_input = .{
|
|
444
|
+
.window_id = 1,
|
|
445
|
+
.label = "canvas",
|
|
446
|
+
.kind = .key_down,
|
|
447
|
+
.key = "tab",
|
|
448
|
+
} });
|
|
449
|
+
recorder.commitEvent();
|
|
450
|
+
recorder.finish();
|
|
451
|
+
try testing.expect(!recorder.failed);
|
|
452
|
+
|
|
453
|
+
var reader = try journal.Reader.init(buffer_sink.bytes());
|
|
454
|
+
_ = (try reader.next()).?; // header
|
|
455
|
+
const action = (try reader.next()).?;
|
|
456
|
+
try testing.expectEqualStrings("outer", action.event.widget_accessibility_action.text);
|
|
457
|
+
const key = (try reader.next()).?;
|
|
458
|
+
try testing.expectEqualStrings("tab", key.event.gpu_surface_input.key);
|
|
459
|
+
const end = (try reader.next()).?;
|
|
460
|
+
try testing.expectEqual(@as(u64, 2), end.end.event_count);
|
|
461
|
+
}
|
|
462
|
+
|
|
297
463
|
test "recorder fails loudly once and seals nothing after a sink error" {
|
|
298
464
|
var buffer_sink = BufferSink{ .fail_after = 32 };
|
|
299
465
|
const recorder = try testing.allocator.create(SessionRecorder);
|