summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-08-03 01:34:50 -0300
committerGabriel Schneider <[email protected]>2026-08-10 09:17:07 -0300
commita774cad033fdc371af9f89b9a787a30ea017481c (patch)
tree321190fb8e3c7708822be9a168c7026d0e4cd819 /test
parentb50005359c9fa33beef9a2ea7496268a246b296e (diff)
downloadpardes-a774cad033fdc371af9f89b9a787a30ea017481c.tar.gz
pardes-a774cad033fdc371af9f89b9a787a30ea017481c.zip
animate anchored theme colors on native and tty backends
Diffstat (limited to 'test')
-rw-r--r--test/snapshot.zig17
1 files changed, 15 insertions, 2 deletions
diff --git a/test/snapshot.zig b/test/snapshot.zig
index 7c00b97c..0a2b299d 100644
--- a/test/snapshot.zig
+++ b/test/snapshot.zig
@@ -617,12 +617,25 @@ fn readProc(buf: []u8, path: [*:0]const u8) ?[]const u8 {
return buf[0..@intCast(got)];
}
-/// What a `snap` capture is made of: the grid text plus the cursor cell.
+/// What a capture is made of: grid text, cursor cell, and a compact digest of
+/// every cell style. Style used not to matter to `stable`, which let a
+/// color-only animation look idle while the TTY frontend was deliberately
+/// asleep between frames; a following `snapstyle` then caught a midpoint.
fn stateKey(h: *eh.Harness) ![]u8 {
const text = try h.screenText();
defer h.gpa.free(text);
const c = h.cursor();
- return std.fmt.allocPrint(h.gpa, "{d},{d}\n{s}", .{ c.x, c.y, text });
+ var styles = std.hash.Wyhash.init(0x5354_594c_4553_2121);
+ var y: u16 = 0;
+ while (y < h.rows) : (y += 1) {
+ var x: u16 = 0;
+ while (x < h.cols) : (x += 1) {
+ var key_buf: [64]u8 = undefined;
+ styles.update(cellKey(h, x, y, &key_buf));
+ styles.update("\x00");
+ }
+ }
+ return std.fmt.allocPrint(h.gpa, "{d},{d},{x}\n{s}", .{ c.x, c.y, styles.final(), text });
}
fn snapText(arena: std.mem.Allocator, out: *std.ArrayList(u8), h: *eh.Harness, label: []const u8) !void {