diff options
Diffstat (limited to 'test/behaviour/addons_pdf.zig')
| -rw-r--r-- | test/behaviour/addons_pdf.zig | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/behaviour/addons_pdf.zig b/test/behaviour/addons_pdf.zig index 0c7982d1..d773f4e2 100644 --- a/test/behaviour/addons_pdf.zig +++ b/test/behaviour/addons_pdf.zig @@ -299,3 +299,31 @@ test "addons: a PDF whose file changes on disk while a page of it renders: the p try s.keys("0"); try std.testing.expect((try shown(&s, n)).len >= 1); } + +test "addons: a PDF under a picker's cursor shows through the pdf addon in the pane it lands in, never its bytes as text, and Esc puts the pane's own text back" { + var s = try Session.initFile(std.testing.allocator, "x\n"); + defer s.deinit(); + s.graphics(); + try s.loadPdf(); + var tmp = std.testing.tmpDir(.{}); + defer tmp.cleanup(); + const pdf = try std.Io.Dir.cwd().readFileAlloc(std.testing.io, "docs/design.pdf", s.arena.allocator(), .limited(4 << 20)); + try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "paper.pdf", .data = pdf }); + try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "notes.txt", .data = "the notes\n" }); + var buf: [4096]u8 = undefined; + const dir = buf[0..try tmp.dir.realPath(std.testing.io, &buf)]; + const pane = try s.lookFile(s.at("{s}/notes.txt", .{dir})); + try s.keys(" ffpaper"); + // (Its kind told its view at the frame after the one that opened it.) + s.tick(); + s.tick(); + const screen = try s.screen(); + try std.testing.expect(!has(screen, "%PDF") and !has(screen, "the notes")); + // Its pages pictures in that pane's body, as a PDF's pane shows them. + try std.testing.expect((try shown(&s, pane)).len > 0); + try s.keys("\x1b"); + s.tick(); + try s.expect(s.at("/pane/{d}/body", .{pane}), "the notes\n"); + try std.testing.expectEqual(0, (try shown(&s, pane)).len); + try std.testing.expect(has(try s.screen(), "the notes")); +} |
