From 5322d373c78ecee48b934886c95f3b8c4471a11f Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 3 Nov 2026 17:04:29 -0300 Subject: test: five of test/pdf.zig's tests through the 9P tree alone: a PDF's body a line for each line of its page's text (panes), PdfTint stepped in its ctl and never in its tag, refused at another pane (panes), PdfSections on a PDF with no outline opening nothing (panes, a PDF written by the test), /recent keeping a PDF open then closed (other_files), the pages a PDF shown as text turns for j/k, Ctrl-d/u/f/b, ge, gg, 3gg, 2G and the editing keys consumed (keys, a new file); the parts with no surface stay as two small tests (tint colours of a theme with none, `:`/SPC/`/` on a PDF); each checked to fail against a break (the page text's newline a blank, toggleTint not stepping, the no-outline check dropped, a PDF given no Recent place, a counted text-mode j taking half its count) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- test/behaviour/other_files.zig | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/behaviour/other_files.zig') diff --git a/test/behaviour/other_files.zig b/test/behaviour/other_files.zig index c0f9c08f..e778ad77 100644 --- a/test/behaviour/other_files.zig +++ b/test/behaviour/other_files.zig @@ -28,3 +28,13 @@ test "other-files: kbdin's Kalt rune is Alt on the key after it alone, and an Al try s.keys("i\u{F015}zy\x1b"); try s.expect(s.at("/pane/{d}/body", .{try s.focused()}), "yx\n"); } + +test "other-files: /recent keeps a PDF as it keeps a file: open, then closed" { + var s = try Session.initFile(std.testing.allocator, "x\n"); + defer s.deinit(); + const n = try s.lookFile("docs/design.pdf"); + const name = std.mem.trimEnd(u8, try s.read(s.at("/pane/{d}/name", .{n})), "\n"); + try std.testing.expect(std.mem.indexOf(u8, try s.read("/recent"), s.at("open {s}\n", .{name})) != null); + try s.write(s.at("/pane/{d}/ctl", .{n}), "Del\n"); + try std.testing.expect(std.mem.indexOf(u8, try s.read("/recent"), s.at("closed {s}\n", .{name})) != null); +} -- cgit v1.3