diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-24 14:38:19 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-24 21:00:18 -0300 |
| commit | 0d3179f04a91c942fc10b0a05cdd6b8aa958d13e (patch) | |
| tree | 2847000be687597a3a1c6963eae4b77f1cae6cf8 /src/draw.zig | |
| parent | a87f917559e3712d36e5809d1f457fbf78c8266e (diff) | |
| download | pardes-0d3179f04a91c942fc10b0a05cdd6b8aa958d13e.tar.gz pardes-0d3179f04a91c942fc10b0a05cdd6b8aa958d13e.zip | |
anim 5: a scroll's colours are painted ahead on a worker (Stream.paintAhead), two views on the way it goes, so a page after a page parses nothing on the frame
Diffstat (limited to 'src/draw.zig')
| -rw-r--r-- | src/draw.zig | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/draw.zig b/src/draw.zig index 92fd8205..265e07c1 100644 --- a/src/draw.zig +++ b/src/draw.zig @@ -1971,7 +1971,7 @@ test "each Motion flavour reaches the lift as its own trajectory" { try std.testing.expect(peaks[2] <= 1.001 and peaks[3] > 1.25 and peaks[4] > peaks[3]); } -test "the focused cursor glides a jump, lands a step at once, and is exact at rest" { +test "the focused cursor glides a jump, eases a step, the thin caret too, and is exact at rest" { if (!builtins.capabilities.lift) return error.SkipZigTest; const p = try Pardes.init(std.testing.allocator, .{ .cols = 80, .rows = 30 }); defer p.deinit(); @@ -1983,12 +1983,17 @@ test "the focused cursor glides a jump, lands a step at once, and is exact at re var now: u64 = std.time.ns_per_s; p.advance(now); _ = try p.render(arena.allocator()); - // A step down: at once. + // A step down: eases there in a few frames. p.update(.{ .key = .{ .cp = 'j' } }); now += 16 * ms; p.advance(now); _ = arena.reset(.retain_capacity); var s = try p.render(arena.allocator()); + try std.testing.expectEqual(@as(u8, 3), s.chrome.cursor_glide); + now += 100 * ms; + p.advance(now); + _ = arena.reset(.retain_capacity); + s = try p.render(arena.allocator()); try std.testing.expectEqual(@as(u8, 2), s.chrome.cursor_glide); const before = s.cursor.?; // To the last line: it glides, a quad partway, and asks for frames. @@ -2023,7 +2028,7 @@ test "the focused cursor glides a jump, lands a step at once, and is exact at re // At rest the quad is the cursor's own cell. try std.testing.expectEqual(@as(f32, @floatFromInt(target.x)), s.chrome.cursor_quad[0]); try std.testing.expectEqual(@as(f32, @floatFromInt(target.y)), s.chrome.cursor_quad[1]); - // A mode change mid-glide lands at once: insert mode never trails. + // A mode change mid-glide: the thin caret glides on to the mark. p.update(.{ .key = .{ .cp = 'g' } }); p.update(.{ .key = .{ .cp = 'g' } }); now += 7 * ms; @@ -2036,7 +2041,17 @@ test "the focused cursor glides a jump, lands a step at once, and is exact at re p.advance(now); _ = arena.reset(.retain_capacity); s = try p.render(arena.allocator()); - try std.testing.expectEqual(@as(u8, 2), s.chrome.cursor_glide); + try std.testing.expectEqual(@as(u8, 3), s.chrome.cursor_glide); + try std.testing.expect(s.cursor.?.bar); + while (p.continuous()) { + now += 7 * ms; + p.advance(now); + _ = arena.reset(.retain_capacity); + s = try p.render(arena.allocator()); + } + // At rest, a bar's width at the caret's cell. + try std.testing.expectEqual(@as(f32, @floatFromInt(s.cursor.?.x)), s.chrome.cursor_quad[0]); + try std.testing.expectApproxEqAbs(@as(f32, 1.0 / 8.0), s.chrome.cursor_quad[2] - s.chrome.cursor_quad[0], 1e-4); } test "a tag caret past its row's end glides to the tag's right edge, where the layer's is" { |
