@native-sdk/cli 0.5.3 → 0.6.0
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/build/app.zig +91 -2
- package/build.zig +756 -5
- package/build.zig.zon +7 -0
- package/native-sdk.d.ts +19 -1
- package/package.json +9 -9
- package/packages/core/package-lock.json +2 -2
- package/packages/core/package.json +1 -1
- package/packages/core/rt/rt.zig +416 -9
- package/packages/core/sdk/core.ts +706 -5
- package/packages/core/sdk/events.ts +17 -8
- package/packages/core/src/checker.ts +305 -2
- package/packages/core/src/diagnostics.ts +12 -0
- package/packages/core/src/emitter.ts +3187 -264
- package/packages/core/src/typed_ast.ts +51 -4
- package/packages/core/src/types.ts +34 -1
- package/skill-data/native-ui/SKILL.md +42 -4
- package/skill-data/ts-core/SKILL.md +13 -3
- package/src/app_runner/root.zig +112 -10
- package/src/app_runner/ts_core_main.zig +4 -0
- package/src/automation/layout_fingerprint.zig +160 -0
- package/src/automation/protocol.zig +82 -33
- package/src/automation/root.zig +1 -0
- package/src/automation/server.zig +1 -1
- package/src/automation/snapshot.zig +68 -9
- package/src/automation/watcher.zig +1 -1
- package/src/embed/host.zig +5 -0
- package/src/embed/tests.zig +119 -1
- package/src/embed/ui_host.zig +13 -0
- package/src/platform/linux/gtk_host.c +639 -16
- package/src/platform/linux/gtk_host.h +25 -0
- package/src/platform/linux/root.zig +351 -7
- package/src/platform/macos/appkit_host.h +152 -8
- package/src/platform/macos/appkit_host.m +1816 -100
- package/src/platform/macos/cef_host.mm +372 -11
- package/src/platform/macos/root.zig +379 -11
- package/src/platform/null_platform.zig +696 -9
- package/src/platform/null_platform_tests.zig +35 -0
- package/src/platform/root.zig +42 -0
- package/src/platform/types.zig +524 -18
- package/src/platform/windows/root.zig +432 -9
- package/src/platform/windows/webview2_host.cpp +482 -45
- package/src/primitives/app_manifest/comptime_scene.zig +5 -0
- package/src/primitives/app_manifest/root.zig +1 -0
- package/src/primitives/app_manifest/types.zig +32 -0
- package/src/primitives/app_manifest/validation.zig +18 -0
- package/src/primitives/canvas/a11y_audit.zig +33 -11
- package/src/primitives/canvas/a11y_audit_tests.zig +20 -0
- package/src/primitives/canvas/drawing.zig +25 -0
- package/src/primitives/canvas/equality.zig +8 -0
- package/src/primitives/canvas/events.zig +103 -16
- package/src/primitives/canvas/frame.zig +125 -1
- package/src/primitives/canvas/layout_audit.zig +22 -5
- package/src/primitives/canvas/markdown_hostile_tests.zig +8 -4
- package/src/primitives/canvas/render_tests.zig +13 -10
- package/src/primitives/canvas/root.zig +48 -0
- package/src/primitives/canvas/terminal_box.zig +471 -0
- package/src/primitives/canvas/terminal_grid.zig +978 -0
- package/src/primitives/canvas/terminal_grid_tests.zig +1093 -0
- package/src/primitives/canvas/test_support.zig +1 -0
- package/src/primitives/canvas/tests.zig +2 -0
- package/src/primitives/canvas/text_tests.zig +39 -4
- package/src/primitives/canvas/tokens.zig +115 -12
- package/src/primitives/canvas/ui.zig +535 -12
- package/src/primitives/canvas/ui_markup.zig +253 -36
- package/src/primitives/canvas/ui_markup_binary.zig +4 -1
- package/src/primitives/canvas/ui_markup_compiled.zig +195 -9
- package/src/primitives/canvas/ui_markup_compiled_tests.zig +188 -8
- package/src/primitives/canvas/ui_markup_contract.zig +89 -6
- package/src/primitives/canvas/ui_markup_contract_tests.zig +65 -1
- package/src/primitives/canvas/ui_markup_huge_document_tests.zig +154 -0
- package/src/primitives/canvas/ui_markup_huge_model_tests.zig +1 -0
- package/src/primitives/canvas/ui_markup_reflect.zig +75 -24
- package/src/primitives/canvas/ui_markup_tests.zig +178 -9
- package/src/primitives/canvas/ui_markup_view.zig +220 -11
- package/src/primitives/canvas/ui_markup_view_tests.zig +553 -28
- package/src/primitives/canvas/ui_schema.zig +110 -17
- package/src/primitives/canvas/ui_schema_tests.zig +18 -10
- package/src/primitives/canvas/ui_tests.zig +141 -9
- package/src/primitives/canvas/widget_access.zig +28 -2
- package/src/primitives/canvas/widget_anchored_tests.zig +48 -0
- package/src/primitives/canvas/widget_invalidation.zig +81 -1
- package/src/primitives/canvas/widget_layout.zig +59 -11
- package/src/primitives/canvas/widget_layout_tests.zig +125 -4
- package/src/primitives/canvas/widget_render.zig +272 -18
- package/src/primitives/canvas/widget_render_scroll.zig +108 -27
- package/src/primitives/canvas/widget_routing.zig +59 -7
- package/src/primitives/canvas/widget_runtime.zig +23 -0
- package/src/primitives/canvas/widget_runtime_tests.zig +149 -0
- package/src/primitives/canvas/widget_semantics.zig +119 -11
- package/src/primitives/canvas/widget_semantics_tests.zig +409 -0
- package/src/primitives/canvas/widget_tree.zig +17 -0
- package/src/primitives/canvas/widgets.zig +132 -0
- package/src/root.zig +23 -0
- package/src/runtime/api.zig +76 -5
- package/src/runtime/automation_commands.zig +20 -1
- package/src/runtime/automation_snapshot.zig +25 -1
- package/src/runtime/automation_widget_dispatch.zig +73 -8
- package/src/runtime/bridge_payload.zig +8 -0
- package/src/runtime/bridge_responses.zig +5 -0
- package/src/runtime/builtin_bridge.zig +9 -4
- package/src/runtime/canvas_font_tests.zig +439 -2
- package/src/runtime/canvas_fonts.zig +61 -6
- package/src/runtime/canvas_frame.zig +62 -7
- package/src/runtime/canvas_frame_animation_tests.zig +5 -4
- package/src/runtime/canvas_frame_helpers.zig +190 -1
- package/src/runtime/canvas_frame_invalidation_tests.zig +531 -0
- package/src/runtime/canvas_frame_patch_tests.zig +161 -10
- package/src/runtime/canvas_frame_retained_tests.zig +5 -2
- package/src/runtime/canvas_image_tests.zig +195 -0
- package/src/runtime/canvas_images.zig +45 -12
- package/src/runtime/canvas_widget_accessibility_tests.zig +1 -1
- package/src/runtime/canvas_widget_clipboard_tests.zig +40 -0
- package/src/runtime/canvas_widget_context_menu.zig +269 -32
- package/src/runtime/canvas_widget_context_menu_tests.zig +640 -14
- package/src/runtime/canvas_widget_display.zig +1 -1
- package/src/runtime/canvas_widget_event_tests.zig +1823 -0
- package/src/runtime/canvas_widget_events.zig +240 -24
- package/src/runtime/canvas_widget_runtime.zig +213 -29
- package/src/runtime/canvas_widget_scroll_driver_tests.zig +170 -7
- package/src/runtime/canvas_widget_scroll_drivers.zig +151 -17
- package/src/runtime/canvas_widget_scroll_tests.zig +435 -23
- package/src/runtime/canvas_widget_state.zig +6 -0
- package/src/runtime/canvas_widget_text_tests.zig +1 -1
- package/src/runtime/core.zig +131 -13
- package/src/runtime/effects.zig +8136 -180
- package/src/runtime/effects_channel_tests.zig +3519 -0
- package/src/runtime/effects_fetch_tests.zig +89 -1
- package/src/runtime/effects_file_tests.zig +41 -1
- package/src/runtime/effects_image_tests.zig +1304 -0
- package/src/runtime/effects_pty_tests.zig +1362 -0
- package/src/runtime/effects_tests.zig +167 -9
- package/src/runtime/effects_video_tests.zig +3609 -0
- package/src/runtime/flow.zig +42 -4
- package/src/runtime/gpu_surface_events.zig +473 -13
- package/src/runtime/media_surface.zig +116 -11
- package/src/runtime/media_surface_tests.zig +61 -0
- package/src/runtime/pty.zig +1252 -0
- package/src/runtime/pty_windows.zig +1780 -0
- package/src/runtime/root.zig +36 -0
- package/src/runtime/runtime_event_tests.zig +20 -1
- package/src/runtime/session_blobs.zig +689 -0
- package/src/runtime/session_journal.zig +432 -62
- package/src/runtime/session_record.zig +43 -2
- package/src/runtime/session_replay.zig +556 -20
- package/src/runtime/session_tests.zig +2087 -1
- package/src/runtime/shell_layout.zig +7 -0
- package/src/runtime/terminal_session.zig +1569 -0
- package/src/runtime/terminal_session_tests.zig +450 -0
- package/src/runtime/terminal_vt_ghostty.zig +15 -0
- package/src/runtime/terminal_vt_stub.zig +13 -0
- package/src/runtime/testdata/fonts/NotoSansSC-Receipt.ttf +0 -0
- package/src/runtime/testdata/fonts/OFL.txt +93 -0
- package/src/runtime/tests.zig +8 -0
- package/src/runtime/ts_core_host.zig +1320 -45
- package/src/runtime/ts_core_host_tests.zig +1100 -1
- package/src/runtime/ts_ui_app.zig +23 -5
- package/src/runtime/ui_app.zig +2444 -69
- package/src/runtime/ui_app_tests.zig +3171 -744
- package/src/runtime/ui_app_virtual_variable_tests.zig +4 -2
- package/src/runtime/ui_app_window_tests.zig +736 -0
- package/src/runtime/view.zig +190 -2
- package/src/runtime/view_widget_scroll.zig +218 -68
- package/src/runtime/view_widget_text.zig +11 -2
- package/src/runtime/view_widget_tree.zig +111 -3
- package/src/runtime/window_command_bridge_tests.zig +117 -0
- package/src/runtime/window_storage.zig +77 -2
- package/src/runtime/window_view_runtime.zig +34 -2
- package/src/runtime/window_views.zig +62 -1
- package/src/terminal_session_tests_root.zig +15 -0
- package/src/tooling/manifest.zig +75 -0
- package/src/tooling/raw_manifest.zig +2 -0
- package/src/tooling/templates.zig +244 -8
|
@@ -63,8 +63,10 @@
|
|
|
63
63
|
const std = @import("std");
|
|
64
64
|
const builtin = @import("builtin");
|
|
65
65
|
const canvas = @import("canvas");
|
|
66
|
+
const platform = @import("../platform/root.zig");
|
|
66
67
|
const canvas_limits = @import("canvas_limits.zig");
|
|
67
68
|
const runtime_canvas_images = @import("canvas_images.zig");
|
|
69
|
+
const effects_mod = @import("effects.zig");
|
|
68
70
|
|
|
69
71
|
pub const max_media_surface_channels = canvas_limits.max_media_surface_channels;
|
|
70
72
|
pub const max_media_surface_pixel_bytes = canvas_limits.max_media_surface_pixel_bytes;
|
|
@@ -289,17 +291,24 @@ pub const MediaSurfaceProducer = struct {
|
|
|
289
291
|
defer slot.mutex.unlock();
|
|
290
292
|
if (!slot.active or slot.generation != self.generation) return error.MediaSurfaceReleased;
|
|
291
293
|
// Push-boundary damage short-circuit: same bytes as the last
|
|
292
|
-
// push
|
|
293
|
-
//
|
|
294
|
-
//
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
slot.
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
294
|
+
// push change nothing downstream — an ADOPTED frame's repeat
|
|
295
|
+
// never stirs an idle compositor. But bytes still STAGED are
|
|
296
|
+
// owed a frame, and the wake that promised one may have been
|
|
297
|
+
// refused (`requestWake` leaves `pending` clear on refusal
|
|
298
|
+
// precisely so a retry can land): an identical push then
|
|
299
|
+
// falls through to the wake below instead of stranding a
|
|
300
|
+
// static frame unadopted forever.
|
|
301
|
+
if (slot.last_push_fingerprint == fingerprint) {
|
|
302
|
+
if (!slot.staged) return;
|
|
303
|
+
} else {
|
|
304
|
+
@memcpy(slot.staging[0..byte_len], rgba8);
|
|
305
|
+
slot.staged = true;
|
|
306
|
+
slot.staged_width = width;
|
|
307
|
+
slot.staged_height = height;
|
|
308
|
+
slot.staged_byte_len = byte_len;
|
|
309
|
+
slot.staged_fingerprint = fingerprint;
|
|
310
|
+
slot.last_push_fingerprint = fingerprint;
|
|
311
|
+
}
|
|
303
312
|
}
|
|
304
313
|
// NEW bytes are staged: make sure a frame is coming to adopt
|
|
305
314
|
// them, even in an idle app whose demand-driven scheduler is
|
|
@@ -335,6 +344,22 @@ pub const MediaSurfaceProducer = struct {
|
|
|
335
344
|
wake.pending = true;
|
|
336
345
|
}
|
|
337
346
|
|
|
347
|
+
/// The claim as a type-erased `platform.VideoFrameSink` — what the
|
|
348
|
+
/// video effect hands the platform decoder. The sink carries only
|
|
349
|
+
/// the slot pointer (process-lived by construction) and the claim
|
|
350
|
+
/// generation, so it is copyable across the C ABI and safe from any
|
|
351
|
+
/// thread: a push through a released claim reports
|
|
352
|
+
/// `error.MediaSurfaceReleased` exactly like the handle itself.
|
|
353
|
+
pub fn frameSink(self: MediaSurfaceProducer) platform.VideoFrameSink {
|
|
354
|
+
return .{ .context = self.slot, .generation = self.generation, .push_fn = sinkPushFrame };
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
fn sinkPushFrame(context: ?*anyopaque, generation: u64, width: usize, height: usize, rgba8: []const u8) anyerror!void {
|
|
358
|
+
const slot: *MediaSurfaceSlot = @ptrCast(@alignCast(context orelse return error.MediaSurfaceReleased));
|
|
359
|
+
const producer = MediaSurfaceProducer{ .slot = slot, .generation = generation, .surface_id = 0 };
|
|
360
|
+
return producer.pushFrame(width, height, rgba8);
|
|
361
|
+
}
|
|
362
|
+
|
|
338
363
|
/// End this claim: later pushes through this handle (or any copy)
|
|
339
364
|
/// report `error.MediaSurfaceReleased`, and the slot becomes
|
|
340
365
|
/// claimable again. The runtime keeps the last ADOPTED texture — a
|
|
@@ -448,6 +473,22 @@ pub fn RuntimeMediaSurfaces(comptime Runtime: type) type {
|
|
|
448
473
|
return error.MediaSurfaceChannelsExhausted;
|
|
449
474
|
}
|
|
450
475
|
|
|
476
|
+
/// Forget the retained (adopted) texture for `surface_id`, if
|
|
477
|
+
/// any: the runtime entry empties (the placeholder shows until
|
|
478
|
+
/// the next adoption), the host's copied side-channel texture is
|
|
479
|
+
/// removed best-effort (the unregister convention: unsupported
|
|
480
|
+
/// seams and never-uploaded ids are no-ops), and views repaint.
|
|
481
|
+
/// Loop-thread-only, like the entry table it edits.
|
|
482
|
+
fn purgeRetainedMediaSurfaceTexture(self: *Runtime, surface_id: u64) void {
|
|
483
|
+
for (self.media_surface_entries[0..self.media_surface_count]) |*entry| {
|
|
484
|
+
if (entry.surface_id != surface_id or entry.fingerprint == 0) continue;
|
|
485
|
+
entry.* = .{ .surface_id = surface_id };
|
|
486
|
+
self.options.platform.services.removeGpuSurfaceImage(canvas.mediaSurfaceTextureImageId(surface_id)) catch {};
|
|
487
|
+
runtime_canvas_images.RuntimeCanvasImages(Runtime).noteCanvasImagesChanged(self);
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
|
|
451
492
|
/// Adopt staged producer frames, paced by the compositor: the
|
|
452
493
|
/// gpu-surface frame dispatch calls this once per frame event,
|
|
453
494
|
/// so a burst of pushes between presents collapses to ONE
|
|
@@ -579,6 +620,70 @@ pub fn RuntimeMediaSurfaces(comptime Runtime: type) type {
|
|
|
579
620
|
}
|
|
580
621
|
}
|
|
581
622
|
|
|
623
|
+
/// Type-erased handle the effects channel's video tier uses to
|
|
624
|
+
/// claim and release texture channels without knowing the
|
|
625
|
+
/// runtime type (`Effects.bindMediaSurfaces`) — the
|
|
626
|
+
/// `canvasImageRegistryBinding` pattern. `acquire` claims the
|
|
627
|
+
/// channel and answers the copyable frame sink the platform
|
|
628
|
+
/// decoder pushes through; `release` ends the claim by sink
|
|
629
|
+
/// (the sink IS the claim: slot pointer + generation).
|
|
630
|
+
pub fn mediaSurfaceBinding(self: *Runtime) effects_mod.MediaSurfaceBinding {
|
|
631
|
+
return .{
|
|
632
|
+
.context = self,
|
|
633
|
+
.acquire_fn = mediaSurfaceBindingAcquire,
|
|
634
|
+
.release_fn = mediaSurfaceBindingRelease,
|
|
635
|
+
};
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
fn mediaSurfaceBindingAcquire(context: *anyopaque, surface_id: u64) anyerror!platform.VideoFrameSink {
|
|
639
|
+
const self: *Runtime = @ptrCast(@alignCast(context));
|
|
640
|
+
const producer = try acquireMediaSurfaceProducer(self, surface_id);
|
|
641
|
+
// A video claim starts from the placeholder: the PREVIOUS
|
|
642
|
+
// playback's retained last frame is a different stream's
|
|
643
|
+
// pixels, and compositing it under the new stream's fitted
|
|
644
|
+
// geometry mis-fits visibly (a portrait replacement's LOADED
|
|
645
|
+
// report rebuilds the quad while a stale landscape texture
|
|
646
|
+
// is still on the glass). VIDEO-CHANNEL-ONLY: generic
|
|
647
|
+
// producers (`acquireMediaSurfaceProducer` direct) keep the
|
|
648
|
+
// adoption-boundary dedup — a re-claim staging the SAME
|
|
649
|
+
// bytes stays free of copies and repaints. Presentation
|
|
650
|
+
// chrome only — display lists, goldens, and session
|
|
651
|
+
// fingerprints never see textures — so the purge cannot
|
|
652
|
+
// perturb replay identity.
|
|
653
|
+
purgeRetainedMediaSurfaceTexture(self, surface_id);
|
|
654
|
+
return producer.frameSink();
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
/// LOOP-THREAD-ONLY, like the acquire half (the binding's
|
|
658
|
+
/// documented contract — `effects_mod.MediaSurfaceBinding`):
|
|
659
|
+
/// the purge below edits the runtime's adopted-texture table
|
|
660
|
+
/// and calls the platform's image-removal service, both
|
|
661
|
+
/// loop-thread state. Every caller is the video channel on an
|
|
662
|
+
/// `update`-dispatch path (stop/replace/failure/teardown);
|
|
663
|
+
/// producer threads hold only the sink, never the binding.
|
|
664
|
+
fn mediaSurfaceBindingRelease(context: *anyopaque, sink: platform.VideoFrameSink) void {
|
|
665
|
+
const self: *Runtime = @ptrCast(@alignCast(context));
|
|
666
|
+
const slot: *MediaSurfaceSlot = @ptrCast(@alignCast(sink.context orelse return));
|
|
667
|
+
// The released claim's surface id, read while the claim is
|
|
668
|
+
// still ours (generation-checked under the data mutex): the
|
|
669
|
+
// purge below needs it after `release` clears the slot.
|
|
670
|
+
slot.mutex.lock();
|
|
671
|
+
const surface_id = if (slot.active and slot.generation == sink.generation) slot.surface_id else 0;
|
|
672
|
+
slot.mutex.unlock();
|
|
673
|
+
const producer = MediaSurfaceProducer{ .slot = slot, .generation = sink.generation, .surface_id = 0 };
|
|
674
|
+
producer.release();
|
|
675
|
+
// A video release ends the picture: the channel releases on
|
|
676
|
+
// stop, replace, and failure — states whose UI story is "no
|
|
677
|
+
// playback" — and a rebuild there also drops the surface's
|
|
678
|
+
// CONTAIN stamp, so a retained last frame would composite
|
|
679
|
+
// stretched-distorted over the placeholder geometry. Purge
|
|
680
|
+
// it (video-channel-only, like the acquire-side purge; the
|
|
681
|
+
// same presentation-only determinism argument applies). A
|
|
682
|
+
// paused or naturally-completed playback keeps its claim,
|
|
683
|
+
// so the freeze-frame stays for those.
|
|
684
|
+
if (surface_id != 0) purgeRetainedMediaSurfaceTexture(self, surface_id);
|
|
685
|
+
}
|
|
686
|
+
|
|
582
687
|
/// Disarm every wake binding this runtime armed: after this
|
|
583
688
|
/// returns, no producer push can call into the runtime's
|
|
584
689
|
/// platform host — not even one already past its generation
|
|
@@ -99,6 +99,67 @@ test "burst pushes stage latest-wins and the frame clock adopts the newest" {
|
|
|
99
99
|
try std.testing.expectEqualSlices(u8, &blue, resources[0].pixels);
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
+
test "a video-channel claim purges the previous playback's retained texture" {
|
|
103
|
+
// Replacing a playback re-claims its surface through the video
|
|
104
|
+
// channel's binding. The old playback's retained last frame is a
|
|
105
|
+
// DIFFERENT stream's pixels: composited under the new stream's
|
|
106
|
+
// fitted geometry it mis-fits visibly (the stale-landscape-in-a-
|
|
107
|
+
// portrait-quad bug), so the VIDEO claim starts from the
|
|
108
|
+
// placeholder — entry emptied, host-side texture removed — until
|
|
109
|
+
// the new stream's first frame adopts. Generic producer re-claims
|
|
110
|
+
// (`acquireMediaSurfaceProducer` direct) deliberately keep the
|
|
111
|
+
// retained texture: the adoption-boundary dedup test below pins
|
|
112
|
+
// that contract.
|
|
113
|
+
const harness = try startedGpuHarness(std.testing.allocator);
|
|
114
|
+
defer harness.destroy(std.testing.allocator);
|
|
115
|
+
var app_state: ProbeApp = .{};
|
|
116
|
+
const app = app_state.app();
|
|
117
|
+
try harness.start(app);
|
|
118
|
+
_ = try harness.runtime.createView(.{
|
|
119
|
+
.window_id = 1,
|
|
120
|
+
.label = "canvas",
|
|
121
|
+
.kind = .gpu_surface,
|
|
122
|
+
.frame = geometry.RectF.init(0, 0, 240, 140),
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
const producer = try harness.runtime.acquireMediaSurfaceProducer(surface_id);
|
|
126
|
+
const amber = solidFrame(.{ 200, 160, 40, 255 });
|
|
127
|
+
try producer.pushFrame(2, 2, &amber);
|
|
128
|
+
try dispatchFrame(harness, app, 1);
|
|
129
|
+
try std.testing.expect(harness.runtime.adoptedMediaSurfaceTexture(surface_id) != null);
|
|
130
|
+
|
|
131
|
+
// Release retains the last frame (the reclaim-ordering contract) —
|
|
132
|
+
// it is the next VIDEO claim that must not inherit it.
|
|
133
|
+
producer.release();
|
|
134
|
+
try std.testing.expect(harness.runtime.adoptedMediaSurfaceTexture(surface_id) != null);
|
|
135
|
+
|
|
136
|
+
const binding = harness.runtime.mediaSurfaceBinding();
|
|
137
|
+
const sink = try binding.acquire_fn(binding.context, surface_id);
|
|
138
|
+
try std.testing.expect(harness.runtime.adoptedMediaSurfaceTexture(surface_id) == null);
|
|
139
|
+
try std.testing.expectEqual(@as(usize, 0), harness.runtime.registeredCanvasImages().len);
|
|
140
|
+
// The host's copied side-channel texture went with it (the
|
|
141
|
+
// unregister convention rides the same seam).
|
|
142
|
+
try std.testing.expectEqual(
|
|
143
|
+
canvas.mediaSurfaceTextureImageId(surface_id),
|
|
144
|
+
harness.null_platform.gpu_surface_image_remove_id,
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
// The replacement's first adopted frame repopulates the channel.
|
|
148
|
+
const teal = solidFrame(.{ 20, 140, 140, 255 });
|
|
149
|
+
try sink.push(2, 2, &teal);
|
|
150
|
+
try dispatchFrame(harness, app, 2);
|
|
151
|
+
const adopted = harness.runtime.adoptedMediaSurfaceTexture(surface_id).?;
|
|
152
|
+
try std.testing.expect(adopted.fingerprint != 0);
|
|
153
|
+
|
|
154
|
+
// The video RELEASE purges too: stop/replace/failure tell the UI
|
|
155
|
+
// "no playback" and the rebuild drops the surface's contain stamp,
|
|
156
|
+
// so a retained frame would composite stretched-distorted. The
|
|
157
|
+
// stopped surface returns to its placeholder.
|
|
158
|
+
binding.release_fn(binding.context, sink);
|
|
159
|
+
try std.testing.expect(harness.runtime.adoptedMediaSurfaceTexture(surface_id) == null);
|
|
160
|
+
try std.testing.expectEqual(@as(usize, 0), harness.runtime.registeredCanvasImages().len);
|
|
161
|
+
}
|
|
162
|
+
|
|
102
163
|
test "unchanged frames short-circuit damage; changed frames invalidate and repaint" {
|
|
103
164
|
const harness = try startedGpuHarness(std.testing.allocator);
|
|
104
165
|
defer harness.destroy(std.testing.allocator);
|