summaryrefslogtreecommitdiff
path: root/src/pardes.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-05 01:14:34 -0300
committerGabriel Schneider <[email protected]>2026-11-05 01:40:44 -0300
commitae975128f8b723d86f2daee3d23168adce21905c (patch)
tree8bc279a1b3325b22327a415b62b8f1505a5f18de /src/pardes.zig
parent8e3636661fce945176d45bf74da6a60e5e016e55 (diff)
downloadpardes-ae975128f8b723d86f2daee3d23168adce21905c.tar.gz
pardes-ae975128f8b723d86f2daee3d23168adce21905c.zip
pardes: a new panel's frame zero and the tagline band offsets are tested at the end of pardes.zig, where both are written, so the tui runs them too (they ran in gui.zig alone)
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/pardes.zig')
-rw-r--r--src/pardes.zig42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/pardes.zig b/src/pardes.zig
index 9af74212..c75d1f4e 100644
--- a/src/pardes.zig
+++ b/src/pardes.zig
@@ -8791,3 +8791,45 @@ test "a Save the host could not do logs no save record" {
p.perform(.{ .save_file = .{ .pane = 0 } });
try std.testing.expect(th.logHas(p, "\nsave "));
}
+
+test "a new panel's frame zero is presented before it advances" {
+ const core = try Pardes.init(std.testing.allocator, .{ .tty_only = true });
+ defer core.deinit();
+ var arena: std.heap.ArenaAllocator = .init(std.testing.allocator);
+ defer arena.deinit();
+ const frame = animation.frame_ns;
+
+ core.advance(100);
+ const idle = try core.render(arena.allocator());
+ core.acknowledgePanelPresentation(idle.panelTracks());
+ try std.testing.expectEqual(@as(?u64, null), core.nextWake());
+
+ core.settings.panel_transition = .slide;
+ core.update(.{ .command = "Newcol" });
+ _ = arena.reset(.retain_capacity);
+ const first = try core.render(arena.allocator());
+ const track_count = first.panelTracks().len;
+ try std.testing.expect(track_count > 0);
+ for (first.panelTracks()) |track| try std.testing.expectEqual(@as(u16, 0), track.frame);
+
+ core.acknowledgePanelPresentation(first.panelTracks());
+ // Just short of a frame is no frame at all.
+ core.advance(100 + frame - 1);
+ _ = arena.reset(.retain_capacity);
+ for ((try core.render(arena.allocator())).panelTracks()) |track| try std.testing.expectEqual(@as(u16, 0), track.frame);
+ core.advance(100 + frame);
+ _ = arena.reset(.retain_capacity);
+ const second = try core.render(arena.allocator());
+ try std.testing.expectEqual(track_count, second.panelTracks().len);
+ for (second.panelTracks()) |track| try std.testing.expectEqual(@as(u16, 1), track.frame);
+}
+
+test "tagline bands center in their cells and Tagbottom faces the window edge" {
+ const cell_h: u32 = 20;
+ const tagline_h: u32 = 16;
+ const canvas_h: f32 = 200;
+ // Workspace, column and pane rows alike: text lines up across bands.
+ for ([_]u16{ 0, 1, 2, 5, 8 }) |row|
+ try std.testing.expectEqual(@as(u32, 2), taglineBandOffset(row, canvas_h, cell_h, tagline_h));
+ try std.testing.expectEqual(@as(u32, 4), taglineBandOffset(9, canvas_h, cell_h, tagline_h));
+}