diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-04 23:30:20 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-05 01:01:28 -0300 |
| commit | e3aaae3a56a56d1147741ff9788a9f7607b9ee57 (patch) | |
| tree | 533a4e168be48f27802deabe58fca69e162e6e9a /test | |
| parent | 42694963a3b55398aac068820d00cd710685e4fb (diff) | |
| download | pardes-e3aaae3a56a56d1147741ff9788a9f7607b9ee57.tar.gz pardes-e3aaae3a56a56d1147741ff9788a9f7607b9ee57.zip | |
pdf: an outline entry is its depth, title and destination, where it also carried is_open, flags and color (with isBold and isItalic) that nothing shows, the sections rows reading none of them; their assertions in pdf.zig's outline test, the literals' fields in test/panes.zig and the sections bench's checksum of them go, and the bridge still fills its C item
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/panes.zig | 30 | ||||
| -rw-r--r-- | test/pdf_sections_bench.zig | 6 |
2 files changed, 15 insertions, 21 deletions
diff --git a/test/panes.zig b/test/panes.zig index f083a88e..f472ba81 100644 --- a/test/panes.zig +++ b/test/panes.zig @@ -2366,14 +2366,14 @@ const PdfTests = struct { test "PDF section rows preserve DFS ordinals and sanitise hierarchy" { if (!enabled) return; const entries = [_]pdf.OutlineEntry{ - .{ .depth = 0, .title = null, .is_open = true, .flags = 0, .color = @splat(0), .destination = .none }, - .{ .depth = 1, .title = " Child\n\tTitle\x01 Café \u{2028} Next ", .is_open = false, .flags = 0, .color = @splat(0), .destination = .{ .internal = .{ .page = 2, .x = 12, .y = 34 } } }, - .{ .depth = 0, .title = "", .is_open = false, .flags = 0, .color = @splat(0), .destination = .{ .internal = .{ .page = 0, .x = null, .y = null } } }, - .{ .depth = 0, .title = "External", .is_open = false, .flags = 0, .color = @splat(0), .destination = .{ .external = "https://example.com/manual" } }, - .{ .depth = 0, .title = "Dead branch", .is_open = false, .flags = 0, .color = @splat(0), .destination = .none }, - .{ .depth = 0, .title = "Unsafe", .is_open = false, .flags = 0, .color = @splat(0), .destination = .{ .external = "javascript:alert" } }, - .{ .depth = 0, .title = "Linked branch", .is_open = true, .flags = 0, .color = @splat(0), .destination = .none }, - .{ .depth = 1, .title = "Deep link", .is_open = false, .flags = 0, .color = @splat(0), .destination = .{ .external = "https://example.com/deep" } }, + .{ .depth = 0, .title = null, .destination = .none }, + .{ .depth = 1, .title = " Child\n\tTitle\x01 Café \u{2028} Next ", .destination = .{ .internal = .{ .page = 2, .x = 12, .y = 34 } } }, + .{ .depth = 0, .title = "", .destination = .{ .internal = .{ .page = 0, .x = null, .y = null } } }, + .{ .depth = 0, .title = "External", .destination = .{ .external = "https://example.com/manual" } }, + .{ .depth = 0, .title = "Dead branch", .destination = .none }, + .{ .depth = 0, .title = "Unsafe", .destination = .{ .external = "javascript:alert" } }, + .{ .depth = 0, .title = "Linked branch", .destination = .none }, + .{ .depth = 1, .title = "Deep link", .destination = .{ .external = "https://example.com/deep" } }, }; const rows = try SectionRows.render(std.testing.allocator, "/tmp/manual.pdf", &entries); defer std.testing.allocator.free(rows); @@ -2425,13 +2425,13 @@ const PdfTests = struct { test "bulk PDF section resolution matches single Look policy across DFS boundaries" { if (!enabled) return; const entries = [_]pdf.OutlineEntry{ - .{ .depth = 0, .title = "Resolved root", .is_open = true, .flags = 0, .color = @splat(0), .destination = .none }, - .{ .depth = 1, .title = "Unsafe branch", .is_open = true, .flags = 0, .color = @splat(0), .destination = .{ .external = "javascript:unsafe" } }, - .{ .depth = 2, .title = "Safe grandchild", .is_open = false, .flags = 0, .color = @splat(0), .destination = .{ .internal = .{ .page = 1, .x = 4, .y = 8 } } }, - .{ .depth = 1, .title = "Unresolved child", .is_open = false, .flags = 0, .color = @splat(0), .destination = .none }, - .{ .depth = 1, .title = "Sibling", .is_open = false, .flags = 0, .color = @splat(0), .destination = .{ .internal = .{ .page = 2, .x = null, .y = null } } }, - .{ .depth = 0, .title = "Unresolved root", .is_open = false, .flags = 0, .color = @splat(0), .destination = .none }, - .{ .depth = 0, .title = "Next root", .is_open = false, .flags = 0, .color = @splat(0), .destination = .{ .internal = .{ .page = 3, .x = null, .y = null } } }, + .{ .depth = 0, .title = "Resolved root", .destination = .none }, + .{ .depth = 1, .title = "Unsafe branch", .destination = .{ .external = "javascript:unsafe" } }, + .{ .depth = 2, .title = "Safe grandchild", .destination = .{ .internal = .{ .page = 1, .x = 4, .y = 8 } } }, + .{ .depth = 1, .title = "Unresolved child", .destination = .none }, + .{ .depth = 1, .title = "Sibling", .destination = .{ .internal = .{ .page = 2, .x = null, .y = null } } }, + .{ .depth = 0, .title = "Unresolved root", .destination = .none }, + .{ .depth = 0, .title = "Next root", .destination = .{ .internal = .{ .page = 3, .x = null, .y = null } } }, }; const bulk = try SectionRows.resolveOrdinals(std.testing.allocator, &entries); defer std.testing.allocator.free(bulk); diff --git a/test/pdf_sections_bench.zig b/test/pdf_sections_bench.zig index ce548924..47b74018 100644 --- a/test/pdf_sections_bench.zig +++ b/test/pdf_sections_bench.zig @@ -357,9 +357,6 @@ fn outlineIdentity(entries: []const pdf.OutlineEntry) Identity { var bytes: u64 = 0; for (entries) |entry| { checksum = mix(checksum, entry.depth); - checksum = mix(checksum, entry.flags); - checksum = mix(checksum, @intFromBool(entry.is_open)); - checksum = std.hash.Wyhash.hash(checksum, &entry.color); if (entry.title) |title| { bytes += title.len; checksum = std.hash.Wyhash.hash(checksum, title); @@ -389,9 +386,6 @@ fn makeWorstShape() ![]pdf.OutlineEntry { entry.* = .{ .depth = depth, .title = "Worst shape outline title", - .is_open = true, - .flags = 0, - .color = .{ 0, 0, 0 }, .destination = if (depth + 1 == near_limit_depth) .{ .internal = .{ .page = ordinal / near_limit_depth, |
