From ae975128f8b723d86f2daee3d23168adce21905c Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 5 Nov 2026 01:14:34 -0300 Subject: 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 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/pardes.zig | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'src/pardes.zig') 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)); +} -- cgit v1.3