summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-24 22:50:15 -0300
committerGabriel Schneider <[email protected]>2026-10-25 01:30:09 -0300
commit6e8a6a63d45b2caef7b649d358f836e6cc4134d6 (patch)
tree0c1259e1fa04e72a8ccb9df18b2811dd94083098 /test
parent0dc2dc053af20d6811bfbe09ab31b762862a53a6 (diff)
downloadpardes-6e8a6a63d45b2caef7b649d358f836e6cc4134d6.tar.gz
pardes-6e8a6a63d45b2caef7b649d358f836e6cc4134d6.zip
anim 11: a PDF's strip moves in the text's motion system: the integrator is animation.Follow (the Glide's, moved out), here the strip's lag behind document_scroll_y in pixels; whatever moves the core's position (a notch, a spin, PageDown, Ctrl-d/f, ge/gg, a Look at a page, Back, the rail) kicks it, a touchpad's fraction and a relayout move it directly; the pages a glide crosses render in its input's frame, a far jump's only where it comes to rest; a slow stream eases onto its mark (it ran into it at speed and passed it); pictures neither scroll nor pan
Diffstat (limited to 'test')
-rw-r--r--test/pdf.zig14
1 files changed, 8 insertions, 6 deletions
diff --git a/test/pdf.zig b/test/pdf.zig
index d4efdfaf..5f7ebc52 100644
--- a/test/pdf.zig
+++ b/test/pdf.zig
@@ -774,6 +774,7 @@ test "MuPDF pane renders, navigates, searches, and round-trips its page" {
.rows = 24,
});
defer p.deinit();
+ p.settings.motion = .off; // placements, not the glide (anim 11)
const pane = p.panes[0].?;
try std.testing.expect(hasPdf(pane));
try std.testing.expect(pane.pdf.?.page_count > 1);
@@ -822,7 +823,7 @@ test "MuPDF pane renders, navigates, searches, and round-trips its page" {
// SDL's raw dy path retains fractions in the placement itself; it does
// not leave native pixels fixed while only the underlying cells slide.
- p.update(.{ .pdf_scroll = .{ .pane = 0, .delta_pixels = 0.25 } });
+ p.update(.{ .pdf_scroll = .{ .pane = 0, .delta_pixels = 0.25, .glide = false } });
try std.testing.expectEqual(@as(f64, 0.25), pane.pdf.?.document_scroll_y);
_ = frame.reset(.retain_capacity);
const fractional = try p.render(frame.allocator());
@@ -940,7 +941,7 @@ test "MuPDF pane renders, navigates, searches, and round-trips its page" {
page0_revision,
panes.Pdf.rasterForPage(&pane.pdf.?, 0).?.revision,
);
- try std.testing.expect(panes.Pdf.scrollPane(p, pane, 1));
+ 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,
@@ -1142,7 +1143,7 @@ test "a fling's banded pages show the reader exactly what whole pages would" {
// is counted the way a wheel batch counts it.
pv.document_scroll_y = 0;
pv.scroll_travel = 0;
- try std.testing.expect(panes.Pdf.scrollPane(p, pane, landing));
+ try std.testing.expect(panes.Pdf.scrollPane(p, pane, landing, false));
_ = frame.reset(.retain_capacity);
const flung = try p.render(frame.allocator());
try std.testing.expect(flung.nimages >= 2);
@@ -1261,7 +1262,7 @@ test "a tall page is drawn at the display's resolution, in bands that are the wh
defer gpa.free(middle);
var middle_y: usize = 0;
for ([_]f64{ 0, @round(max_scroll / 2), max_scroll }, 0..) |at, step| {
- _ = panes.Pdf.scrollPane(p, pane, at - pv.document_scroll_y);
+ _ = panes.Pdf.scrollPane(p, pane, at - pv.document_scroll_y, false);
pv.scroll_travel = 0; // read, not flung
_ = frame.reset(.retain_capacity);
const surface = try p.render(frame.allocator());
@@ -1291,7 +1292,7 @@ test "a tall page is drawn at the display's resolution, in bands that are the wh
// Straight back to the middle from the foot: the rows rendered afresh
// are the very rows rendered on the way down, so no seam moves with the
// path a reader took.
- _ = panes.Pdf.scrollPane(p, pane, @round(max_scroll / 2) - pv.document_scroll_y);
+ _ = panes.Pdf.scrollPane(p, pane, @round(max_scroll / 2) - pv.document_scroll_y, false);
pv.scroll_travel = 0;
_ = frame.reset(.retain_capacity);
const again = (try p.render(frame.allocator())).images[0].?;
@@ -1305,7 +1306,7 @@ test "a tall page is drawn at the display's resolution, in bands that are the wh
middle[(common_top - middle_y) * stride .. (common_end - middle_y) * stride],
again.rgba[(common_top - again_y) * stride .. (common_end - again_y) * stride],
);
- _ = panes.Pdf.scrollPane(p, pane, max_scroll - pv.document_scroll_y);
+ _ = panes.Pdf.scrollPane(p, pane, max_scroll - pv.document_scroll_y, false);
pv.scroll_travel = 0;
_ = frame.reset(.retain_capacity);
const foot = try gpa.dupe(u8, (try p.render(frame.allocator())).images[0].?.rgba);
@@ -1663,6 +1664,7 @@ test "PDF tint and tinted theme changes rebuild every visible raster only" {
.rows = 24,
});
defer p.deinit();
+ p.settings.motion = .off; // placements, not the glide (anim 11)
const pane = p.panes[0].?;
const pv = &pane.pdf.?;
p.native_images = true;