diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/panes.zig | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/test/panes.zig b/test/panes.zig index 2da7a313..55ad303d 100644 --- a/test/panes.zig +++ b/test/panes.zig @@ -4166,7 +4166,7 @@ const PdfAddon = struct { try std.testing.expect(p.surface.pointer_shape != .link); } - test "a touchpad's fraction of a turn moves a PDF's strip by that fraction of a notch's" { + test "a wheel's notch glides a PDF's strip there over four ticks, and a touchpad's fraction of a turn moves it that fraction of a notch's at once" { if (!addons.has_pdf) return error.SkipZigTest; const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{ .cols = 80, .rows = 24, .tty_only = true }); @@ -4178,13 +4178,22 @@ const PdfAddon = struct { const r = p.view().rects[id]; const slot = p.panes[id].?.addon.?; var at: [3]f32 = undefined; + var first: f32 = 0; for (&at, [_]f32{ 0, 1, 0.25 }) |*a, turn| { if (turn > 0) p.update(.{ .mouse = .{ .button = .wheel_down, .kind = .press, .col = r.x + 4, .row = r.y + r.h - 2, .amount = turn } }); _ = try p.render(arena.allocator()); + if (turn == 1) first = slot.thumb_at; + // (a frame and a tick each, four) + for (0..4) |_| { + now += 16 * std.time.ns_per_ms; + p.advance(now); + p.update(.tick); + _ = try p.render(arena.allocator()); + } a.* = slot.thumb_at; } const notch = at[1] - at[0]; - try std.testing.expect(notch > 0); + try std.testing.expect(notch > 0 and first > at[0] and first < at[1]); try std.testing.expectApproxEqRel(notch / 4, at[2] - at[1], 0.05); } }; |
