summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/pdf.zig52
-rw-r--r--test/pdf_pointer_bench.zig2
-rw-r--r--test/pdf_scroll_bench.zig4
-rw-r--r--test/pdf_sections_bench.zig2
4 files changed, 30 insertions, 30 deletions
diff --git a/test/pdf.zig b/test/pdf.zig
index 9e183224..655e046a 100644
--- a/test/pdf.zig
+++ b/test/pdf.zig
@@ -369,7 +369,7 @@ test "watched PDF reload replaces MuPDF state and preserves the reading view" {
try std.testing.expect(watched);
const pane = p.panes[0].?;
- const state = &pane.pdf.?;
+ const state = pane.pdf.?;
try std.testing.expectEqual(@as(usize, 3), state.page_count);
panes.Pdf.openSections(p, 0);
const sections_id = pane.search_pane orelse return error.MissingPdfSectionsOutput;
@@ -495,7 +495,7 @@ test "PDF reload does not re-center an already revealed matching search" {
defer p.deinit();
p.native_images = true;
const pane = p.panes[0].?;
- const state = &pane.pdf.?;
+ const state = pane.pdf.?;
try state.setSearchQuery(p.pdf_gpa, "Pardes");
var frame = std.heap.ArenaAllocator.init(gpa);
defer frame.deinit();
@@ -578,7 +578,7 @@ test "MuPDF pane renders, navigates, searches, and round-trips its page" {
try std.testing.expectEqual(pdf_raster_policy.max_dimension, request.max_dimension);
try std.testing.expectEqual(
request,
- panes.Pdf.rasterForPage(&pane.pdf.?, pane.pdf.?.page).?.request,
+ panes.Pdf.rasterForPage(pane.pdf.?, pane.pdf.?.page).?.request,
);
try std.testing.expect(@max(first_place.iw, first_place.ih) <= request.max_dimension);
if (pdf_raster_policy.match_viewport) {
@@ -611,7 +611,7 @@ test "MuPDF pane renders, navigates, searches, and round-trips its page" {
try std.testing.expectEqual(@as(f64, p.cell_pixels.h), pane.pdf.?.document_scroll_y);
try std.testing.expectEqual(
first_place.native.revision,
- panes.Pdf.rasterForPage(&pane.pdf.?, pane.pdf.?.page).?.revision,
+ panes.Pdf.rasterForPage(pane.pdf.?, pane.pdf.?.page).?.revision,
);
_ = frame.reset(.retain_capacity);
const panned = try p.render(frame.allocator());
@@ -671,7 +671,7 @@ test "MuPDF pane renders, navigates, searches, and round-trips its page" {
try std.testing.expectEqual(@max(@as(f64, 0), counted_full - @as(f64, @floatFromInt(key_viewport.pixel_h * 2))), pane.pdf.?.document_scroll_y);
try std.testing.expectEqual(
first_place.native.revision,
- panes.Pdf.rasterForPage(&pane.pdf.?, pane.pdf.?.page).?.revision,
+ panes.Pdf.rasterForPage(pane.pdf.?, pane.pdf.?.page).?.revision,
);
// At a page boundary both page rasters coexist, the gap remains uncovered,
@@ -712,13 +712,13 @@ test "MuPDF pane renders, navigates, searches, and round-trips its page" {
pane.pdf.?.document_scroll_y = @as(f64, @floatFromInt(pane.pdf.?.page_starts[1])) - 0.5;
try std.testing.expectEqual(
page0_revision,
- panes.Pdf.rasterForPage(&pane.pdf.?, 0).?.revision,
+ panes.Pdf.rasterForPage(pane.pdf.?, 0).?.revision,
);
try std.testing.expect(panes.Pdf.scrollPane(p, pane, 1, false));
try std.testing.expectEqual(@as(usize, 1), pane.pdf.?.page);
try std.testing.expectEqual(
page1_revision,
- panes.Pdf.rasterForPage(&pane.pdf.?, pane.pdf.?.page).?.revision,
+ panes.Pdf.rasterForPage(pane.pdf.?, pane.pdf.?.page).?.revision,
);
panes.Pdf.activatePage(p, pane, 0, false);
pane.pdf.?.document_scroll_y = before_boundary_scroll;
@@ -745,7 +745,7 @@ test "MuPDF pane renders, navigates, searches, and round-trips its page" {
try std.testing.expect(away.images.items.len > 0);
for (away.images.items) |place|
try std.testing.expect(place.native.page != 0);
- try std.testing.expect(panes.Pdf.rasterForPage(&pane.pdf.?, 0) == null);
+ try std.testing.expect(panes.Pdf.rasterForPage(pane.pdf.?, 0) == null);
try std.testing.expectEqual(@as(usize, 1), pane.pdf.?.spare_len);
const retired = pane.pdf.?.spare[0];
panes.Pdf.activatePage(p, pane, 0, true);
@@ -761,7 +761,7 @@ test "MuPDF pane renders, navigates, searches, and round-trips its page" {
const fit_builtin = std.meta.stringToEnum(Builtin, "PdfFit") orelse
return error.MissingPdfFitBuiltin;
const revision_before_toggle = panes.Pdf.rasterForPage(
- &pane.pdf.?,
+ pane.pdf.?,
pane.pdf.?.page,
).?.revision;
try std.testing.expect(pardes.test_api.runBuiltin(
@@ -776,7 +776,7 @@ test "MuPDF pane renders, navigates, searches, and round-trips its page" {
try std.testing.expectEqual(@as(u16, 0), pane.pdf.?.pan_y);
try std.testing.expectEqual(
revision_before_toggle,
- panes.Pdf.rasterForPage(&pane.pdf.?, pane.pdf.?.page).?.revision,
+ panes.Pdf.rasterForPage(pane.pdf.?, pane.pdf.?.page).?.revision,
);
const height_tag = try pardes.tagline.tagText(p, p.scratch.allocator(), pane);
const expected_height_tag = try std.fmt.allocPrint(p.scratch.allocator(), "{s} [{d}/{d}]{s}", .{ pane.pdf.?.path, pane.pdf.?.page + 1, pane.pdf.?.page_count, pane_tail });
@@ -792,7 +792,7 @@ test "MuPDF pane renders, navigates, searches, and round-trips its page" {
// A fit-height landscape page exposes horizontal overflow to a horizontal
// wheel without rerasterizing. Use synthetic dimensions only for the
// geometry check; no frame is drawn while they differ from the buffer.
- const active_raster = panes.Pdf.rasterForPage(&pane.pdf.?, pane.pdf.?.page).?;
+ const active_raster = panes.Pdf.rasterForPage(pane.pdf.?, pane.pdf.?.page).?;
const saved_iw = active_raster.iw;
const saved_ih = active_raster.ih;
active_raster.iw = 2000;
@@ -893,7 +893,7 @@ test "a fling's banded pages show the reader exactly what whole pages would" {
defer p.deinit();
p.native_images = true;
const pane = p.panes[0].?;
- const pv = &pane.pdf.?;
+ const pv = pane.pdf.?;
var frame = std.heap.ArenaAllocator.init(gpa);
defer frame.deinit();
_ = try p.render(frame.allocator());
@@ -997,7 +997,7 @@ test "a tall page is drawn at the display's resolution, in bands that are the wh
defer p.deinit();
p.native_images = true;
const pane = p.panes[0].?;
- const pv = &pane.pdf.?;
+ const pv = pane.pdf.?;
var frame = std.heap.ArenaAllocator.init(gpa);
defer frame.deinit();
_ = try p.render(frame.allocator());
@@ -1155,7 +1155,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.?;
+ const pv = pane.pdf.?;
p.native_images = true;
// A second pane, then focus it and come back: `Last` has somewhere to go
@@ -1236,7 +1236,7 @@ test "PDF continuous strip renders every intersecting short page" {
});
defer p.deinit();
const pane = p.panes[0].?;
- const pv = &pane.pdf.?;
+ const pv = pane.pdf.?;
try std.testing.expect(pv.page_count > 3);
p.native_images = true;
@@ -1312,7 +1312,7 @@ test "PDF tint and tinted theme changes rebuild every visible raster only" {
defer p.deinit();
p.settings.motion = .off; // placements, not the glide (anim 11)
const pane = p.panes[0].?;
- const pv = &pane.pdf.?;
+ const pv = pane.pdf.?;
p.native_images = true;
var frame = std.heap.ArenaAllocator.init(gpa);
defer frame.deinit();
@@ -1451,7 +1451,7 @@ test "PDF resize preserves page-relative document position" {
});
defer p.deinit();
const pane = p.panes[0].?;
- const pv = &pane.pdf.?;
+ const pv = pane.pdf.?;
p.native_images = true;
var frame = std.heap.ArenaAllocator.init(gpa);
defer frame.deinit();
@@ -1502,7 +1502,7 @@ test "PDF pane geometry change preserves its page-relative position" {
_ = layout.splitColumn(p, 0, 1, false);
p.sync(); // rects for the new column, exactly as the two-pane boot did
const pane = p.panes[0].?;
- const pv = &pane.pdf.?;
+ const pv = pane.pdf.?;
p.native_images = true;
var frame = std.heap.ArenaAllocator.init(gpa);
defer frame.deinit();
@@ -1554,7 +1554,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.?;
+ const pv = pane.pdf.?;
p.native_images = true;
var page_hits = try pv.document.search(gpa, 0, "Pardes");
@@ -1685,7 +1685,7 @@ test "PDF native mouse selection, Look, and highlights share page geometry" {
const quad = found.quads[0].quad;
const nx = (quad.ul.x + quad.ur.x + quad.ll.x + quad.lr.x) / 4;
const ny = (quad.ul.y + quad.ur.y + quad.ll.y + quad.lr.y) / 4;
- const pv = &pane.pdf.?;
+ const pv = pane.pdf.?;
const raster = panes.Pdf.rasterForPage(pv, pv.page).?;
const source_x: u32 = @intCast(@min(
raster.iw - 1,
@@ -2020,7 +2020,7 @@ test "Esc back into a PDF keeps the offset within its page" {
p.sync();
// Read a little way DOWN the page you are on, then step away.
- const pv = &dp.pdf.?;
+ const pv = dp.pdf.?;
pv.document_scroll_y += 137;
const mid = pv.document_scroll_y;
pv.scroll_to_page_pending = false;
@@ -2049,7 +2049,7 @@ test "PDF Back and Forward clear selections and land on recorded pages" {
p.native_images = true;
p.presentation.enabled = false;
const pane = p.panes[0].?;
- const state = &pane.pdf.?;
+ const state = pane.pdf.?;
try std.testing.expect(state.page_count > 1);
try std.testing.expect(state.focusLocation(p.pdf_gpa, 2, 0));
p.njumps = 2;
@@ -2091,7 +2091,7 @@ test "a PDF's fit and tint, and Collapse, read in its ctl and come back from a D
try pardes.dump.dumpState(p);
const restored = try pardes.dump.restore(p, p.dump_out.?, "/tmp/pardes.dump.zon");
defer restored.deinit();
- const pv = &restored.panes[0].?.pdf.?;
+ const pv = restored.panes[0].?.pdf.?;
try std.testing.expectEqualStrings("height", @tagName(pv.fit));
try std.testing.expectEqualStrings("full", @tagName(pv.tint));
}
@@ -2114,7 +2114,7 @@ fn jumpFrame(p: *Pardes) !void {
}
fn stripAtPlace(p: *Pardes, pane: *pardes.Pane, page: usize, fraction: f64) !f64 {
- const pv = &pane.pdf.?;
+ const pv = pane.pdf.?;
pv.document_scroll_y = @as(f64, @floatFromInt(pv.page_starts[page])) + fraction * @as(f64, @floatFromInt(pv.page_heights[page]));
try jumpFrame(p);
return pv.document_scroll_y;
@@ -2128,7 +2128,7 @@ test "a PDF's jumps: Back after a far jump returns to the exact offset, two plac
p.presentation.enabled = false;
const id = p.active;
const pane = p.panes[id].?;
- const pv = &pane.pdf.?;
+ const pv = pane.pdf.?;
try jumpFrame(p);
try std.testing.expect(pv.page_count > 3);
// Two places on page 1, more than a body apart: two entries.
@@ -2199,7 +2199,7 @@ test "a PDF's jumps: JumpScope file keeps to the PDF, and a closed PDF reopens a
}
const reopened = p.panes[p.active].?;
try std.testing.expect(reopened.pdf != null);
- const pv = &reopened.pdf.?;
+ const pv = reopened.pdf.?;
// The newest PDF place before the text: page 4, half way down.
try std.testing.expectEqual(@as(usize, 3), pv.page);
const want = @as(f64, @floatFromInt(pv.page_starts[3])) + 0.5 * @as(f64, @floatFromInt(pv.page_heights[3]));
diff --git a/test/pdf_pointer_bench.zig b/test/pdf_pointer_bench.zig
index a6560263..573b8766 100644
--- a/test/pdf_pointer_bench.zig
+++ b/test/pdf_pointer_bench.zig
@@ -124,7 +124,7 @@ var verify_failures: usize = 0;
fn verify(core: *pardes.Pardes, arena: std.mem.Allocator) !void {
const Pdf = pardes.panes.Pdf;
const pane = core.panes[0] orelse return;
- const state = &(pane.pdf orelse return);
+ const state = pane.pdf orelse return;
const highlights = try Pdf.buildHighlights(state, arena, Pdf.highlightInput(core, 0, pane));
for (state.rasters[0..state.rasters_len]) |*r| {
if (!r.valid or r.rgba.len == 0 or r.tint_key == null) continue;
diff --git a/test/pdf_scroll_bench.zig b/test/pdf_scroll_bench.zig
index 391a98e6..1a27b828 100644
--- a/test/pdf_scroll_bench.zig
+++ b/test/pdf_scroll_bench.zig
@@ -263,7 +263,7 @@ fn probeTravel(config: Config) Travel {
const first_frame_ns = nowNs() -| started;
const pane = core.panes[0] orelse fatal("PDF pane disappeared", .{});
if (pane.pdf == null) fatal("{s} did not open as a PDF", .{path});
- const pv = &pane.pdf.?;
+ const pv = pane.pdf.?;
if (!pv.layout_valid or pv.document_height == 0)
fatal("the pixel strip never laid out; is native_images/cell_pixels wired?", .{});
// Exactly the clamp scrollPdfDocument enforces, so the last fling frame
@@ -356,7 +356,7 @@ fn measure(config: Config, plan: Plan) !Result {
_ = try core.render(frame_arena.allocator());
drainEffects(core);
const pane = core.panes[0] orelse fatal("PDF pane disappeared", .{});
- const pv = &pane.pdf.?;
+ const pv = pane.pdf.?;
const rect = core.rects[0];
// Anywhere inside the pane body resolves to this pane's hover, which
// is what routes the notch; the exact cell is irrelevant to a wheel.
diff --git a/test/pdf_sections_bench.zig b/test/pdf_sections_bench.zig
index b793bd0c..4d0f85de 100644
--- a/test/pdf_sections_bench.zig
+++ b/test/pdf_sections_bench.zig
@@ -335,7 +335,7 @@ fn sectionsOutputIdentity(core: *pardes.Pardes) Identity {
fn stepIdentity(core: *pardes.Pardes) Identity {
var identity = sectionsOutputIdentity(core);
const owner = core.panes[0].?;
- const view = &owner.pdf.?;
+ const view = owner.pdf.?;
identity.checksum = mix(identity.checksum, view.page);
identity.checksum = mix(identity.checksum, @as(u64, @bitCast(view.document_scroll_y)));
identity.checksum = mix(identity.checksum, owner.search_row orelse std.math.maxInt(usize));