diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-04 23:57:01 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-05 01:02:08 -0300 |
| commit | 96cabca7ebe287692ebdff0dba6bb2897eba9d3e (patch) | |
| tree | fc74379958b5d6763966e4bc7c65e6a08e9ff4d5 /test/pdf.zig | |
| parent | b4863573f775c73ca4e9aa233af2f6e5113c06b3 (diff) | |
| download | pardes-96cabca7ebe287692ebdff0dba6bb2897eba9d3e.tar.gz pardes-96cabca7ebe287692ebdff0dba6bb2897eba9d3e.zip | |
pdf: the test PDFs are files under test/pdf-fixtures, byte for byte what the generators wrote, where pdf.zig wrote each object by object (139 lines fewer there): testFixture reads one, the two outlines sized by the bridge's limits stay generated, and the sections bench embeds its outline
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'test/pdf.zig')
| -rw-r--r-- | test/pdf.zig | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/test/pdf.zig b/test/pdf.zig index 1bbfa59c..9e183224 100644 --- a/test/pdf.zig +++ b/test/pdf.zig @@ -36,7 +36,7 @@ const PdfLinkTests = struct { const Cell = struct { col: u16, row: u16 }; fn init(tmp: std.testing.TmpDir) !*Pardes { - const bytes = try pdf_impl.makeLinksTestPdf(std.testing.allocator); + const bytes = try pdf_impl.testFixture(std.testing.allocator, "links.pdf"); defer std.testing.allocator.free(bytes); try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "links.pdf", .data = bytes }); try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "target.txt", .data = "chosen file\n" }); @@ -228,9 +228,9 @@ test "explicit OS PDF opens and reloads keep their namespace path" { const gpa = std.testing.allocator; var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); - const original = try pdf_impl.makeOutlineTestPdf(gpa); + const original = try pdf_impl.testFixture(gpa, "outline.pdf"); defer gpa.free(original); - const replacement = try pdf_impl.makeNoOutlineTestPdf(gpa); + const replacement = try pdf_impl.testFixture(gpa, "offset-rotated.pdf"); defer gpa.free(replacement); try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "live.pdf", .data = original }); var directory_buffer: [4096]u8 = undefined; @@ -283,7 +283,7 @@ test "PdfSections Look follows the exact owning PDF, not an equal path" { const gpa = std.testing.allocator; var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); - const fixture = try pdf_impl.makeOutlineTestPdf(gpa); + const fixture = try pdf_impl.testFixture(gpa, "outline.pdf"); defer gpa.free(fixture); try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "outline.pdf", .data = fixture }); var path_buf: [256]u8 = undefined; @@ -345,9 +345,9 @@ test "watched PDF reload replaces MuPDF state and preserves the reading view" { const gpa = std.testing.allocator; var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); - const original = try pdf_impl.makeOutlineTestPdf(gpa); + const original = try pdf_impl.testFixture(gpa, "outline.pdf"); defer gpa.free(original); - const replacement = try pdf_impl.makeNoOutlineTestPdf(gpa); + const replacement = try pdf_impl.testFixture(gpa, "offset-rotated.pdf"); defer gpa.free(replacement); try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "live.pdf", .data = original }); var path_buf: [256]u8 = undefined; @@ -986,7 +986,7 @@ test "a tall page is drawn at the display's resolution, in bands that are the wh const gpa = std.testing.allocator; var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); - const bytes = try pdf_impl.makeTallTestPdf(gpa); + const bytes = try pdf_impl.testFixture(gpa, "tall.pdf"); defer gpa.free(bytes); try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "tall.pdf", .data = bytes }); var dir_buf: [4096]u8 = undefined; @@ -2005,7 +2005,7 @@ test "Esc back into a PDF keeps the offset within its page" { const gpa = std.testing.allocator; var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); - const fixture = try pdf_impl.makeOutlineTestPdf(gpa); + const fixture = try pdf_impl.testFixture(gpa, "outline.pdf"); defer gpa.free(fixture); try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "outline.pdf", .data = fixture }); var path_buf: [256]u8 = undefined; @@ -2074,7 +2074,7 @@ test "a PDF's fit and tint, and Collapse, read in its ctl and come back from a D const gpa = std.testing.allocator; var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); - const fixture = try pdf_impl.makeOutlineTestPdf(gpa); + const fixture = try pdf_impl.testFixture(gpa, "outline.pdf"); defer gpa.free(fixture); try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "outline.pdf", .data = fixture }); var path_buf: [256]u8 = undefined; |
