diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-07 19:45:54 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-07 20:39:56 -0300 |
| commit | 4c134eaa5c7f84eba7091c9ccef86567f1434d49 (patch) | |
| tree | c6bd720bc8999887573e8d9112e553e19154f78b /test/behaviour/addons_pdf.zig | |
| parent | f2784acb88c98f33fed25dbf41f1a5af278c8e84 (diff) | |
| download | pardes-4c134eaa5c7f84eba7091c9ccef86567f1434d49.tar.gz pardes-4c134eaa5c7f84eba7091c9ccef86567f1434d49.zip | |
gui: a kind's pane (an image, a PDF) is watched again and shows its file as it is now: Kind.open and a restored kind's pane emit its watch, which kinds #14 dropped with pdf_view, and a reload counts into its pictures' keys, since its kind numbers them afresh from each open and a window keeps a texture by key; the T1 session watches files as a host does (Session.filesChanged) and two behaviour cases pin it
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'test/behaviour/addons_pdf.zig')
| -rw-r--r-- | test/behaviour/addons_pdf.zig | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/behaviour/addons_pdf.zig b/test/behaviour/addons_pdf.zig index 48b75806..6cdeebf1 100644 --- a/test/behaviour/addons_pdf.zig +++ b/test/behaviour/addons_pdf.zig @@ -232,3 +232,27 @@ test "addons: a PDF's body is its page's text layer, read from any offset and ne _ = try s.refused("/look", s.at("{s}/cut.pdf\n", .{dir})); try std.testing.expect(has(s.said, "cut.pdf") and has(s.said, "not a PDF pardes can read")); } + +test "addons: a PDF whose file changes on disk shows its new pages, under new keys: a window keeps a texture by its key" { + var s = try Session.initFile(std.testing.allocator, "x\n"); + defer s.deinit(); + s.graphics(); + var tmp = std.testing.tmpDir(.{}); + defer tmp.cleanup(); + var buf: [4096]u8 = undefined; + const dir = buf[0..try tmp.dir.realPath(std.testing.io, &buf)]; + const a = s.arena.allocator(); + const links = try std.Io.Dir.cwd().readFileAlloc(std.testing.io, "test/pdf-fixtures/links.pdf", a, .unlimited); + const outline = try std.Io.Dir.cwd().readFileAlloc(std.testing.io, "test/pdf-fixtures/outline.pdf", a, .unlimited); + try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "doc.pdf", .data = links }); + const n = try s.lookFile(s.at("{s}/doc.pdf", .{dir})); + const first = try shown(&s, n); + try std.testing.expect(first.len >= 1); + try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "doc.pdf", .data = outline }); + try std.testing.expect(try s.filesChanged()); + // Its pages laid out at the step after (the host's next). + try s.keys("0"); + const now = try shown(&s, n); + try std.testing.expect(now.len >= 1); + for (now) |pic| for (first) |old| try std.testing.expect(!std.mem.eql(u8, pic.key, old.key)); +} |
