summaryrefslogtreecommitdiff
path: root/test/pdf.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-30 20:03:22 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:17 -0300
commit30378c63d752bf27d44f6a64738bab5a2cddc863 (patch)
tree4ae24379c643faafbaff1d5fecdedae63e61785b /test/pdf.zig
parent741d088c60da40fd811dedc80d8e62753959bfea (diff)
downloadpardes-30378c63d752bf27d44f6a64738bab5a2cddc863.tar.gz
pardes-30378c63d752bf27d44f6a64738bab5a2cddc863.zip
PdfSections on a PDF with no outline says so, "this PDF has no outline", rather than open an empty +PdfSections
An empty pane with no word of why read as a failure to load, and was kept to be re-shown on the next press. With no outline there is nothing to list: the press is refused with the reason, and a read or slot failure is said too, where it returned silently. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'test/pdf.zig')
-rw-r--r--test/pdf.zig14
1 files changed, 6 insertions, 8 deletions
diff --git a/test/pdf.zig b/test/pdf.zig
index 36b3570e..2a18ca3c 100644
--- a/test/pdf.zig
+++ b/test/pdf.zig
@@ -364,7 +364,7 @@ test "PdfSections Look follows the exact owning PDF, not an equal path" {
try std.testing.expectEqual(first_output_id, p.active);
}
-test "PdfSections caches an empty outline output" {
+test "PdfSections on a PDF with no outline says so and opens nothing" {
if (!pdf_enabled or platform == .web) return;
const gpa = std.testing.allocator;
var tmp = std.testing.tmpDir(.{});
@@ -376,14 +376,12 @@ test "PdfSections caches an empty outline output" {
const path = try std.fmt.bufPrint(&path_buf, ".zig-cache/tmp/{s}/plain.pdf", .{tmp.sub_path});
const p = try Pardes.init(gpa, .{ .file = path });
defer p.deinit();
- panes.Pdf.openSections(p, 0);
const pane = p.panes[0].?;
- const output_id = pane.search_pane orelse return error.MissingEmptyPdfSections;
- try std.testing.expectEqual(@as(usize, 0), p.panes[output_id].?.file.?.content.len);
- const serial = p.panes[output_id].?.serial;
- panes.Pdf.openSections(p, 0);
- try std.testing.expectEqual(output_id, pane.search_pane.?);
- try std.testing.expectEqual(serial, p.panes[output_id].?.serial);
+ for (0..2) |_| {
+ panes.Pdf.openSections(p, 0);
+ try std.testing.expect(pane.search_pane == null);
+ try std.testing.expectEqualStrings("PdfSections: this PDF has no outline", pane.msg[0..pane.msg_len]);
+ }
}
test "a look at a PDF's page past its last is a miss, never the last page" {