summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-04 23:57:01 -0300
committerGabriel Schneider <[email protected]>2026-11-05 01:02:08 -0300
commit96cabca7ebe287692ebdff0dba6bb2897eba9d3e (patch)
treefc74379958b5d6763966e4bc7c65e6a08e9ff4d5 /test
parentb4863573f775c73ca4e9aa233af2f6e5113c06b3 (diff)
downloadpardes-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')
-rw-r--r--test/mode.zig2
-rw-r--r--test/pdf-fixtures/links.pdf55
-rw-r--r--test/pdf-fixtures/offset-rotated.pdf29
-rw-r--r--test/pdf-fixtures/outline.pdf54
-rw-r--r--test/pdf-fixtures/rotated-link-empty-uri.pdf25
-rw-r--r--test/pdf-fixtures/rotated-link-javascript.pdf25
-rw-r--r--test/pdf-fixtures/rotated-link-missing-dest.pdf25
-rw-r--r--test/pdf-fixtures/rotated-link.pdf25
-rw-r--r--test/pdf-fixtures/tall.pdf211
-rw-r--r--test/pdf.zig18
-rw-r--r--test/pdf_sections_bench.zig3
11 files changed, 460 insertions, 12 deletions
diff --git a/test/mode.zig b/test/mode.zig
index 40a23fc4..cb618a98 100644
--- a/test/mode.zig
+++ b/test/mode.zig
@@ -101,7 +101,7 @@ test "Mode leaves image and PDF document modes unchanged" {
if (comptime panes.Pdf.enabled) {
var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup();
- const bytes = try panes.Pdf.pdf.makeLinksTestPdf(std.testing.allocator);
+ const bytes = try panes.Pdf.pdf.testFixture(std.testing.allocator, "links.pdf");
defer std.testing.allocator.free(bytes);
try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "mode.pdf", .data = bytes });
var buffer: [4096]u8 = undefined;
diff --git a/test/pdf-fixtures/links.pdf b/test/pdf-fixtures/links.pdf
new file mode 100644
index 00000000..bc9aa255
--- /dev/null
+++ b/test/pdf-fixtures/links.pdf
@@ -0,0 +1,55 @@
+%PDF-1.7
+%����
+1 0 obj
+<< /Type /Catalog /Pages 2 0 R >>
+endobj
+2 0 obj
+<< /Type /Pages /Count 2 /Kids [3 0 R 4 0 R] >>
+endobj
+3 0 obj
+<< /Type /Page /Parent 2 0 R /MediaBox [0 0 200 300] /Resources << /Font << /F1 5 0 R >> >> /Contents 6 0 R /Annots [7 0 R 8 0 R 9 0 R 10 0 R] >>
+endobj
+4 0 obj
+<< /Type /Page /Parent 2 0 R /MediaBox [0 0 200 300] /Resources << >> >>
+endobj
+5 0 obj
+<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica >>
+endobj
+6 0 obj
+<< /Length 131 >>
+stream
+BT /F1 6 Tf 20 240 Td (target.txt) Tj ET
+BT /F1 6 Tf 20 120 Td (https://example.com/same) Tj ET
+BT /F1 6 Tf 20 60 Td (label) Tj ET
+endstream
+endobj
+7 0 obj
+<< /Type /Annot /Subtype /Link /Rect [20 230 120 260] /Border [0 0 0] /A << /S /URI /URI (https://example.com/embedded) >> >>
+endobj
+8 0 obj
+<< /Type /Annot /Subtype /Link /Rect [20 170 120 200] /Border [0 0 0] /Dest [4 0 R /XYZ 12 34 null] >>
+endobj
+9 0 obj
+<< /Type /Annot /Subtype /Link /Rect [20 110 190 140] /Border [0 0 0] /A << /S /URI /URI (https://example.com/same) >> >>
+endobj
+10 0 obj
+<< /Type /Annot /Subtype /Link /Rect [20 50 120 80] /Border [0 0 0] /A << /S /URI /URI (https://example.com/only) >> >>
+endobj
+xref
+0 11
+0000000000 65535 f
+0000000015 00000 n
+0000000064 00000 n
+0000000127 00000 n
+0000000288 00000 n
+0000000376 00000 n
+0000000446 00000 n
+0000000627 00000 n
+0000000768 00000 n
+0000000886 00000 n
+0000001023 00000 n
+trailer
+<< /Size 11 /Root 1 0 R >>
+startxref
+1159
+%%EOF
diff --git a/test/pdf-fixtures/offset-rotated.pdf b/test/pdf-fixtures/offset-rotated.pdf
new file mode 100644
index 00000000..74fb6800
--- /dev/null
+++ b/test/pdf-fixtures/offset-rotated.pdf
@@ -0,0 +1,29 @@
+%PDF-1.4
+%����
+1 0 obj
+<< /Type /Catalog /Pages 2 0 R >>
+endobj
+2 0 obj
+<< /Type /Pages /Count 1 /Kids [3 0 R] >>
+endobj
+3 0 obj
+<< /Type /Page /Parent 2 0 R /MediaBox [100 200 300 400] /CropBox [120 220 280 370] /Rotate 90 /Resources << >> /Contents 4 0 R >>
+endobj
+4 0 obj
+<< /Length 34 >>
+stream
+q 1 0 0 rg 120 220 160 150 re f Q
+endstream
+endobj
+xref
+0 5
+0000000000 65535 f
+0000000015 00000 n
+0000000064 00000 n
+0000000121 00000 n
+0000000267 00000 n
+trailer
+<< /Size 5 /Root 1 0 R >>
+startxref
+350
+%%EOF
diff --git a/test/pdf-fixtures/outline.pdf b/test/pdf-fixtures/outline.pdf
new file mode 100644
index 00000000..b0864599
--- /dev/null
+++ b/test/pdf-fixtures/outline.pdf
@@ -0,0 +1,54 @@
+%PDF-1.7
+%����
+1 0 obj
+<< /Type /Catalog /Pages 2 0 R /Outlines 7 0 R /PageMode /UseOutlines >>
+endobj
+2 0 obj
+<< /Type /Pages /Count 3 /Kids [3 0 R 4 0 R 5 0 R] >>
+endobj
+3 0 obj
+<< /Type /Page /Parent 2 0 R /MediaBox [0 0 200 300] /Resources << >> >>
+endobj
+4 0 obj
+<< /Type /Page /Parent 2 0 R /MediaBox [0 0 200 300] /Resources << >> >>
+endobj
+5 0 obj
+<< /Type /Page /Parent 2 0 R /MediaBox [0 0 200 300] /Resources << >> >>
+endobj
+6 0 obj
+<< >>
+endobj
+7 0 obj
+<< /Type /Outlines /First 8 0 R /Last 11 0 R /Count 4 >>
+endobj
+8 0 obj
+<< /Parent 7 0 R /First 9 0 R /Last 9 0 R /Next 10 0 R /Count 1 >>
+endobj
+9 0 obj
+<< /Title <FEFF00430061006600E900205B50> /Parent 8 0 R /Dest [4 0 R /XYZ 12 34 null] /F 3 /C [0.2 0.4 0.6] >>
+endobj
+10 0 obj
+<< /Title () /Parent 7 0 R /Prev 8 0 R /Next 11 0 R /Dest [5 0 R /FitH 70] >>
+endobj
+11 0 obj
+<< /Title (External) /Parent 7 0 R /Prev 10 0 R /A << /S /URI /URI (https://example.com/manual) >> >>
+endobj
+xref
+0 12
+0000000000 65535 f
+0000000015 00000 n
+0000000103 00000 n
+0000000172 00000 n
+0000000260 00000 n
+0000000348 00000 n
+0000000436 00000 n
+0000000457 00000 n
+0000000529 00000 n
+0000000611 00000 n
+0000000736 00000 n
+0000000830 00000 n
+trailer
+<< /Size 12 /Root 1 0 R >>
+startxref
+948
+%%EOF
diff --git a/test/pdf-fixtures/rotated-link-empty-uri.pdf b/test/pdf-fixtures/rotated-link-empty-uri.pdf
new file mode 100644
index 00000000..278f2348
--- /dev/null
+++ b/test/pdf-fixtures/rotated-link-empty-uri.pdf
@@ -0,0 +1,25 @@
+%PDF-1.7
+1 0 obj
+<< /Type /Catalog /Pages 2 0 R >>
+endobj
+2 0 obj
+<< /Type /Pages /Count 1 /Kids [3 0 R] >>
+endobj
+3 0 obj
+<< /Type /Page /Parent 2 0 R /MediaBox [100 200 300 400] /CropBox [120 220 280 370] /Rotate 90 /Resources << >> /Annots [4 0 R] >>
+endobj
+4 0 obj
+<< /Type /Annot /Subtype /Link /Rect [120 220 160 270] /Border [0 0 0] /A << /S /URI /URI () >> >>
+endobj
+xref
+0 5
+0000000000 65535 f
+0000000009 00000 n
+0000000058 00000 n
+0000000115 00000 n
+0000000261 00000 n
+trailer
+<< /Size 5 /Root 1 0 R >>
+startxref
+375
+%%EOF
diff --git a/test/pdf-fixtures/rotated-link-javascript.pdf b/test/pdf-fixtures/rotated-link-javascript.pdf
new file mode 100644
index 00000000..e835e06b
--- /dev/null
+++ b/test/pdf-fixtures/rotated-link-javascript.pdf
@@ -0,0 +1,25 @@
+%PDF-1.7
+1 0 obj
+<< /Type /Catalog /Pages 2 0 R >>
+endobj
+2 0 obj
+<< /Type /Pages /Count 1 /Kids [3 0 R] >>
+endobj
+3 0 obj
+<< /Type /Page /Parent 2 0 R /MediaBox [100 200 300 400] /CropBox [120 220 280 370] /Rotate 90 /Resources << >> /Annots [4 0 R] >>
+endobj
+4 0 obj
+<< /Type /Annot /Subtype /Link /Rect [120 220 160 270] /Border [0 0 0] /A << /S /JavaScript /JS (ignored) >> >>
+endobj
+xref
+0 5
+0000000000 65535 f
+0000000009 00000 n
+0000000058 00000 n
+0000000115 00000 n
+0000000261 00000 n
+trailer
+<< /Size 5 /Root 1 0 R >>
+startxref
+388
+%%EOF
diff --git a/test/pdf-fixtures/rotated-link-missing-dest.pdf b/test/pdf-fixtures/rotated-link-missing-dest.pdf
new file mode 100644
index 00000000..42d7ccec
--- /dev/null
+++ b/test/pdf-fixtures/rotated-link-missing-dest.pdf
@@ -0,0 +1,25 @@
+%PDF-1.7
+1 0 obj
+<< /Type /Catalog /Pages 2 0 R >>
+endobj
+2 0 obj
+<< /Type /Pages /Count 1 /Kids [3 0 R] >>
+endobj
+3 0 obj
+<< /Type /Page /Parent 2 0 R /MediaBox [100 200 300 400] /CropBox [120 220 280 370] /Rotate 90 /Resources << >> /Annots [4 0 R] >>
+endobj
+4 0 obj
+<< /Type /Annot /Subtype /Link /Rect [120 220 160 270] /Border [0 0 0] /Dest /missing_destination >>
+endobj
+xref
+0 5
+0000000000 65535 f
+0000000009 00000 n
+0000000058 00000 n
+0000000115 00000 n
+0000000261 00000 n
+trailer
+<< /Size 5 /Root 1 0 R >>
+startxref
+377
+%%EOF
diff --git a/test/pdf-fixtures/rotated-link.pdf b/test/pdf-fixtures/rotated-link.pdf
new file mode 100644
index 00000000..47a8b3eb
--- /dev/null
+++ b/test/pdf-fixtures/rotated-link.pdf
@@ -0,0 +1,25 @@
+%PDF-1.7
+1 0 obj
+<< /Type /Catalog /Pages 2 0 R >>
+endobj
+2 0 obj
+<< /Type /Pages /Count 1 /Kids [3 0 R] >>
+endobj
+3 0 obj
+<< /Type /Page /Parent 2 0 R /MediaBox [100 200 300 400] /CropBox [120 220 280 370] /Rotate 90 /Resources << >> /Annots [4 0 R] >>
+endobj
+4 0 obj
+<< /Type /Annot /Subtype /Link /Rect [120 220 160 270] /Border [0 0 0] /A << /S /URI /URI (https://example.com/rotated) >> >>
+endobj
+xref
+0 5
+0000000000 65535 f
+0000000009 00000 n
+0000000058 00000 n
+0000000115 00000 n
+0000000261 00000 n
+trailer
+<< /Size 5 /Root 1 0 R >>
+startxref
+402
+%%EOF
diff --git a/test/pdf-fixtures/tall.pdf b/test/pdf-fixtures/tall.pdf
new file mode 100644
index 00000000..e330ac10
--- /dev/null
+++ b/test/pdf-fixtures/tall.pdf
@@ -0,0 +1,211 @@
+%PDF-1.7
+%����
+1 0 obj
+<< /Type /Catalog /Pages 2 0 R >>
+endobj
+2 0 obj
+<< /Type /Pages /Count 1 /Kids [3 0 R] >>
+endobj
+3 0 obj
+<< /Type /Page /Parent 2 0 R /MediaBox [0 0 600 9000] /Resources << /Font << /F1 5 0 R >> >> /Contents 4 0 R >>
+endobj
+4 0 obj
+<< /Length 7211 >>
+stream
+BT /F1 28 Tf 40 8940 Td (Row 0) Tj ET
+0.2 0.3 0.9 RG 3 w 20 8920 m 580 8860 l S
+BT /F1 28 Tf 40 8840 Td (Row 1) Tj ET
+0.2 0.3 0.9 RG 3 w 20 8820 m 580 8760 l S
+BT /F1 28 Tf 40 8740 Td (Row 2) Tj ET
+0.2 0.3 0.9 RG 3 w 20 8720 m 580 8660 l S
+BT /F1 28 Tf 40 8640 Td (Row 3) Tj ET
+0.2 0.3 0.9 RG 3 w 20 8620 m 580 8560 l S
+BT /F1 28 Tf 40 8540 Td (Row 4) Tj ET
+0.2 0.3 0.9 RG 3 w 20 8520 m 580 8460 l S
+BT /F1 28 Tf 40 8440 Td (Row 5) Tj ET
+0.2 0.3 0.9 RG 3 w 20 8420 m 580 8360 l S
+BT /F1 28 Tf 40 8340 Td (Row 6) Tj ET
+0.2 0.3 0.9 RG 3 w 20 8320 m 580 8260 l S
+BT /F1 28 Tf 40 8240 Td (Row 7) Tj ET
+0.2 0.3 0.9 RG 3 w 20 8220 m 580 8160 l S
+BT /F1 28 Tf 40 8140 Td (Row 8) Tj ET
+0.2 0.3 0.9 RG 3 w 20 8120 m 580 8060 l S
+BT /F1 28 Tf 40 8040 Td (Row 9) Tj ET
+0.2 0.3 0.9 RG 3 w 20 8020 m 580 7960 l S
+BT /F1 28 Tf 40 7940 Td (Row 10) Tj ET
+0.2 0.3 0.9 RG 3 w 20 7920 m 580 7860 l S
+BT /F1 28 Tf 40 7840 Td (Row 11) Tj ET
+0.2 0.3 0.9 RG 3 w 20 7820 m 580 7760 l S
+BT /F1 28 Tf 40 7740 Td (Row 12) Tj ET
+0.2 0.3 0.9 RG 3 w 20 7720 m 580 7660 l S
+BT /F1 28 Tf 40 7640 Td (Row 13) Tj ET
+0.2 0.3 0.9 RG 3 w 20 7620 m 580 7560 l S
+BT /F1 28 Tf 40 7540 Td (Row 14) Tj ET
+0.2 0.3 0.9 RG 3 w 20 7520 m 580 7460 l S
+BT /F1 28 Tf 40 7440 Td (Row 15) Tj ET
+0.2 0.3 0.9 RG 3 w 20 7420 m 580 7360 l S
+BT /F1 28 Tf 40 7340 Td (Row 16) Tj ET
+0.2 0.3 0.9 RG 3 w 20 7320 m 580 7260 l S
+BT /F1 28 Tf 40 7240 Td (Row 17) Tj ET
+0.2 0.3 0.9 RG 3 w 20 7220 m 580 7160 l S
+BT /F1 28 Tf 40 7140 Td (Row 18) Tj ET
+0.2 0.3 0.9 RG 3 w 20 7120 m 580 7060 l S
+BT /F1 28 Tf 40 7040 Td (Row 19) Tj ET
+0.2 0.3 0.9 RG 3 w 20 7020 m 580 6960 l S
+BT /F1 28 Tf 40 6940 Td (Row 20) Tj ET
+0.2 0.3 0.9 RG 3 w 20 6920 m 580 6860 l S
+BT /F1 28 Tf 40 6840 Td (Row 21) Tj ET
+0.2 0.3 0.9 RG 3 w 20 6820 m 580 6760 l S
+BT /F1 28 Tf 40 6740 Td (Row 22) Tj ET
+0.2 0.3 0.9 RG 3 w 20 6720 m 580 6660 l S
+BT /F1 28 Tf 40 6640 Td (Row 23) Tj ET
+0.2 0.3 0.9 RG 3 w 20 6620 m 580 6560 l S
+BT /F1 28 Tf 40 6540 Td (Row 24) Tj ET
+0.2 0.3 0.9 RG 3 w 20 6520 m 580 6460 l S
+BT /F1 28 Tf 40 6440 Td (Row 25) Tj ET
+0.2 0.3 0.9 RG 3 w 20 6420 m 580 6360 l S
+BT /F1 28 Tf 40 6340 Td (Row 26) Tj ET
+0.2 0.3 0.9 RG 3 w 20 6320 m 580 6260 l S
+BT /F1 28 Tf 40 6240 Td (Row 27) Tj ET
+0.2 0.3 0.9 RG 3 w 20 6220 m 580 6160 l S
+BT /F1 28 Tf 40 6140 Td (Row 28) Tj ET
+0.2 0.3 0.9 RG 3 w 20 6120 m 580 6060 l S
+BT /F1 28 Tf 40 6040 Td (Row 29) Tj ET
+0.2 0.3 0.9 RG 3 w 20 6020 m 580 5960 l S
+BT /F1 28 Tf 40 5940 Td (Row 30) Tj ET
+0.2 0.3 0.9 RG 3 w 20 5920 m 580 5860 l S
+BT /F1 28 Tf 40 5840 Td (Row 31) Tj ET
+0.2 0.3 0.9 RG 3 w 20 5820 m 580 5760 l S
+BT /F1 28 Tf 40 5740 Td (Row 32) Tj ET
+0.2 0.3 0.9 RG 3 w 20 5720 m 580 5660 l S
+BT /F1 28 Tf 40 5640 Td (Row 33) Tj ET
+0.2 0.3 0.9 RG 3 w 20 5620 m 580 5560 l S
+BT /F1 28 Tf 40 5540 Td (Row 34) Tj ET
+0.2 0.3 0.9 RG 3 w 20 5520 m 580 5460 l S
+BT /F1 28 Tf 40 5440 Td (Row 35) Tj ET
+0.2 0.3 0.9 RG 3 w 20 5420 m 580 5360 l S
+BT /F1 28 Tf 40 5340 Td (Row 36) Tj ET
+0.2 0.3 0.9 RG 3 w 20 5320 m 580 5260 l S
+BT /F1 28 Tf 40 5240 Td (Row 37) Tj ET
+0.2 0.3 0.9 RG 3 w 20 5220 m 580 5160 l S
+BT /F1 28 Tf 40 5140 Td (Row 38) Tj ET
+0.2 0.3 0.9 RG 3 w 20 5120 m 580 5060 l S
+BT /F1 28 Tf 40 5040 Td (Row 39) Tj ET
+0.2 0.3 0.9 RG 3 w 20 5020 m 580 4960 l S
+BT /F1 28 Tf 40 4940 Td (Row 40) Tj ET
+0.2 0.3 0.9 RG 3 w 20 4920 m 580 4860 l S
+BT /F1 28 Tf 40 4840 Td (Row 41) Tj ET
+0.2 0.3 0.9 RG 3 w 20 4820 m 580 4760 l S
+BT /F1 28 Tf 40 4740 Td (Row 42) Tj ET
+0.2 0.3 0.9 RG 3 w 20 4720 m 580 4660 l S
+BT /F1 28 Tf 40 4640 Td (Row 43) Tj ET
+0.2 0.3 0.9 RG 3 w 20 4620 m 580 4560 l S
+BT /F1 28 Tf 40 4540 Td (Row 44) Tj ET
+0.2 0.3 0.9 RG 3 w 20 4520 m 580 4460 l S
+BT /F1 28 Tf 40 4440 Td (Row 45) Tj ET
+0.2 0.3 0.9 RG 3 w 20 4420 m 580 4360 l S
+BT /F1 28 Tf 40 4340 Td (Row 46) Tj ET
+0.2 0.3 0.9 RG 3 w 20 4320 m 580 4260 l S
+BT /F1 28 Tf 40 4240 Td (Row 47) Tj ET
+0.2 0.3 0.9 RG 3 w 20 4220 m 580 4160 l S
+BT /F1 28 Tf 40 4140 Td (Row 48) Tj ET
+0.2 0.3 0.9 RG 3 w 20 4120 m 580 4060 l S
+BT /F1 28 Tf 40 4040 Td (Row 49) Tj ET
+0.2 0.3 0.9 RG 3 w 20 4020 m 580 3960 l S
+BT /F1 28 Tf 40 3940 Td (Row 50) Tj ET
+0.2 0.3 0.9 RG 3 w 20 3920 m 580 3860 l S
+BT /F1 28 Tf 40 3840 Td (Row 51) Tj ET
+0.2 0.3 0.9 RG 3 w 20 3820 m 580 3760 l S
+BT /F1 28 Tf 40 3740 Td (Row 52) Tj ET
+0.2 0.3 0.9 RG 3 w 20 3720 m 580 3660 l S
+BT /F1 28 Tf 40 3640 Td (Row 53) Tj ET
+0.2 0.3 0.9 RG 3 w 20 3620 m 580 3560 l S
+BT /F1 28 Tf 40 3540 Td (Row 54) Tj ET
+0.2 0.3 0.9 RG 3 w 20 3520 m 580 3460 l S
+BT /F1 28 Tf 40 3440 Td (Row 55) Tj ET
+0.2 0.3 0.9 RG 3 w 20 3420 m 580 3360 l S
+BT /F1 28 Tf 40 3340 Td (Row 56) Tj ET
+0.2 0.3 0.9 RG 3 w 20 3320 m 580 3260 l S
+BT /F1 28 Tf 40 3240 Td (Row 57) Tj ET
+0.2 0.3 0.9 RG 3 w 20 3220 m 580 3160 l S
+BT /F1 28 Tf 40 3140 Td (Row 58) Tj ET
+0.2 0.3 0.9 RG 3 w 20 3120 m 580 3060 l S
+BT /F1 28 Tf 40 3040 Td (Row 59) Tj ET
+0.2 0.3 0.9 RG 3 w 20 3020 m 580 2960 l S
+BT /F1 28 Tf 40 2940 Td (Row 60) Tj ET
+0.2 0.3 0.9 RG 3 w 20 2920 m 580 2860 l S
+BT /F1 28 Tf 40 2840 Td (Row 61) Tj ET
+0.2 0.3 0.9 RG 3 w 20 2820 m 580 2760 l S
+BT /F1 28 Tf 40 2740 Td (Row 62) Tj ET
+0.2 0.3 0.9 RG 3 w 20 2720 m 580 2660 l S
+BT /F1 28 Tf 40 2640 Td (Row 63) Tj ET
+0.2 0.3 0.9 RG 3 w 20 2620 m 580 2560 l S
+BT /F1 28 Tf 40 2540 Td (Row 64) Tj ET
+0.2 0.3 0.9 RG 3 w 20 2520 m 580 2460 l S
+BT /F1 28 Tf 40 2440 Td (Row 65) Tj ET
+0.2 0.3 0.9 RG 3 w 20 2420 m 580 2360 l S
+BT /F1 28 Tf 40 2340 Td (Row 66) Tj ET
+0.2 0.3 0.9 RG 3 w 20 2320 m 580 2260 l S
+BT /F1 28 Tf 40 2240 Td (Row 67) Tj ET
+0.2 0.3 0.9 RG 3 w 20 2220 m 580 2160 l S
+BT /F1 28 Tf 40 2140 Td (Row 68) Tj ET
+0.2 0.3 0.9 RG 3 w 20 2120 m 580 2060 l S
+BT /F1 28 Tf 40 2040 Td (Row 69) Tj ET
+0.2 0.3 0.9 RG 3 w 20 2020 m 580 1960 l S
+BT /F1 28 Tf 40 1940 Td (Row 70) Tj ET
+0.2 0.3 0.9 RG 3 w 20 1920 m 580 1860 l S
+BT /F1 28 Tf 40 1840 Td (Row 71) Tj ET
+0.2 0.3 0.9 RG 3 w 20 1820 m 580 1760 l S
+BT /F1 28 Tf 40 1740 Td (Row 72) Tj ET
+0.2 0.3 0.9 RG 3 w 20 1720 m 580 1660 l S
+BT /F1 28 Tf 40 1640 Td (Row 73) Tj ET
+0.2 0.3 0.9 RG 3 w 20 1620 m 580 1560 l S
+BT /F1 28 Tf 40 1540 Td (Row 74) Tj ET
+0.2 0.3 0.9 RG 3 w 20 1520 m 580 1460 l S
+BT /F1 28 Tf 40 1440 Td (Row 75) Tj ET
+0.2 0.3 0.9 RG 3 w 20 1420 m 580 1360 l S
+BT /F1 28 Tf 40 1340 Td (Row 76) Tj ET
+0.2 0.3 0.9 RG 3 w 20 1320 m 580 1260 l S
+BT /F1 28 Tf 40 1240 Td (Row 77) Tj ET
+0.2 0.3 0.9 RG 3 w 20 1220 m 580 1160 l S
+BT /F1 28 Tf 40 1140 Td (Row 78) Tj ET
+0.2 0.3 0.9 RG 3 w 20 1120 m 580 1060 l S
+BT /F1 28 Tf 40 1040 Td (Row 79) Tj ET
+0.2 0.3 0.9 RG 3 w 20 1020 m 580 960 l S
+BT /F1 28 Tf 40 940 Td (Row 80) Tj ET
+0.2 0.3 0.9 RG 3 w 20 920 m 580 860 l S
+BT /F1 28 Tf 40 840 Td (Row 81) Tj ET
+0.2 0.3 0.9 RG 3 w 20 820 m 580 760 l S
+BT /F1 28 Tf 40 740 Td (Row 82) Tj ET
+0.2 0.3 0.9 RG 3 w 20 720 m 580 660 l S
+BT /F1 28 Tf 40 640 Td (Row 83) Tj ET
+0.2 0.3 0.9 RG 3 w 20 620 m 580 560 l S
+BT /F1 28 Tf 40 540 Td (Row 84) Tj ET
+0.2 0.3 0.9 RG 3 w 20 520 m 580 460 l S
+BT /F1 28 Tf 40 440 Td (Row 85) Tj ET
+0.2 0.3 0.9 RG 3 w 20 420 m 580 360 l S
+BT /F1 28 Tf 40 340 Td (Row 86) Tj ET
+0.2 0.3 0.9 RG 3 w 20 320 m 580 260 l S
+BT /F1 28 Tf 40 240 Td (Row 87) Tj ET
+0.2 0.3 0.9 RG 3 w 20 220 m 580 160 l S
+BT /F1 28 Tf 40 140 Td (Row 88) Tj ET
+0.2 0.3 0.9 RG 3 w 20 120 m 580 60 l S
+BT /F1 28 Tf 40 40 Td (bottommost) Tj ET
+endstream
+endobj
+5 0 obj
+<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica >>
+endobj
+xref
+0 6
+0000000000 65535 f
+0000000015 00000 n
+0000000064 00000 n
+0000000121 00000 n
+0000000248 00000 n
+0000007510 00000 n
+trailer
+<< /Size 6 /Root 1 0 R >>
+startxref
+7580
+%%EOF
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;
diff --git a/test/pdf_sections_bench.zig b/test/pdf_sections_bench.zig
index 2796910c..b793bd0c 100644
--- a/test/pdf_sections_bench.zig
+++ b/test/pdf_sections_bench.zig
@@ -65,8 +65,7 @@ pub fn main(init: std.process.Init) !void {
const args = try init.minimal.args.toSlice(init.arena.allocator());
const config = parseArgs(args);
- const fixture = try pdf.makeOutlineTestPdf(gpa);
- defer gpa.free(fixture);
+ const fixture = @embedFile("pdf-fixtures/outline.pdf");
var path_buf: [256]u8 = undefined;
const path = try std.fmt.bufPrint(&path_buf, "/tmp/pardes-pdf-sections-bench-{d}.pdf", .{libc.getpid()});
try writeFile(path, fixture);