summaryrefslogtreecommitdiff
path: root/tests.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-06-30 20:29:43 -0300
committerGabriel Schneider <[email protected]>2026-06-30 22:21:44 -0300
commitf6089186cfe1517073fafc8979a7546ec773d6c1 (patch)
treecfb474b5a5cff5d7197aa5084ea6013a0c53df6f /tests.zig
parent8b60c2c29c016c7db0fa6ee63769cea1defd9b3c (diff)
downloadpardes-f6089186cfe1517073fafc8979a7546ec773d6c1.tar.gz
pardes-f6089186cfe1517073fafc8979a7546ec773d6c1.zip
stealing petsciinatorfull-prototype
Diffstat (limited to 'tests.zig')
-rw-r--r--tests.zig43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests.zig b/tests.zig
index bd44e2ea..1af5625d 100644
--- a/tests.zig
+++ b/tests.zig
@@ -392,4 +392,47 @@ pub fn main(init: std.process.Init) !void {
try hs4.send("\t"); // Tab: execute the SELECTION (not the word under cursor)
try hs4.expectWaitFor("ZZSEL5X", 8000, "Tab on a selection did not execute the selected text");
}
+
+ // 15. Image panes open even without kitty graphics, rendering via the PETSCII
+ // fallback, and carry a "Petscii" toggle in their tagline. Write a small PPM,
+ // open it with an acme right-click, confirm the image pane + toggle appear,
+ // and pump frames (smoke-testing the glyph draw doesn't crash).
+ {
+ var hs5 = try Harness.init(gpa, exe.ptr, 24, 80);
+ defer hs5.deinit();
+ try hs5.expectWaitFor("build.zig", 8000, "fresh terminal never auto-ls'd");
+ {
+ var ppm: std.ArrayList(u8) = .empty;
+ defer ppm.deinit(gpa);
+ try ppm.appendSlice(gpa, "P6\n64 64\n255\n"); // diagonal split -> per-cell glyphs
+ var y: usize = 0;
+ while (y < 64) : (y += 1) {
+ var x: usize = 0;
+ while (x < 64) : (x += 1)
+ try ppm.appendSlice(gpa, if (x + y < 64) &[_]u8{ 255, 255, 255 } else &[_]u8{ 0, 0, 255 });
+ }
+ try h.writeFile("/tmp/pardesE2Epet.ppm", ppm.items);
+ }
+ try hs5.send("\x02"); // normal -> tty
+ try hs5.pump(500);
+ try hs5.send("clear\r"); // blank the pane
+ try hs5.pump(900);
+ try hs5.send("\x02"); // tty -> normal
+ try hs5.pump(400);
+ try hs5.send("\x1b[<0;5;8M\x1b[<0;5;8m"); // pin a blank row near col 0
+ try hs5.pump(400);
+ try hs5.send("i");
+ try hs5.pump(300);
+ try hs5.send("/tmp/pardesE2Epet.ppm");
+ try hs5.pump(500);
+ try hs5.send("\x1b"); // -> normal
+ try hs5.pump(400);
+ try hs5.send("\x1b[<2;10;8M\x1b[<2;10;8m"); // right-click the typed path -> open image pane
+ try hs5.expectWaitFor("Petscii", 10000, "right-click on an image path did not open an image pane with the Petscii toggle");
+ try hs5.pump(800); // let the petscii grid render across frames
+ // the diagonal split renders as real block glyphs — assert the full block
+ // shows (a blank body here would mean the grid didn't blit, e.g. a dangling
+ // grapheme slice into a stack-local cell).
+ try hs5.expectContains("█", "petscii image body is blank — no block glyphs rendered");
+ }
}