summaryrefslogtreecommitdiff
path: root/test/pdf.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-05 21:02:51 -0300
committerGabriel Schneider <[email protected]>2026-11-05 22:08:14 -0300
commitd8e5fc18f5923c4213de1cb4105a677e725200af (patch)
treeec9adccb3ccb3118f1422777180b766cce55ba2b /test/pdf.zig
parent5b135dc60d4e9f77be0a4f883439f3200ac30d30 (diff)
downloadpardes-d8e5fc18f5923c4213de1cb4105a677e725200af.tar.gz
pardes-d8e5fc18f5923c4213de1cb4105a677e725200af.zip
fields #41, a view's frontend is one field: windowed, native_images and native_image_patches, the three fields Event.frontend carries, are the session's frontend, a Frontend, so update's frontend arm is p.frontend = f where it copied them one by one; native_image_patches, each process's own, is said so on Frontend (its replica .local), where the session's list said it, so the digest and a dump leave it out as before, and the tape watches frontend where it watched the three (a host's write of patches alone, which only drawing reads, is no longer a set of its own on the tape); the reads in 22 files say p.frontend.native_images (macos.zig's by text, built nowhere here; dump.zig, the persistence agent's, only where it names native_images); views.zig's per-view fields name frontend; a dump written before this change loads it as the default once: an Upgrade or Restore from it comes back as a terminal's view without native images until its frontend says otherwise (a window's says so at once), and the wire's semantics change; gates on tui: core-test 960/960, behaviour-test 238/238, pane-test 171/172 (1 skipped), snap all 108 scripts ok; gui unit-test 1518/1519 (1 skipped)
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.zig34
1 files changed, 17 insertions, 17 deletions
diff --git a/test/pdf.zig b/test/pdf.zig
index 2f14fb2f..b66db1df 100644
--- a/test/pdf.zig
+++ b/test/pdf.zig
@@ -45,7 +45,7 @@ const PdfLinkTests = struct {
const path = try std.fmt.allocPrint(std.testing.allocator, "{s}/links.pdf", .{dir_buf[0..len]});
defer std.testing.allocator.free(path);
const p = try Pardes.init(std.testing.allocator, .{ .file = path, .cols = 100, .rows = 36 });
- p.native_images = true;
+ p.frontend.native_images = true;
p.panes[0].?.pdf.?.fit = .height;
return p;
}
@@ -375,7 +375,7 @@ test "watched PDF reload replaces MuPDF state and preserves the reading view" {
const sections = p.panes[sections_id].?;
try std.testing.expect(sections.file.?.content.len > 0);
- p.native_images = true;
+ p.frontend.native_images = true;
state.fit = .height;
state.tint = .full;
state.pan_x = 1234;
@@ -492,7 +492,7 @@ test "PDF reload does not re-center an already revealed matching search" {
const path = try std.fmt.bufPrint(&path_buf, ".zig-cache/tmp/{s}/search.pdf", .{tmp.sub_path});
const p = try Pardes.init(gpa, .{ .file = path, .cols = 80, .rows = 28 });
defer p.deinit();
- p.native_images = true;
+ p.frontend.native_images = true;
const pane = p.panes[0].?;
const state = pane.pdf.?;
try state.setSearchQuery(p.pdf_gpa, "Pardes");
@@ -559,7 +559,7 @@ test "MuPDF pane renders, navigates, searches, and round-trips its page" {
try std.testing.expectEqualStrings(expected_tag, initial_tag);
try std.testing.expect(std.mem.endsWith(u8, initial_tag, pane_tail));
- p.native_images = true;
+ p.frontend.native_images = true;
var frame = std.heap.ArenaAllocator.init(gpa);
defer frame.deinit();
const first = try p.render(frame.allocator());
@@ -889,7 +889,7 @@ test "a fling's banded pages show the reader exactly what whole pages would" {
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{ .file = "docs/design.pdf", .cols = 120, .rows = 40 });
defer p.deinit();
- p.native_images = true;
+ p.frontend.native_images = true;
const pane = p.panes[0].?;
const pv = pane.pdf.?;
var frame = std.heap.ArenaAllocator.init(gpa);
@@ -993,7 +993,7 @@ test "a tall page is drawn at the display's resolution, in bands that are the wh
defer gpa.free(path);
const p = try Pardes.init(gpa, .{ .file = path, .cols = 120, .rows = 40 });
defer p.deinit();
- p.native_images = true;
+ p.frontend.native_images = true;
const pane = p.panes[0].?;
const pv = pane.pdf.?;
var frame = std.heap.ArenaAllocator.init(gpa);
@@ -1154,7 +1154,7 @@ test "Escape cancels PDF chrome in place, then leaves the pane; Shift-Escape lea
defer p.deinit();
const pane = p.panes[0].?;
const pv = pane.pdf.?;
- p.native_images = true;
+ p.frontend.native_images = true;
// A second pane, then focus it and come back: `Last` has somewhere to go
// and the PDF is where the keys land.
@@ -1214,7 +1214,7 @@ test "Escape cancels PDF chrome in place, then leaves the pane; Shift-Escape lea
try std.testing.expect(pv.selection != null);
// A text-only page shows neither: one Escape drops them and goes.
- p.native_images = false;
+ p.frontend.native_images = false;
p.update(.{ .key = .{ .cp = Key.escape } });
try std.testing.expectEqual(@as(usize, 0), p.active);
try pv.setSearchQuery(p.pdf_gpa, "Pardes");
@@ -1236,7 +1236,7 @@ test "PDF continuous strip renders every intersecting short page" {
const pane = p.panes[0].?;
const pv = pane.pdf.?;
try std.testing.expect(pv.page_count > 3);
- p.native_images = true;
+ p.frontend.native_images = true;
// A legal wide MediaBox can make more than three pages intersect one
// viewport. Seed tiny matching rasters so this tests transport/cache
@@ -1310,7 +1310,7 @@ test "PDF tint and tinted theme changes rebuild every visible raster only" {
defer p.deinit();
const pane = p.panes[0].?;
const pv = pane.pdf.?;
- p.native_images = true;
+ p.frontend.native_images = true;
var frame = std.heap.ArenaAllocator.init(gpa);
defer frame.deinit();
@@ -1433,7 +1433,7 @@ test "PDF resize preserves page-relative document position" {
defer p.deinit();
const pane = p.panes[0].?;
const pv = pane.pdf.?;
- p.native_images = true;
+ p.frontend.native_images = true;
var frame = std.heap.ArenaAllocator.init(gpa);
defer frame.deinit();
@@ -1484,7 +1484,7 @@ test "PDF pane geometry change preserves its page-relative position" {
p.sync(); // rects for the new column, exactly as the two-pane boot did
const pane = p.panes[0].?;
const pv = pane.pdf.?;
- p.native_images = true;
+ p.frontend.native_images = true;
var frame = std.heap.ArenaAllocator.init(gpa);
defer frame.deinit();
@@ -1536,7 +1536,7 @@ test "PDF n/N addresses and reveals distinct MuPDF hits on one page" {
defer p.deinit();
const pane = p.panes[0].?;
const pv = pane.pdf.?;
- p.native_images = true;
+ p.frontend.native_images = true;
var page_hits = try pv.document.search(gpa, 0, "Pardes");
defer page_hits.deinit(gpa);
@@ -1656,7 +1656,7 @@ test "PDF native mouse selection, Look, and highlights share page geometry" {
try std.testing.expect(pane.pdf.?.selection == null);
pane.sel[sel_slot].state = .none;
- p.native_images = true;
+ p.frontend.native_images = true;
_ = frame.reset(.retain_capacity);
const plain = try p.render(frame.allocator());
const plain_revision = plain.images.items[0].native.revision;
@@ -2027,7 +2027,7 @@ test "PDF Back and Forward clear selections and land on recorded pages" {
if (!pdf_enabled) return error.SkipZigTest;
const p = try Pardes.init(std.testing.allocator, .{ .file = "docs/design.pdf", .cols = 80, .rows = 28 });
defer p.deinit();
- p.native_images = true;
+ p.frontend.native_images = true;
const pane = p.panes[0].?;
const state = pane.pdf.?;
try std.testing.expect(state.page_count > 1);
@@ -2104,7 +2104,7 @@ test "a PDF's jumps: Back after a far jump returns to the exact offset, two plac
if (!pdf_enabled) return error.SkipZigTest;
const p = try Pardes.init(std.testing.allocator, .{ .file = jumpPdf(), .cols = 80, .rows = 28 });
defer p.deinit();
- p.native_images = true;
+ p.frontend.native_images = true;
const id = p.active;
const pane = p.panes[id].?;
const pv = pane.pdf.?;
@@ -2144,7 +2144,7 @@ test "a PDF's jumps: JumpScope file keeps to the PDF, and a closed PDF reopens a
const path = try std.fmt.bufPrint(&path_buf, "{s}/docs/design.pdf", .{cwd});
const p = try Pardes.init(std.testing.allocator, .{ .file = path, .cols = 80, .rows = 28 });
defer p.deinit();
- p.native_images = true;
+ p.frontend.native_images = true;
try std.testing.expectEqual(config.Runtime.JumpScope.file, p.settings.jump_scope);
const doc = p.active;
const pane = p.panes[doc].?;