diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/gui/gui.zig | 42 | ||||
| -rw-r--r-- | src/pardes.zig | 42 |
2 files changed, 42 insertions, 42 deletions
diff --git a/src/gui/gui.zig b/src/gui/gui.zig index 554b127f..9b9a08d1 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -243,38 +243,6 @@ const LoadedFallback = struct { const max_touch_points: usize = 16; const touch_scroll_tick: f32 = 0.02; -test "a new panel's frame zero is presented before it advances" { - const core = try pardes.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 = pardes.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); -} - // The triangle overlay holds only the pet and the cursor's glide quad: the // chrome is decor. const max_overlay_vertices: usize = pet.max_vertices + 6; @@ -6431,16 +6399,6 @@ const ResolvedCell = struct { const taglineBandOffset = pardes.taglineBandOffset; -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)); -} - /// The colours and atlas slot of `line[at]`. `cursor` is where the cursor sits /// in `line`, block or bar: shaping breaks around it. fn resolveCell(g: *Gui, line: []const pardes.Cell, at: usize, cursor: ?usize, role: pardes.FontRole, is_cursor: bool, page: [3]u8) ResolvedCell { 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)); +} |
