summaryrefslogtreecommitdiff
path: root/src/ninep/screen.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-05 11:50:43 -0300
committerGabriel Schneider <[email protected]>2026-11-05 15:17:05 -0300
commitecdb0996147f319a4427273bf276e1fc5bf89156 (patch)
tree0b1be457ce4b8ce99db4acd713ff2620cde2d015 /src/ninep/screen.zig
parent2bd4066a932ec8fc401e4b85e9f8441b17df3cfb (diff)
downloadpardes-ecdb0996147f319a4427273bf276e1fc5bf89156.tar.gz
pardes-ecdb0996147f319a4427273bf276e1fc5bf89156.zip
effects out, the panel transitions: the eleven Panel words in both tracks go, with the core's Presentation (tracks, the frozen previous grid, cell diffs, the acknowledged-geometry pending guard, and the pointer's mapping through a moving pane, so a pointer's cell is the cell it is over), draw.zig's core-composed character effects, animation.zig's transition half, the Surface's tracks and previous grid, the tty's compositor (src/tui/panel_compositor.zig: the glide's rows move into tui.zig) and the window's track groups, frozen old layers, last-frame image snapshot, transition instance fields and shader paths (ui.vert, ui.frag's crossfade, image.vert and image.frag, the transition-<n>.ppm capture); acknowledgePanelPresentation becomes `presented`, which a frontend calls after drawing a frame (a drag's moving end and a look-hover follow what is under the pointer now), and its tape site with it; the pointer tape site goes; GUI golden 18-mid-transition goes, ttyhelp's golden loses the `SPC a` rows (its wait is on `SPC Y` now), the window monkey loses PanelSlide, and the settings behaviour test's floor of on/off words is ten
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/ninep/screen.zig')
-rw-r--r--src/ninep/screen.zig128
1 files changed, 47 insertions, 81 deletions
diff --git a/src/ninep/screen.zig b/src/ninep/screen.zig
index 95fe50a7..71b656d2 100644
--- a/src/ninep/screen.zig
+++ b/src/ninep/screen.zig
@@ -223,89 +223,55 @@ test "screen snapshots preserve rendered cells and styles until their handle is
for (p.fs.opens) |o| try testing.expect(o.node == 0);
}
-test "screen inspection preserves acknowledged presentation and the next real frame" {
+test "screen inspection leaves the next real frame as it would have been" {
const gpa = testing.allocator;
- for (std.enums.values(pardes.animation.Transition)) |transition| {
- errdefer std.debug.print("screen inspection during {s}\n", .{@tagName(transition)});
- const control = try withFile(gpa, "const value = 1;\n");
- defer control.deinit();
- const inspected = try withFile(gpa, "const value = 1;\n");
- defer inspected.deinit();
- var arena: std.heap.ArenaAllocator = .init(gpa);
- defer arena.deinit();
- for ([_]*Pardes{ control, inspected }) |p| {
- // The mechanism, at a fixed flavour, not the default's tuning.
- p.settings.motion = .crisp;
- p.settings.panel_transition = .off;
- p.update(.tick);
- p.acknowledgePanelPresentation((try p.render(arena.allocator())).panelTracks());
- p.settings.panel_transition = transition;
- }
- for (0..4) |phase| {
- for ([_]*Pardes{ control, inspected }) |p| switch (phase) {
- 0 => {},
- 1 => p.update(.{ .command = "New" }),
- 2 => {
- p.update(.tick);
- try testing.expectEqual(Status.ok, wr(p, Node.of(p.panes[p.active].?.serial, .body), "changed cells\n").reply.status);
- },
- 3 => {
- for (0..transition.frames() + 1) |_| p.update(.tick);
- p.acknowledgePanelPresentation((try p.render(arena.allocator())).panelTracks());
- p.update(.{ .command = "Del" });
- },
- else => unreachable,
- };
- for (0..2) |_| {
- const opened = call(inspected, .{ .tag = 1, .op = .open, .node = screen_node });
- try testing.expectEqual(Status.ok, opened.reply.status);
- const captured = call(inspected, .{ .tag = 2, .op = .read, .node = screen_node, .handle = opened.reply.handle, .size = 32 });
- try testing.expectEqual(Status.ok, captured.reply.status);
- try testing.expect(captured.bytes.len > 0);
- try testing.expectEqual(Status.ok, call(inspected, .{
- .tag = 3,
- .op = .release,
- .node = screen_node,
- .handle = opened.reply.handle,
- }).reply.status);
- }
- const a = &control.presentation;
- const b = &inspected.presentation;
- try testing.expectEqualDeep(a.shown, b.shown);
- try testing.expectEqualDeep(a.shown_tracks, b.shown_tracks);
- try testing.expectEqualDeep(a.shown_closing[0..a.shown_closing_len], b.shown_closing[0..b.shown_closing_len]);
- try testing.expectEqual(a.pending, b.pending);
- try testing.expectEqual(a.acknowledged, b.acknowledged);
- try testing.expectEqual(a.previous_valid, b.previous_valid);
- try testing.expectEqual(a.previous_cols, b.previous_cols);
- try testing.expectEqual(a.previous_rows, b.previous_rows);
- try testing.expectEqualDeep(a.previous_layout, b.previous_layout);
- try testing.expectEqual(a.previous_cells.len, b.previous_cells.len);
- for (a.previous_cells, b.previous_cells) |*expected, *actual|
- try testing.expect(expected.visuallyEqual(actual));
-
- const expected = try control.render(arena.allocator());
- const actual = try inspected.render(arena.allocator());
- try testing.expectEqual(expected.cols, actual.cols);
- try testing.expectEqual(expected.rows, actual.rows);
- try testing.expectEqualDeep(expected.cursor, actual.cursor);
- try testing.expectEqualDeep(expected.panelTracks(), actual.panelTracks());
- try testing.expectEqualDeep(expected.cell_diffs, actual.cell_diffs);
- try testing.expectEqual(expected.previous_cells.len, actual.previous_cells.len);
- try testing.expectEqual(expected.cells.len, actual.cells.len);
- try testing.expectEqual(@as(usize, 0), expected.images.items.len);
- try testing.expectEqual(@as(usize, 0), actual.images.items.len);
- for (expected.cells, actual.cells) |*left, *right| try testing.expect(left.visuallyEqual(right));
- for (expected.previous_cells, actual.previous_cells) |*left, *right| try testing.expect(left.visuallyEqual(right));
- if (phase == 1 and transition != .off) try testing.expect(expected.panelTracks().len > 0);
- if (phase == 1 and transition.needsPreviousGrid()) try testing.expect(expected.hasPanelDiff());
- if (phase == 3 and transition == .vertical) try testing.expect(a.closing_len > 0);
- control.acknowledgePanelPresentation(expected.panelTracks());
- inspected.acknowledgePanelPresentation(actual.panelTracks());
- try testing.expectEqualDeep(a.shown, b.shown);
- try testing.expectEqualDeep(a.previous_layout, b.previous_layout);
- _ = arena.reset(.retain_capacity);
+ const control = try withFile(gpa, "const value = 1;\n");
+ defer control.deinit();
+ const inspected = try withFile(gpa, "const value = 1;\n");
+ defer inspected.deinit();
+ var arena: std.heap.ArenaAllocator = .init(gpa);
+ defer arena.deinit();
+ for ([_]*Pardes{ control, inspected }) |p| {
+ p.update(.tick);
+ _ = try p.render(arena.allocator());
+ p.presented();
+ }
+ for (0..4) |phase| {
+ for ([_]*Pardes{ control, inspected }) |p| switch (phase) {
+ 0 => {},
+ 1 => p.update(.{ .command = "New" }),
+ 2 => {
+ p.update(.tick);
+ try testing.expectEqual(Status.ok, wr(p, Node.of(p.panes[p.active].?.serial, .body), "changed cells\n").reply.status);
+ },
+ 3 => p.update(.{ .command = "Del" }),
+ else => unreachable,
+ };
+ for (0..2) |_| {
+ const opened = call(inspected, .{ .tag = 1, .op = .open, .node = screen_node });
+ try testing.expectEqual(Status.ok, opened.reply.status);
+ const captured = call(inspected, .{ .tag = 2, .op = .read, .node = screen_node, .handle = opened.reply.handle, .size = 32 });
+ try testing.expectEqual(Status.ok, captured.reply.status);
+ try testing.expect(captured.bytes.len > 0);
+ try testing.expectEqual(Status.ok, call(inspected, .{
+ .tag = 3,
+ .op = .release,
+ .node = screen_node,
+ .handle = opened.reply.handle,
+ }).reply.status);
}
+ const expected = try control.render(arena.allocator());
+ const actual = try inspected.render(arena.allocator());
+ try testing.expectEqual(expected.cols, actual.cols);
+ try testing.expectEqual(expected.rows, actual.rows);
+ try testing.expectEqualDeep(expected.cursor, actual.cursor);
+ try testing.expectEqual(expected.cells.len, actual.cells.len);
+ try testing.expectEqual(@as(usize, 0), expected.images.items.len);
+ try testing.expectEqual(@as(usize, 0), actual.images.items.len);
+ for (expected.cells, actual.cells) |*left, *right| try testing.expect(left.visuallyEqual(right));
+ control.presented();
+ inspected.presented();
+ _ = arena.reset(.retain_capacity);
}
}